fixed bug also for loops

This commit is contained in:
louis 2015-03-31 05:34:41 +02:00
parent 10e551d760
commit 1ba2ae905a
3 changed files with 33 additions and 6 deletions

View File

@ -243,3 +243,5 @@ Version 0.3.3
recordings in main menu
- fixed bug that parameters with both dynamic tokens and relative width,
height, posx or posy values are not parsed correctly
- fixed bug also for loops

View File

@ -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) {

View File

@ -11,8 +11,8 @@ class cTemplateLoopFunction : public cTemplateFunction {
private:
vector<cTemplateFunction*> functions;
vector<cTemplateFunction*>::iterator funcIt;
void ReplaceWidthFunctions(void);
void ReplaceHeightFunctions(void);
bool ReplaceWidthFunctions(void);
bool ReplaceHeightFunctions(void);
public:
cTemplateLoopFunction(void);
virtual ~cTemplateLoopFunction(void);