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 - added viewelement <lastrecordings> with information about 5 newest
recordings in main menu 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; return;
} }
ReplaceWidthFunctions(); bool replacedWidth = ReplaceWidthFunctions();
ReplaceHeightFunctions(); bool replacedHeight = ReplaceHeightFunctions();
ReplacePosXFunctions(); bool replacedPosX = ReplacePosXFunctions();
ReplacePosYFunctions(); 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) { bool cTemplatePixmap::CalculateDrawPortSize(cSize &size, map < string, vector< map< string, string > > > *loopTokens) {
@ -376,7 +393,8 @@ bool cTemplatePixmap::Ready(void) {
return true; return true;
} }
void cTemplatePixmap::ReplaceWidthFunctions(void) { bool cTemplatePixmap::ReplaceWidthFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -397,14 +415,18 @@ void cTemplatePixmap::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 cTemplatePixmap::ReplaceHeightFunctions(void) { bool cTemplatePixmap::ReplaceHeightFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -425,14 +447,18 @@ void cTemplatePixmap::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;
} }
void cTemplatePixmap::ReplacePosXFunctions(void) { bool cTemplatePixmap::ReplacePosXFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -454,15 +480,19 @@ void cTemplatePixmap::ReplacePosXFunctions(void) {
func->SetX(type, label, funcX); func->SetX(type, label, funcX);
if (func->Updated()) { if (func->Updated()) {
func->CompleteParameters(); func->CompleteParameters();
} else {
replaced = true;
} }
} }
} }
} }
} }
} }
return replaced;
} }
void cTemplatePixmap::ReplacePosYFunctions(void) { bool cTemplatePixmap::ReplacePosYFunctions(void) {
bool replaced = false;
InitIterator(); InitIterator();
cTemplateFunction *func = NULL; cTemplateFunction *func = NULL;
while(func = GetNextFunction()) { while(func = GetNextFunction()) {
@ -484,12 +514,15 @@ void cTemplatePixmap::ReplacePosYFunctions(void) {
func->SetY(type, label, funcY); func->SetY(type, label, funcY);
if (func->Updated()) { if (func->Updated()) {
func->CompleteParameters(); func->CompleteParameters();
} else {
replaced = true;
} }
} }
} }
} }
} }
} }
return replaced;
} }
void cTemplatePixmap::Debug(void) { void cTemplatePixmap::Debug(void) {

View File

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