EDIT: I wish to withdraw this implementation. I'll post a new one soon... Thanks!
-----
This is a second attempt to have this feature accepted. I have made corrections that address the concerns for the original patch being rejected. The <include> tag must now appear in the <window> node.
-----
This patch allows for skin developers to create one or more xml files that contain only <define> nodes. This is useful for centralizing the definitions for colors, design screen sizes and other parameters used in controls. Without this feature skin designers either hard code the values into controls or create defines in every xml file. Either way, this leaves the skin designer (or re-designer) with a lot of work to switch the values of these control parameters.
Below is a sample xml skin file that contains only defines (the name of the file is arbitrary) and an example of how to consume this file in another xml skin file. I have bolded the reference to defines.xml and highlighted in red the use of a specific define (screenWidth).
Note that the <include> for defines.xml must appear inside the <window> node. This implementation allows you to have both an included defines xml file and a set of defines locally specified inside the target skin file (e.g., timeTextColor in this case BasicHome.xml). The implementation aggregates the defines from both files.
defines.xml:
BasicHome.xml: (a sample consumer of defines.xml)
-----
This is a second attempt to have this feature accepted. I have made corrections that address the concerns for the original patch being rejected. The <include> tag must now appear in the <window> node.
-----
This patch allows for skin developers to create one or more xml files that contain only <define> nodes. This is useful for centralizing the definitions for colors, design screen sizes and other parameters used in controls. Without this feature skin designers either hard code the values into controls or create defines in every xml file. Either way, this leaves the skin designer (or re-designer) with a lot of work to switch the values of these control parameters.
Below is a sample xml skin file that contains only defines (the name of the file is arbitrary) and an example of how to consume this file in another xml skin file. I have bolded the reference to defines.xml and highlighted in red the use of a specific define (screenWidth).
Note that the <include> for defines.xml must appear inside the <window> node. This implementation allows you to have both an included defines xml file and a set of defines locally specified inside the target skin file (e.g., timeTextColor in this case BasicHome.xml). The implementation aggregates the defines from both files.
defines.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
[COLOR="Red"]<define>#screenWidth:1366</define>[/COLOR]
<define>#screenHeight:768</define>
<define>#screenTitleTextColor:FFFFFFFF</define>
</window>
BasicHome.xml: (a sample consumer of defines.xml)
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
<id>35</id>
<defaultcontrol>1</defaultcontrol>
<allowoverlay>no</allowoverlay>
<disabletopbar>yes</disabletopbar>
[B]<include>defines.xml</include>[/B]
<define>#timeTextColor:FFFFFFFF</define>
<controls>
<include>common.background.xml</include>
<!-- MAIN MENU BAR -->
<control>
<type>image</type>
<id>999</id>
[COLOR="Red"]<width>#screenWidth</width>[/COLOR]
<height>84</height>
<texture>menubar.png</texture>
</control>
...