Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  use xml for skins?
« previous next »
  • Print
Pages: [1]

Author Topic: use xml for skins?  (Read 1726 times)

Offline atsakir

  • Member
  • *
  • Posts: 35
use xml for skins?
« on: June 07, 2010, 07:04:21 AM »
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: [Select]
<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>

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: [Select]
<bitmap="A" filename="mediastatus.bmp" x=0 y=0 w=36 h=16 parts=6 />

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: [Select]
<text="b" element="%s%al%?it<%it|%fn>" />

or a complete rewrite of all the tags in XML form e.g. like so:

Code: [Select]
<text="b" scroll=1 alignment=left >
   <tag condition=0 element="%it">
   <tag condition=1 element="%fn">       
</text>

What do you think?
« Last Edit: June 07, 2010, 07:22:17 AM by atsakir »
Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
use xml for skins?
« Reply #1 on: June 07, 2010, 07:17:01 AM »
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
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline atsakir

  • Member
  • *
  • Posts: 35
use xml for skins?
« Reply #2 on: June 07, 2010, 07:47:16 AM »
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.
« Last Edit: June 07, 2010, 07:49:04 AM by atsakir »
Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
use xml for skins?
« Reply #3 on: June 07, 2010, 07:54:38 AM »
because inside the viewports you know that each line represents one line of the display.
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline torne

  • Developer
  • Member
  • *
  • Posts: 994
  • arf arf
Re: use xml for skins?
« Reply #4 on: June 07, 2010, 08:40:23 AM »
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.
Logged
some kind of ARM guy. ipodvideo/gigabeat-s/h120/clipv2. to save time let's assume i know everything.

Offline atsakir

  • Member
  • *
  • Posts: 35
Re: use xml for skins?
« Reply #5 on: June 07, 2010, 10:09:44 AM »
I could be wrong but a lot of UI APIs use XML to define graphical user interfaces (e.g. CEGUI, QT, Android and even JAVA ME on mobile devices with limited cpu power) so, human readability apart, the structure necessary to define a GUI seems to fit XML quite nicely.

Now, from a code footprint and performance point of view since I haven't really searched to see what solutions are out there involving straight C implementations of XML parsers and I haven't looked deep into the rockbox codebase to see how much the parser code takes up and how fast it performs I can't really compare one syntax to another.

Performance-wise, we must take into account that parsing a theme file happens only once per theme load. Therefore, unless the time it takes to parse an XML-based theme file is 10-fold the time it takes to parse the current syntax I don't see how it is out of the question as the replies seem to indicate.
« Last Edit: June 07, 2010, 10:12:12 AM by atsakir »
Logged

Offline gevaerts

  • Administrator
  • Member
  • *
  • Posts: 1053
Re: use xml for skins?
« Reply #6 on: June 07, 2010, 10:21:43 AM »
Quote from: atsakir on June 07, 2010, 10:09:44 AM
I could be wrong but a lot of UI APIs use XML to define graphical user interfaces (e.g. CEGUI, QT, Android and even JAVA ME on mobile devices with limited cpu power) so, human readability apart, the structure necessary to define a GUI seems to fit XML quite nicely.

The fact that xml is used a lot in no way proves that it's suitable for those uses!

If we ever decided that a graphical theme editor is required to make themes, we could consider xml (apart from performance issues), but I really don't think we should do that. Themes should be hand-editable.

Which actual advantages would xml give us?
Logged

Offline torne

  • Developer
  • Member
  • *
  • Posts: 994
  • arf arf
Re: use xml for skins?
« Reply #7 on: June 07, 2010, 10:45:40 AM »
Parsing the skins happens *on every boot*, and thus its performance has a direct impact on boot time. Thus, it's generally desirable to have it be as quick as possible... performance is important for anything that happens at startup.
Logged
some kind of ARM guy. ipodvideo/gigabeat-s/h120/clipv2. to save time let's assume i know everything.

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  use xml for skins?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.084 seconds with 14 queries.