Difference between revisions of "GUI Themes/Specs"

Jump to navigation Jump to search
308 bytes removed ,  23:19, 7 March 2011
adapt to recent theme parser changes
(adapt to recent theme parser changes)
Line 122: Line 122:
=== Resolution-dependent keys and layouts ===
=== Resolution-dependent keys and layouts ===


Several keys in the STX syntax support the <tt>resolution</tt> property, which allows to load or skip the key and all its children when loading the theme on a given resolution.
Several keys in the STX syntax support the <tt>resolution</tt> property, which allows to load or skip the key and all its children when loading the theme on a given resolution dimension limit.


The resolution property must contain one or more resolutions, comma separated, for which the given key is supposed to be loaded. Resolutions preceded by the minus sign will block the key from being loaded in that resolution, while resolutions without any modifiers will force the theme to be loaded in all resolutions. Here are a few examples:
The resolution property must contain one or more resolution dimension limits, comma separated, for which the given key is supposed to be loaded. Resolutions without any modifiers will force the theme to be loaded in all resolutions. Here are a few examples:


<syntax type="xml">
<syntax type="xml">
Line 130: Line 130:
<render_info>
<render_info>


/* Key will ONLY be loaded in resolutions with 320 width */
/* Key will ONLY be loaded in resolutions with 400 width or more */
<render_info resolution = '320xY'>
<render_info resolution = 'y>399'>


/* Key will ONLY be loaded in resolutions with 240 height and in the 320x200 resolution */
/* Key will ONLY be loaded in resolutions with less than 400 height */
<render_info resolution = 'Xx240, 320x200'>
<render_info resolution = 'y<400'>
 
/* Key will be loaded on ALL resolutions except for 320x200 */
<render_info resolution = '-320x200'>
 
/* Key will ONLY be loaded in resolutions with 320 width; the -240xY is superfluous. */
<render_info resolution = '320xY, -240xY'>
</syntax>
</syntax>


Line 147: Line 141:
<syntax type="xml">
<syntax type="xml">
<def var = 'TestVar' value = '100'/>
<def var = 'TestVar' value = '100'/>
<def var = 'TestVar' value = '200' resolution = '320xY'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
</syntax>
</syntax>


won't fail to parse. What will happen when loading the theme using a resolution with 320 width is that <tt>TestVal</tt> first will be assigned the <tt>100</tt> value, and then it will be overwritten with the <tt>200</tt> value. On the other hand, when loading the theme using a resolution ''without'' a with of 320, the <tt>ThemeVal</tt> will be assigned the <tt>100</tt> value and the second key will be plain ignored.
won't fail to parse. What will happen when loading the theme using a resolution with 400 height or mire is that <tt>TestVal</tt> first will be assigned the <tt>100</tt> value, and then it will be overwritten with the <tt>200</tt> value. On the other hand, when loading the theme using a resolution ''with less'' than 400 height, the <tt>ThemeVal</tt> will be assigned the <tt>100</tt> value and the second key will be plain ignored.


The &quot;proper&quot; way to do that multi-resolution assignment would obviously be:
The &quot;proper&quot; way to do that multi-resolution assignment would obviously be:


<syntax type="xml">
<syntax type="xml">
<def var = 'TestVar' value = '100' resolution = '-320xY'/>
<def var = 'TestVar' value = '100' resolution = 'y<400'/>
<def var = 'TestVar' value = '200' resolution = '320xY'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
</syntax>
</syntax>


This way keys are only parsed on the resolution they are used in, but the result will be '''exactly the same''': Most of the time it's just cleaner to avoid using <tt>-320xY</tt> resolution tags, and instead write a layout that works on all resolutions and overwrite parts of it with the '320xY' tag.
This way keys are only parsed on the resolution they are used in, but the result will be '''exactly the same''': Most of the time it's just cleaner to avoid using <tt>y<400</tt> resolution tags, and instead write a layout that works on all resolutions and overwrite parts of it with the <tt>y>399<tt> tag.
24

edits

Navigation menu