Support and General Use > Theming and Appearance Customization
use xml for skins?
atsakir:
I am wondering if a complete rewrite of the theme syntax in XML form is the way to go, let's say from version 4 onwards. XML is far better structured and a custom streamlined XML parser (I don't know if there is a tinyXML equivalent in straight C) that would only parse tags required for the theme syntax (and not support things we don't really need like XSD etc.) would not hurt the code size that much.
In the case of conditional tags depending on screen and playback status we could have something like this:
--- Code: ---<viewport="a" x=14 y=45 w=36 h=16 font=1 >
<element="b" type="viewport" screen="menu" screen="wps" screen="playlist" status="play" />
<element="c" type="viewport" screen="menu" screen="wps" screen="playlist" status="paused" />
<element="d" type="text" screen="fm" status="fmplay" />
</viewport>
--- End code ---
where in cases we don't need conditionals in the above we can simply omit screen and/or status tags. The tag "type" denotes text, viewport or bitmap to be displayed in this viewport.
A bitmap tag can be like this:
--- Code: ---<bitmap="A" filename="mediastatus.bmp" x=0 y=0 w=36 h=16 parts=6 />
--- End code ---
where parts can be omitted when the bitmap only contains one subimage.
A text tag can either follow the current tagging system e.g.:
--- Code: ---<text="b" element="%s%al%?it<%it|%fn>" />
--- End code ---
or a complete rewrite of all the tags in XML form e.g. like so:
--- Code: ---<text="b" scroll=1 alignment=left >
<tag condition=0 element="%it">
<tag condition=1 element="%fn">
</text>
--- End code ---
What do you think?
JdGordon:
XML is never a good idea!
the best reason against xml is that it doesnt give you the line-by-line view of the wps. a line in the skin file is a line on the screen.. xml kills that
atsakir:
since viewports and conditional viewports in particular have already have kinda broken the line by line paradigm (which can only apply for text, anyway) and there are already cases where logic does not follow order of declaration (like the %Vl and %Vd tags used in different orders than logic dictates) I don't see how XML can create more confusion.
JdGordon:
because inside the viewports you know that each line represents one line of the display.
torne:
Parsing XML is expensive, even with lightweight libraries. XML is not easily readable or writable by humans most of the time, and it's not easy for computers to parse *either*.
XML has its uses: generally, things where the "extensible" part is relevant. The skin format is defined exactly by what Rockbox will accept, there is no need for flexibility or extensibility in the format since we have no mechanism to *do* anything like that.
Navigation
[0] Message Index
[#] Next page
Go to full version