To promote #defines to properties, allow #defines to contain skin expressions, and allow #defines to be added to the window definition through the use of an <include> file.
By promoting #defines to be tracked inside MediaPortal as properties skin designers will be able to use defines to transfer information from one page to another and to use those values in skin expressions and functions. This is very useful for skin capabilities that provide for user controlled layout changes on a "skin settings" page. Enabling this behavior will significantly reduce the need for skin developers to develop and distribute an MP plugin with their skin (where this decision logic has historically resided); e.g., for modifying the EPG length or home page layout and content.
The implementation handles a few important considerations:
Property/#define namespaces - Because #defines are now managed as properties it makes good sense for skins to maintain #defines using a namespace that will not be in conflict with built-in properties. This is easily done by adopting a simple naming convention for #defines. The recommendation is to preface all #defines with the word "Skin". This convention is safe since MediaPortal does not maintain any properties that begin with "Skin". For example, use "#Skin.tvguide.rows.is_short" rather then simply "tvguide.rows.is_short".
Defines can be added to a skin xml file using an <include> file. This behavior allows for the skin designer to create skin files that contain a common set of values that may be used throughout the skin. For example, you can create a skin file named colors.xml with the following content. Each skin xml file that includes colors.xml ( <include>colors.xml</include> ) will be able to use the #defines it contains.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <window> <define>#red:ffff0000</define> <define>#green:ff00ff00</define> <define>#blue:ff0000ff</define> </window> |
<define property="true">#name:value</define>
<define evaluateNow="true">#name:value</define>
<define property="true" evaluateNow="true">#name:value</define>
<define>#name:value</define> <define property="false">#name:value</define> <define evaluateNow="false">#name:value</define> <define property="false" evaluateNow="false">#name:value</define>
<control> <description>Guide Rows</description> <type>checkbutton</type> <id>14</id> <label>Display Less Rows In Guide</label> <font>font12</font> <width>471</width> <height>52</height> <textXOff>28</textXOff> <textYOff>8</textYOff> <markalign>right</markalign> <markvalign>top</markvalign> <markWidth>33</markWidth> <markHeight>21</markHeight> <markXOff>30</markXOff> <markYOff>10</markYOff> <textureFocus>settings_button_focus.png</textureFocus> <textureNoFocus>settings_button_nofocus.png</textureNoFocus> <textureCheckmark>settings_checkmark_checked.png</textureCheckmark> <textureCheckmarkNoFocus>settings_checkmark_unchecked.png</textureCheckmarkNoFocus> <textcolor>ffffffff</textcolor> <textcolorNoFocus>ffffffff</textcolorNoFocus> <onleft>#defaultcontrol.onleft</onleft> <selected>skin.hassetting(#Skin.tvguide.rows.is_short)</selected> <onclick>skin.togglesetting(#Skin.tvguide.rows.is_short)</onclick> </control>
<define>#Skin.tvguide.viewport.height:#(iif(#Skin.tvguide.rows.is_short, 101, 789))</define> <define>#Skin.tvguide.viewport.texture:#(iif(#Skin.tvguide.rows.is_short, 'tvguide_timeline_bg.png', 'viewport_tv_guide_10rows.png'))</define> <define>#Skin.tvguide.panel.height:#(iif(#Skin.tvguide.rows.is_short, 566, 666))</define> <define>#Skin.tvguide.channel_template.height:#(iif(#Skin.tvguide.rows.is_short, 64, 66))</define> <define>#Skin.tvguide.current_program_title.posy:#(iif(#Skin.tvguide.rows.is_short, 816, 950))</define> <define>#Skin.tvguide.current_program_time.posy:#(iif(#Skin.tvguide.rows.is_short, 868, 1006))</define> <define>#Skin.tvguide.description1.visible:#(iif(#Skin.tvguide.rows.is_short, 'yes', 'no'))</define> <define>#Skin.tvguide.horizontal_scrollbar.posy:#(iif(#Skin.tvguide.rows.is_short, 905, 505))</define> <define>#Skin.tvguide.vertical_scrollbar.posx:#(iif(#Skin.tvguide.rows.is_short, 1829, 1329))</define> <define>#Skin.tvguide.tv_group_button.height:#(iif(#Skin.tvguide.rows.is_short, 533, 665))</define> <define>#Skin.tvguide.tv_group_label.posy:#(iif(#Skin.tvguide.rows.is_short, 733, 860))</define>
<control> <description>VIEWPORT</description> <type>image</type> <id>0</id> <posX>0</posX> <posY>162</posY> <width>1893</width> <height>#Skin.tvguide.viewport.height</height> <texture>#Skin.tvguide.viewport.texture</texture> <shouldCache>true</shouldCache> </control>
See also: Skin Expressions