summaryrefslogtreecommitdiff
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
parent30b29f1866c0f1899698e01708015c6e68dd9014 (diff)
downloadrockbox-5729be4017c6e6081069c56637c4339aaddddd0b.tar.gz
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
-rw-r--r--utils/themeeditor/graphics/rbimage.h5
-rw-r--r--utils/themeeditor/models/parsetreenode.cpp67
2 files changed, 63 insertions, 9 deletions
diff --git a/utils/themeeditor/graphics/rbimage.h b/utils/themeeditor/graphics/rbimage.h
index f89213bb33..6caddae399 100644
--- a/utils/themeeditor/graphics/rbimage.h
+++ b/utils/themeeditor/graphics/rbimage.h
@@ -47,6 +47,11 @@ public:
47 currentTile = tiles -1; 47 currentTile = tiles -1;
48 } 48 }
49 49
50 int numTiles()
51 {
52 return tiles;
53 }
54
50 void enableMovement() 55 void enableMovement()
51 { 56 {
52 setFlag(ItemSendsGeometryChanges, true); 57 setFlag(ItemSendsGeometryChanges, true);
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)
747 { 747 {
748 case 'd': 748 case 'd':
749 /* %xd */ 749 /* %xd */
750 id = "";
751 id.append(element->params[0].data.text[0]);
752 c = element->params[0].data.text[1];
753 750
754 if(c == '\0') 751 /* Breaking up into cases, getting the id first */
752 if(element->params_count == 1)
755 { 753 {
756 tile = 1; 754 /* The old fashioned style */
755 id = "";
756 id.append(element->params[0].data.text[0]);
757 } 757 }
758 else 758 else
759 { 759 {
760 if(isupper(c)) 760 id = QString(element->params[0].data.text);
761 tile = c - 'A' + 25;
762 else
763 tile = c - 'a';
764 } 761 }
765 762
763
766 if(info.screen()->getImage(id)) 764 if(info.screen()->getImage(id))
767 { 765 {
766 /* Fetching the image if available */
768 image = new RBImage(*(info.screen()->getImage(id)), viewport); 767 image = new RBImage(*(info.screen()->getImage(id)), viewport);
768 }
769 else
770 {
771 image = 0;
772 }
773
774 /* Now determining the particular tile to load */
775 if(element->params_count == 1)
776 {
777 c = element->params[0].data.text[1];
778
779 if(c == '\0')
780 {
781 tile = 1;
782 }
783 else
784 {
785 if(isupper(c))
786 tile = c - 'A' + 25;
787 else
788 tile = c - 'a';
789 }
790
791 }else{
792 /* If the next param is just an int, use it as the tile */
793 if(element->params[1].type == skin_tag_parameter::INTEGER)
794 {
795 tile = element->params[1].data.number - 1;
796 }
797 else
798 {
799 tile = children[1]->evalTag(info, true,
800 image->numTiles()).toInt();
801
802 /* Adding the offset if there is one */
803 if(element->params_count == 3)
804 tile += element->params[2].data.number;
805 if(tile < 0)
806 {
807 /* If there is no image for the current status, then
808 * just refrain from showing anything
809 */
810 delete image;
811 return true;
812 }
813 }
814 }
815
816 if(image)
817 {
769 image->setTile(tile); 818 image->setTile(tile);
770 image->show(); 819 image->show();
771 image->enableMovement(); 820 image->enableMovement();