Theme Editor: Fixed parsing and code generation for nested conditionals

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26467 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-06-02 07:48:48 +00:00
parent 7f10b0336e
commit 496bcf39c7
3 changed files with 40 additions and 1 deletions

View file

@ -25,6 +25,8 @@
#include "parsetreenode.h"
#include "parsetreemodel.h"
int ParseTreeNode::openConditionals = 0;
/* Root element constructor */
ParseTreeNode::ParseTreeNode(struct skin_element* data)
: parent(0), element(0), param(0), children()
@ -117,7 +119,8 @@ QString ParseTreeNode::genCode() const
buffer.append(TAGSYM);
buffer.append(children[i]->genCode());
}
buffer.append('\n');
if(openConditionals == 0)
buffer.append('\n');
break;
case SUBLINES:
@ -131,6 +134,7 @@ QString ParseTreeNode::genCode() const
break;
case CONDITIONAL:
openConditionals++;
/* Inserts a %?, the tag renderer doesn't deal with the TAGSYM */
buffer.append(TAGSYM);
buffer.append(CONDITIONSYM);
@ -145,6 +149,7 @@ QString ParseTreeNode::genCode() const
buffer.append(ENUMLISTSEPERATESYM);
}
buffer.append(ENUMLISTCLOSESYM);
openConditionals--;
break;
case TAG: