summaryrefslogtreecommitdiff
path: root/utils/themeeditor/parsetreenode.cpp
diff options
context:
space:
mode:
authorRobert Bieber <robby@bieberphoto.com>2010-06-10 21:52:53 +0000
committerRobert Bieber <robby@bieberphoto.com>2010-06-10 21:52:53 +0000
commit66d9ab289f175bfc6873af38d6668697c13577eb (patch)
treeb6d8d3514ec7c92ff0cb9c4cce57bdf6b338f100 /utils/themeeditor/parsetreenode.cpp
parent4b77e82d6712b570d71ee6091aeb2793d09bcc61 (diff)
downloadrockbox-66d9ab289f175bfc6873af38d6668697c13577eb.zip
rockbox-66d9ab289f175bfc6873af38d6668697c13577eb.tar.gz
rockbox-66d9ab289f175bfc6873af38d6668697c13577eb.tar.bz2
rockbox-66d9ab289f175bfc6873af38d6668697c13577eb.tar.xz
Theme Editor: Fixed code generation with new CONDITIONAL elements
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26753 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/parsetreenode.cpp')
-rw-r--r--utils/themeeditor/parsetreenode.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/utils/themeeditor/parsetreenode.cpp b/utils/themeeditor/parsetreenode.cpp
index 10f15df..6f61540 100644
--- a/utils/themeeditor/parsetreenode.cpp
+++ b/utils/themeeditor/parsetreenode.cpp
@@ -104,8 +104,6 @@ QString ParseTreeNode::genCode() const
{
case VIEWPORT:
- if(children[0]->element->type == TAG)
- buffer.append(TAGSYM);
buffer.append(children[0]->genCode());
if(children[0]->element->type == TAG)
buffer.append('\n');
@@ -116,16 +114,13 @@ QString ParseTreeNode::genCode() const
case LINE:
for(int i = 0; i < children.count(); i++)
{
- /*
- Adding a % in case of tag, because the tag rendering code
- doesn't insert its own
- */
- if(children[i]->element->type == TAG)
- buffer.append(TAGSYM);
buffer.append(children[i]->genCode());
}
- if(openConditionals == 0)
+ if(openConditionals == 0
+ && !(parent && parent->element->type == SUBLINES))
+ {
buffer.append('\n');
+ }
break;
case SUBLINES:
@@ -135,19 +130,32 @@ QString ParseTreeNode::genCode() const
if(i != children.count() - 1)
buffer.append(MULTILINESYM);
}
- buffer.append('\n');
+ if(openConditionals == 0)
+ buffer.append('\n');
break;
case CONDITIONAL:
openConditionals++;
- /* Inserts a %?, the tag renderer doesn't deal with the TAGSYM */
+
+ /* Inserting the tag part */
buffer.append(TAGSYM);
buffer.append(CONDITIONSYM);
- buffer.append(children[0]->genCode());
+ buffer.append(element->tag->name);
+ if(element->params_count > 0)
+ {
+ buffer.append(ARGLISTOPENSYM);
+ for(int i = 0; i < element->params_count; i++)
+ {
+ buffer.append(children[i]->genCode());
+ if( i != element->params_count - 1)
+ buffer.append(ARGLISTSEPERATESYM);
+ buffer.append(ARGLISTCLOSESYM);
+ }
+ }
/* Inserting the sublines */
buffer.append(ENUMLISTOPENSYM);
- for(int i = 1; i < children.count(); i++)
+ for(int i = element->params_count; i < children.count(); i++)
{
buffer.append(children[i]->genCode());
if(i != children.count() - 1)
@@ -158,9 +166,7 @@ QString ParseTreeNode::genCode() const
break;
case TAG:
- /* When generating code, we DO NOT insert the leading TAGSYM, leave
- * the calling functions to handle that
- */
+ buffer.append(TAGSYM);
buffer.append(element->tag->name);
if(element->params_count > 0)