summaryrefslogtreecommitdiff
path: root/utils/themeeditor/parsetreenode.cpp
diff options
context:
space:
mode:
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 10f15dfd73..6f6154039c 100644
--- a/utils/themeeditor/parsetreenode.cpp
+++ b/utils/themeeditor/parsetreenode.cpp
@@ -104,8 +104,6 @@ QString ParseTreeNode::genCode() const
104 { 104 {
105 105
106 case VIEWPORT: 106 case VIEWPORT:
107 if(children[0]->element->type == TAG)
108 buffer.append(TAGSYM);
109 buffer.append(children[0]->genCode()); 107 buffer.append(children[0]->genCode());
110 if(children[0]->element->type == TAG) 108 if(children[0]->element->type == TAG)
111 buffer.append('\n'); 109 buffer.append('\n');
@@ -116,16 +114,13 @@ QString ParseTreeNode::genCode() const
116 case LINE: 114 case LINE:
117 for(int i = 0; i < children.count(); i++) 115 for(int i = 0; i < children.count(); i++)
118 { 116 {
119 /*
120 Adding a % in case of tag, because the tag rendering code
121 doesn't insert its own
122 */
123 if(children[i]->element->type == TAG)
124 buffer.append(TAGSYM);
125 buffer.append(children[i]->genCode()); 117 buffer.append(children[i]->genCode());
126 } 118 }
127 if(openConditionals == 0) 119 if(openConditionals == 0
120 && !(parent && parent->element->type == SUBLINES))
121 {
128 buffer.append('\n'); 122 buffer.append('\n');
123 }
129 break; 124 break;
130 125
131 case SUBLINES: 126 case SUBLINES:
@@ -135,19 +130,32 @@ QString ParseTreeNode::genCode() const
135 if(i != children.count() - 1) 130 if(i != children.count() - 1)
136 buffer.append(MULTILINESYM); 131 buffer.append(MULTILINESYM);
137 } 132 }
138 buffer.append('\n'); 133 if(openConditionals == 0)
134 buffer.append('\n');
139 break; 135 break;
140 136
141 case CONDITIONAL: 137 case CONDITIONAL:
142 openConditionals++; 138 openConditionals++;
143 /* Inserts a %?, the tag renderer doesn't deal with the TAGSYM */ 139
140 /* Inserting the tag part */
144 buffer.append(TAGSYM); 141 buffer.append(TAGSYM);
145 buffer.append(CONDITIONSYM); 142 buffer.append(CONDITIONSYM);
146 buffer.append(children[0]->genCode()); 143 buffer.append(element->tag->name);
144 if(element->params_count > 0)
145 {
146 buffer.append(ARGLISTOPENSYM);
147 for(int i = 0; i < element->params_count; i++)
148 {
149 buffer.append(children[i]->genCode());
150 if( i != element->params_count - 1)
151 buffer.append(ARGLISTSEPERATESYM);
152 buffer.append(ARGLISTCLOSESYM);
153 }
154 }
147 155
148 /* Inserting the sublines */ 156 /* Inserting the sublines */
149 buffer.append(ENUMLISTOPENSYM); 157 buffer.append(ENUMLISTOPENSYM);
150 for(int i = 1; i < children.count(); i++) 158 for(int i = element->params_count; i < children.count(); i++)
151 { 159 {
152 buffer.append(children[i]->genCode()); 160 buffer.append(children[i]->genCode());
153 if(i != children.count() - 1) 161 if(i != children.count() - 1)
@@ -158,9 +166,7 @@ QString ParseTreeNode::genCode() const
158 break; 166 break;
159 167
160 case TAG: 168 case TAG:
161 /* When generating code, we DO NOT insert the leading TAGSYM, leave 169 buffer.append(TAGSYM);
162 * the calling functions to handle that
163 */
164 buffer.append(element->tag->name); 170 buffer.append(element->tag->name);
165 171
166 if(element->params_count > 0) 172 if(element->params_count > 0)