diff options
35 files changed, 1510 insertions, 1412 deletions
@@ -378,3 +378,4 @@ Version 0.5.3 - fixed crash using animated images in plugins - added banner to displaymenuschedulescurrentview and displaymenureplaycurrentview +- immplemented areacontainers to group areas @@ -73,6 +73,7 @@ OBJS = $(PLUGIN).o \ libcore/imagecache.o \ libcore/helpers.o \ libcore/imageloader.o \ + libcore/libxmlwrapper.o \ libcore/recfolderinfo.o \ libcore/skinsetup.o \ libcore/skinrepo.o \ @@ -237,7 +237,10 @@ void cDesignerConfig::DeleteSkin(string skin) { if (FolderExists(delPath)) { dsyslog("skindesigner: deleting skin %s", delPath.c_str()); cString command = cString::sprintf("rm -rf %s", delPath.c_str()); - system(*command); + int ok = system(*command); + if (!ok) { + esyslog("skindesigner: error deleting skin %s", delPath.c_str()); + } } } diff --git a/dtd/displayaudiotracks.dtd b/dtd/displayaudiotracks.dtd index 0ebdf80..b4b0c59 100644 --- a/dtd/displayaudiotracks.dtd +++ b/dtd/displayaudiotracks.dtd @@ -21,13 +21,13 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area|areascroll)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT header (area|areascroll)*>
+<!ELEMENT header (areacontainer|area|areascroll)*>
<!ATTLIST header
debug CDATA #IMPLIED
condition CDATA #IMPLIED
@@ -45,6 +45,6 @@ orientation (horizontal|vertical) #REQUIRED
>
-<!ELEMENT listelement (area|areascroll)*>
+<!ELEMENT listelement (areacontainer|area|areascroll)*>
%functions;
\ No newline at end of file diff --git a/dtd/displaychannel.dtd b/dtd/displaychannel.dtd index e0f718b..589f372 100644 --- a/dtd/displaychannel.dtd +++ b/dtd/displaychannel.dtd @@ -24,79 +24,79 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT channelinfo (area|areascroll)*>
+<!ELEMENT channelinfo (areacontainer|area|areascroll)*>
<!ATTLIST channelinfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT epginfo (area|areascroll)*>
+<!ELEMENT epginfo (areacontainer|area|areascroll)*>
<!ATTLIST epginfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT progressbar (area|areascroll)*>
+<!ELEMENT progressbar (areacontainer|area|areascroll)*>
<!ATTLIST progressbar
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT progressbarback (area)*>
+<!ELEMENT progressbarback (areacontainer|area|areascroll)*>
<!ATTLIST progressbarback
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT statusinfo (area|areascroll)*>
+<!ELEMENT statusinfo (areacontainer|area|areascroll)*>
<!ATTLIST statusinfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT audioinfo (area|areascroll)*>
+<!ELEMENT audioinfo (areacontainer|area|areascroll)*>
<!ATTLIST audioinfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT ecminfo (area|areascroll)*>
+<!ELEMENT ecminfo (areacontainer|area|areascroll)*>
<!ATTLIST ecminfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT screenresolution (area|areascroll)*>
+<!ELEMENT screenresolution (areacontainer|area|areascroll)*>
<!ATTLIST screenresolution
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT channelgroup (area|areascroll)*>
+<!ELEMENT channelgroup (areacontainer|area|areascroll)*>
<!ATTLIST channelgroup
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT signalquality (area|areascroll)*>
+<!ELEMENT signalquality (areacontainer|area|areascroll)*>
<!ATTLIST signalquality
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT signalqualityback (area|areascroll)*>
+<!ELEMENT signalqualityback (areacontainer|area|areascroll)*>
<!ATTLIST signalqualityback
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT devices (area|areascroll)*>
+<!ELEMENT devices (areacontainer|area|areascroll)*>
<!ATTLIST devices
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -111,7 +111,7 @@ mode CDATA #IMPLIED
>
-<!ELEMENT currentweather (area|areascroll)*>
+<!ELEMENT currentweather (areacontainer|area|areascroll)*>
<!ATTLIST currentweather
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -125,7 +125,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT scrapercontent (area|areascroll)*>
+<!ELEMENT scrapercontent (areacontainer|area|areascroll)*>
<!ATTLIST scrapercontent
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -139,7 +139,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT datetime (area|areascroll)*>
+<!ELEMENT datetime (areacontainer|area|areascroll)*>
<!ATTLIST datetime
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -153,7 +153,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT time (area|areascroll)*>
+<!ELEMENT time (areacontainer|area|areascroll)*>
<!ATTLIST time
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -167,13 +167,13 @@ condition CDATA #IMPLIED
>
-<!ELEMENT message (area|areascroll)*>
+<!ELEMENT message (areacontainer|area|areascroll)*>
<!ATTLIST message
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT customtokens (area|areascroll)*>
+<!ELEMENT customtokens (areacontainer|area|areascroll)*>
<!ATTLIST customtokens
detached CDATA #IMPLIED
delay CDATA #IMPLIED
diff --git a/dtd/displaymenu.dtd b/dtd/displaymenu.dtd index 7bff662..0569d42 100644 --- a/dtd/displaymenu.dtd +++ b/dtd/displaymenu.dtd @@ -16,13 +16,13 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT header (area|areascroll)*>
+<!ELEMENT header (areacontainer|area|areascroll)*>
<!ATTLIST header
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -36,7 +36,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT datetime (area|areascroll)*>
+<!ELEMENT datetime (areacontainer|area|areascroll)*>
<!ATTLIST datetime
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -50,7 +50,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT time (area|areascroll)*>
+<!ELEMENT time (areacontainer|area|areascroll)*>
<!ATTLIST time
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -64,7 +64,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT message (area|areascroll)*>
+<!ELEMENT message (areacontainer|area|areascroll)*>
<!ATTLIST message
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -78,19 +78,19 @@ condition CDATA #IMPLIED
>
-<!ELEMENT sortmode (area|areascroll)*>
+<!ELEMENT sortmode (areacontainer|area|areascroll)*>
<!ATTLIST sortmode
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT colorbuttons (area|areascroll)*>
+<!ELEMENT colorbuttons (areacontainer|area|areascroll)*>
<!ATTLIST colorbuttons
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT timers (area|areascroll)*>
+<!ELEMENT timers (areacontainer|area|areascroll)*>
<!ATTLIST timers
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -104,7 +104,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT discusage (area|areascroll)*>
+<!ELEMENT discusage (areacontainer|area|areascroll)*>
<!ATTLIST discusage
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -118,7 +118,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT devices (area|areascroll)*>
+<!ELEMENT devices (areacontainer|area|areascroll)*>
<!ATTLIST devices
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -133,7 +133,7 @@ mode CDATA #IMPLIED
>
-<!ELEMENT systemload (area|areascroll)*>
+<!ELEMENT systemload (areacontainer|area|areascroll)*>
<!ATTLIST systemload
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -147,7 +147,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT systemmemory (area|areascroll)*>
+<!ELEMENT systemmemory (areacontainer|area|areascroll)*>
<!ATTLIST systemmemory
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -161,7 +161,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT temperatures (area|areascroll)*>
+<!ELEMENT temperatures (areacontainer|area|areascroll)*>
<!ATTLIST temperatures
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -175,7 +175,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT vdrstatistics (area|areascroll)*>
+<!ELEMENT vdrstatistics (areacontainer|area|areascroll)*>
<!ATTLIST vdrstatistics
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -189,7 +189,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT currentschedule (area|areascroll)*>
+<!ELEMENT currentschedule (areacontainer|area|areascroll)*>
<!ATTLIST currentschedule
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -203,7 +203,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT currentweather (area|areascroll)*>
+<!ELEMENT currentweather (areacontainer|area|areascroll)*>
<!ATTLIST currentweather
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -217,7 +217,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT lastrecordings (area|areascroll)*>
+<!ELEMENT lastrecordings (areacontainer|area|areascroll)*>
<!ATTLIST lastrecordings
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -231,7 +231,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT customtokens (area|areascroll)*>
+<!ELEMENT customtokens (areacontainer|area|areascroll)*>
<!ATTLIST customtokens
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -245,19 +245,19 @@ condition CDATA #IMPLIED
>
-<!ELEMENT scrollbar (area|areascroll)*>
+<!ELEMENT scrollbar (areacontainer|area|areascroll)*>
<!ATTLIST scrollbar
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT detailheader (area|areascroll)*>
+<!ELEMENT detailheader (areacontainer|area|areascroll)*>
<!ATTLIST detailheader
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT tablabels (area|areascroll)*>
+<!ELEMENT tablabels (areacontainer|area|areascroll)*>
<!ATTLIST tablabels
debug CDATA #IMPLIED
condition CDATA #IMPLIED
@@ -421,12 +421,12 @@ orientation (horizontal|vertical) #REQUIRED
>
-<!ELEMENT listelement (area|areascroll)*>
+<!ELEMENT listelement (areacontainer|area|areascroll)*>
<!ATTLIST listelement
debug CDATA #IMPLIED
>
-<!ELEMENT currentelement (area|areascroll)*>
+<!ELEMENT currentelement (areacontainer|area|areascroll)*>
<!ATTLIST currentelement
delay CDATA #REQUIRED
fadetime CDATA #IMPLIED
diff --git a/dtd/displaymenuplugin.dtd b/dtd/displaymenuplugin.dtd index d7352c6..1f9560f 100644 --- a/dtd/displaymenuplugin.dtd +++ b/dtd/displaymenuplugin.dtd @@ -16,42 +16,42 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
>
-<!ELEMENT header (area|areascroll)*>
+<!ELEMENT header (areacontainer|area|areascroll)*>
<!ATTLIST header
debug CDATA #IMPLIED
>
-<!ELEMENT datetime (area|areascroll)*>
+<!ELEMENT datetime (areacontainer|area|areascroll)*>
<!ATTLIST datetime
debug CDATA #IMPLIED
>
-<!ELEMENT message (area|areascroll)*>
+<!ELEMENT message (areacontainer|area|areascroll)*>
<!ATTLIST message
debug CDATA #IMPLIED
>
-<!ELEMENT colorbuttons (area|areascroll)*>
+<!ELEMENT colorbuttons (areacontainer|area|areascroll)*>
<!ATTLIST colorbuttons
debug CDATA #IMPLIED
>
-<!ELEMENT scrollbar (area|areascroll)*>
+<!ELEMENT scrollbar (areacontainer|area|areascroll)*>
<!ATTLIST scrollbar
debug CDATA #IMPLIED
>
-<!ELEMENT detailheader (area|areascroll)*>
+<!ELEMENT detailheader (areacontainer|area|areascroll)*>
<!ATTLIST detailheader
debug CDATA #IMPLIED
>
-<!ELEMENT tablabels (area|areascroll)*>
+<!ELEMENT tablabels (areacontainer|area|areascroll)*>
<!ATTLIST tablabels
debug CDATA #IMPLIED
>
@@ -68,12 +68,12 @@ orientation (horizontal|vertical) #REQUIRED
>
-<!ELEMENT listelement (area|areascroll)*>
+<!ELEMENT listelement (areacontainer|area|areascroll)*>
<!ATTLIST listelement
debug CDATA #IMPLIED
>
-<!ELEMENT currentelement (area|areascroll)*>
+<!ELEMENT currentelement (areacontainer|area|areascroll)*>
<!ATTLIST currentelement
delay CDATA #REQUIRED
fadetime CDATA #IMPLIED
diff --git a/dtd/displaymessage.dtd b/dtd/displaymessage.dtd index 1b85442..392adf5 100644 --- a/dtd/displaymessage.dtd +++ b/dtd/displaymessage.dtd @@ -21,12 +21,12 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
>
-<!ELEMENT message (area|areascroll)*>
+<!ELEMENT message (areacontainer|area|areascroll)*>
<!ATTLIST message
debug CDATA #IMPLIED
>
diff --git a/dtd/displayplugin.dtd b/dtd/displayplugin.dtd index 2e436d9..9d00b26 100644 --- a/dtd/displayplugin.dtd +++ b/dtd/displayplugin.dtd @@ -22,18 +22,18 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT viewelement (area|areascroll)*>
+<!ELEMENT viewelement (areacontainer|area|areascroll)*>
<!ATTLIST viewelement
name CDATA #REQUIRED
debug CDATA #IMPLIED
>
-<!ELEMENT scrollbar (area|areascroll)*>
+<!ELEMENT scrollbar (areacontainer|area|areascroll)*>
<!ATTLIST scrollbar
debug CDATA #IMPLIED
>
-<!ELEMENT tablabels (area|areascroll)*>
+<!ELEMENT tablabels (areacontainer|area|areascroll)*>
<!ATTLIST tablabels
debug CDATA #IMPLIED
>
diff --git a/dtd/displayreplay.dtd b/dtd/displayreplay.dtd index d5d47fc..e0bfa3b 100644 --- a/dtd/displayreplay.dtd +++ b/dtd/displayreplay.dtd @@ -25,29 +25,29 @@ debuggrid CDATA #IMPLIED
>
-<!ELEMENT background (area)*>
+<!ELEMENT background (areacontainer|area|areascroll)*>
<!ATTLIST background
debug CDATA #IMPLIED
>
-<!ELEMENT backgroundmodeonly (area)*>
+<!ELEMENT backgroundmodeonly (areacontainer|area|areascroll)*>
<!ATTLIST backgroundmodeonly
debug CDATA #IMPLIED
>
-<!ELEMENT datetime (area|areascroll)*>
+<!ELEMENT datetime (areacontainer|area|areascroll)*>
<!ATTLIST datetime
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT time (area|areascroll)*>
+<!ELEMENT time (areacontainer|area|areascroll)*>
<!ATTLIST time
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT scrapercontent (area|areascroll)*>
+<!ELEMENT scrapercontent (areacontainer|area|areascroll)*>
<!ATTLIST scrapercontent
detached CDATA #IMPLIED
delay CDATA #IMPLIED
@@ -61,73 +61,73 @@ condition CDATA #IMPLIED
>
-<!ELEMENT rectitle (area|areascroll)*>
+<!ELEMENT rectitle (areacontainer|area|areascroll)*>
<!ATTLIST rectitle
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT recinfo (area|areascroll)*>
+<!ELEMENT recinfo (areacontainer|area|areascroll)*>
<!ATTLIST recinfo
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT currenttime (area|areascroll)*>
+<!ELEMENT currenttime (areacontainer|area|areascroll)*>
<!ATTLIST currenttime
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT totaltime (area|areascroll)*>
+<!ELEMENT totaltime (areacontainer|area|areascroll)*>
<!ATTLIST totaltime
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT endtime (area|areascroll)*>
+<!ELEMENT endtime (areacontainer|area|areascroll)*>
<!ATTLIST endtime
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT progressbar (area|areascroll)*>
+<!ELEMENT progressbar (areacontainer|area|areascroll)*>
<!ATTLIST progressbar
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT cutmarks (area|areascroll)*>
+<!ELEMENT cutmarks (areacontainer|area|areascroll)*>
<!ATTLIST cutmarks
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT controlicons (area|areascroll)*>
+<!ELEMENT controlicons (areacontainer|area|areascroll)*>
<!ATTLIST controlicons
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT controliconsmodeonly (area|areascroll)*>
+<!ELEMENT controliconsmodeonly (areacontainer|area|areascroll)*>
<!ATTLIST controliconsmodeonly
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT jump (area|areascroll)*>
+<!ELEMENT jump (areacontainer|area|areascroll)*>
<!ATTLIST jump
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT message (area|areascroll)*>
+<!ELEMENT message (areacontainer|area|areascroll)*>
<!ATTLIST message
debug CDATA #IMPLIED
condition CDATA #IMPLIED
>
-<!ELEMENT onpause (area|areascroll)*>
+<!ELEMENT onpause (areacontainer|area|areascroll)*>
<!ATTLIST onpause
debug CDATA #IMPLIED
delay CDATA #REQUIRED
@@ -135,7 +135,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT onpausemodeonly (area|areascroll)*>
+<!ELEMENT onpausemodeonly (areacontainer|area|areascroll)*>
<!ATTLIST onpausemodeonly
debug CDATA #IMPLIED
delay CDATA #REQUIRED
@@ -143,7 +143,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT customtokens (area|areascroll)*>
+<!ELEMENT customtokens (areacontainer|area|areascroll)*>
<!ATTLIST customtokens
debug CDATA #IMPLIED
condition CDATA #IMPLIED
diff --git a/dtd/functions.dtd b/dtd/functions.dtd index 50198f4..85ef1f5 100644 --- a/dtd/functions.dtd +++ b/dtd/functions.dtd @@ -1,3 +1,13 @@ +<!ELEMENT areacontainer (area|areascroll)*> +<!ATTLIST areacontainer + x CDATA #IMPLIED + y CDATA #IMPLIED + width CDATA #IMPLIED + height CDATA #IMPLIED + condition CDATA #IMPLIED + debug (true|false) #IMPLIED +> + <!ELEMENT area (loop|fill|drawtext|drawtextbox|drawimage|drawtextvertical|drawrectangle|drawellipse|drawslope)*> <!ATTLIST area x CDATA #IMPLIED @@ -28,7 +38,7 @@ debug (true|false) #IMPLIED > -<!ELEMENT grid (area|areascroll)*> +<!ELEMENT grid (areacontainer|area|areascroll)*> <!ATTLIST grid x CDATA #REQUIRED y CDATA #REQUIRED diff --git a/libcore/helpers.c b/libcore/helpers.c index bdddb66..6af7bcb 100644 --- a/libcore/helpers.c +++ b/libcore/helpers.c @@ -151,7 +151,10 @@ bool FirstFileInFolder(string &path, string &extension, string &fileName) { void CreateFolder(string &path) { cString command = cString::sprintf("mkdir -p %s", path.c_str()); - system(*command); + int ok = system(*command); + if (!ok) { + esyslog("skindesigner: error creating folder %s", path.c_str()); + } } // trim from start diff --git a/libcore/skinsetup.c b/libcore/skinsetup.c index f695935..e52ff41 100644 --- a/libcore/skinsetup.c +++ b/libcore/skinsetup.c @@ -88,19 +88,19 @@ void cSkinSetupMenu::InitIterators(void) { subMenuIt = subMenus.begin(); } -void cSkinSetupMenu::SetParameter(eSetupParameterType paramType, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { +void cSkinSetupMenu::SetParameter(eSetupParameterType paramType, string name, string displayText, string min, string max, string value) { cSkinSetupParameter *param = new cSkinSetupParameter(); param->type = paramType; - param->name = (const char*)name; - param->displayText = (const char*)displayText; + param->name = name; + param->displayText = displayText; - if (min && paramType == sptInt) { - param->min = atoi((const char*)min); + if (min.size() && paramType == sptInt) { + param->min = atoi(min.c_str()); } - if (max && paramType == sptInt) { - param->max = atoi((const char*)max); + if (max.size() && paramType == sptInt) { + param->max = atoi(max.c_str()); } - param->value = atoi((const char*)value); + param->value = atoi(value.c_str()); parameters.push_back(param); } @@ -169,10 +169,10 @@ bool cSkinSetup::ReadFromXML(void) { return true; } -void cSkinSetup::SetSubMenu(xmlChar *name, xmlChar *displayText) { +void cSkinSetup::SetSubMenu(string name, string displayText) { cSkinSetupMenu *subMenu = new cSkinSetupMenu(); - subMenu->SetName((const char*)name); - subMenu->SetDisplayText((const char*)displayText); + subMenu->SetName(name); + subMenu->SetDisplayText(displayText); subMenu->SetParent(currentMenu); currentMenu->AddSubMenu(subMenu); currentMenu = subMenu; @@ -185,15 +185,15 @@ void cSkinSetup::SubMenuDone(void) { } } -void cSkinSetup::SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value) { - if (!type || !name || !displayText || !value) { +void cSkinSetup::SetParameter(string type, string name, string displayText, string min, string max, string value) { + if (!type.size() || !name.size() || !displayText.size() || !value.size()) { esyslog("skindesigner: invalid setup parameter for skin %s", skin.c_str()); return; } eSetupParameterType paramType = sptUnknown; - if (!xmlStrcmp(type, (const xmlChar *) "int")) { + if (!type.compare("int")) { paramType = sptInt; - } else if (!xmlStrcmp(type, (const xmlChar *) "bool")) { + } else if (!type.compare("bool")) { paramType = sptBool; } if (paramType == sptUnknown) { diff --git a/libcore/skinsetup.h b/libcore/skinsetup.h index 0de768b..29649ed 100644 --- a/libcore/skinsetup.h +++ b/libcore/skinsetup.h @@ -55,7 +55,7 @@ public: void SetParent(cSkinSetupMenu *p) { parent = p; }; cSkinSetupMenu *GetParent(void) { return parent; }; void AddSubMenu(cSkinSetupMenu *sub) { subMenus.push_back(sub); }; - void SetParameter(eSetupParameterType paramType, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value); + void SetParameter(eSetupParameterType paramType, string name, string displayText, string min, string max, string value); void InitIterators(void); void InitParameterIterator(void) { paramIt = parameters.begin(); }; cSkinSetupParameter *GetNextParameter(bool deep = true); @@ -80,9 +80,9 @@ public: cSkinSetup(string skin); virtual ~cSkinSetup(void); bool ReadFromXML(void); - void SetSubMenu(xmlChar *name, xmlChar *displayText); + void SetSubMenu(string name, string displayText); void SubMenuDone(void); - void SetParameter(xmlChar *type, xmlChar *name, xmlChar* displayText, xmlChar *min, xmlChar *max, xmlChar *value); + void SetParameter(string type, string name, string displayText, string min, string max, string value); void InitParameterIterator(void) { rootMenu->InitIterators(); }; cSkinSetupParameter *GetNextParameter(void); cSkinSetupParameter *GetParameter(string name); diff --git a/libtemplate/globals.c b/libtemplate/globals.c index 702bf8e..822b993 100644 --- a/libtemplate/globals.c +++ b/libtemplate/globals.c @@ -18,13 +18,13 @@ bool cGlobals::ReadFromXML(void) { //globals.xml is mandatory string xmlFile = "globals.xml"; cXmlParser parser; - if (!parser.ReadGlobals(this, xmlFile, true)) + if (!parser.ReadGlobals(this, xmlFile)) return false; if (!parser.ParseGlobals()) return false; //theme.xml is optional xmlFile = "theme.xml"; - if (parser.ReadGlobals(this, xmlFile, false)) { + if (parser.ReadGlobals(this, xmlFile)) { parser.ParseGlobals(); } return true; diff --git a/libtemplate/template.c b/libtemplate/template.c index b9698c2..43fd3da 100644 --- a/libtemplate/template.c +++ b/libtemplate/template.c @@ -190,10 +190,10 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u view->InitViewElementIterator(); cTemplateViewElement *viewElement = NULL; while(viewElement = view->GetNextViewElement()) { - viewElement->InitIterator(); + viewElement->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewElement->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText) { @@ -206,10 +206,10 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u view->InitViewListIterator(); cTemplateViewList *viewList = NULL; while(viewList = view->GetNextViewList()) { - viewList->InitIterator(); + viewList->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewList->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText) { @@ -218,9 +218,9 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u } } cTemplateViewElement *listElement = viewList->GetListElement(); - listElement->InitIterator(); + listElement->InitPixmapIterator(); while(pix = listElement->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText) { @@ -233,7 +233,7 @@ void cTemplate::GetUsedFonts(cTemplateView *view, vector< pair<string, int> > &u view->InitViewTabIterator(); cTemplateViewTab *viewTab = NULL; while(viewTab = view->GetNextViewTab()) { - viewTab->InitIterator(); + viewTab->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = viewTab->GetNextFunction()) { if (func->GetType() == ftDrawText) { @@ -248,7 +248,7 @@ void cTemplate::CacheImages(cTemplateView *view) { view->InitViewElementIterator(); cTemplateViewElement *viewElement = NULL; while(viewElement = view->GetNextViewElement()) { - viewElement->InitIterator(); + viewElement->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewElement->GetNextPixmap()) { CachePixmapImages(pix); @@ -258,13 +258,13 @@ void cTemplate::CacheImages(cTemplateView *view) { view->InitViewListIterator(); cTemplateViewList *viewList = NULL; while(viewList = view->GetNextViewList()) { - viewList->InitIterator(); + viewList->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewList->GetNextPixmap()) { CachePixmapImages(pix); } cTemplateViewElement *listElement = viewList->GetListElement(); - listElement->InitIterator(); + listElement->InitPixmapIterator(); while(pix = listElement->GetNextPixmap()) { CachePixmapImages(pix); } @@ -272,7 +272,7 @@ void cTemplate::CacheImages(cTemplateView *view) { if (!currentElement) { continue; } - currentElement->InitIterator(); + currentElement->InitPixmapIterator(); while(pix = currentElement->GetNextPixmap()) { CachePixmapImages(pix); } @@ -286,7 +286,7 @@ void cTemplate::CacheImages(cTemplateView *view) { } void cTemplate::CachePixmapImages(cTemplatePixmap *pix) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawImage) { diff --git a/libtemplate/templatefunction.c b/libtemplate/templatefunction.c index 6c6ae5c..0adc754 100644 --- a/libtemplate/templatefunction.c +++ b/libtemplate/templatefunction.c @@ -1568,6 +1568,9 @@ string cTemplateFunction::GetFuncName(void) { case ftViewElement:
name = "View Element Parameters";
break;
+ case ftPixmapContainer:
+ name = "Pixmap Container Parameters";
+ break;
case ftPixmap:
name = "Pixmap Parameters";
break;
diff --git a/libtemplate/templatefunction.h b/libtemplate/templatefunction.h index a000110..d800c5f 100644 --- a/libtemplate/templatefunction.h +++ b/libtemplate/templatefunction.h @@ -23,6 +23,7 @@ enum eFuncType { ftView, ftViewElement, ftViewList, + ftPixmapContainer, ftPixmap, ftPixmapScroll, ftLoop, diff --git a/libtemplate/templatepixmap.c b/libtemplate/templatepixmap.c index d6866b5..117ab25 100644 --- a/libtemplate/templatepixmap.c +++ b/libtemplate/templatepixmap.c @@ -1,41 +1,50 @@ #include "templatepixmap.h"
using namespace std;
+// --- cTemplatePixmapNode -------------------------------------------------------------
-// --- cTemplatePixmap -------------------------------------------------------------
-
-cTemplatePixmap::cTemplatePixmap(void) {
+cTemplatePixmapNode::cTemplatePixmapNode(void) {
parameters = NULL;
+ globals = NULL;
containerX = 0;
containerY = 0;
containerWidth = 0;
containerHeight = 0;
- globals = NULL;
- scrolling = false;
- background = false;
}
-cTemplatePixmap::~cTemplatePixmap() {
- for (vector<cTemplateFunction*>::iterator it = functions.begin(); it != functions.end(); it++) {
- delete (*it);
- }
+cTemplatePixmapNode::~cTemplatePixmapNode() {
if (parameters)
delete parameters;
}
-void cTemplatePixmap::SetParameters(vector<pair<string, string> > ¶ms) {
- parameters = new cTemplateFunction(ftPixmap);
+void cTemplatePixmapNode::SetParameters(vector<stringpair> ¶ms) {
+ parameters = new cTemplateFunction(isContainer?ftPixmapContainer:ftPixmap);
parameters->SetGlobals(globals);
parameters->SetParameters(params);
}
-void cTemplatePixmap::SetContainer(int x, int y, int w, int h) {
+void cTemplatePixmapNode::SetContainer(int x, int y, int w, int h) {
containerX = x;
containerY = y;
containerWidth = w;
containerHeight = h;
}
+// --- cTemplatePixmap -------------------------------------------------------------
+
+cTemplatePixmap::cTemplatePixmap(void) {
+ pixContainer = NULL;
+ isContainer = false;
+ scrolling = false;
+ background = false;
+}
+
+cTemplatePixmap::~cTemplatePixmap() {
+ for (vector<cTemplateFunction*>::iterator it = functions.begin(); it != functions.end(); it++) {
+ delete (*it);
+ }
+}
+
void cTemplatePixmap::SetWidth(int width) {
cString pWidth = cString::sprintf("%d", width);
parameters->SetWidthManually(*pWidth);
@@ -76,6 +85,11 @@ void cTemplatePixmap::SetYPercent(double y) { parameters->SetYManually(absY);
}
+void cTemplatePixmap::SetParameter(eParamType type, string value) {
+ parameters->SetParameter(type, value);
+}
+
+
void cTemplatePixmap::ClearDynamicParameters(void) {
parameters->ClearDynamicParameters();
}
@@ -180,7 +194,7 @@ bool cTemplatePixmap::CalculateParameters(void) { }
void cTemplatePixmap::ClearDynamicFunctionParameters(void) {
- InitIterator();
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
func->ClearDynamicParameters();
@@ -188,7 +202,7 @@ void cTemplatePixmap::ClearDynamicFunctionParameters(void) { }
void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens) {
- InitIterator();
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
bool completelyParsed = true;
while(func = GetNextFunction()) {
@@ -215,7 +229,7 @@ void cTemplatePixmap::ParseDynamicFunctionParameters(map <string,string> *string if (!replacedWidth && !replacedHeight && !replacedPosX && !replacedPosY)
return;
- InitIterator();
+ InitFunctionIterator();
func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely())
@@ -249,7 +263,7 @@ bool cTemplatePixmap::CalculateDrawPortSize(cSize &size, map < string, vector< m }
} else if (orientation == orVertical) {
//check "last" element height
- InitIterator();
+ InitFunctionIterator();
cTemplateFunction *f = NULL;
int drawportHeight = 1;
while (f = GetNextFunction()) {
@@ -324,7 +338,7 @@ void cTemplatePixmap::SetScrollingTextWidth(void) { if (orientation != orHorizontal)
return;
int pixWidth = parameters->GetNumericParameter(ptWidth);
- InitIterator();
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
if (func->GetType() == ftDrawText) {
@@ -339,7 +353,7 @@ cTemplateFunction *cTemplatePixmap::GetScrollFunction(void) { string scrollElement = parameters->GetParameter(ptScrollElement);
if (scrollElement.size() == 0)
return NULL;
- InitIterator();
+ InitFunctionIterator();
cTemplateFunction *f = NULL;
while (f = GetNextFunction()) {
string funcName = f->GetParameter(ptName);
@@ -365,7 +379,7 @@ int cTemplatePixmap::GetNumericParameter(eParamType type) { return parameters->GetNumericParameter(type);
}
-void cTemplatePixmap::InitIterator(void) {
+void cTemplatePixmap::InitFunctionIterator(void) {
funcIt = functions.begin();
}
@@ -393,9 +407,26 @@ bool cTemplatePixmap::Ready(void) { return true;
}
+bool cTemplatePixmap::ParameterSet(eParamType type) {
+ string value = parameters->GetParameter(type);
+ if (value.size() > 0)
+ return true;
+ return false;
+}
+
+cTemplateFunction *cTemplatePixmap::GetFunction(string name) {
+ for (vector<cTemplateFunction*>::iterator it = functions.begin(); it != functions.end(); it++) {
+ string funcName = (*it)->GetParameter(ptName);
+ if (!name.compare(funcName))
+ return *it;
+ }
+ return NULL;
+}
+
bool cTemplatePixmap::ReplaceWidthFunctions(void) {
bool replaced = false;
- InitIterator();
+ bool found = false;
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely()) {
@@ -411,6 +442,20 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) { cTemplateFunction *myFunc = *it;
string myFuncName = myFunc->GetParameter(ptName);
if (!myFuncName.compare(label)) {
+ found = true;
+ funcWidth = myFunc->GetWidth();
+ func->SetWidth(type, label, funcWidth);
+ if (func->Updated()) {
+ func->CompleteParameters();
+ } else {
+ replaced = true;
+ }
+ break;
+ }
+ }
+ if (!found && pixContainer) {
+ cTemplateFunction *myFunc = pixContainer->GetFunction(label);
+ if (myFunc) {
funcWidth = myFunc->GetWidth();
func->SetWidth(type, label, funcWidth);
if (func->Updated()) {
@@ -418,6 +463,7 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) { } else {
replaced = true;
}
+ break;
}
}
}
@@ -427,7 +473,8 @@ bool cTemplatePixmap::ReplaceWidthFunctions(void) { bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens) {
bool replaced = false;
- InitIterator();
+ bool found = false;
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely()) {
@@ -443,6 +490,20 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, cTemplateFunction *myFunc = *it;
string myFuncName = myFunc->GetParameter(ptName);
if (!myFuncName.compare(label)) {
+ found = true;
+ funcHeight = myFunc->GetHeight(loopTokens);
+ func->SetHeight(type, label, funcHeight);
+ if (func->Updated()) {
+ func->CompleteParameters();
+ } else {
+ replaced = true;
+ }
+ break;
+ }
+ }
+ if (!found && pixContainer) {
+ cTemplateFunction *myFunc = pixContainer->GetFunction(label);
+ if (myFunc) {
funcHeight = myFunc->GetHeight(loopTokens);
func->SetHeight(type, label, funcHeight);
if (func->Updated()) {
@@ -450,6 +511,7 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, } else {
replaced = true;
}
+ break;
}
}
}
@@ -459,7 +521,8 @@ bool cTemplatePixmap::ReplaceHeightFunctions(map < string, vector< map< string, bool cTemplatePixmap::ReplacePosXFunctions(void) {
bool replaced = false;
- InitIterator();
+ bool found = false;
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely()) {
@@ -475,6 +538,22 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) { cTemplateFunction *myFunc = *it;
string myFuncName = myFunc->GetParameter(ptName);
if (!myFuncName.compare(label)) {
+ found = true;
+ funcX = myFunc->GetNumericParameter(ptX);
+ if (funcX > -1) {
+ func->SetX(type, label, funcX);
+ if (func->Updated()) {
+ func->CompleteParameters();
+ } else {
+ replaced = true;
+ }
+ }
+ break;
+ }
+ }
+ if (!found && pixContainer) {
+ cTemplateFunction *myFunc = pixContainer->GetFunction(label);
+ if (myFunc) {
funcX = myFunc->GetNumericParameter(ptX);
if (funcX > -1) {
func->SetX(type, label, funcX);
@@ -484,6 +563,7 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) { replaced = true;
}
}
+ break;
}
}
}
@@ -493,7 +573,8 @@ bool cTemplatePixmap::ReplacePosXFunctions(void) { bool cTemplatePixmap::ReplacePosYFunctions(void) {
bool replaced = false;
- InitIterator();
+ bool found = false;
+ InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = GetNextFunction()) {
if (func->ParsedCompletely()) {
@@ -509,6 +590,7 @@ bool cTemplatePixmap::ReplacePosYFunctions(void) { cTemplateFunction *myFunc = *it;
string myFuncName = myFunc->GetParameter(ptName);
if (!myFuncName.compare(label)) {
+ found = true;
funcY = myFunc->GetNumericParameter(ptY);
if (funcY > -1) {
func->SetY(type, label, funcY);
@@ -518,6 +600,22 @@ bool cTemplatePixmap::ReplacePosYFunctions(void) { replaced = true;
}
}
+ break;
+ }
+ }
+ if (!found && pixContainer) {
+ cTemplateFunction *myFunc = pixContainer->GetFunction(label);
+ if (myFunc) {
+ funcY = myFunc->GetNumericParameter(ptY);
+ if (funcY > -1) {
+ func->SetY(type, label, funcY);
+ if (func->Updated()) {
+ func->CompleteParameters();
+ } else {
+ replaced = true;
+ }
+ }
+ break;
}
}
}
@@ -532,3 +630,110 @@ void cTemplatePixmap::Debug(void) { (*it)->Debug();
}
}
+
+// --- cTemplatePixmapContainer -------------------------------------------------------------
+
+cTemplatePixmapContainer::cTemplatePixmapContainer(void) {
+ isContainer = true;
+}
+
+cTemplatePixmapContainer::~cTemplatePixmapContainer() {
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ delete (*it);
+ }
+}
+
+void cTemplatePixmapContainer::SetGlobals(cGlobals *globals) {
+ this->globals = globals;
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ (*it)->SetGlobals(globals);
+ }
+}
+
+void cTemplatePixmapContainer::SetWidth(int width) {
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ (*it)->SetWidth(width);
+ }
+}
+
+void cTemplatePixmapContainer::SetHeight(int height) {
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ (*it)->SetHeight(height);
+ }
+}
+
+void cTemplatePixmapContainer::AddPixmap(cTemplatePixmap *pix) {
+ //setting default parameters of container if parameter is not set in area
+ string containerDefaultX = parameters->GetParameter(ptX);
+ string containerDefaultY = parameters->GetParameter(ptY);
+ string containerDefaultWidth = parameters->GetParameter(ptWidth);
+ string containerDefaultHeight = parameters->GetParameter(ptHeight);
+ if (containerDefaultX.size() > 0 && !pix->ParameterSet(ptX))
+ pix->SetParameter(ptX, containerDefaultX);
+ if (containerDefaultY.size() > 0 && !pix->ParameterSet(ptY))
+ pix->SetParameter(ptY, containerDefaultY);
+ if (containerDefaultWidth.size() > 0 && !pix->ParameterSet(ptWidth))
+ pix->SetParameter(ptWidth, containerDefaultWidth);
+ if (containerDefaultHeight.size() > 0 && !pix->ParameterSet(ptHeight))
+ pix->SetParameter(ptHeight, containerDefaultHeight);
+
+ pix->SetPixmapContainer(this);
+ pixmaps.push_back(pix);
+}
+
+bool cTemplatePixmapContainer::CalculateParameters(void) {
+ bool paramsValid = true;
+ //Calculate Pixmap Size
+ parameters->SetContainer(containerX, containerY, containerWidth, containerHeight);
+ parameters->SetGlobals(globals);
+ paramsValid = parameters->CalculateParameters();
+
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ (*it)->SetContainer(containerX, containerY, containerWidth, containerHeight);
+ (*it)->SetGlobals(globals);
+ paramsValid = (*it)->CalculateParameters() && paramsValid;
+ }
+
+ return paramsValid;
+}
+
+void cTemplatePixmapContainer::ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens) {
+ parameters->ClearDynamicParameters();
+ parameters->SetIntTokens(intTokens);
+ parameters->SetStringTokens(stringTokens);
+ parameters->ParseParameters();
+ parameters->UnsetIntTokens();
+ parameters->UnsetStringTokens();
+}
+
+void cTemplatePixmapContainer::InitIterator(void) {
+ pixmapIterator = pixmaps.begin();
+}
+
+cTemplatePixmap *cTemplatePixmapContainer::GetNextPixmap(void) {
+ if (pixmapIterator == pixmaps.end())
+ return NULL;
+ cTemplatePixmap *pix = *pixmapIterator;
+ pixmapIterator++;
+ return pix;
+}
+
+cTemplateFunction *cTemplatePixmapContainer::GetFunction(string name) {
+ cTemplateFunction *hit = NULL;
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ hit = (*it)->GetFunction(name);
+ if (hit)
+ return hit;
+ }
+ return NULL;
+}
+
+
+void cTemplatePixmapContainer::Debug(void) {
+ esyslog("skindesigner: pixmapcontainer");
+ parameters->Debug();
+ for (vector<cTemplatePixmap*>::iterator it = pixmaps.begin(); it != pixmaps.end(); it++) {
+ (*it)->Debug();
+ }
+}
+
diff --git a/libtemplate/templatepixmap.h b/libtemplate/templatepixmap.h index 5f16f21..f9c2f6f 100644 --- a/libtemplate/templatepixmap.h +++ b/libtemplate/templatepixmap.h @@ -13,23 +13,46 @@ #include "globals.h" #include "templateloopfunction.h" +#include "../views/viewhelpers.h" using namespace std; +// --- cTemplatePixmapNode ------------------------------------------------------------- +class cTemplatePixmapNode { +protected: + bool isContainer; + cGlobals *globals; + cTemplateFunction *parameters; + int containerX; + int containerY; + int containerWidth; + int containerHeight; +public: + cTemplatePixmapNode(void); + virtual ~cTemplatePixmapNode(void); + void SetParameters(vector<stringpair> ¶ms); + void SetContainer(int x, int y, int w, int h); + bool IsContainer(void) { return isContainer; }; + bool DoExecute(void) { return parameters->DoExecute(); }; + bool DoDebug(void) { return parameters->DoDebug(); }; + virtual void SetGlobals(cGlobals *globals) { this->globals = globals; }; + virtual bool CalculateParameters(void) { return false; }; + virtual void SetWidth(int width) {}; + virtual void SetHeight(int height) {}; + virtual int NumPixmaps(void) { return 0; }; + virtual void Debug(void) {}; +}; + // --- cTemplatePixmap ------------------------------------------------------------- +class cTemplatePixmapContainer; -class cTemplatePixmap { +class cTemplatePixmap : public cTemplatePixmapNode { protected: + cTemplatePixmapContainer *pixContainer; bool scrolling; bool background; - cTemplateFunction *parameters; vector<cTemplateFunction*> functions; vector<cTemplateFunction*>::iterator funcIt; - int containerX; - int containerY; - int containerWidth; - int containerHeight; - cGlobals *globals; //functions replacing {width(label)} and {height(label)} tokens bool ReplaceWidthFunctions(void); bool ReplaceHeightFunctions(map < string, vector< map< string, string > > > *loopTokens); @@ -42,8 +65,8 @@ public: cTemplatePixmap(void); virtual ~cTemplatePixmap(void); //Setter Functions + void SetPixmapContainer(cTemplatePixmapContainer *pixContainer) { this->pixContainer = pixContainer; }; void SetScrolling(void) { scrolling = true; }; - void SetParameters(vector<pair<string, string> > ¶ms); void SetWidth(int width); void SetHeight(int height); void SetX(int x); @@ -52,8 +75,7 @@ public: void SetHeightPercent(double height); void SetXPercent(double x); void SetYPercent(double y); - void SetContainer(int x, int y, int w, int h); - void SetGlobals(cGlobals *globals) { this->globals = globals; }; + void SetParameter(eParamType type, string value); void AddFunction(string name, vector<pair<string, string> > ¶ms); void AddLoopFunction(cTemplateLoopFunction *lf); //PreCache Parameters @@ -71,18 +93,40 @@ public: //Set max width for text in scrollarea void SetScrollingTextWidth(void); //Getter Functions + int NumPixmaps(void) { return 1; }; cRect GetPixmapSize(void); int GetNumericParameter(eParamType type); bool Scrolling(void) { return scrolling; }; - bool DoExecute(void) { return parameters->DoExecute(); }; - bool DoDebug(void) { return parameters->DoDebug(); }; bool Ready(void); bool BackgroundArea(void) { return background; }; + bool ParameterSet(eParamType type); + cTemplateFunction *GetFunction(string name); //Traverse Functions - void InitIterator(void); + void InitFunctionIterator(void); cTemplateFunction *GetNextFunction(void); //Debug void Debug(void); }; +class cTemplatePixmapContainer : public cTemplatePixmapNode { +private: + vector<cTemplatePixmap*> pixmaps; + vector<cTemplatePixmap*>::iterator pixmapIterator; +public: + cTemplatePixmapContainer(void); + virtual ~cTemplatePixmapContainer(void); + void SetGlobals(cGlobals *globals); + void SetWidth(int width); + void SetHeight(int height); + void AddPixmap(cTemplatePixmap *pix); + //PreCache Parameters + bool CalculateParameters(void); + void ParseDynamicParameters(map <string,string> *stringTokens, map <string,int> *intTokens); + int NumPixmaps(void) { return pixmaps.size(); }; + void InitIterator(void); + cTemplatePixmap *GetNextPixmap(void); + cTemplateFunction *GetFunction(string name); + void Debug(void); +}; + #endif //__TEMPLATEPIXMAP_H
\ No newline at end of file diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 91e28c4..363c37a 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -349,10 +349,10 @@ void cTemplateView::Translate(void) { InitViewElementIterator(); cTemplateViewElement *viewElement = NULL; while(viewElement = GetNextViewElement()) { - viewElement->InitIterator(); + viewElement->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewElement->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -385,10 +385,10 @@ void cTemplateView::Translate(void) { InitViewListIterator(); cTemplateViewList *viewList = NULL; while(viewList = GetNextViewList()) { - viewList->InitIterator(); + viewList->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewList->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -402,9 +402,9 @@ void cTemplateView::Translate(void) { } } cTemplateViewElement *listElement = viewList->GetListElement(); - listElement->InitIterator(); + listElement->InitPixmapIterator(); while(pix = listElement->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -420,9 +420,9 @@ void cTemplateView::Translate(void) { cTemplateViewElement *listElementCurrent = viewList->GetListElementCurrent(); if (listElementCurrent) { - listElementCurrent->InitIterator(); + listElementCurrent->InitPixmapIterator(); while(pix = listElementCurrent->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -463,7 +463,7 @@ void cTemplateView::Translate(void) { if (translated) { viewTab->SetName(tabTrans); } - viewTab->InitIterator(); + viewTab->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = viewTab->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -496,10 +496,10 @@ void cTemplateView::Translate(void) { InitViewGridIterator(); cTemplateViewGrid *viewGrid = NULL; while(viewGrid = GetNextViewGrid()) { - viewGrid->InitIterator(); + viewGrid->InitPixmapIterator(); cTemplatePixmap *pix = NULL; while(pix = viewGrid->GetNextPixmap()) { - pix->InitIterator(); + pix->InitFunctionIterator(); cTemplateFunction *func = NULL; while(func = pix->GetNextFunction()) { if (func->GetType() == ftDrawText || func->GetType() == ftDrawTextBox || func->GetType() == ftDrawTextVertical) { @@ -696,6 +696,16 @@ void cTemplateView::SetFunctionDefinitions(void) { attributes.insert("debug"); funcsAllowed.insert(pair< string, set<string> >(name, attributes)); + name = "areacontainer"; + attributes.clear(); + attributes.insert("x"); + attributes.insert("y"); + attributes.insert("width"); + attributes.insert("height"); + attributes.insert("debug"); + attributes.insert("condition"); + funcsAllowed.insert(pair< string, set<string> >(name, attributes)); + name = "area"; attributes.clear(); attributes.insert("debug"); @@ -998,9 +1008,9 @@ string cTemplateViewChannel::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes) { eViewElement ve = veUndefined; - + if (!sViewElement.compare("background")) { ve = veBackground; } else if (!sViewElement.compare("channelinfo")) { @@ -1040,7 +1050,6 @@ void cTemplateViewChannel::AddPixmap(string sViewElement, cTemplatePixmap *pix, } else if (!sViewElement.compare("customtokens")) { ve = veCustomTokens; } - if (ve == veUndefined) { esyslog("skindesigner: unknown ViewElement in displaychannel: %s", sViewElement.c_str()); return; @@ -1507,7 +1516,7 @@ void cTemplateViewMenu::AddPluginView(string plugName, int templNo, cTemplateVie } } -void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1648,7 +1657,7 @@ string cTemplateViewMessage::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewMessage::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1801,7 +1810,7 @@ string cTemplateViewReplay::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewReplay::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -1916,7 +1925,7 @@ string cTemplateViewVolume::GetViewElementName(eViewElement ve) { return name; } -void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewVolume::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -2026,7 +2035,7 @@ string cTemplateViewAudioTracks::GetViewListName(eViewList vl) { return name; } -void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewAudioTracks::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; if (!sViewElement.compare("background")) { @@ -2133,7 +2142,7 @@ void cTemplateViewPlugin::AddSubView(string sSubView, cTemplateView *subView) { subViews.insert(pair< eSubView, cTemplateView* >((eSubView)subViewId, subView)); } -void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) { +void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes) { eViewElement ve = veUndefined; string viewElementName = ""; int viewElementID = -1; @@ -2177,7 +2186,7 @@ void cTemplateViewPlugin::AddPixmap(string sViewElement, cTemplatePixmap *pix, v } } -void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) { +void cTemplateViewPlugin::AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes) { string gridName = ""; bool found = false; for (vector<pair<string, string> >::iterator it = gridAttributes.begin(); it != gridAttributes.end(); it++) { diff --git a/libtemplate/templateview.h b/libtemplate/templateview.h index d592b22..726ce68 100644 --- a/libtemplate/templateview.h +++ b/libtemplate/templateview.h @@ -76,8 +76,8 @@ public: virtual string GetViewListName(eViewList vl) { return ""; }; virtual void AddSubView(string sSubView, cTemplateView *subView) {}; virtual void AddPluginView(string plugName, int templNo, cTemplateView *plugView) {}; - virtual void AddPixmap(string sViewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes) {}; - virtual void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes) {}; + virtual void AddPixmap(string sViewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes) {}; + virtual void AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes) {}; virtual void AddViewList(string sViewList, cTemplateViewList *viewList) {}; virtual void AddViewTab(cTemplateViewTab *viewTab) {}; //Setter Functions @@ -146,11 +146,12 @@ class cTemplateViewChannel : public cTemplateView { private: void SetViewElements(void); void SetViewLists(void); + eViewElement GetViewElementID(string sViewElement); public: cTemplateViewChannel(void); virtual ~cTemplateViewChannel(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<stringpair> &viewElementattributes); }; // --- cTemplateViewMenu ------------------------------------------------------------- @@ -168,7 +169,7 @@ public: string GetViewListName(eViewList vl); void AddSubView(string sSubView, cTemplateView *subView); void AddPluginView(string plugName, int templNo, cTemplateView *plugView); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); void AddViewList(string sViewList, cTemplateViewList *viewList); void AddViewTab(cTemplateViewTab *viewTab); }; @@ -182,7 +183,7 @@ public: cTemplateViewMessage(void); virtual ~cTemplateViewMessage(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); }; // --- cTemplateViewReplay ------------------------------------------------------------- @@ -194,7 +195,7 @@ public: cTemplateViewReplay(void); virtual ~cTemplateViewReplay(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); }; // --- cTemplateViewVolume ------------------------------------------------------------- @@ -206,7 +207,7 @@ public: cTemplateViewVolume(void); virtual ~cTemplateViewVolume(void); string GetViewElementName(eViewElement ve); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); }; // --- cTemplateViewAudioTracks ------------------------------------------------------------- @@ -220,7 +221,7 @@ public: virtual ~cTemplateViewAudioTracks(void); string GetViewElementName(eViewElement ve); string GetViewListName(eViewList vl); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); void AddViewList(string sViewList, cTemplateViewList *viewList); }; @@ -234,8 +235,8 @@ public: cTemplateViewPlugin(string pluginName, int viewID); virtual ~cTemplateViewPlugin(void); void AddSubView(string sSubView, cTemplateView *subView); - void AddPixmap(string viewElement, cTemplatePixmap *pix, vector<pair<string, string> > &viewElementattributes); - void AddPixmapGrid(cTemplatePixmap *pix, vector<pair<string, string> > &gridAttributes); + void AddPixmap(string viewElement, cTemplatePixmapNode *pix, vector<pair<string, string> > &viewElementattributes); + void AddPixmapGrid(cTemplatePixmapNode *pix, vector<pair<string, string> > &gridAttributes); void AddViewTab(cTemplateViewTab *viewTab); }; diff --git a/libtemplate/templateviewelement.c b/libtemplate/templateviewelement.c index 5b18de2..0171bdb 100644 --- a/libtemplate/templateviewelement.c +++ b/libtemplate/templateviewelement.c @@ -9,12 +9,14 @@ cTemplateViewElement::cTemplateViewElement(void) { containerWidth = 0;
containerHeight = 0;
pixOffset = -1;
+ pixmapIterator = NULL;
+ currentNode = NULL;
}
cTemplateViewElement::~cTemplateViewElement(void) {
if (parameters)
delete parameters;
- for (vector<cTemplatePixmap*>::iterator it = viewPixmaps.begin(); it != viewPixmaps.end(); it++) {
+ for (vector<cTemplatePixmapNode*>::iterator it = viewPixmapNodes.begin(); it != viewPixmapNodes.end(); it++) {
delete (*it);
}
}
@@ -28,7 +30,7 @@ void cTemplateViewElement::SetContainer(int x, int y, int width, int height) { void cTemplateViewElement::SetGlobals(cGlobals *globals) {
this->globals = globals;
- for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
+ for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
(*pix)->SetGlobals(globals);
}
}
@@ -52,7 +54,7 @@ bool cTemplateViewElement::CalculateParameters(void) { bool cTemplateViewElement::CalculatePixmapParameters(void) {
bool paramsValid = true;
- for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
+ for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
(*pix)->SetContainer(containerX, containerY, containerWidth, containerHeight);
(*pix)->SetGlobals(globals);
paramsValid = paramsValid && (*pix)->CalculateParameters();
@@ -62,7 +64,7 @@ bool cTemplateViewElement::CalculatePixmapParameters(void) { bool cTemplateViewElement::CalculatePixmapParametersList(int orientation, int numElements) {
bool paramsValid = true;
- for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
+ for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
(*pix)->SetContainer(containerX, containerY, containerWidth, containerHeight);
(*pix)->SetGlobals(globals);
if (orientation == orHorizontal) {
@@ -87,23 +89,91 @@ int cTemplateViewElement::GetNumericParameter(eParamType type) { return parameters->GetNumericParameter(type);
}
-void cTemplateViewElement::InitIterator(void) {
- pixIterator = viewPixmaps.begin();
+int cTemplateViewElement::GetNumPixmaps(void) {
+ int numPixmaps = 0;
+ for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
+ numPixmaps += (*pix)->NumPixmaps();
+ }
+ return numPixmaps;
+};
+
+void cTemplateViewElement::InitPixmapNodeIterator(void) {
+ pixmapNodeIterator = viewPixmapNodes.begin();
+}
+
+cTemplatePixmapNode *cTemplateViewElement::GetNextPixmapNode(void) {
+ if (pixmapNodeIterator == viewPixmapNodes.end())
+ return NULL;
+ cTemplatePixmapNode *pix = *pixmapNodeIterator;
+ pixmapNodeIterator++;
+ return pix;
+}
+
+void cTemplateViewElement::InitPixmapIterator(void) {
+ pixmapNodeIterator = viewPixmapNodes.begin();
+ if (pixmapNodeIterator == viewPixmapNodes.end())
+ return;
+ if (!(*pixmapNodeIterator)->IsContainer()) {
+ //first node is a pixmap, use this
+ pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
+ return;
+ }
+ //first node is a container, so fetch first pixmap of this container
+ currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
+ currentNode->InitIterator();
+ pixmapIterator = currentNode->GetNextPixmap();
}
cTemplatePixmap *cTemplateViewElement::GetNextPixmap(void) {
- if (pixIterator == viewPixmaps.end())
+ if (!pixmapIterator)
return NULL;
- cTemplatePixmap *pix = *pixIterator;
- pixIterator++;
- return pix;
+ cTemplatePixmap *current = pixmapIterator;
+ //set next pixmap
+ if (!currentNode) {
+ //last node was a pixmap
+ pixmapNodeIterator++;
+ if (pixmapNodeIterator == viewPixmapNodes.end()) {
+ pixmapIterator = NULL;
+ return current;
+ }
+ if (!(*pixmapNodeIterator)->IsContainer()) {
+ //node is a pixmap, use this
+ pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
+ return current;
+ }
+ //node is a container, so fetch first pixmap of this container
+ currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
+ currentNode->InitIterator();
+ pixmapIterator = currentNode->GetNextPixmap();
+ } else {
+ pixmapIterator = currentNode->GetNextPixmap();
+ if (pixmapIterator) {
+ return current;
+ }
+ currentNode = NULL;
+ pixmapNodeIterator++;
+ if (pixmapNodeIterator == viewPixmapNodes.end()) {
+ pixmapIterator = NULL;
+ return current;
+ }
+ if (!(*pixmapNodeIterator)->IsContainer()) {
+ //node is a pixmap, use this
+ pixmapIterator = dynamic_cast<cTemplatePixmap*>(*pixmapNodeIterator);
+ return current;
+ }
+ //node is a container, so fetch first pixmap of this container
+ currentNode = dynamic_cast<cTemplatePixmapContainer*>(*pixmapNodeIterator);
+ currentNode->InitIterator();
+ pixmapIterator = currentNode->GetNextPixmap();
+ }
+ return current;
}
cTemplateFunction *cTemplateViewElement::GetFunction(string name) {
- InitIterator();
+ InitPixmapIterator();
cTemplatePixmap *pix = NULL;
while (pix = GetNextPixmap()) {
- pix->InitIterator();
+ pix->InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = pix->GetNextFunction()) {
if (func->GetType() == ftDrawText) {
@@ -151,7 +221,7 @@ void cTemplateViewElement::Debug(void) { if (parameters)
parameters->Debug();
return;
- for (vector<cTemplatePixmap*>::iterator it = viewPixmaps.begin(); it != viewPixmaps.end(); it++) {
+ for (vector<cTemplatePixmapNode*>::iterator it = viewPixmapNodes.begin(); it != viewPixmapNodes.end(); it++) {
(*it)->Debug();
}
}
\ No newline at end of file diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index 20c0906..cbc2911 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -91,24 +91,28 @@ protected: int containerY;
int containerWidth;
int containerHeight;
- vector<cTemplatePixmap*> viewPixmaps;
- vector<cTemplatePixmap*>::iterator pixIterator;
+ vector<cTemplatePixmapNode*> viewPixmapNodes;
+ vector<cTemplatePixmapNode*>::iterator pixmapNodeIterator;
+ cTemplatePixmap *pixmapIterator;
+ cTemplatePixmapContainer *currentNode;
int pixOffset;
public:
cTemplateViewElement(void);
virtual ~cTemplateViewElement(void);
+ void SetContainer(int x, int y, int width, int height);
+ virtual void SetGlobals(cGlobals *globals);
void SetParameters(vector<pair<string, string> > ¶ms);
bool CalculateParameters(void);
virtual bool CalculatePixmapParameters(void);
bool CalculatePixmapParametersList(int orientation, int numElements);
+ void AddPixmap(cTemplatePixmapNode *pix) { viewPixmapNodes.push_back(pix); };
int GetNumericParameter(eParamType type);
- void AddPixmap(cTemplatePixmap *pix) { viewPixmaps.push_back(pix); };
- virtual void SetGlobals(cGlobals *globals);
- void SetContainer(int x, int y, int width, int height);
void SetPixOffset(int offset) { pixOffset = offset; };
int GetPixOffset(void) { return pixOffset; };
- virtual int GetNumPixmaps(void) { return viewPixmaps.size(); };
- void InitIterator(void);
+ virtual int GetNumPixmaps(void);
+ void InitPixmapNodeIterator(void);
+ cTemplatePixmapNode *GetNextPixmapNode(void);
+ void InitPixmapIterator(void);
cTemplatePixmap *GetNextPixmap(void);
cTemplateFunction *GetFunction(string name);
bool Execute(void);
diff --git a/libtemplate/templateviewgrid.c b/libtemplate/templateviewgrid.c index dc4af63..bd73d84 100644 --- a/libtemplate/templateviewgrid.c +++ b/libtemplate/templateviewgrid.c @@ -15,7 +15,7 @@ bool cTemplateViewGrid::CalculatePixmapParameters(void) { int gridWidth = parameters->GetNumericParameter(ptWidth);
int gridHeight = parameters->GetNumericParameter(ptHeight);
- for (vector<cTemplatePixmap*>::iterator pix = viewPixmaps.begin(); pix != viewPixmaps.end(); pix++) {
+ for (vector<cTemplatePixmapNode*>::iterator pix = viewPixmapNodes.begin(); pix != viewPixmapNodes.end(); pix++) {
(*pix)->SetContainer(gridX, gridY, gridWidth, gridHeight);
(*pix)->SetGlobals(globals);
paramsValid = paramsValid && (*pix)->CalculateParameters();
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c index 4db7ce5..3df65f3 100644 --- a/libtemplate/xmlparser.c +++ b/libtemplate/xmlparser.c @@ -4,459 +4,432 @@ using namespace std; -void SkinDesignerXMLErrorHandler (void * userData, xmlErrorPtr error) { - esyslog("skindesigner: Error in XML: %s", error->message); -} - cXmlParser::cXmlParser(void) { view = NULL; - doc = NULL; - root = NULL; - ctxt = NULL; globals = NULL; skinSetup = NULL; - - initGenericErrorDefaultFunc(NULL); - xmlSetStructuredErrorFunc(NULL, SkinDesignerXMLErrorHandler); - ctxt = xmlNewParserCtxt(); } cXmlParser::~cXmlParser() { - DeleteDocument(); - xmlFreeParserCtxt(ctxt); } /********************************************************************* * PUBLIC Functions *********************************************************************/ bool cXmlParser::ReadView(cTemplateView *view, string xmlFile) { + if (!view) + return false; this->view = view; - string xmlPath = GetPath(xmlFile); - - if (ctxt == NULL) { - esyslog("skindesigner: Failed to allocate parser context"); + if (! ReadXMLFile(xmlPath.c_str()) ) return false; - } - - doc = xmlCtxtReadFile(ctxt, xmlPath.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); - - if (doc == NULL) { - esyslog("skindesigner: ERROR: TemplateView %s not parsed successfully.", xmlPath.c_str()); + if (! Validate() ) return false; - } - if (ctxt->valid == 0) { - esyslog("skindesigner: Failed to validate %s", xmlPath.c_str()); + if (! SetDocument() ) return false; - } - - root = xmlDocGetRootElement(doc); + if (! CheckNodeName(view->GetViewName()) ) + return false; + return true; +} - if (root == NULL) { - esyslog("skindesigner: ERROR: TemplateView %s is empty", xmlPath.c_str()); +bool cXmlParser::ParseView(void) { + if (!view) return false; - } - if (xmlStrcmp(root->name, (const xmlChar *) view->GetViewName())) { + vector<stringpair> rootAttribs = ParseAttributes(); + ValidateAttributes(NodeName(), rootAttribs); + view->SetParameters(rootAttribs); + + if (!LevelDown()) return false; - } + + do { + + if (view->ValidSubView(NodeName())) { + ParseSubView(); + } else if (view->ValidViewElement(NodeName())) { + ParseViewElement(); + } else if (view->ValidViewList(NodeName())) { + ParseViewList(); + } else if (view->ValidViewGrid(NodeName())) { + ParseGrid(); + } else if (CheckNodeName("tab")) { + ParseViewTab(view); + } else { + return false; + } + + } while (NextNode()); + return true; + } bool cXmlParser::ReadPluginView(string plugName, int templateNumber, string templateName) { - string xmlPath = GetPath(templateName); - - if (!FileExists(xmlPath) || ctxt == NULL) { - return false; - } DeleteDocument(); - doc = xmlCtxtReadFile(ctxt, xmlPath.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); - - if (doc == NULL) { + if (! ReadXMLFile(xmlPath.c_str()) ) return false; - } - if (ctxt->valid == 0) { - esyslog("skindesigner: Failed to validate %s", xmlPath.c_str()); + if (! Validate() ) return false; - } + if (! SetDocument() ) + return false; + return true; +} - root = xmlDocGetRootElement(doc); +bool cXmlParser::ParsePluginView(string plugName, int templateNumber) { + cTemplateView *plugView = new cTemplateViewMenu(); + view->AddPluginView(plugName, templateNumber, plugView); + + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + plugView->SetParameters(attribs); - if (root == NULL) { + if (!LevelDown()) return false; - } + do { + + if (plugView->ValidViewElement(NodeName())) { + ParseViewElement(plugView); + } else if (plugView->ValidViewList(NodeName())) { + ParseViewList(plugView); + } else if (CheckNodeName("tab")) { + ParseViewTab(plugView); + } else { + return false; + } + + } while (NextNode()); return true; } -bool cXmlParser::ReadGlobals(cGlobals *globals, string xmlFile, bool mandatory) { +bool cXmlParser::ReadGlobals(cGlobals *globals, string xmlFile) { this->globals = globals; - string xmlPath = GetPath(xmlFile); - - if (ctxt == NULL) { - esyslog("skindesigner: Failed to allocate parser context"); + DeleteDocument(); + if (! ReadXMLFile(xmlPath.c_str()) ) return false; - } - - doc = xmlCtxtReadFile(ctxt, xmlPath.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); - - if (doc == NULL) { - if (mandatory) { - esyslog("skindesigner: ERROR: Globals %s not parsed successfully.", xmlPath.c_str()); - } else { - dsyslog("skindesigner: Globals %s not parsed successfully.", xmlPath.c_str()); - } + if (! Validate() ) return false; - } - - root = xmlDocGetRootElement(doc); - - if (ctxt->valid == 0) { - if (mandatory) { - esyslog("skindesigner: ERROR: Failed to validate %s", xmlPath.c_str()); - } else { - dsyslog("skindesigner: Failed to validate %s", xmlPath.c_str()); - } + if (! SetDocument() ) return false; - } - - if (root == NULL) { - if (mandatory) { - esyslog("skindesigner: ERROR: Globals %s is empty", xmlPath.c_str()); - } + if (! CheckNodeName("globals") ) return false; - } + return true; +} - if (xmlStrcmp(root->name, (const xmlChar *) "globals")) { +bool cXmlParser::ParseGlobals(void) { + if (!LevelDown()) return false; - } + do { + if (CheckNodeName("colors")) { + ParseGlobalColors(); + } else if (CheckNodeName("variables")) { + ParseGlobalVariables(); + } else if (CheckNodeName("fonts")) { + ParseGlobalFonts(); + } else if (CheckNodeName("translations")) { + ParseTranslations(); + } + } while (NextNode()); return true; } bool cXmlParser::ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile) { this->skinSetup = skinSetup; - - if (!FileExists(xmlFile)) - return false; - if (ctxt == NULL) { - esyslog("skindesigner: Failed to allocate parser context"); - return false; - } - - doc = xmlCtxtReadFile(ctxt, xmlFile.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_DTDVALID); - - if (doc == NULL ) { - esyslog("skindesigner: ERROR: skin setup %s not parsed successfully.", xmlFile.c_str()); + if (! ReadXMLFile(xmlFile.c_str()) ) return false; - } - - root = xmlDocGetRootElement(doc); - - if (ctxt->valid == 0) { - esyslog("skindesigner: Failed to validate %s", xmlFile.c_str()); + if (! Validate() ) return false; - } - if (root == NULL) { + if (! SetDocument() ) return false; - } - if (xmlStrcmp(root->name, (const xmlChar *) "setup")) { + if (! CheckNodeName("setup") ) return false; - } - return true; } +bool cXmlParser::ParseSkinSetup(string skin) { + if (!LevelDown()) + return false; + do { + if (CheckNodeName("menu")) { + ParseSetupMenu(); + } else if (CheckNodeName("translations")) { + ParseTranslations(); + } + } while (NextNode()); + return true; +} +/********************************************************************* +* PRIVATE Functions +*********************************************************************/ -bool cXmlParser::ParseView(void) { - vector<pair<string, string> > rootAttribs; - ParseAttributes(root->properties, root, rootAttribs); - +bool cXmlParser::ParseSubView(void) { if (!view) return false; - view->SetParameters(rootAttribs); - - xmlNodePtr node = root->xmlChildrenNode; + cTemplateView *subView = new cTemplateViewMenu(); + view->AddSubView(NodeName(), subView); - while (node != NULL) { + vector<pair<string, string> > subViewAttribs = ParseAttributes(); + ValidateAttributes(NodeName(), subViewAttribs); + subView->SetParameters(subViewAttribs); - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (view->ValidSubView((const char*)node->name)) { - ParseSubView(node); - } else if (view->ValidViewElement((const char*)node->name)) { - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs, true); - ParseViewElement(node->name, node->xmlChildrenNode, attribs); - } else if (view->ValidViewList((const char*)node->name)) { - ParseViewList(node); - } else if (view->ValidViewGrid((const char*)node->name)) { - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - ParseGrid(node->xmlChildrenNode, attribs); - } else if (!xmlStrcmp(node->name, (const xmlChar *) "tab")) { - ParseViewTab(node, view); + if (!LevelDown()) + return false; + do { + + if (subView->ValidViewElement(NodeName())) { + ParseViewElement(subView); + } else if (subView->ValidViewList(NodeName())) { + ParseViewList(subView); + } else if (CheckNodeName("tab")) { + ParseViewTab(subView); } else { return false; } - node = node->next; - } - + } while (NextNode()); + LevelUp(); return true; - -} -bool cXmlParser::ParsePluginView(string plugName, int templateNumber) { +} +void cXmlParser::ParseViewElement(cTemplateView *subView) { + if (!view) + return; + + const char *viewElement = NodeName(); + vector<stringpair> attributes = ParseAttributes(); + ValidateAttributes("viewelement", attributes); - cTemplateView *plugView = new cTemplateViewMenu(); - view->AddPluginView(plugName, templateNumber, plugView); + if (!LevelDown()) + return; + do { + if (!CheckNodeName("areacontainer") && !CheckNodeName("area") && !CheckNodeName("areascroll")) { + esyslog("skindesigner: invalid tag \"%s\" in viewelement", NodeName()); + continue; + } + cTemplatePixmapNode *pix = NULL; + if (CheckNodeName("area") || CheckNodeName("areascroll")) { + pix = ParseArea(); + } else { + pix = ParseAreaContainer(); + } + if (subView) + subView->AddPixmap(viewElement, pix, attributes); + else + view->AddPixmap(viewElement, pix, attributes); + } while (NextNode()); + LevelUp(); +} - vector<pair<string, string> > attribs; - ParseAttributes(root->properties, root, attribs); +void cXmlParser::ParseViewList(cTemplateView *subView) { + if (!view) + return; + + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); - plugView->SetParameters(attribs); + cTemplateViewList *viewList = new cTemplateViewList(); + viewList->SetGlobals(globals); + viewList->SetParameters(attribs); - xmlNodePtr childNode = root->xmlChildrenNode; + if (!LevelDown()) + return; - while (childNode != NULL) { + do { + if (CheckNodeName("currentelement")) { - if (childNode->type != XML_ELEMENT_NODE) { - childNode = childNode->next; - continue; - } + cTemplateViewElement *currentElement = new cTemplateViewElement(); + vector<stringpair> attribsCur = ParseAttributes(); + ValidateAttributes(NodeName(), attribsCur); + currentElement->SetGlobals(globals); + currentElement->SetParameters(attribsCur); + if (!LevelDown()) + return; + do { + if (!CheckNodeName("areacontainer") && !CheckNodeName("area") && !CheckNodeName("areascroll")) { + esyslog("skindesigner: invalid tag \"%s\" in viewelement", NodeName()); + continue; + } + cTemplatePixmapNode *pix = NULL; + if (CheckNodeName("area") || CheckNodeName("areascroll")) { + pix = ParseArea(); + } else { + pix = ParseAreaContainer(); + } + currentElement->AddPixmap(pix); + } while (NextNode()); + LevelUp(); + viewList->AddCurrentElement(currentElement); - if (plugView->ValidViewElement((const char*)childNode->name)) { - vector<pair<string, string> > attribs; - ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, plugView); - } else if (plugView->ValidViewList((const char*)childNode->name)) { - ParseViewList(childNode, plugView); - } else if (!xmlStrcmp(childNode->name, (const xmlChar *) "tab")) { - ParseViewTab(childNode, plugView); - } else { - return false; + } else if (CheckNodeName("listelement")) { + + cTemplateViewElement *listElement = new cTemplateViewElement(); + vector<stringpair> attribsList = ParseAttributes(); + ValidateAttributes(NodeName(), attribsList); + listElement->SetGlobals(globals); + listElement->SetParameters(attribsList); + if (!LevelDown()) + return; + do { + if (!CheckNodeName("areacontainer") && !CheckNodeName("area") && !CheckNodeName("areascroll")) { + esyslog("skindesigner: invalid tag \"%s\" in viewelement", NodeName()); + continue; + } + cTemplatePixmapNode *pix = NULL; + if (CheckNodeName("area") || CheckNodeName("areascroll")) { + pix = ParseArea(); + } else { + pix = ParseAreaContainer(); + } + listElement->AddPixmap(pix); + } while (NextNode()); + LevelUp(); + viewList->AddListElement(listElement); } - childNode = childNode->next; - } + } while (NextNode()); + LevelUp(); - return true; + if (subView) + subView->AddViewList(NodeName(), viewList); + else + view->AddViewList(NodeName(), viewList); } -bool cXmlParser::ParseGlobals(void) { - xmlNodePtr node = root->xmlChildrenNode; - while (node != NULL) { - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (!xmlStrcmp(node->name, (const xmlChar *) "colors")) { - ParseGlobalColors(node->xmlChildrenNode); - node = node->next; - continue; - } else if (!xmlStrcmp(node->name, (const xmlChar *) "variables")) { - ParseGlobalVariables(node->xmlChildrenNode); - node = node->next; - continue; - } else if (!xmlStrcmp(node->name, (const xmlChar *) "fonts")) { - ParseGlobalFonts(node->xmlChildrenNode); - node = node->next; - continue; - } else if (!xmlStrcmp(node->name, (const xmlChar *) "translations")) { - ParseTranslations(node->xmlChildrenNode); - node = node->next; - continue; - } - node = node->next; - } +void cXmlParser::ParseViewTab(cTemplateView *subView) { + if (!view || !subView) + return; - return true; + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + cTemplateViewTab *viewTab = new cTemplateViewTab(); + viewTab->SetGlobals(globals); + viewTab->SetParameters(attribs); + viewTab->SetScrolling(); + ParseFunctionCalls(viewTab); + subView->AddViewTab(viewTab); } -bool cXmlParser::ParseSkinSetup(string skin) { - xmlNodePtr node = root->xmlChildrenNode; +void cXmlParser::ParseGrid(void) { + if (!view) + return; + + vector<stringpair> attributes = ParseAttributes(); + ValidateAttributes(NodeName(), attributes); + + if (!LevelDown()) + return; + do { - while (node != NULL) { - if (node->type != XML_ELEMENT_NODE) { - node = node->next; + if (!CheckNodeName("areacontainer") && !CheckNodeName("area") && !CheckNodeName("areascroll")) { + esyslog("skindesigner: invalid tag \"%s\" in grid", NodeName()); continue; } - if (!xmlStrcmp(node->name, (const xmlChar *) "menu")) { - ParseSetupMenu(node->xmlChildrenNode); - node = node->next; - continue; - } else if (!xmlStrcmp(node->name, (const xmlChar *) "translations")) { - ParseTranslations(node->xmlChildrenNode); - node = node->next; - continue; + cTemplatePixmapNode *pix = NULL; + if (CheckNodeName("area") || CheckNodeName("areascroll")) { + pix = ParseArea(); + } else { + pix = ParseAreaContainer(); } - node = node->next; - } - - return true; - + view->AddPixmapGrid(pix, attributes); + } while (NextNode()); + LevelUp(); } -void cXmlParser::DeleteDocument(void) { - if (doc) { - xmlFreeDoc(doc); - doc = NULL; +cTemplatePixmap *cXmlParser::ParseArea(void) { + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + + cTemplatePixmap *pix = new cTemplatePixmap(); + if (CheckNodeName("areascroll")) { + pix->SetScrolling(); } + pix->SetParameters(attribs); + ParseFunctionCalls(pix); + return pix; } -/********************************************************************* -* PRIVATE Functions -*********************************************************************/ +cTemplatePixmapContainer *cXmlParser::ParseAreaContainer(void) { + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); -string cXmlParser::GetPath(string xmlFile) { - string activeSkin = Setup.OSDSkin; - string activeTheme = Setup.OSDTheme; - string path = ""; - if (!xmlFile.compare("globals.xml")) { - path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); - } else if (!xmlFile.compare("theme.xml")) { - path = *cString::sprintf("%s%s/themes/%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), activeTheme.c_str(), xmlFile.c_str()); - } else if (!xmlFile.compare("setup.xml")) { - path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); - } else { - path = *cString::sprintf("%s%s/xmlfiles/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); - } - return path; + cTemplatePixmapContainer *pixContainer = new cTemplatePixmapContainer(); + pixContainer->SetParameters(attribs); + + if (!LevelDown()) + return pixContainer; + do { + if (!CheckNodeName("area") && !CheckNodeName("areascroll")) { + esyslog("skindesigner: invalid tag \"%s\" in areacontainer", NodeName()); + continue; + } + cTemplatePixmap *pix = ParseArea(); + pixContainer->AddPixmap(pix); + } while (NextNode()); + LevelUp(); + return pixContainer; } -void cXmlParser::ParseSetupMenu(xmlNodePtr node) { - if (!node) +void cXmlParser::ParseFunctionCalls(cTemplatePixmap *pix) { + if (!view) return; - if (!skinSetup) + if (!LevelDown()) return; - - while (node != NULL) { - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; + do { + if (CheckNodeName("loop")) { + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + cTemplateLoopFunction *loopFunc = new cTemplateLoopFunction(); + loopFunc->SetParameters(attribs); + ParseLoopFunctionCalls(loopFunc); + pix->AddLoopFunction(loopFunc); + } else if (view->ValidFunction(NodeName())) { + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + pix->AddFunction(NodeName(), attribs); } - if (!xmlStrcmp(node->name, (const xmlChar *) "parameter")) { - ParseSetupParameter(node); - } else if (!xmlStrcmp(node->name, (const xmlChar *) "submenu")) { - xmlAttrPtr attr = node->properties; - xmlChar *subMenuName = NULL; - xmlChar *subDisplayText = NULL; - while (NULL != attr) { - if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { - subMenuName = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "displaytext")) { - subDisplayText = xmlGetProp(node, attr->name); - } - attr = attr->next; - } - skinSetup->SetSubMenu(subMenuName, subDisplayText); - ParseSetupMenu(node->xmlChildrenNode); - if (subMenuName) - xmlFree(subMenuName); - if (subDisplayText) - xmlFree(subDisplayText); - } - node = node->next; - } - skinSetup->SubMenuDone(); + } while (NextNode()); + LevelUp(); } -void cXmlParser::ParseSetupParameter(xmlNodePtr node) { - if (!node) - return; - if (!skinSetup) +void cXmlParser::ParseLoopFunctionCalls(cTemplateLoopFunction *loopFunc) { + if (!view) return; - - xmlAttrPtr attr = node->properties; - if (attr == NULL) { + if (!LevelDown()) return; - } - xmlChar *paramType = NULL; - xmlChar *paramName = NULL; - xmlChar *paramDisplayText = NULL; - xmlChar *paramMin = NULL; - xmlChar *paramMax = NULL; - xmlChar *paramValue = NULL; - while (NULL != attr) { - if (!xmlStrcmp(attr->name, (const xmlChar *) "type")) { - paramType = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { - paramName = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "displaytext")) { - paramDisplayText = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "min")) { - paramMin = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "max")) { - paramMax = xmlGetProp(node, attr->name); - } - attr = attr->next; - } - paramValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); - skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramMin, paramMax, paramValue); - if (paramType) - xmlFree(paramType); - if (paramName) - xmlFree(paramName); - if (paramDisplayText) - xmlFree(paramDisplayText); - if (paramMin) - xmlFree(paramMin); - if (paramMax) - xmlFree(paramMax); - if (paramValue) - xmlFree(paramValue); + do { + if (view->ValidFunction(NodeName())) { + vector<stringpair> attribs = ParseAttributes(); + ValidateAttributes(NodeName(), attribs); + loopFunc->AddFunction(NodeName(), attribs); + } + } while (NextNode()); + LevelUp(); } -void cXmlParser::ParseGlobalColors(xmlNodePtr node) { - if (!node) +void cXmlParser::ParseGlobalColors(void) { + if (!LevelDown()) return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (xmlStrcmp(node->name, (const xmlChar *) "color")) { - node = node->next; - continue; - } - xmlAttrPtr attr = node->properties; - if (attr == NULL) { - node = node->next; + do { + if (!CheckNodeName("color")) { continue; } - xmlChar *colName = NULL; - xmlChar *colValue = NULL; - bool ok = false; - while (NULL != attr) { - if (xmlStrcmp(attr->name, (const xmlChar *) "name")) { - attr = attr->next; - continue; - } - ok = true; - colName = xmlGetProp(node, attr->name); - attr = attr->next; - } + string attributeName = "name"; + string colorName = ""; + string colorValue = ""; + bool ok = GetAttribute(attributeName, colorName); if (ok) { - colValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); - if (colName && colValue) - InsertColor((const char*)colName, (const char*)colValue); + ok = GetNodeValue(colorValue); + if (ok) + InsertColor(colorName, colorValue); } - if (colName) - xmlFree(colName); - if (colValue) - xmlFree(colValue); - node = node->next; - } + } while (NextNode()); + LevelUp(); } void cXmlParser::InsertColor(string name, string value) { @@ -469,50 +442,29 @@ void cXmlParser::InsertColor(string name, string value) { globals->AddColor(name, colVal); } -void cXmlParser::ParseGlobalVariables(xmlNodePtr node) { - if (!node) +void cXmlParser::ParseGlobalVariables(void) { + if (!LevelDown()) return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; + do { + if (!CheckNodeName("var")) { continue; } - if (xmlStrcmp(node->name, (const xmlChar *) "var")) { - node = node->next; - continue; - } - xmlAttrPtr attr = node->properties; - if (attr == NULL) { - node = node->next; - continue; - } - xmlChar *varName = NULL; - xmlChar *varType = NULL; - xmlChar *varValue = NULL; - while (NULL != attr) { - if (!xmlStrcmp(attr->name, (const xmlChar *) "name")) { - varName = xmlGetProp(node, attr->name); - } else if (!xmlStrcmp(attr->name, (const xmlChar *) "type")) { - varType = xmlGetProp(node, attr->name); - } else { - attr = attr->next; - continue; - } - attr = attr->next; + string attributeName = "name"; + string attributeType = "type"; + string varName = ""; + string varType = ""; + string varValue = ""; + + bool ok1 = GetAttribute(attributeName, varName); + bool ok2 = GetAttribute(attributeType, varType); + + if (ok1 && ok2) { + bool ok = GetNodeValue(varValue); + if (ok) + InsertVariable(varName, varType, varValue); } - varValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); - if (varName && varType && varValue) - InsertVariable((const char*)varName, (const char*)varType, (const char*)varValue); - if (varName) - xmlFree(varName); - if (varType) - xmlFree(varType); - if (varValue) - xmlFree(varValue); - node = node->next; - } + } while (NextNode()); + LevelUp(); } void cXmlParser::InsertVariable(string name, string type, string value) { @@ -526,467 +478,146 @@ void cXmlParser::InsertVariable(string name, string type, string value) { } } -void cXmlParser::ParseGlobalFonts(xmlNodePtr node) { - if (!node) +void cXmlParser::ParseGlobalFonts(void) { + if (!LevelDown()) return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (xmlStrcmp(node->name, (const xmlChar *) "font")) { - node = node->next; - continue; - } - xmlAttrPtr attr = node->properties; - if (attr == NULL) { - node = node->next; + do { + if (!CheckNodeName("font")) { continue; } - xmlChar *fontName = NULL; - xmlChar *fontValue = NULL; - bool ok = false; - while (NULL != attr) { - if (xmlStrcmp(attr->name, (const xmlChar *) "name")) { - attr = attr->next; - continue; - } - ok = true; - fontName = xmlGetProp(node, attr->name); - attr = attr->next; - } + string attributeName = "name"; + string fontName = ""; + string fontValue = ""; + + bool ok = GetAttribute(attributeName, fontName); if (ok) { - fontValue = xmlNodeListGetString(doc, node->xmlChildrenNode, 1); - if (fontName && fontValue) { - string fN = (const char*)fontName; - string fV = (const char*)fontValue; - globals->AddFont(fN, fV); + ok = GetNodeValue(fontValue); + if (ok) { + globals->AddFont(fontName, fontValue); } } - if (fontName) - xmlFree(fontName); - if (fontValue) - xmlFree(fontValue); - node = node->next; - } + } while (NextNode()); + LevelUp(); } -void cXmlParser::ParseTranslations(xmlNodePtr node) { - if (!node) +void cXmlParser::ParseTranslations(void) { + if (!LevelDown()) return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (xmlStrcmp(node->name, (const xmlChar *) "token")) { - node = node->next; - continue; - } - xmlAttrPtr attr = node->properties; - if (attr == NULL) { - node = node->next; - continue; - } - xmlChar *tokenName; - bool ok = false; - while (NULL != attr) { - if (xmlStrcmp(attr->name, (const xmlChar *) "name")) { - attr = attr->next; - continue; - } - ok = true; - tokenName = xmlGetProp(node, attr->name); - attr = attr->next; - } - if (!ok) - continue; - map < string, string > tokenTranslations; - xmlNodePtr nodeTrans = node->xmlChildrenNode; - while (nodeTrans != NULL) { - if (nodeTrans->type != XML_ELEMENT_NODE) { - nodeTrans = nodeTrans->next; - continue; - } - xmlChar *language = NULL; - if (xmlStrcmp(nodeTrans->name, (const xmlChar *) "trans")) { - nodeTrans = nodeTrans->next; - continue; - } - xmlAttrPtr attrTrans = nodeTrans->properties; - if (attrTrans == NULL) { - nodeTrans = nodeTrans->next; - continue; - } - ok = false; - - while (NULL != attrTrans) { - if (!ok && xmlStrcmp(attrTrans->name, (const xmlChar *) "lang")) { - attrTrans = attrTrans->next; - continue; - } - ok = true; - language = xmlGetProp(nodeTrans, attrTrans->name); - attrTrans = attrTrans->next; - } - if (!ok) - continue; - xmlChar *value = NULL; - value = xmlNodeListGetString(doc, nodeTrans->xmlChildrenNode, 1); - if (language && value) - tokenTranslations.insert(pair<string, string>((const char*)language, (const char*)value)); - if (language) - xmlFree(language); - if (value) - xmlFree(value); - nodeTrans = nodeTrans->next; - } - if (globals) { - globals->AddTranslation((const char*)tokenName, tokenTranslations); - } else if (skinSetup) { - skinSetup->SetTranslation((const char*)tokenName, tokenTranslations); - } - xmlFree(tokenName); - node = node->next; - } -} - -bool cXmlParser::ParseSubView(xmlNodePtr node) { - if (!node) - return false; - - if (!view) - return false; - - cTemplateView *subView = new cTemplateViewMenu(); - view->AddSubView((const char*)node->name, subView); - - vector<pair<string, string> > subViewAttribs; - ParseAttributes(node->properties, node, subViewAttribs); - - subView->SetParameters(subViewAttribs); - - xmlNodePtr childNode = node->xmlChildrenNode; - - while (childNode != NULL) { - - if (childNode->type != XML_ELEMENT_NODE) { - childNode = childNode->next; + do { + if (!CheckNodeName("token")) { continue; } + string attributeName = "name"; + string tokenName = ""; - if (subView->ValidViewElement((const char*)childNode->name)) { - xmlAttrPtr attr = childNode->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, childNode, attribs, true); - ParseViewElement(childNode->name, childNode->xmlChildrenNode, attribs, subView); - } else if (subView->ValidViewList((const char*)childNode->name)) { - ParseViewList(childNode, subView); - } else if (!xmlStrcmp(childNode->name, (const xmlChar *) "tab")) { - ParseViewTab(childNode, subView); - } else { - return false; - } - - childNode = childNode->next; - } - - - - return true; - -} - -void cXmlParser::ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector<pair<string, string> > &attributes, cTemplateView *subView) { - if (!node) - return; - - if (!view) - return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; + if (!GetAttribute(attributeName, tokenName)) continue; - } - if (xmlStrcmp(node->name, (const xmlChar *) "area") && xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { - esyslog("skindesigner: invalid tag \"%s\"", node->name); - node = node->next; + if (!LevelDown()) continue; - } - - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - - cTemplatePixmap *pix = new cTemplatePixmap(); - if (!xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { - pix->SetScrolling(); - } - pix->SetParameters(attribs); - ParseFunctionCalls(node->xmlChildrenNode, pix); - if (subView) - subView->AddPixmap((const char*)viewElement, pix, attributes); - else - view->AddPixmap((const char*)viewElement, pix, attributes); - - node = node->next; - } -} - -void cXmlParser::ParseViewList(xmlNodePtr parentNode, cTemplateView *subView) { - if (!parentNode || !view) - return; - - xmlAttrPtr attr = parentNode->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, parentNode, attribs); - - cTemplateViewList *viewList = new cTemplateViewList(); - viewList->SetGlobals(globals); - viewList->SetParameters(attribs); - xmlNodePtr node = parentNode->xmlChildrenNode; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - - if (!xmlStrcmp(node->name, (const xmlChar *) "currentelement")) { - xmlNodePtr childNode = node->xmlChildrenNode; - if (!childNode) + stringmap tokenTranslations; + do { + if (!CheckNodeName("trans")) { continue; - cTemplateViewElement *currentElement = new cTemplateViewElement(); - xmlAttrPtr attrCur = node->properties; - vector<pair<string, string> > attribsCur; - ParseAttributes(attrCur, node, attribsCur); - currentElement->SetGlobals(globals); - currentElement->SetParameters(attribsCur); - while (childNode != NULL) { - if (childNode->type != XML_ELEMENT_NODE) { - childNode = childNode->next; - continue; - } - if ((!xmlStrcmp(childNode->name, (const xmlChar *) "area")) || (!xmlStrcmp(childNode->name, (const xmlChar *) "areascroll"))) { - xmlAttrPtr attrPix = childNode->properties; - vector<pair<string, string> > attribsPix; - ParseAttributes(attrPix, childNode, attribsPix); - cTemplatePixmap *pix = new cTemplatePixmap(); - pix->SetParameters(attribsPix); - ParseFunctionCalls(childNode->xmlChildrenNode, pix); - if (!xmlStrcmp(childNode->name, (const xmlChar *) "areascroll")) { - pix->SetScrolling(); - } - currentElement->AddPixmap(pix); - } - childNode = childNode->next; } - viewList->AddCurrentElement(currentElement); - } else if (!xmlStrcmp(node->name, (const xmlChar *) "listelement")) { - xmlNodePtr childNode = node->xmlChildrenNode; - if (!childNode) + string attributeName = "lang"; + string language = ""; + if (!GetAttribute(attributeName, language)) continue; - cTemplateViewElement *listElement = new cTemplateViewElement(); - xmlAttrPtr attrList = node->properties; - vector<pair<string, string> > attribsList; - ParseAttributes(attrList, node, attribsList); - listElement->SetGlobals(globals); - listElement->SetParameters(attribsList); - while (childNode != NULL) { - if (childNode->type != XML_ELEMENT_NODE) { - childNode = childNode->next; - continue; - } - if ((!xmlStrcmp(childNode->name, (const xmlChar *) "area")) || (!xmlStrcmp(childNode->name, (const xmlChar *) "areascroll"))) { - xmlAttrPtr attrPix = childNode->properties; - vector<pair<string, string> > attribsPix; - ParseAttributes(attrPix, childNode, attribsPix); - cTemplatePixmap *pix = new cTemplatePixmap(); - pix->SetParameters(attribsPix); - ParseFunctionCalls(childNode->xmlChildrenNode, pix); - if (!xmlStrcmp(childNode->name, (const xmlChar *) "areascroll")) { - pix->SetScrolling(); - } - listElement->AddPixmap(pix); - } - childNode = childNode->next; - } - viewList->AddListElement(listElement); - } else { - node = node->next; - continue; - } - node = node->next; - } - if (subView) - subView->AddViewList((const char*)parentNode->name, viewList); - else - view->AddViewList((const char*)parentNode->name, viewList); -} - -void cXmlParser::ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView) { - if (!parentNode || !view || !subView) - return; - - xmlAttrPtr attr = parentNode->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, parentNode, attribs); - - cTemplateViewTab *viewTab = new cTemplateViewTab(); - viewTab->SetGlobals(globals); - viewTab->SetParameters(attribs); - viewTab->SetScrolling(); - xmlNodePtr node = parentNode->xmlChildrenNode; - ParseFunctionCalls(node, viewTab); - - subView->AddViewTab(viewTab); -} - -void cXmlParser::ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes) { - if (!node) - return; - - if (!view) - return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } + string translation = ""; + if (!GetNodeValue(translation)) + continue; + tokenTranslations.insert(stringpair(language, translation)); + } while (NextNode()); + LevelUp(); - if (xmlStrcmp(node->name, (const xmlChar *) "area") && xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { - esyslog("skindesigner: invalid tag \"%s\"", node->name); - node = node->next; - continue; + if (globals) { + globals->AddTranslation(tokenName, tokenTranslations); + } else if (skinSetup) { + skinSetup->SetTranslation(tokenName, tokenTranslations); } - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - - cTemplatePixmap *pix = new cTemplatePixmap(); - if (!xmlStrcmp(node->name, (const xmlChar *) "areascroll")) { - pix->SetScrolling(); - } - pix->SetParameters(attribs); - ParseFunctionCalls(node->xmlChildrenNode, pix); - view->AddPixmapGrid(pix, attributes); - - node = node->next; - } + } while (NextNode()); + LevelUp(); } -void cXmlParser::ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix) { - if (!node) +void cXmlParser::ParseSetupMenu(void) { + if (!skinSetup) return; - - if (!view) + if (!LevelDown()) return; - - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - - if (!xmlStrcmp(node->name, (const xmlChar *) "loop")) { - xmlNodePtr childNode = node->xmlChildrenNode; - if (!childNode) - continue; - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - cTemplateLoopFunction *loopFunc = new cTemplateLoopFunction(); - loopFunc->SetParameters(attribs); - ParseLoopFunctionCalls(childNode, loopFunc); - pix->AddLoopFunction(loopFunc); - node = node->next; - } else if (view->ValidFunction((const char*)node->name)) { - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - pix->AddFunction((const char*)node->name, attribs); - node = node->next; - } else { - node = node->next; - continue; + do { + if (CheckNodeName("parameter")) { + ParseSetupParameter(); + } else if (CheckNodeName("submenu")) { + string attributeName = "name"; + string subMenuName = ""; + string attributeDisplayText = "displaytext"; + string subDisplayText = ""; + GetAttribute(attributeName, subMenuName); + GetAttribute(attributeDisplayText, subDisplayText); + skinSetup->SetSubMenu(subMenuName, subDisplayText); + ParseSetupMenu(); } - - } + } while (NextNode()); + skinSetup->SubMenuDone(); + LevelUp(); } -void cXmlParser::ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc) { - if (!node) - return; - - if (!view) +void cXmlParser::ParseSetupParameter(void) { + if (!skinSetup) return; + string attributeType = "type"; + string paramType = ""; + string attributeName = "name"; + string paramName = ""; + string attributeDisplayText = "displaytext"; + string paramDisplayText = ""; + string attributeMin = "min"; + string paramMin = ""; + string attributeMax = "max"; + string paramMax = ""; + string paramValue = ""; + + GetAttribute(attributeType, paramType); + GetAttribute(attributeName, paramName); + GetAttribute(attributeDisplayText, paramDisplayText); + GetAttribute(attributeMin, paramMin); + GetAttribute(attributeMax, paramMax); + GetNodeValue(paramValue); - while (node != NULL) { - - if (node->type != XML_ELEMENT_NODE) { - node = node->next; - continue; - } - if (view->ValidFunction((const char*)node->name)) { - xmlAttrPtr attr = node->properties; - vector<pair<string, string> > attribs; - ParseAttributes(attr, node, attribs); - loopFunc->AddFunction((const char*)node->name, attribs); - node = node->next; - } else { - node = node->next; - continue; - } - - } + skinSetup->SetParameter(paramType, paramName, paramDisplayText, paramMin, paramMax, paramValue); } -bool cXmlParser::ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement) { - if (attr == NULL) { - return false; - } - - if (!view) - return false; - - while (NULL != attr) { - - string name = (const char*)attr->name; - xmlChar *value = NULL; - value = xmlGetProp(node, attr->name); - if (!view->ValidAttribute(isViewElement ? "viewelement" : (const char*)node->name, (const char*)attr->name)) { - esyslog("skindesigner: unknown attribute %s in %s", (const char*)attr->name, (const char*)node->name); - attr = attr->next; - if (value) - xmlFree(value); - continue; +void cXmlParser::ValidateAttributes(const char *nodeName, vector<stringpair> &attributes) { + bool repeat = true; + while (repeat) { + repeat = false; + for (vector<stringpair>::iterator it = attributes.begin(); it != attributes.end(); it++) { + string attributeName = (*it).first; + if (!view->ValidAttribute(nodeName, attributeName.c_str())) { + attributes.erase(it); + repeat = true; + break; + } } - if (value) - attribs.push_back(pair<string, string>((const char*)attr->name, (const char*)value)); - attr = attr->next; - if (value) - xmlFree(value); } - return true; } -void cXmlParser::InitLibXML() { - xmlInitParser(); +string cXmlParser::GetPath(string xmlFile) { + string activeSkin = Setup.OSDSkin; + string activeTheme = Setup.OSDTheme; + string path = ""; + if (!xmlFile.compare("globals.xml")) { + path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); + } else if (!xmlFile.compare("theme.xml")) { + path = *cString::sprintf("%s%s/themes/%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), activeTheme.c_str(), xmlFile.c_str()); + } else if (!xmlFile.compare("setup.xml")) { + path = *cString::sprintf("%s%s/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); + } else { + path = *cString::sprintf("%s%s/xmlfiles/%s", *config.GetSkinPath(activeSkin), activeSkin.c_str(), xmlFile.c_str()); + } + return path; } -void cXmlParser::CleanupLibXML() { - xmlCleanupParser(); -} diff --git a/libtemplate/xmlparser.h b/libtemplate/xmlparser.h index 58d4e91..3dd0705 100644 --- a/libtemplate/xmlparser.h +++ b/libtemplate/xmlparser.h @@ -8,11 +8,8 @@ #include <vector> #include <map> #include <set> -#include <libxml/parser.h> -#include <libxml/tree.h> -#include <libxml/xmlerror.h> #include <vdr/plugin.h> - +#include "../libcore/libxmlwrapper.h" #include "templateview.h" #include "templateviewlist.h" #include "templateviewgrid.h" @@ -23,45 +20,49 @@ using namespace std; // --- cXmlParser ------------------------------------------------------------- -class cXmlParser { +class cXmlParser : public cLibXMLWrapper { private: cTemplateView *view; cGlobals *globals; cSkinSetup *skinSetup; - xmlParserCtxtPtr ctxt; - xmlDocPtr doc; - xmlNodePtr root; - string GetPath(string xmlFile); - void ParseSetupMenu(xmlNodePtr node); - void ParseSetupParameter(xmlNodePtr node); - void ParseGlobalColors(xmlNodePtr node); + //parsing views + bool ParseSubView(void); + void ParseViewElement(cTemplateView *subView = NULL); + void ParseViewList(cTemplateView *subView = NULL); + void ParseViewTab(cTemplateView *subView); + void ParseGrid(void); + cTemplatePixmap *ParseArea(void); + cTemplatePixmapContainer *ParseAreaContainer(void); + void ParseFunctionCalls(cTemplatePixmap *pix); + void ParseLoopFunctionCalls(cTemplateLoopFunction *loopFunc); + //parsing globals + void ParseGlobalColors(void); void InsertColor(string name, string value); - void ParseGlobalVariables(xmlNodePtr node); + void ParseGlobalVariables(void); void InsertVariable(string name, string type, string value); - void ParseGlobalFonts(xmlNodePtr node); - void ParseTranslations(xmlNodePtr node); - bool ParseSubView(xmlNodePtr node); - void ParseViewElement(const xmlChar * viewElement, xmlNodePtr node, vector<pair<string, string> > &attributes, cTemplateView *subView = NULL); - void ParseViewList(xmlNodePtr parentNode, cTemplateView *subView = NULL); - void ParseViewTab(xmlNodePtr parentNode, cTemplateView *subView); - void ParseGrid(xmlNodePtr node, vector<pair<string, string> > &attributes); - void ParseFunctionCalls(xmlNodePtr node, cTemplatePixmap *pix); - void ParseLoopFunctionCalls(xmlNodePtr node, cTemplateLoopFunction *loopFunc); - bool ParseAttributes(xmlAttrPtr attr, xmlNodePtr node, vector<pair<string, string> > &attribs, bool isViewElement = false); + void ParseGlobalFonts(void); + void ParseTranslations(void); + //parsing skin setup + void ParseSetupMenu(void); + void ParseSetupParameter(void); + //helpers + void ValidateAttributes(const char *nodeName, vector<stringpair> &attributes); + string GetPath(string xmlFile); public: cXmlParser(void); virtual ~cXmlParser(void); + //reading views bool ReadView(cTemplateView *view, string xmlFile); - bool ReadPluginView(string plugName, int templateNumber, string templateName); - bool ReadGlobals(cGlobals *globals, string xmlFile, bool mandatory); - bool ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile); bool ParseView(void); + //reading plugin views + bool ReadPluginView(string plugName, int templateNumber, string templateName); bool ParsePluginView(string plugName, int templateNumber); + //reading globals + bool ReadGlobals(cGlobals *globals, string xmlFile); bool ParseGlobals(void); + //reading skin setups + bool ReadSkinSetup(cSkinSetup *skinSetup, string xmlFile); bool ParseSkinSetup(string skin); - void DeleteDocument(void); - static void InitLibXML(); - static void CleanupLibXML(); }; #endif //__XMLPARSER_H diff --git a/skins/metrixhd/xmlfiles/displaychannel.xml b/skins/metrixhd/xmlfiles/displaychannel.xml index 13b9c07..dea21f1 100644 --- a/skins/metrixhd/xmlfiles/displaychannel.xml +++ b/skins/metrixhd/xmlfiles/displaychannel.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> -<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimechannel}" shifttype="bottom" shiftmode="slowed"> +<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="0" shifttype="bottom" shiftmode="slowed"> <background> <!-- background infobar --> <area x="0" y="80%" width="100%" height="20%" layer="1"> diff --git a/skins/metrixhd/xmlfiles/displaymenudefault.xml b/skins/metrixhd/xmlfiles/displaymenudefault.xml index 38bc647..d3f56c1 100644 --- a/skins/metrixhd/xmlfiles/displaymenudefault.xml +++ b/skins/metrixhd/xmlfiles/displaymenudefault.xml @@ -1,5 +1,5 @@ - <menudefault x="0" y="0" width="100%" height="100%" fadetime="0"> - <background> +<menudefault x="0" y="0" width="100%" height="100%" fadetime="0"> + <background> <!-- background Menu --> <area x="0" y="0" width="100%" height="100%" layer="1"> <fill color="{clrTransBlack}" /> diff --git a/skins/metrixhd/xmlfiles/displaymenuschedules.xml b/skins/metrixhd/xmlfiles/displaymenuschedules.xml index 58300c6..d1f0428 100644 --- a/skins/metrixhd/xmlfiles/displaymenuschedules.xml +++ b/skins/metrixhd/xmlfiles/displaymenuschedules.xml @@ -61,64 +61,72 @@ <fill condition="{separator}" color="{clrSemiTransBlack}" /> </area> <!-- WHATSON --> - <areascroll condition="not{separator}++{whatson}++not{running}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="58%" layer="3"> - <drawtext name="menutext" x="20" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> - </areascroll> - <areascroll condition="not{separator}++{whatson}++{running}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="48%" layer="3"> - <drawtext name="menutext" x="20" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> - </areascroll> - <area condition="not{separator}++{whatson}" x="1%" width="58%" layer="3"> - <drawimage condition="{timerfull}" imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> - <drawimage condition="{timerpartitial}" imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> - <drawrectangle condition="{running}" x="{areawidth}*0.85 - 10" y="{areaheight}/3" width="{areawidth}*0.15" height="{areaheight}/3" color="{clrWhite}" /> - <drawrectangle condition="{running}" x="{areawidth}*0.85 - 8" y="{areaheight}/3 + 2" width="{areawidth}*0.15 - 4" height="{areaheight}/3 - 4" color="{clrTransparent}" /> - <drawrectangle condition="{running}" x="{areawidth}*0.85 - 6" y="{areaheight}/3 + 4" width="{areawidth}*0.15 * {elapsed} / {duration} - 8" height="{areaheight}/3 - 8" color="{clrWhite}" /> - </area> + <areacontainer x="1%" width="58%" condition="not{separator}++{whatson}"> + <areascroll condition="not{running}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" layer="3"> + <drawtext name="menutext" x="20" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> + </areascroll> + <areascroll condition="{running}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" width="48%" layer="3"> + <drawtext name="menutext" x="20" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> + </areascroll> + <area layer="3"> + <drawimage condition="{timerfull}" imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> + <drawimage condition="{timerpartitial}" imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> + <drawrectangle condition="{running}" x="{areawidth}*0.85 - 10" y="{areaheight}/3" width="{areawidth}*0.15" height="{areaheight}/3" color="{clrWhite}" /> + <drawrectangle condition="{running}" x="{areawidth}*0.85 - 8" y="{areaheight}/3 + 2" width="{areawidth}*0.15 - 4" height="{areaheight}/3 - 4" color="{clrTransparent}" /> + <drawrectangle condition="{running}" x="{areawidth}*0.85 - 6" y="{areaheight}/3 + 4" width="{areawidth}*0.15 * {elapsed} / {duration} - 8" height="{areaheight}/3 - 8" color="{clrWhite}" /> + </area> + </areacontainer> <!-- WHATSONNOW --> - <area condition="not{separator}++{whatsonnow}" x="1%" width="6%" layer="3"> - <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> - </area> - <area condition="not{separator}++{whatsonnow}++{running}" x="8%" width="7%" layer="3"> - <drawrectangle condition="{current}" x="0" y="{areaheight}/3" width="{areawidth}" height="{areaheight}/3" color="{clrWhite}" /> - <drawrectangle condition="not{current}" x="0" y="{areaheight}/3" width="{areawidth}" height="{areaheight}/3" color="{clrTransBlueLight}" /> - <drawrectangle x="2" y="{areaheight}/3 + 2" width="{areawidth} - 4" height="{areaheight}/3 - 4" color="{clrTransparent}" /> - <drawrectangle x="4" y="{areaheight}/3 + 4" width="{areawidth} * {elapsed} / {duration} - 8" height="{areaheight}/3 - 8" color="{clrWhite}" /> - </area> - <area condition="not{separator}++{whatsonnow}++{timerfull}" x="53%" width="6%" layer="4"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> - </area> - <area condition="not{separator}++{whatsonnow}++{timerpartitial}" x="53%" width="6%" layer="5"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> - </area> - <areascroll condition="not{separator}++{whatsonnow}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="15%" width="44%" layer="4"> - <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> - </areascroll> + <areacontainer condition="not{separator}++{whatsonnow}"> + <area x="1%" width="6%" layer="3"> + <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> + </area> + <area condition="{running}" x="8%" width="7%" layer="3"> + <drawrectangle condition="{current}" x="0" y="{areaheight}/3" width="{areawidth}" height="{areaheight}/3" color="{clrWhite}" /> + <drawrectangle condition="not{current}" x="0" y="{areaheight}/3" width="{areawidth}" height="{areaheight}/3" color="{clrTransBlueLight}" /> + <drawrectangle x="2" y="{areaheight}/3 + 2" width="{areawidth} - 4" height="{areaheight}/3 - 4" color="{clrTransparent}" /> + <drawrectangle x="4" y="{areaheight}/3 + 4" width="{areawidth} * {elapsed} / {duration} - 8" height="{areaheight}/3 - 8" color="{clrWhite}" /> + </area> + <area condition="{timerfull}" x="53%" width="6%" layer="4"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> + </area> + <area condition="{timerpartitial}" x="53%" width="6%" layer="5"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> + </area> + <areascroll scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="15%" width="44%" layer="4"> + <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> + </areascroll> + </areacontainer> <!-- WHATSONNEXT --> - <area condition="not{separator}++{whatsonnext}" x="1%" width="6%" layer="3"> - <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> - </area> - <area condition="not{separator}++{whatsonnext}++{timerfull}" x="53%" width="6%" layer="4"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> - </area> - <area condition="not{separator}++{whatsonnext}++{timerpartitial}" x="53%" width="6%" layer="5"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> - </area> - <areascroll condition="not{separator}++{whatsonnext}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="7%" width="52%" layer="4"> - <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> - </areascroll> + <areacontainer condition="not{separator}++{whatsonnext}"> + <area x="1%" width="6%" layer="3"> + <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> + </area> + <area condition="{timerfull}" x="53%" width="6%" layer="4"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> + </area> + <area condition="{timerpartitial}" x="53%" width="6%" layer="5"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> + </area> + <areascroll scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="7%" width="52%" layer="4"> + <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> + </areascroll> + </areacontainer> <!-- WHATSONFAVORITES --> - <area condition="not{separator}++{whatsonfavorites}" x="1%" width="6%" layer="3"> - <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> - </area> - <area condition="not{separator}++{whatsonfavorites}++{timerfull}" x="53%" width="6%" layer="4"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> - </area> - <area condition="not{separator}++{whatsonfavorites}++{timerpartitial}" x="53%" width="6%" layer="5"> - <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> - </area> - <areascroll condition="not{separator}++{whatsonfavorites}" scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="7%" width="52%" layer="4"> - <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> - </areascroll> + <areacontainer condition="not{separator}++{whatsonfavorites}"> + <area x="1%" width="6%" layer="3"> + <drawimage name="logo" imagetype="channellogo" path="{channelid}" x="0" width="100%" height="100%" valign="center" /> + </area> + <area condition="{timerfull}" x="53%" width="6%" layer="4"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.9*{areaheight} - 10" width="0.9*{areaheight}" height="0.9*{areaheight}" valign="center" /> + </area> + <area condition="{timerpartitial}" x="53%" width="6%" layer="5"> + <drawimage imagetype="icon" path="ico_activetimer" x="{areawidth} - 0.5*{areaheight} - 10" width="0.5*{areaheight}" height="0.5*{areaheight}" valign="center" /> + </area> + <areascroll scrollelement="menutext" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="7%" width="52%" layer="4"> + <drawtext name="menutext" x="10" valign="center" font="{light}" fontsize="95%" color="{clrWhite}" text="{start} {title}" /> + </areascroll> + </areacontainer> <!-- Separator --> <area condition="{separator}" x="0" width="68%" layer="3"> <drawtext x="20" valign="center" font="{light}" fontsize="95%" color="{clrBlueLight}" text="{title}" /> @@ -177,28 +185,30 @@ <drawtextbox condition="{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" float="topleft" floatwidth="{width(poster)} + 10" floatheight="{height(poster)} + 20" font="{light}" fontsize="{areaheight}/20" color="{clrWhite}" text="{description}" /> <drawtextbox condition="not{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" font="{light}" fontsize="{areaheight}/20" color="{clrWhite}" text="{description}" /> </area> - <area condition="{whatsonnow}||{whatsonnext}" x="63%" y="0" width="36%" height="85%" layer="2"> - <!-- title --> - <drawtext align="center" y="0" font="{semibold}" width="{areawidth}-20" fontsize="10%" color="{clrWhite}" text="{title}" /> - <!-- progress bar if event is running --> - <drawtext condition="{running}" name="start" x="{areawidth}/4 - {width(start)}" y="{areaheight}/16 + 15" font="{light}" fontsize="{areaheight}/15" color="{clrWhite}" text="{start}" /> - <drawtext condition="{running}" name="stop" x="{areawidth}*3/4" y="{areaheight}/16 + 15" font="{light}" fontsize="{areaheight}/15" color="{clrWhite}" text="{stop}" /> - <drawrectangle condition="{running}" x="{areawidth}/4+10" y="{areaheight}/16 + 15 + {areaheight}/30" width="{areawidth}/2 - 20" height="1" color="{clrWhite}" /> - <drawrectangle condition="{running}" x="{areawidth}/4+10" y="{areaheight}/16 + 15 + {areaheight}/30 -2" width="{areawidth}/2 * {elapsed} / {duration} - 20 * {elapsed} / {duration}" height="5" color="{clrWhite}" /> - <!-- start and stop if event is not running --> - <drawtext condition="not{running}" x="10" y="{areaheight}/18 + 15" font="{light}" fontsize="{areaheight}/20" color="{clrWhite}" text="{start} - {stop} ({duration} min)" /> - <!-- scraper poster --> - <drawimage condition="{hasposter}" name="poster" imagetype="image" path="{posterpath}" x="10" y="{posy(start)} + {height(start)} + 10" width="{areawidth}/3" height="{areawidth}/3 * {posterheight} / {posterwidth}"/> - <!-- description --> - <drawtextbox condition="{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" float="topleft" floatwidth="{width(poster)} + 10" floatheight="{height(poster)} + 10" font="{light}" fontsize="{areaheight}/18" color="{clrWhite}" text="{description}" /> - <drawtextbox condition="not{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" font="{light}" fontsize="{areaheight}/18" color="{clrWhite}" text="{description}" /> - </area> - <areascroll condition="{whatsonnow}||{whatsonnext}" mode="forthandback" orientation="vertical" delay="1000" scrollspeed="medium" x="63%" y="85%" width="36%" height="15%" layer="2"> - <drawtext x="10" y="0" font="{semibold}" fontsize="30%" color="{clrWhite}" text="Next Schedules:" /> - <loop name="schedule" x="0" y="{areaheight}/4 + 5" orientation="vertical"> - <drawtext x="10" font="{light}" width="{areawidth}-20" fontsize="30%" color="{clrWhite}" text="{schedule[start]} {schedule[title]}" /> - </loop> - </areascroll> + <areacontainer condition="{whatsonnow}||{whatsonnext}"> + <area x="63%" y="0" width="36%" height="85%" layer="2"> + <!-- title --> + <drawtext align="center" y="0" font="{semibold}" width="{areawidth}-20" fontsize="10%" color="{clrWhite}" text="{title}" /> + <!-- progress bar if event is running --> + <drawtext condition="{running}" name="start" x="{areawidth}/4 - {width(start)}" y="{areaheight}/16 + 15" font="{light}" fontsize="{areaheight}/15" color="{clrWhite}" text="{start}" /> + <drawtext condition="{running}" name="stop" x="{areawidth}*3/4" y="{areaheight}/16 + 15" font="{light}" fontsize="{areaheight}/15" color="{clrWhite}" text="{stop}" /> + <drawrectangle condition="{running}" x="{areawidth}/4+10" y="{areaheight}/16 + 15 + {areaheight}/30" width="{areawidth}/2 - 20" height="1" color="{clrWhite}" /> + <drawrectangle condition="{running}" x="{areawidth}/4+10" y="{areaheight}/16 + 15 + {areaheight}/30 -2" width="{areawidth}/2 * {elapsed} / {duration} - 20 * {elapsed} / {duration}" height="5" color="{clrWhite}" /> + <!-- start and stop if event is not running --> + <drawtext condition="not{running}" x="10" y="{areaheight}/18 + 15" font="{light}" fontsize="{areaheight}/20" color="{clrWhite}" text="{start} - {stop} ({duration} min)" /> + <!-- scraper poster --> + <drawimage condition="{hasposter}" name="poster" imagetype="image" path="{posterpath}" x="10" y="{posy(start)} + {height(start)} + 10" width="{areawidth}/3" height="{areawidth}/3 * {posterheight} / {posterwidth}"/> + <!-- description --> + <drawtextbox condition="{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" float="topleft" floatwidth="{width(poster)} + 10" floatheight="{height(poster)} + 10" font="{light}" fontsize="{areaheight}/18" color="{clrWhite}" text="{description}" /> + <drawtextbox condition="not{hasposter}" x="10" y="{posy(poster)}" width="99%" height="{areaheight} - {posy(poster)}" font="{light}" fontsize="{areaheight}/18" color="{clrWhite}" text="{description}" /> + </area> + <areascroll mode="forthandback" orientation="vertical" delay="1000" scrollspeed="medium" x="63%" y="85%" width="36%" height="15%" layer="2"> + <drawtext x="10" y="0" font="{semibold}" fontsize="30%" color="{clrWhite}" text="Next Schedules:" /> + <loop name="schedule" x="0" y="{areaheight}/4 + 5" orientation="vertical"> + <drawtext x="10" font="{light}" width="{areawidth}-20" fontsize="30%" color="{clrWhite}" text="{schedule[start]} {schedule[title]}" /> + </loop> + </areascroll> + </areacontainer> </currentelement> </menuitems> <!-- Available Variables scrollbar: diff --git a/skins/metrixhd/xmlfiles/plug-tvguideng-recmenu.xml b/skins/metrixhd/xmlfiles/plug-tvguideng-recmenu.xml index 03ae66f..d2f3174 100644 --- a/skins/metrixhd/xmlfiles/plug-tvguideng-recmenu.xml +++ b/skins/metrixhd/xmlfiles/plug-tvguideng-recmenu.xml @@ -78,18 +78,20 @@ {textyes} text to display on yes button {textno} text to display on no button --> - <area condition="{buttonyesno}" layer="5"> - <drawrectangle condition="not{current}" x="2%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> - <drawrectangle condition="not{current}" x="52%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> - <drawrectangle condition="{current}++{yes}" x="2%" y="5%" width="46%" height="90%" color="{clrTransBlueLight}"/> - <drawrectangle condition="{current}++{yes}" x="52%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> - <drawrectangle condition="{current}++not{yes}" x="2%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> - <drawrectangle condition="{current}++not{yes}" x="52%" y="5%" width="46%" height="90%" color="{clrTransBlueLight}"/> - </area> - <area condition="{buttonyesno}" layer="6"> - <drawtext name="yestext" x="{areawidth}/4 - {width(yestext)}/2" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="{textyes}" /> - <drawtext name="notext" x="3*{areawidth}/4 - {width(notext)}/2" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="{textno}" /> - </area> + <areacontainer condition="{buttonyesno}"> + <area layer="5"> + <drawrectangle condition="not{current}" x="2%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> + <drawrectangle condition="not{current}" x="52%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> + <drawrectangle condition="{current}++{yes}" x="2%" y="5%" width="46%" height="90%" color="{clrTransBlueLight}"/> + <drawrectangle condition="{current}++{yes}" x="52%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> + <drawrectangle condition="{current}++not{yes}" x="2%" y="5%" width="46%" height="90%" color="{clrDarkGray}"/> + <drawrectangle condition="{current}++not{yes}" x="52%" y="5%" width="46%" height="90%" color="{clrTransBlueLight}"/> + </area> + <area layer="6"> + <drawtext name="yestext" x="{areawidth}/4 - {width(yestext)}/2" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="{textyes}" /> + <drawtext name="notext" x="3*{areawidth}/4 - {width(notext)}/2" valign="center" font="{light}" fontsize="70%" color="{clrWhite}" text="{textno}" /> + </area> + </areacontainer> <!-- Int Selector {intselector} true {text} title of selector @@ -126,14 +128,16 @@ {text} title of selector {value} current value of selector, string --> - <area condition="{textinput}" layer="6"> - <drawtext x="1%" y="10%" font="{light}" fontsize="40%" color="{clrWhite}" text="{text}" /> - <drawrectangle condition="not{editmode}" x="1%" y="55%" width="98%" height="40%" color="{clrWhite}"/> - <drawrectangle condition="{editmode}" x="1%" y="55%" width="98%" height="40%" color="{clrRed}"/> - </area> - <area condition="{textinput}" layer="7"> - <drawtext align="right" y="55%" font="{light}" fontsize="40%" color="{clrBlack}" text="{value} " /> - </area> + <areacontainer condition="{textinput}"> + <area layer="6"> + <drawtext x="1%" y="10%" font="{light}" fontsize="40%" color="{clrWhite}" text="{text}" /> + <drawrectangle condition="not{editmode}" x="1%" y="55%" width="98%" height="40%" color="{clrWhite}"/> + <drawrectangle condition="{editmode}" x="1%" y="55%" width="98%" height="40%" color="{clrRed}"/> + </area> + <area layer="7"> + <drawtext align="right" y="55%" font="{light}" fontsize="40%" color="{clrBlack}" text="{value} " /> + </area> + </areacontainer> <!-- Time Selector {timeselector} true {text} title of selector @@ -174,49 +178,51 @@ {day0abbr} ... {day6abbr} localized one character abbrevation for weekdays from Monday to Sunday {day0set} ... {day6set} true if according weekday from Monday to Sunday is set --> - <area condition="{weekdayselector}" layer="6"> - <drawtext x="1%" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{text}" /> - - <drawrectangle x="{areawidth} - {areaheight}*4" y="25%" width="{areaheight}*3.5" height="50%" color="{clrWhite}" /> + <areacontainer condition="{weekdayselector}"> + <area layer="6"> + <drawtext x="1%" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{text}" /> + + <drawrectangle x="{areawidth} - {areaheight}*4" y="25%" width="{areaheight}*3.5" height="50%" color="{clrWhite}" /> - <drawrectangle condition="not{day0set}" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day0set}" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - - <drawrectangle condition="not{day1set}" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day1set}" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + <drawrectangle condition="not{day0set}" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day0set}" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + + <drawrectangle condition="not{day1set}" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day1set}" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - <drawrectangle condition="not{day2set}" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day2set}" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + <drawrectangle condition="not{day2set}" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day2set}" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - <drawrectangle condition="not{day3set}" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day3set}" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + <drawrectangle condition="not{day3set}" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day3set}" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - <drawrectangle condition="not{day4set}" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day4set}" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + <drawrectangle condition="not{day4set}" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day4set}" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - <drawrectangle condition="not{day5set}" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day5set}" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + <drawrectangle condition="not{day5set}" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day5set}" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - <drawrectangle condition="not{day6set}" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> - <drawrectangle condition="{day6set}" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> - </area> - <area condition="{weekdayselector}" layer="7"> - <drawrectangle condition="{current}++eq({dayselected}, 0)" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 1)" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 2)" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 3)" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 4)" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 5)" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawrectangle condition="{current}++eq({dayselected}, 6)" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="not{day6set}" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrDarkGray}" /> + <drawrectangle condition="{day6set}" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlueLight}" /> + </area> + <area layer="7"> + <drawrectangle condition="{current}++eq({dayselected}, 0)" x="{areawidth} - {areaheight}*4.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 1)" x="{areawidth} - {areaheight}*3.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 2)" x="{areawidth} - {areaheight}*3.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 3)" x="{areawidth} - {areaheight}*2.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 4)" x="{areawidth} - {areaheight}*2.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 5)" x="{areawidth} - {areaheight}*1.5 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> + <drawrectangle condition="{current}++eq({dayselected}, 6)" x="{areawidth} - {areaheight}*1.0 + 2" y="{areaheight}*0.25+2" width="{areaheight}*0.5-4" height="{areaheight}*0.5-4" color="{clrTransBlack}" /> - <drawtext name="day0" x="{areawidth} - {areaheight}*4.0 + {areaheight}/4 - {width(day0)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day0abbr}" /> - <drawtext name="day1" x="{areawidth} - {areaheight}*3.5 + {areaheight}/4 - {width(day1)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day1abbr}" /> - <drawtext name="day2" x="{areawidth} - {areaheight}*3.0 + {areaheight}/4 - {width(day2)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day2abbr}" /> - <drawtext name="day3" x="{areawidth} - {areaheight}*2.5 + {areaheight}/4 - {width(day3)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day3abbr}" /> - <drawtext name="day4" x="{areawidth} - {areaheight}*2.0 + {areaheight}/4 - {width(day4)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day4abbr}" /> - <drawtext name="day5" x="{areawidth} - {areaheight}*1.5 + {areaheight}/4 - {width(day5)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day5abbr}" /> - <drawtext name="day6" x="{areawidth} - {areaheight}*1.0 + {areaheight}/4 - {width(day6)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day6abbr}" /> - </area> + <drawtext name="day0" x="{areawidth} - {areaheight}*4.0 + {areaheight}/4 - {width(day0)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day0abbr}" /> + <drawtext name="day1" x="{areawidth} - {areaheight}*3.5 + {areaheight}/4 - {width(day1)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day1abbr}" /> + <drawtext name="day2" x="{areawidth} - {areaheight}*3.0 + {areaheight}/4 - {width(day2)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day2abbr}" /> + <drawtext name="day3" x="{areawidth} - {areaheight}*2.5 + {areaheight}/4 - {width(day3)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day3abbr}" /> + <drawtext name="day4" x="{areawidth} - {areaheight}*2.0 + {areaheight}/4 - {width(day4)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day4abbr}" /> + <drawtext name="day5" x="{areawidth} - {areaheight}*1.5 + {areaheight}/4 - {width(day5)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day5abbr}" /> + <drawtext name="day6" x="{areawidth} - {areaheight}*1.0 + {areaheight}/4 - {width(day6)}/2" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{day6abbr}" /> + </area> + </areacontainer> <!-- Directory Selector {directoryselector} true {text} title of selector @@ -238,17 +244,19 @@ {overlapstartpercent} start of overlap in percent of total conflict time width {overlapwidthpercent} width of overlap in percent of total conflict time width --> - <area condition="{timerconflictheader}" layer="5"> - <drawtext name="title" x="{areawidth}*0.7*0.5 - {width(title)}/2" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{text}" /> - <drawrectangle x="70%" y="0" width="30%" height="100%" color="{clrWhite}"/> - </area> - <area condition="{timerconflictheader}" layer="6"> - <drawtext x="{areawidth}*0.7" y="0" font="{light}" fontsize="50%" color="{clrBlack}" text="{conflictstart}" /> - <drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrBlack}" text="{conflictstop}" /> - <drawtext name="olstart" x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100 - 70" y="50%" font="{light}" fontsize="50%" color="{clrRed}" text="{overlapstart}" /> - <drawtext x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100 + {overlapwidthpercent}*{areawidth}*0.3/100 + 5" y="50%" font="{light}" fontsize="50%" color="{clrRed}" text="{overlapstop}" /> - <drawrectangle x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100" y="50%" width="{overlapwidthpercent}*{areawidth}*0.3/100" height="50%" color="{clrRedTrans}"/> - </area> + <areacontainer condition="{timerconflictheader}"> + <area layer="5"> + <drawtext name="title" x="{areawidth}*0.7*0.5 - {width(title)}/2" valign="center" font="{light}" fontsize="80%" color="{clrWhite}" text="{text}" /> + <drawrectangle x="70%" y="0" width="30%" height="100%" color="{clrWhite}"/> + </area> + <area layer="6"> + <drawtext x="{areawidth}*0.7" y="0" font="{light}" fontsize="50%" color="{clrBlack}" text="{conflictstart}" /> + <drawtext align="right" y="0" font="{light}" fontsize="50%" color="{clrBlack}" text="{conflictstop}" /> + <drawtext name="olstart" x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100 - 70" y="50%" font="{light}" fontsize="50%" color="{clrRed}" text="{overlapstart}" /> + <drawtext x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100 + {overlapwidthpercent}*{areawidth}*0.3/100 + 5" y="50%" font="{light}" fontsize="50%" color="{clrRed}" text="{overlapstop}" /> + <drawrectangle x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100" y="50%" width="{overlapwidthpercent}*{areawidth}*0.3/100" height="50%" color="{clrRedTrans}"/> + </area> + </areacontainer> <!-- Timerconflict {timerconflict} true {timertitle} title of timer @@ -268,28 +276,30 @@ {overlapstartpercent} start of overlap in percent of total conflict time width {overlapwidthpercent} width of overlap in percent of total conflict time width --> - <area condition="{timerconflict}" layer="5"> - <drawimage condition="not{current}" imagetype="skinpart" path="menubutton" x="0" y="0" width="70%" height="100%"/> - <drawimage condition="{current}" imagetype="skinpart" path="menubuttonactive" x="0" y="0" width="70%" height="100%"/> - </area> - <area condition="{timerconflict}" layer="6"> - <drawimage condition="{current}++{infoactive}" imagetype="icon" path="ico_info_active" x="{areaheight}*0.05" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="not{current}||not{infoactive}" imagetype="icon" path="ico_info_inactive" x="{areaheight}*0.05" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="{current}++{deleteactive}" imagetype="icon" path="ico_delete_active" x="{areaheight}*0.6" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="not{current}||not{deleteactive}" imagetype="icon" path="ico_delete_inactive" x="{areaheight}*0.6" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="{current}++{editactive}" imagetype="icon" path="ico_edit_active" x="{areaheight}*1.15" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="not{current}||not{editactive}" imagetype="icon" path="ico_edit_inactive" x="{areaheight}*1.15" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="{current}++{searchactive}" imagetype="icon" path="ico_search_active" x="{areaheight}*1.7" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawimage condition="not{current}||not{searchactive}" imagetype="icon" path="ico_search_inactive" x="{areaheight}*1.7" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> - <drawtext x="{areaheight}*2.3" width="{areawidth}*0.7 - {areaheight}*2.4" y="0" font="{regular}" fontsize="40%" color="{clrWhite}" text="{timertitle}" /> - <drawtext x="{areaheight}*2.3" y="40%" font="{light}" fontsize="30%" color="{clrWhite}" text="{weekday} {date} {starttime} - {stoptime}" /> - <drawtext x="{areaheight}*2.3" y="70%" font="{light}" fontsize="30%" color="{clrWhite}" text="{channelname}, Transp. {transponder}" /> - <drawrectangle x="70%" y="0" width="30%" height="100%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.7 + {timerstartpercent}*{areawidth}*0.3/100" y="30%" width="{timerwidthpercent}*{areawidth}*0.3/100" height="40%" color="{clrBlack}"/> - </area> - <area condition="{timerconflict}" layer="7"> - <drawrectangle x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100" y="0" width="{overlapwidthpercent}*{areawidth}*0.3/100" height="100%" color="{clrRedTrans}"/> - </area> + <areacontainer condition="{timerconflict}"> + <area layer="5"> + <drawimage condition="not{current}" imagetype="skinpart" path="menubutton" x="0" y="0" width="70%" height="100%"/> + <drawimage condition="{current}" imagetype="skinpart" path="menubuttonactive" x="0" y="0" width="70%" height="100%"/> + </area> + <area layer="6"> + <drawimage condition="{current}++{infoactive}" imagetype="icon" path="ico_info_active" x="{areaheight}*0.05" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="not{current}||not{infoactive}" imagetype="icon" path="ico_info_inactive" x="{areaheight}*0.05" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="{current}++{deleteactive}" imagetype="icon" path="ico_delete_active" x="{areaheight}*0.6" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="not{current}||not{deleteactive}" imagetype="icon" path="ico_delete_inactive" x="{areaheight}*0.6" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="{current}++{editactive}" imagetype="icon" path="ico_edit_active" x="{areaheight}*1.15" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="not{current}||not{editactive}" imagetype="icon" path="ico_edit_inactive" x="{areaheight}*1.15" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="{current}++{searchactive}" imagetype="icon" path="ico_search_active" x="{areaheight}*1.7" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawimage condition="not{current}||not{searchactive}" imagetype="icon" path="ico_search_inactive" x="{areaheight}*1.7" valign="center" width="{areaheight}*0.5" height="{areaheight}*0.5"/> + <drawtext x="{areaheight}*2.3" width="{areawidth}*0.7 - {areaheight}*2.4" y="0" font="{regular}" fontsize="40%" color="{clrWhite}" text="{timertitle}" /> + <drawtext x="{areaheight}*2.3" y="40%" font="{light}" fontsize="30%" color="{clrWhite}" text="{weekday} {date} {starttime} - {stoptime}" /> + <drawtext x="{areaheight}*2.3" y="70%" font="{light}" fontsize="30%" color="{clrWhite}" text="{channelname}, Transp. {transponder}" /> + <drawrectangle x="70%" y="0" width="30%" height="100%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.7 + {timerstartpercent}*{areawidth}*0.3/100" y="30%" width="{timerwidthpercent}*{areawidth}*0.3/100" height="40%" color="{clrBlack}"/> + </area> + <area layer="7"> + <drawrectangle x="{areawidth}*0.7 + {overlapstartpercent}*{areawidth}*0.3/100" y="0" width="{overlapwidthpercent}*{areawidth}*0.3/100" height="100%" color="{clrRedTrans}"/> + </area> + </areacontainer> <!-- Event {event} true {title} title of event @@ -367,78 +377,82 @@ {eventstart} start time of according event {eventstop} end time of according event --> - <area condition="{timelineheader}" layer="5"> - <drawtext align="center" y="1%" font="{regular}" fontsize="35%" color="{clrWhite}" text="Timer for {date}" /> - <drawrectangle x="{areawidth}*0.05" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.0875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.1625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.2" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.2375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.275" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.3125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.35" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.3875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.425" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.4625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.5" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.5375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.575" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.6125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.65" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.6875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.725" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.7625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.8" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.8375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - <drawrectangle x="{areawidth}*0.875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> - <drawrectangle x="{areawidth}*0.9125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> - </area> - <area condition="{timelineheader}" layer="6"> - <drawtext name="text0" x="{areawidth}*0.05 + {areawidth}*0.0375/2 - {width(text0)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="0"/> - <drawtext name="text1" x="{areawidth}*0.0875 + {areawidth}*0.0375/2 - {width(text1)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="1"/> - <drawtext name="text2" x="{areawidth}*0.125 + {areawidth}*0.0375/2 - {width(text2)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="2"/> - <drawtext name="text3" x="{areawidth}*0.1625 + {areawidth}*0.0375/2 - {width(text3)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="3"/> - <drawtext name="text4" x="{areawidth}*0.2 + {areawidth}*0.0375/2 - {width(text4)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="4"/> - <drawtext name="text5" x="{areawidth}*0.2375 + {areawidth}*0.0375/2 - {width(text5)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="5"/> - <drawtext name="text6" x="{areawidth}*0.275 + {areawidth}*0.0375/2 - {width(text6)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="6"/> - <drawtext name="text7" x="{areawidth}*0.3125 + {areawidth}*0.0375/2 - {width(text7)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="7"/> - <drawtext name="text8" x="{areawidth}*0.35 + {areawidth}*0.0375/2 - {width(text8)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="8"/> - <drawtext name="text9" x="{areawidth}*0.3875 + {areawidth}*0.0375/2 - {width(text9)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="9"/> - <drawtext name="text10" x="{areawidth}*0.425 + {areawidth}*0.0375/2 - {width(text10)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="10"/> - <drawtext name="text11" x="{areawidth}*0.4625 + {areawidth}*0.0375/2 - {width(text11)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="11"/> - <drawtext name="text12" x="{areawidth}*0.5 + {areawidth}*0.0375/2 - {width(text12)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="12"/> - <drawtext name="text13" x="{areawidth}*0.5375 + {areawidth}*0.0375/2 - {width(text13)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="13"/> - <drawtext name="text14" x="{areawidth}*0.575 + {areawidth}*0.0375/2 - {width(text14)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="14"/> - <drawtext name="text15" x="{areawidth}*0.6125 + {areawidth}*0.0375/2 - {width(text15)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="15"/> - <drawtext name="text16" x="{areawidth}*0.65 + {areawidth}*0.0375/2 - {width(text16)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="16"/> - <drawtext name="text17" x="{areawidth}*0.6875 + {areawidth}*0.0375/2 - {width(text17)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="17"/> - <drawtext name="text18" x="{areawidth}*0.725 + {areawidth}*0.0375/2 - {width(text18)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="18"/> - <drawtext name="text19" x="{areawidth}*0.7625 + {areawidth}*0.0375/2 - {width(text19)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="19"/> - <drawtext name="text20" x="{areawidth}*0.8 + {areawidth}*0.0375/2 - {width(text20)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="20"/> - <drawtext name="text21" x="{areawidth}*0.8375 + {areawidth}*0.0375/2 - {width(text21)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="21"/> - <drawtext name="text22" x="{areawidth}*0.875 + {areawidth}*0.0375/2 - {width(text22)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="22"/> - <drawtext name="text23" x="{areawidth}*0.9125 + {areawidth}*0.0375/2 - {width(text23)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="23"/> - </area> - <area condition="{timelineheader}++{timerset}" layer="6"> - <drawimage condition="{channellogoexisis}" imagetype="channellogo" path="{channelid}" x="1%" y="30%" width="{areaheight}*0.5" height="{areaheight}*0.5" /> - <drawtext condition="not{channellogoexisis}" x="1%" width="{areaheight}*0.7" y="40%" font="{light}" fontsize="20%" color="{clrWhite}" text="{channelname}"/> - <drawtext x="{areaheight}*0.8" y="36%" font="{light}" fontsize="25%" color="{clrWhite}" text="{eventstart} - {eventstop} (Rec. {timerstart} - {timerstop}), Transp. {channeltransponder}"/> - <drawtext x="{areaheight}*0.8" y="57%" width="{areawidth}-{areaheight}" font="{light}" fontsize="25%" color="{clrWhite}" text="{eventtitle} - {eventshorttext}"/> - </area> + <areacontainer condition="{timelineheader}"> + <area layer="5"> + <drawtext align="center" y="1%" font="{regular}" fontsize="35%" color="{clrWhite}" text="Timer for {date}" /> + <drawrectangle x="{areawidth}*0.05" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.0875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.1625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.2" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.2375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.275" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.3125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.35" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.3875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.425" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.4625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.5" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.5375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.575" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.6125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.65" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.6875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.725" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.7625" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.8" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.8375" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + <drawrectangle x="{areawidth}*0.875" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrBlack}"/> + <drawrectangle x="{areawidth}*0.9125" y="80%" width="{areawidth}*0.0375" height="20%" color="{clrWhite}"/> + </area> + <area layer="6"> + <drawtext name="text0" x="{areawidth}*0.05 + {areawidth}*0.0375/2 - {width(text0)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="0"/> + <drawtext name="text1" x="{areawidth}*0.0875 + {areawidth}*0.0375/2 - {width(text1)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="1"/> + <drawtext name="text2" x="{areawidth}*0.125 + {areawidth}*0.0375/2 - {width(text2)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="2"/> + <drawtext name="text3" x="{areawidth}*0.1625 + {areawidth}*0.0375/2 - {width(text3)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="3"/> + <drawtext name="text4" x="{areawidth}*0.2 + {areawidth}*0.0375/2 - {width(text4)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="4"/> + <drawtext name="text5" x="{areawidth}*0.2375 + {areawidth}*0.0375/2 - {width(text5)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="5"/> + <drawtext name="text6" x="{areawidth}*0.275 + {areawidth}*0.0375/2 - {width(text6)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="6"/> + <drawtext name="text7" x="{areawidth}*0.3125 + {areawidth}*0.0375/2 - {width(text7)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="7"/> + <drawtext name="text8" x="{areawidth}*0.35 + {areawidth}*0.0375/2 - {width(text8)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="8"/> + <drawtext name="text9" x="{areawidth}*0.3875 + {areawidth}*0.0375/2 - {width(text9)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="9"/> + <drawtext name="text10" x="{areawidth}*0.425 + {areawidth}*0.0375/2 - {width(text10)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="10"/> + <drawtext name="text11" x="{areawidth}*0.4625 + {areawidth}*0.0375/2 - {width(text11)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="11"/> + <drawtext name="text12" x="{areawidth}*0.5 + {areawidth}*0.0375/2 - {width(text12)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="12"/> + <drawtext name="text13" x="{areawidth}*0.5375 + {areawidth}*0.0375/2 - {width(text13)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="13"/> + <drawtext name="text14" x="{areawidth}*0.575 + {areawidth}*0.0375/2 - {width(text14)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="14"/> + <drawtext name="text15" x="{areawidth}*0.6125 + {areawidth}*0.0375/2 - {width(text15)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="15"/> + <drawtext name="text16" x="{areawidth}*0.65 + {areawidth}*0.0375/2 - {width(text16)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="16"/> + <drawtext name="text17" x="{areawidth}*0.6875 + {areawidth}*0.0375/2 - {width(text17)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="17"/> + <drawtext name="text18" x="{areawidth}*0.725 + {areawidth}*0.0375/2 - {width(text18)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="18"/> + <drawtext name="text19" x="{areawidth}*0.7625 + {areawidth}*0.0375/2 - {width(text19)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="19"/> + <drawtext name="text20" x="{areawidth}*0.8 + {areawidth}*0.0375/2 - {width(text20)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="20"/> + <drawtext name="text21" x="{areawidth}*0.8375 + {areawidth}*0.0375/2 - {width(text21)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="21"/> + <drawtext name="text22" x="{areawidth}*0.875 + {areawidth}*0.0375/2 - {width(text22)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrWhite}" text="22"/> + <drawtext name="text23" x="{areawidth}*0.9125 + {areawidth}*0.0375/2 - {width(text23)}/2" y="80%" font="{regular}" fontsize="20%" color="{clrBlack}" text="23"/> + </area> + <area condition="{timerset}" layer="6"> + <drawimage condition="{channellogoexisis}" imagetype="channellogo" path="{channelid}" x="1%" y="30%" width="{areaheight}*0.5" height="{areaheight}*0.5" /> + <drawtext condition="not{channellogoexisis}" x="1%" width="{areaheight}*0.7" y="40%" font="{light}" fontsize="20%" color="{clrWhite}" text="{channelname}"/> + <drawtext x="{areaheight}*0.8" y="36%" font="{light}" fontsize="25%" color="{clrWhite}" text="{eventstart} - {eventstop} (Rec. {timerstart} - {timerstop}), Transp. {channeltransponder}"/> + <drawtext x="{areaheight}*0.8" y="57%" width="{areawidth}-{areaheight}" font="{light}" fontsize="25%" color="{clrWhite}" text="{eventtitle} - {eventshorttext}"/> + </area> + </areacontainer> <!-- Timeline Timer {timelinetimer} true {timerstart} start of timer in tenth percent of complete 24h width {timerwidth} width of timer in tenth percent of complete 24h width --> - <area condition="{timelinetimer}" layer="5"> - <drawrectangle condition="{current}" x="5%" y="0" width="90%" height="100%" color="{clrTransBlueLight}"/> - <drawrectangle condition="not{current}" x="5%" y="0" width="90%" height="100%" color="{clrDarkGray}"/> - <drawrectangle x="5%" y="{areaheight}-1" width="90%" height="1" color="{clrBlack}"/> - </area> - <area condition="{timelinetimer}" layer="6"> - <drawrectangle x="{areawidth}*0.05 + {timerstart}*{areawidth}*0.9/1000" y="25%" width="{timerwidth}*{areawidth}*0.9/1000" height="50%" color="{clrBlack}"/> - </area> + <areacontainer condition="{timelinetimer}"> + <area layer="5"> + <drawrectangle condition="{current}" x="5%" y="0" width="90%" height="100%" color="{clrTransBlueLight}"/> + <drawrectangle condition="not{current}" x="5%" y="0" width="90%" height="100%" color="{clrDarkGray}"/> + <drawrectangle x="5%" y="{areaheight}-1" width="90%" height="1" color="{clrBlack}"/> + </area> + <area layer="6"> + <drawrectangle x="{areawidth}*0.05 + {timerstart}*{areawidth}*0.9/1000" y="25%" width="{timerwidth}*{areawidth}*0.9/1000" height="50%" color="{clrBlack}"/> + </area> + </areacontainer> <!-- Favorites {favorite} true {favdesc} description of favorite diff --git a/views/view.c b/views/view.c index 98fe38e..c6111c5 100644 --- a/views/view.c +++ b/views/view.c @@ -130,68 +130,91 @@ void cView::DrawViewElement(eViewElement ve, map <string,string> *stringTokens, int pixCurrent = viewElement->GetPixOffset();
if (pixCurrent < 0)
return;
- viewElement->InitIterator();
- cTemplatePixmap *pix = NULL;
- while(pix = viewElement->GetNextPixmap()) {
- //check if already drawn background area, this can be skipped
- if (PixmapExists(pixCurrent) && pix->BackgroundArea()) {
- pixCurrent++;
- continue;
- }
- //reset Template
- pix->ClearDynamicParameters();
- //create Pixmap if already fully parsed
- if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
- CreateViewPixmap(pixCurrent, pix);
- }
- //check if pixmap needs dynamic parameters
- if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) {
- //parse dynamic parameters and initiate functions
- pix->ParseDynamicParameters(stringTokens, intTokens, true);
- if (pix->Ready() && pix->DoExecute()) {
- CreateViewPixmap(pixCurrent, pix);
- }
+ viewElement->InitPixmapNodeIterator();
+ cTemplatePixmapNode *pixNode = NULL;
+ while(pixNode = viewElement->GetNextPixmapNode()) {
+ cTemplatePixmap *pix = dynamic_cast<cTemplatePixmap*>(pixNode);
+ if (pix) {
+ bool draw = PreparePixmap(ve, pixCurrent, pix, stringTokens, intTokens, loopTokens);
+ if (draw)
+ DrawPixmap(pixCurrent, pix, loopTokens);
+ pixCurrent++;
} else {
- //parse dynamic parameters but not initiate functions
- pix->ParseDynamicParameters(stringTokens, intTokens, false);
- }
- //if pixmap still not valid, skip
- if (!pix->Ready() && !pix->Scrolling()) {
- pixCurrent++;
- continue;
- }
- //if condition for pixmap set, check if cond is true
- if (!pix->DoExecute()) {
- pixCurrent++;
- continue;
- }
- //parse dynamic tokens of pixmap functions
- pix->ClearDynamicFunctionParameters();
- pix->ParseDynamicFunctionParameters(stringTokens, intTokens, loopTokens);
-
- if (!PixmapExists(pixCurrent) && pix->Scrolling()) {
- cSize drawportSize;
- scrolling = pix->CalculateDrawPortSize(drawportSize, loopTokens);
- if (scrolling) {
- CreateScrollingPixmap(pixCurrent, pix, drawportSize);
- pix->SetScrollingTextWidth();
- veScroll = ve;
- scrollingPix = pixCurrent;
- scrollOrientation = pix->GetNumericParameter(ptOrientation);
- scrollMode = pix->GetNumericParameter(ptScrollMode);
- scrollDelay = pix->GetNumericParameter(ptDelay);
- scrollSpeed = pix->GetNumericParameter(ptScrollSpeed);
- } else {
- CreateViewPixmap(pixCurrent, pix);
+ cTemplatePixmapContainer *pixContainer = dynamic_cast<cTemplatePixmapContainer*>(pixNode);
+ pixContainer->ParseDynamicParameters(stringTokens, intTokens);
+ if (pixContainer->DoDebug()) {
+ pixContainer->Debug();
+ }
+ if (!pixContainer->DoExecute()) {
+ pixCurrent += pixContainer->NumPixmaps();
+ continue;
+ }
+ pixContainer->InitIterator();
+ cTemplatePixmap *pix = NULL;
+ while (pix = pixContainer->GetNextPixmap()) {
+ bool draw = PreparePixmap(ve, pixCurrent, pix, stringTokens, intTokens, loopTokens);
+ if (draw)
+ DrawPixmap(pixCurrent, pix, loopTokens);
+ pixCurrent++;
}
}
- if (pix->DoDebug()) {
- pix->Debug();
+ }
+}
+
+bool cView::PreparePixmap(eViewElement ve, int num, cTemplatePixmap *pix, map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens) {
+ //check if already drawn background area, this can be skipped
+ if (PixmapExists(num) && pix->BackgroundArea()) {
+ return false;
+ }
+ //reset Template
+ pix->ClearDynamicParameters();
+ //create Pixmap if already fully parsed
+ if (!PixmapExists(num) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
+ CreateViewPixmap(num, pix);
+ }
+ //check if pixmap needs dynamic parameters
+ if ((!pix->Ready() || !pix->DoExecute()) && !pix->Scrolling()) {
+ //parse dynamic parameters and initiate functions
+ pix->ParseDynamicParameters(stringTokens, intTokens, true);
+ if (pix->Ready() && pix->DoExecute()) {
+ CreateViewPixmap(num, pix);
}
-
- DrawPixmap(pixCurrent, pix, loopTokens);
- pixCurrent++;
+ } else {
+ //parse dynamic parameters but not initiate functions
+ pix->ParseDynamicParameters(stringTokens, intTokens, false);
+ }
+ //if pixmap still not valid, skip
+ if (!pix->Ready() && !pix->Scrolling()) {
+ return false;
}
+ //if condition for pixmap set, check if cond is true
+ if (!pix->DoExecute()) {
+ return false;
+ }
+ //parse dynamic tokens of pixmap functions
+ pix->ClearDynamicFunctionParameters();
+ pix->ParseDynamicFunctionParameters(stringTokens, intTokens, loopTokens);
+
+ if (!PixmapExists(num) && pix->Scrolling()) {
+ cSize drawportSize;
+ scrolling = pix->CalculateDrawPortSize(drawportSize, loopTokens);
+ if (scrolling) {
+ CreateScrollingPixmap(num, pix, drawportSize);
+ pix->SetScrollingTextWidth();
+ veScroll = ve;
+ scrollingPix = num;
+ scrollOrientation = pix->GetNumericParameter(ptOrientation);
+ scrollMode = pix->GetNumericParameter(ptScrollMode);
+ scrollDelay = pix->GetNumericParameter(ptDelay);
+ scrollSpeed = pix->GetNumericParameter(ptScrollSpeed);
+ } else {
+ CreateViewPixmap(num, pix);
+ }
+ }
+ if (pix->DoDebug()) {
+ pix->Debug();
+ }
+ return true;
}
void cView::ClearViewElement(eViewElement ve) {
@@ -217,7 +240,7 @@ void cView::ClearViewElement(eViewElement ve) { if (pixCurrent < 0)
return;
cTemplatePixmap *pix = NULL;
- viewElement->InitIterator();
+ viewElement->InitPixmapIterator();
while(pix = viewElement->GetNextPixmap()) {
if (!pix->BackgroundArea()) {
Fill(pixCurrent, clrTransparent);
@@ -237,7 +260,7 @@ void cView::DestroyViewElement(eViewElement ve) { if (pixCurrent < 0)
return;
cTemplatePixmap *pix = NULL;
- viewElement->InitIterator();
+ viewElement->InitPixmapIterator();
while(pix = viewElement->GetNextPixmap()) {
DestroyPixmap(pixCurrent);
pixCurrent++;
@@ -299,7 +322,7 @@ void cView::ActivateScrolling(void) { int pixCurrent = scrollViewElement->GetPixOffset();
if (pixCurrent < 0)
return;
- scrollViewElement->InitIterator();
+ scrollViewElement->InitPixmapIterator();
cTemplatePixmap *pix = NULL;
while(pix = scrollViewElement->GetNextPixmap()) {
DrawPixmap(pixCurrent, pix);
@@ -376,7 +399,7 @@ void cView::CreateScrollingPixmap(int num, cTemplatePixmap *pix, cSize &drawport }
void cView::DrawPixmap(int num, cTemplatePixmap *pix, map < string, vector< map< string, string > > > *loopTokens, bool flushPerLoop) {
- pix->InitIterator();
+ pix->InitFunctionIterator();
cTemplateFunction *func = NULL;
while(func = pix->GetNextFunction()) {
eFuncType type = func->GetType();
@@ -1200,61 +1223,88 @@ cRect cViewListItem::DrawListItem(map <string,string> *stringTokens, map <string DebugTokens("ListItem", stringTokens, intTokens);
}
- tmplViewElement->InitIterator();
- cTemplatePixmap *pix = NULL;
+ tmplViewElement->InitPixmapIterator();
int pixCurrent = 0;
-
- while(pix = tmplViewElement->GetNextPixmap()) {
- SetListElementPosition(pix);
- if (pixCurrent == 0) {
- posItem = pix->GetPixmapSize();
- }
- if (!PixmapExists(pixCurrent)) {
- pix->ParseDynamicParameters(stringTokens, intTokens, true);
+ cTemplatePixmapNode *pixNode = NULL;
+ while(pixNode = tmplViewElement->GetNextPixmapNode()) {
+ cTemplatePixmap *pix = dynamic_cast<cTemplatePixmap*>(pixNode);
+ if (pix) {
+ SetListElementPosition(pix);
+ if (pixCurrent == 0) {
+ posItem = pix->GetPixmapSize();
+ }
+ bool draw = PrepareListItemPixmap(pixCurrent, pix, stringTokens, intTokens);
+ if (draw) {
+ DrawPixmap(pixCurrent, pix);
+ }
+ pixCurrent++;
} else {
- pix->ParseDynamicParameters(stringTokens, intTokens, false);
- }
- if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
- CreateViewPixmap(pixCurrent, pix);
- }
- //if pixmap still not valid, skip
- if (!pix->Ready() && !pix->Scrolling()) {
- pixCurrent++;
- continue;
- }
- //if condition for pixmap set, check if cond is true
- if (!pix->DoExecute()) {
- pixCurrent++;
- continue;
- }
-
- pix->ClearDynamicFunctionParameters();
- pix->ParseDynamicFunctionParameters(stringTokens, intTokens, NULL);
-
- if (!PixmapExists(pixCurrent) && pix->Scrolling()) {
- cSize drawportSize;
- scrolling = pix->CalculateDrawPortSize(drawportSize);
- pix->SetScrollingTextWidth();
- if (scrolling) {
- CreateScrollingPixmap(pixCurrent, pix, drawportSize);
- scrollingPix = pixCurrent;
- scrollOrientation = pix->GetNumericParameter(ptOrientation);
- scrollMode = pix->GetNumericParameter(ptScrollMode);
- scrollDelay = pix->GetNumericParameter(ptDelay);
- scrollSpeed = pix->GetNumericParameter(ptScrollSpeed);
- } else {
- CreateViewPixmap(pixCurrent, pix);
+ cTemplatePixmapContainer *pixContainer = dynamic_cast<cTemplatePixmapContainer*>(pixNode);
+ pixContainer->ParseDynamicParameters(stringTokens, intTokens);
+ if (pixContainer->DoDebug()) {
+ pixContainer->Debug();
+ }
+ if (!pixContainer->DoExecute()) {
+ pixCurrent += pixContainer->NumPixmaps();
+ continue;
+ }
+ pixContainer->InitIterator();
+ cTemplatePixmap *pix = NULL;
+ while (pix = pixContainer->GetNextPixmap()) {
+ SetListElementPosition(pix);
+ bool draw = PrepareListItemPixmap(pixCurrent, pix, stringTokens, intTokens);
+ if (draw) {
+ DrawPixmap(pixCurrent, pix);
+ }
+ pixCurrent++;
}
}
- if (pix->DoDebug()) {
- pix->Debug();
- }
- DrawPixmap(pixCurrent, pix);
- pixCurrent++;
}
return posItem;
}
+bool cViewListItem::PrepareListItemPixmap(int num, cTemplatePixmap *pix, map <string,string> *stringTokens, map <string,int> *intTokens) {
+ if (!PixmapExists(num)) {
+ pix->ParseDynamicParameters(stringTokens, intTokens, true);
+ } else {
+ pix->ParseDynamicParameters(stringTokens, intTokens, false);
+ }
+ if (!PixmapExists(num) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
+ CreateViewPixmap(num, pix);
+ }
+ //if pixmap still not valid, skip
+ if (!pix->Ready() && !pix->Scrolling()) {
+ return false;
+ }
+ //if condition for pixmap set, check if cond is true
+ if (!pix->DoExecute()) {
+ return false;
+ }
+
+ pix->ClearDynamicFunctionParameters();
+ pix->ParseDynamicFunctionParameters(stringTokens, intTokens, NULL);
+
+ if (!PixmapExists(num) && pix->Scrolling()) {
+ cSize drawportSize;
+ scrolling = pix->CalculateDrawPortSize(drawportSize);
+ pix->SetScrollingTextWidth();
+ if (scrolling) {
+ CreateScrollingPixmap(num, pix, drawportSize);
+ scrollingPix = num;
+ scrollOrientation = pix->GetNumericParameter(ptOrientation);
+ scrollMode = pix->GetNumericParameter(ptScrollMode);
+ scrollDelay = pix->GetNumericParameter(ptDelay);
+ scrollSpeed = pix->GetNumericParameter(ptScrollSpeed);
+ } else {
+ CreateViewPixmap(num, pix);
+ }
+ }
+ if (pix->DoDebug()) {
+ pix->Debug();
+ }
+ return true;
+}
+
void cViewListItem::ClearListItem(void) {
int pixMax = NumPixmaps();
for (int pixCurrent = 0; pixCurrent < pixMax; pixCurrent++) {
@@ -1352,7 +1402,7 @@ void cGrid::SetCurrent(bool current) { void cGrid::Move(void) {
if (!tmplViewElement)
return;
- tmplViewElement->InitIterator();
+ tmplViewElement->InitPixmapIterator();
cTemplatePixmap *pix = NULL;
int pixCurrent = 0;
@@ -1374,42 +1424,73 @@ void cGrid::Draw(void) { DebugTokens("Grid", &stringTokens, &intTokens);
}
- tmplViewElement->InitIterator();
- cTemplatePixmap *pix = NULL;
+ tmplViewElement->InitPixmapIterator();
int pixCurrent = 0;
-
- while(pix = tmplViewElement->GetNextPixmap()) {
- PositionPixmap(pix);
- if (!PixmapExists(pixCurrent)) {
- pix->ParseDynamicParameters(&stringTokens, &intTokens, true);
- } else {
- pix->ParseDynamicParameters(&stringTokens, &intTokens, false);
- }
- if (!PixmapExists(pixCurrent) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
- CreateViewPixmap(pixCurrent, pix);
- }
- //if pixmap still not valid, skip
- if (!pix->Ready() && !pix->Scrolling()) {
- pixCurrent++;
- continue;
- }
- //if condition for pixmap set, check if cond is true
- if (!pix->DoExecute()) {
+ cTemplatePixmapNode *pixNode = NULL;
+ while(pixNode = tmplViewElement->GetNextPixmapNode()) {
+ cTemplatePixmap *pix = dynamic_cast<cTemplatePixmap*>(pixNode);
+ if (pix) {
+ PositionPixmap(pix);
+ bool draw = PrepareGridPixmap(pixCurrent, pix);
+ if (pix->DoDebug())
+ pix->Debug();
+ if (draw) {
+ DrawPixmap(pixCurrent, pix);
+ }
pixCurrent++;
- continue;
+ } else {
+ cTemplatePixmapContainer *pixContainer = dynamic_cast<cTemplatePixmapContainer*>(pixNode);
+ pixContainer->ParseDynamicParameters(&stringTokens, &intTokens);
+ if (pixContainer->DoDebug()) {
+ pixContainer->Debug();
+ }
+ if (!pixContainer->DoExecute()) {
+ pixCurrent += pixContainer->NumPixmaps();
+ continue;
+ }
+ pixContainer->InitIterator();
+ cTemplatePixmap *pix = NULL;
+ while (pix = pixContainer->GetNextPixmap()) {
+ PositionPixmap(pix);
+ bool draw = PrepareGridPixmap(pixCurrent, pix);
+ if (pix->DoDebug())
+ pix->Debug();
+ if (draw) {
+ DrawPixmap(pixCurrent, pix);
+ }
+ pixCurrent++;
+ }
+
+
}
-
- pix->ClearDynamicFunctionParameters();
- pix->ParseDynamicFunctionParameters(&stringTokens, &intTokens, NULL);
- //pix->Debug();
- DrawPixmap(pixCurrent, pix);
- pixCurrent++;
}
dirty = false;
resized = false;
moved = false;
}
+bool cGrid::PrepareGridPixmap(int num, cTemplatePixmap *pix) {
+ if (!PixmapExists(num)) {
+ pix->ParseDynamicParameters(&stringTokens, &intTokens, true);
+ } else {
+ pix->ParseDynamicParameters(&stringTokens, &intTokens, false);
+ }
+ if (!PixmapExists(num) && pix->Ready() && pix->DoExecute() && !pix->Scrolling()) {
+ CreateViewPixmap(num, pix);
+ }
+ //if pixmap still not valid, skip
+ if (!pix->Ready() && !pix->Scrolling()) {
+ return false;
+ }
+ //if condition for pixmap set, check if cond is true
+ if (!pix->DoExecute()) {
+ return false;
+ }
+ pix->ClearDynamicFunctionParameters();
+ pix->ParseDynamicFunctionParameters(&stringTokens, &intTokens, NULL);
+ return true;
+}
+
void cGrid::Clear(void) {
int pixMax = NumPixmaps();
for (int pixCurrent = 0; pixCurrent < pixMax; pixCurrent++) {
diff --git a/views/view.h b/views/view.h index ccdc14c..8211028 100644 --- a/views/view.h +++ b/views/view.h @@ -56,6 +56,7 @@ protected: int scrollSpeed;
int animCat;
void DrawViewElement(eViewElement ve, map <string,string> *stringTokens = NULL, map <string,int> *intTokens = NULL, map < string, vector< map< string, string > > > *loopTokens = NULL);
+ bool PreparePixmap(eViewElement ve, int num, cTemplatePixmap *pix, map <string,string> *stringTokens, map <string,int> *intTokens, map < string, vector< map< string, string > > > *loopTokens);
void ClearViewElement(eViewElement ve);
void DestroyViewElement(eViewElement ve);
void DestroyDetachedViewElement(eViewElement ve);
@@ -112,6 +113,7 @@ protected: int align;
int listOrientation;
void SetListElementPosition(cTemplatePixmap *pix);
+ bool PrepareListItemPixmap(int num, cTemplatePixmap *pix, map <string,string> *stringTokens, map <string,int> *intTokens);
public:
cViewListItem(cTemplateViewElement *tmplItem);
virtual ~cViewListItem();
@@ -132,6 +134,7 @@ protected: map <string,string> stringTokens;
map <string,int> intTokens;
void PositionPixmap(cTemplatePixmap *pix);
+ bool PrepareGridPixmap(int num, cTemplatePixmap *pix);
public:
cGrid(cTemplateViewElement *tmplGrid);
virtual ~cGrid();
diff --git a/views/viewhelpers.c b/views/viewhelpers.c index 8643753..972c607 100644 --- a/views/viewhelpers.c +++ b/views/viewhelpers.c @@ -221,7 +221,8 @@ bool cViewHelpers::SetSystemMemory(bool forced, stringmap &stringTokens, intmap bool cViewHelpers::SetSystemTemperatures(bool forced, stringmap &stringTokens, intmap &intTokens) { cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/temperatures\"", SCRIPTFOLDER, SCRIPTFOLDER); - system(*execCommand); + int ok = system(*execCommand); + if (ok) {} string tempCPU, tempGPU; int cpu, gpu; @@ -261,7 +262,8 @@ bool cViewHelpers::SetSystemTemperatures(bool forced, stringmap &stringTokens, i bool cViewHelpers::SetVDRStats(bool forced, stringmap &stringTokens, intmap &intTokens) { cString execCommand = cString::sprintf("cd \"%s/\"; \"%s/vdrstats\"", SCRIPTFOLDER, SCRIPTFOLDER); - system(*execCommand); + int ok = system(*execCommand); + if (ok) {} string vdrCPU = ""; string vdrMEM = ""; diff --git a/views/viewhelpers.h b/views/viewhelpers.h index c66b6f6..7dc191e 100644 --- a/views/viewhelpers.h +++ b/views/viewhelpers.h @@ -5,6 +5,7 @@ typedef map<string,string> stringmap; typedef map<string,int> intmap; +typedef pair<string,string> stringpair; class cViewHelpers { private: |