fixed bug that parameters with both dynamic tokens and relative width, height, posx or posy values are not parsed correctly

This commit is contained in:
louis 2015-03-30 18:05:53 +02:00
parent 335f57f0d3
commit 10e551d760
3 changed files with 47 additions and 13 deletions

View File

@ -241,4 +241,5 @@ Version 0.3.3
- added viewelement <lastrecordings> with information about 5 newest
recordings in main menu
- fixed bug that parameters with both dynamic tokens and relative width,
height, posx or posy values are not parsed correctly

View File

@ -206,10 +206,27 @@ void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *string
return;
}
ReplaceWidthFunctions();
ReplaceHeightFunctions();
ReplacePosXFunctions();
ReplacePosYFunctions();
bool replacedWidth = ReplaceWidthFunctions();
bool replacedHeight = ReplaceHeightFunctions();
bool replacedPosX = ReplacePosXFunctions();
bool replacedPosY = ReplacePosYFunctions();
if (!replacedWidth && !replacedHeight && !replacedPosX && !replacedPosY)
return;
InitIterator();
func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely())
continue;
func->SetStringTokens(stringTokens);
func->SetIntTokens(intTokens);
func->ParseParameters();
if (func->Updated())
func->CompleteParameters();
func->UnsetIntTokens();
func->UnsetStringTokens();
}
}
bool cTemplatePixmap::CalculateDrawPortSize(cSize &size, map < string, vector< map< string, string > > > *loopTokens) {
@ -376,7 +393,8 @@ bool cTemplatePixmap::Ready(void) {
return true;
}
void cTemplatePixmap::ReplaceWidthFunctions(void) {
bool cTemplatePixmap::ReplaceWidthFunctions(void) {
bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@ -397,14 +415,18 @@ void cTemplatePixmap::ReplaceWidthFunctions(void) {
func->SetWidth(type, label, funcWidth);
if (func->Updated()) {
func->CompleteParameters();
} else {
replaced = true;
}
}
}
}
}
return replaced;
}
void cTemplatePixmap::ReplaceHeightFunctions(void) {
bool cTemplatePixmap::ReplaceHeightFunctions(void) {
bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@ -425,14 +447,18 @@ void cTemplatePixmap::ReplaceHeightFunctions(void) {
func->SetHeight(type, label, funcHeight);
if (func->Updated()) {
func->CompleteParameters();
} else {
replaced = true;
}
}
}
}
}
return replaced;
}
void cTemplatePixmap::ReplacePosXFunctions(void) {
bool cTemplatePixmap::ReplacePosXFunctions(void) {
bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@ -454,15 +480,19 @@ void cTemplatePixmap::ReplacePosXFunctions(void) {
func->SetX(type, label, funcX);
if (func->Updated()) {
func->CompleteParameters();
} else {
replaced = true;
}
}
}
}
}
}
return replaced;
}
void cTemplatePixmap::ReplacePosYFunctions(void) {
bool cTemplatePixmap::ReplacePosYFunctions(void) {
bool replaced = false;
InitIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
@ -484,12 +514,15 @@ void cTemplatePixmap::ReplacePosYFunctions(void) {
func->SetY(type, label, funcY);
if (func->Updated()) {
func->CompleteParameters();
} else {
replaced = true;
}
}
}
}
}
}
return replaced;
}
void cTemplatePixmap::Debug(void) {

View File

@ -31,11 +31,11 @@ protected:
int containerHeight;
cGlobals *globals;
//functions replacing {width(label)} and {height(label)} tokens
void ReplaceWidthFunctions(void);
void ReplaceHeightFunctions(void);
bool ReplaceWidthFunctions(void);
bool ReplaceHeightFunctions(void);
//functions replacing {posx(label)} and {posy(label)} tokens
void ReplacePosXFunctions(void);
void ReplacePosYFunctions(void);
bool ReplacePosXFunctions(void);
bool ReplacePosYFunctions(void);
//Get Scrolling Function
cTemplateFunction *GetScrollFunction(void);
public: