fixed bug that string tokens are not evaluated in area conditions

This commit is contained in:
louis 2015-04-10 16:44:29 +02:00
parent 97f3d372dc
commit 5146f15e44
7 changed files with 25 additions and 12 deletions

View File

@ -287,4 +287,5 @@ Version 0.4.1
Version 0.4.2
- fixed bug that datetime was not drawn correctly in menus
- fixed bug that string tokens are not evaluated in area conditions

View File

@ -80,11 +80,13 @@ void cTemplatePixmap::ClearDynamicParameters(void) {
parameters->ClearDynamicParameters();
}
void cTemplatePixmap::ParseDynamicParameters(map <string,int> *intTokens, bool initFuncs) {
void cTemplatePixmap::ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs) {
parameters->ClearDynamicParameters();
parameters->SetIntTokens(intTokens);
parameters->SetStringTokens(stringTokens);
parameters->ParseParameters();
parameters->UnsetIntTokens();
parameters->UnsetStringTokens();
if (!DoExecute()) {
parameters->ClearDynamicParameters();

View File

@ -63,7 +63,7 @@ public:
//Clear dynamically set pixmap parameters
void ClearDynamicParameters(void);
//Parse pixmap parameters with dynamically set Tokens
void ParseDynamicParameters(map <string,int> *intTokens, bool initFuncs);
void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens, bool initFuncs);
//Parse all function parameters with dynamically set Tokens
void ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens);
//Calculate size of drawport in case area scrolls

View File

@ -60,18 +60,28 @@
{nextrecording} true if next Schedule will be recorded
-->
<epginfo>
<area x="17%" y="80%" width="66%" height="7%" layer="3">
<area condition="isset{currentsubtitle}" x="17%" y="80%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrWhite}" text="{currentstart}" />
<drawtext align="right" name="elapsed" valign="center" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currentelapsed}/{currentduration}min" />
<drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="70%" color="{clrWhite}" text="{currenttitle}" />
<drawtext x="{width(starttime)} + 40" y="56%" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="45%" color="{clrWhite}" text="{currentsubtitle}" />
</area>
<area x="17%" y="87%" width="66%" height="7%" layer="3">
<area condition="empty{currentsubtitle}" x="17%" y="80%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrWhite}" text="{currentstart}" />
<drawtext align="right" name="elapsed" valign="center" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currentelapsed}/{currentduration}min" />
<drawtext x="{width(starttime)} + 40" valign="center" width="{areawidth} - {width(starttime)} - {width(elapsed)} - 45" font="{regular}" fontsize="75%" color="{clrWhite}" text="{currenttitle}" />
</area>
<area condition="isset{nextsubtitle}" x="17%" y="87%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrGray}" text="{nextstart}" />
<drawtext align="right" name="duration" valign="center" font="{regular}" fontsize="75%" color="{clrGray}" text="{nextduration}min" />
<drawtext x="{width(starttime)} + 40" y="0" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="70%" color="{clrGray}" text="{nexttitle}" />
<drawtext x="{width(starttime)} + 40" y="55%" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="40%" color="{clrGray}" text="{nextsubtitle}" />
</area>
<area condition="empty{nextsubtitle}" x="17%" y="87%" width="66%" height="7%" layer="3">
<drawtext name="starttime" x="1%" valign="center" font="{regular}" fontsize="80%" color="{clrGray}" text="{nextstart}" />
<drawtext align="right" name="duration" valign="center" font="{regular}" fontsize="75%" color="{clrGray}" text="{nextduration}min" />
<drawtext x="{width(starttime)} + 40" valign="center" width="{areawidth} - {width(starttime)} - {width(duration)} - 45" font="{regular}" fontsize="75%" color="{clrGray}" text="{nexttitle}" />
</area>
</epginfo>
<!-- Available Variables progressbar:

View File

@ -224,7 +224,7 @@ void cDisplayMenuDetailView::InitTabs(void) {
tmplView->InitViewTabIterator();
cTemplateViewTab *tmplTab = NULL;
while(tmplTab = tmplView->GetNextViewTab()) {
tmplTab->ParseDynamicParameters(&intTokens, true);
tmplTab->ParseDynamicParameters(&stringTokens, &intTokens, true);
tmplTab->ClearDynamicFunctionParameters();
tmplTab->ParseDynamicFunctionParameters(&stringTokens, &intTokens);
if (tmplTab->DoExecute()) {

View File

@ -143,7 +143,7 @@ void cDisplayPluginView::SetTabs(void) {
tmplView->InitViewTabIterator();
cTemplateViewTab *tmplTab = NULL;
while(tmplTab = tmplView->GetNextViewTab()) {
tmplTab->ParseDynamicParameters(&tabIntTokens, true);
tmplTab->ParseDynamicParameters(&tabStringTokens, &tabIntTokens, true);
tmplTab->ClearDynamicFunctionParameters();
tmplTab->ParseDynamicFunctionParameters(&tabStringTokens, &tabIntTokens);
if (tmplTab->DoExecute()) {

View File

@ -109,13 +109,13 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens,
//check if pixmap needs dynamic parameters
if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) {
//parse dynamic parameters and initiate functions
pix->ParseDynamicParameters(intTokens, true);
pix->ParseDynamicParameters(stringTokens, intTokens, true);
if (pix->Ready() && pix->DoExecute()) {
CreateViewPixmap(pixCurrent, pix);
}
} else {
//parse dynamic parameters but not initiate functions
pix->ParseDynamicParameters(intTokens, false);
pix->ParseDynamicParameters(stringTokens, intTokens, false);
}
//if pixmap still not valid, skip
if (!pix->Ready() && !pix->Scrolling()) {
@ -917,9 +917,9 @@ cRect cViewListItem::DrawListItem(map <string,string> *stringTokens, map <string
posItem = pix->GetPixmapSize();
}
if (!PixmapExists(pixCurrent)) {
pix->ParseDynamicParameters(intTokens, true);
pix->ParseDynamicParameters(stringTokens, intTokens, true);
} else {
pix->ParseDynamicParameters(intTokens, false);
pix->ParseDynamicParameters(stringTokens, intTokens, false);
}
if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
CreateViewPixmap(pixCurrent, pix);
@ -1087,9 +1087,9 @@ void cGrid::Draw(void) {
while(pix = tmplViewElement->GetNextPixmap()) {
PositionPixmap(pix);
if (!PixmapExists(pixCurrent)) {
pix->ParseDynamicParameters(&intTokens, true);
pix->ParseDynamicParameters(&stringTokens, &intTokens, true);
} else {
pix->ParseDynamicParameters(&intTokens, false);
pix->ParseDynamicParameters(&stringTokens, &intTokens, false);
}
if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
CreateViewPixmap(pixCurrent, pix);