summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-03-30 18:05:53 +0200
committerlouis <louis.braun@gmx.de>2015-03-30 18:05:53 +0200
commit10e551d7604d4e3c871f74174fdd535fb9c8e61a (patch)
tree0ffe2e9afc2f97fdc4c275bcbfcf3a468365c5a3
parent335f57f0d38a4403c5e3948a8ca79de9b391381a (diff)
downloadvdr-plugin-skindesigner-10e551d7604d4e3c871f74174fdd535fb9c8e61a.tar.gz
vdr-plugin-skindesigner-10e551d7604d4e3c871f74174fdd535fb9c8e61a.tar.bz2
fixed bug that parameters with both dynamic tokens and relative width, height, posx or posy values are not parsed correctly
-rw-r--r--HISTORY3
-rw-r--r--libtemplate/templatepixmap.c49
-rw-r--r--libtemplate/templatepixmap.h8
3 files changed, 47 insertions, 13 deletions
diff --git a/HISTORY b/HISTORY
index 27b9a7b..95deb82 100644
--- a/HISTORY
+++ b/HISTORY
@@ -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
diff --git a/libtemplate/templatepixmap.c b/libtemplate/templatepixmap.c
index 1490236..2dfba83 100644
--- a/libtemplate/templatepixmap.c
+++ b/libtemplate/templatepixmap.c
@@ -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) {
diff --git a/libtemplate/templatepixmap.h b/libtemplate/templatepixmap.h
index a5d8f83..3be1816 100644
--- a/libtemplate/templatepixmap.h
+++ b/libtemplate/templatepixmap.h
@@ -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: