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 recordings in main menu
- fixed bug that parameters with both dynamic tokens and relative width, - fixed bug that parameters with both dynamic tokens and relative width,
height, posx or posy values are not parsed correctly 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; return;
} }
ReplaceWidthFunctions(); bool replacedWidth = ReplaceWidthFunctions();
ReplaceHeightFunctions(); 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) { int cTemplateLoopFunction::GetLoopElementsWidth(void) {
@ -132,7 +149,8 @@ int cTemplateLoopFunction::GetLoopElementsHeight(void) {
return maxHeight; return maxHeight;
} }
void cTemplateLoopFunction::ReplaceWidthFunctions(void) { bool cTemplateLoopFunction::ReplaceWidthFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -153,14 +171,18 @@ void cTemplateLoopFunction::ReplaceWidthFunctions(void) {
func->SetWidth(type, label, funcWidth); func->SetWidth(type, label, funcWidth);
if (func->Updated()) { if (func->Updated()) {
func->CompleteParameters(); func->CompleteParameters();
} else {
replaced = true;
} }
} }
} }
} }
} }
return replaced;
} }
void cTemplateLoopFunction::ReplaceHeightFunctions(void) { bool cTemplateLoopFunction::ReplaceHeightFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -181,11 +203,14 @@ void cTemplateLoopFunction::ReplaceHeightFunctions(void) {
func->SetHeight(type, label, funcHeight); func->SetHeight(type, label, funcHeight);
if (func->Updated()) { if (func->Updated()) {
func->CompleteParameters(); func->CompleteParameters();
} else {
replaced = true;
} }
} }
} }
} }
} }
return replaced;
} }
bool cTemplateLoopFunction::Ready(void) { bool cTemplateLoopFunction::Ready(void) {

View File

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