summaryrefslogtreecommitdiff
path: root/libtemplate/templateloopfunction.c
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-03-31 05:34:41 +0200
committerlouis <louis.braun@gmx.de>2015-03-31 05:34:41 +0200
commit1ba2ae905ad33f8e311100fd4e9e48653ca4b63d (patch)
tree202919e0fbe52bc5e44567bdfd193a66da4e3ef7 /libtemplate/templateloopfunction.c
parent10e551d7604d4e3c871f74174fdd535fb9c8e61a (diff)
downloadvdr-plugin-skindesigner-1ba2ae905ad33f8e311100fd4e9e48653ca4b63d.tar.gz
vdr-plugin-skindesigner-1ba2ae905ad33f8e311100fd4e9e48653ca4b63d.tar.bz2
fixed bug also for loops
Diffstat (limited to 'libtemplate/templateloopfunction.c')
-rw-r--r--libtemplate/templateloopfunction.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/libtemplate/templateloopfunction.c b/libtemplate/templateloopfunction.c
index b0030d3..4de9ec4 100644
--- a/libtemplate/templateloopfunction.c
+++ b/libtemplate/templateloopfunction.c
@@ -95,8 +95,25 @@ void cTemplateLoopFunction::ParseDynamicParameters(map <string,string> *tokens)
return;
}
- ReplaceWidthFunctions();
- ReplaceHeightFunctions();
+ bool replacedWidth = ReplaceWidthFunctions();
+ bool replacedHeight = ReplaceHeightFunctions();
+
+ if (!replacedWidth && !replacedHeight)
+ return;
+
+ InitIterator();
+ func = NULL;
+ while(func = GetNextFunction()) {
+ if (func->ParsedCompletely())
+ continue;
+ func->SetStringTokens(tokens);
+ func->SetIntTokens(&intTokens);
+ func->ParseParameters();
+ if (func->Updated())
+ func->CompleteParameters();
+ func->UnsetIntTokens();
+ func->UnsetStringTokens();
+ }
}
int cTemplateLoopFunction::GetLoopElementsWidth(void) {
@@ -132,7 +149,8 @@ int cTemplateLoopFunction::GetLoopElementsHeight(void) {
return maxHeight;
}
-void cTemplateLoopFunction::ReplaceWidthFunctions(void) {
+bool cTemplateLoopFunction::ReplaceWidthFunctions(void) {
+ bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@@ -153,14 +171,18 @@ void cTemplateLoopFunction::ReplaceWidthFunctions(void) {
func->SetWidth(type, label, funcWidth);
if (func->Updated()) {
func->CompleteParameters();
+ } else {
+ replaced = true;
}
}
}
}
}
+ return replaced;
}
-void cTemplateLoopFunction::ReplaceHeightFunctions(void) {
+bool cTemplateLoopFunction::ReplaceHeightFunctions(void) {
+ bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@@ -181,11 +203,14 @@ void cTemplateLoopFunction::ReplaceHeightFunctions(void) {
func->SetHeight(type, label, funcHeight);
if (func->Updated()) {
func->CompleteParameters();
+ } else {
+ replaced = true;
}
}
}
}
}
+ return replaced;
}
bool cTemplateLoopFunction::Ready(void) {