summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor/models/parsetreenode.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2011-01-22 08:45:59 +0000
committerRobert Bieber <robby@bieberphoto.com>2011-01-22 08:45:59 +0000
commit5729be4017c6e6081069c56637c4339aaddddd0b (patch)
treef97d8de5667c4b09677f14d3d649b8441a248c43 /utils/themeeditor/models/parsetreenode.cpp
parent30b29f1866c0f1899698e01708015c6e68dd9014 (diff)
downloadrockbox-5729be4017c6e6081069c56637c4339aaddddd0b.tar.gz
rockbox-5729be4017c6e6081069c56637c4339aaddddd0b.tar.bz2
rockbox-5729be4017c6e6081069c56637c4339aaddddd0b.zip
Theme Editor: Updated rendering code to accomodate new format for %xd tags, including long names, numerical tile specification, tag-evaluating tile specification, and tile offset
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29107 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/models/parsetreenode.cpp')
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp67
1 files changed, 58 insertions, 9 deletions
diff --git a/utils/themeeditor/models/parsetreenode.cpp b/utils/themeeditor/models/parsetreenode.cpp
index bef7e553d1..03f1b21444 100644
--- a/utils/themeeditor/models/parsetreenode.cpp
+++ b/utils/themeeditor/models/parsetreenode.cpp
@@ -747,25 +747,74 @@ bool ParseTreeNode::execTag(const RBRenderInfo& info, RBViewport* viewport)
{
case 'd':
/* %xd */
- id = "";
- id.append(element->params[0].data.text[0]);
- c = element->params[0].data.text[1];
- if(c == '\0')
+ /* Breaking up into cases, getting the id first */
+ if(element->params_count == 1)
{
- tile = 1;
+ /* The old fashioned style */
+ id = "";
+ id.append(element->params[0].data.text[0]);
}
else
{
- if(isupper(c))
- tile = c - 'A' + 25;
- else
- tile = c - 'a';
+ id = QString(element->params[0].data.text);
}
+
if(info.screen()->getImage(id))
{
+ /* Fetching the image if available */
image = new RBImage(*(info.screen()->getImage(id)), viewport);
+ }
+ else
+ {
+ image = 0;
+ }
+
+ /* Now determining the particular tile to load */
+ if(element->params_count == 1)
+ {
+ c = element->params[0].data.text[1];
+
+ if(c == '\0')
+ {
+ tile = 1;
+ }
+ else
+ {
+ if(isupper(c))
+ tile = c - 'A' + 25;
+ else
+ tile = c - 'a';
+ }
+
+ }else{
+ /* If the next param is just an int, use it as the tile */
+ if(element->params[1].type == skin_tag_parameter::INTEGER)
+ {
+ tile = element->params[1].data.number - 1;
+ }
+ else
+ {
+ tile = children[1]->evalTag(info, true,
+ image->numTiles()).toInt();
+
+ /* Adding the offset if there is one */
+ if(element->params_count == 3)
+ tile += element->params[2].data.number;
+ if(tile < 0)
+ {
+ /* If there is no image for the current status, then
+ * just refrain from showing anything
+ */
+ delete image;
+ return true;
+ }
+ }
+ }
+
+ if(image)
+ {
image->setTile(tile);
image->show();
image->enableMovement();