Changes

Jump to navigation Jump to search
70 bytes removed ,  12:29, 15 October 2008
use xml syntax highlighting
Here's a schematic overview of the layout of keys in a STX file:
<presyntax type="xml">&lt;<render_info&gt;> &lt;<palette&gt;>
...
&lt;</palette&gt;>
&lt;<bitmaps&gt;>
...
&lt;</bitmaps&gt;>
&lt;<fonts&gt;>
...
&lt;</fonts&gt;>
&lt;<drawdata&gt;>
...
&lt;</drawdata&gt;>
...
&lt;</render_info&gt;>
&lt;<layout_info&gt;> &lt;<globals&gt;>
...
&lt;</globals&gt;>
&lt;<dialog&gt;>
...
&lt;</dialog&gt;>
...
&lt;</layout_info&gt;></presyntax
The best place to start writing a full theme description is taking a look at the already written themes in the <tt>gui/themes/</tt> directory of the Subversion repository, while consulting the following documentation for each specific key:
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:
<presyntax type="xml">/* Key will be loaded in all resolutions */&lt;<render_info&gt;>
/* Key will ONLY be loaded in resolutions with 320 width */
&lt;<render_info resolution = '320xY'&gt;>
/* Key will ONLY be loaded in resolutions with 240 height and in the 320x200 resolution */
&lt;<render_info resolution = 'Xx240, 320x200'&gt;>
/* Key will be loaded on ALL resolutions except for 320x200 */
&lt;<render_info resolution = '-320x200'&gt;>
/* Key will ONLY be loaded in resolutions with 320 width; the -240xY is superfluous. */
&lt;<render_info resolution = '320xY, -240xY'&gt;></presyntax
Note that the Theme Parser does not assert on repeated keys or values, it just replaces them accordingly. For instance, the following variable definition:
<presyntax type="xml">&lt;<def var = 'TestVar' value = '100'/&gt;>&lt;<def var = 'TestVar' value = '200' resolution = '320xY'/&gt;></presyntax
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.
The &quot;proper&quot; way to do that multi-resolution assignment would obviously be:
<presyntax type="xml">&lt;<def var = 'TestVar' value = '100' resolution = '-320xY'/&gt;>&lt;<def var = 'TestVar' value = '200' resolution = '320xY'/&gt;></presyntax
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.
2,051

edits

Navigation menu