diff options
| author | louis <louis.braun@gmx.de> | 2015-03-31 16:08:42 +0200 |
|---|---|---|
| committer | louis <louis.braun@gmx.de> | 2015-03-31 16:08:42 +0200 |
| commit | 203754e2047998185a177b177c5c46ccb265318e (patch) | |
| tree | d2f86a51b39526f34ef39cc452fc1e2623d5b204 | |
| parent | 43422fac91d7c67d1cb69e2add4abce49e89ca90 (diff) | |
| download | vdr-plugin-skindesigner-203754e2047998185a177b177c5c46ccb265318e.tar.gz vdr-plugin-skindesigner-203754e2047998185a177b177c5c46ccb265318e.tar.bz2 | |
added viewelement <sortmode> in displaymenu to display the sort mode of the currently displayed menu
| -rw-r--r-- | HISTORY | 3 | ||||
| -rw-r--r-- | displaymenu.c | 6 | ||||
| -rw-r--r-- | displaymenu.h | 1 | ||||
| -rw-r--r-- | dtd/displaymenu.dtd | 22 | ||||
| -rw-r--r-- | libtemplate/templateview.c | 17 | ||||
| -rw-r--r-- | libtemplate/templateviewelement.h | 1 | ||||
| -rw-r--r-- | skins/blackhole/xmlfiles/displaymenu.xml | 16 | ||||
| -rw-r--r-- | skins/metrixhd/xmlfiles/displaymenu.xml | 15 | ||||
| -rw-r--r-- | skinskeleton/xmlfiles/displaymenu.xml | 8 | ||||
| -rw-r--r-- | views/displaymenurootview.c | 52 | ||||
| -rw-r--r-- | views/displaymenurootview.h | 5 | ||||
| -rw-r--r-- | views/displaymenuview.c | 34 | ||||
| -rw-r--r-- | views/displaymenuview.h | 14 |
13 files changed, 175 insertions, 19 deletions
@@ -248,5 +248,8 @@ Version 0.3.3 - translate drawtextvertical - added viewelement <endtime> in displayreplay to display the time the currently replayed recording ends +- added viewelement <sortmode> in displaymenu to display the sort + mode of the currently displayed menu. <sortmode> can be used in + any list menu, implementation in displaymenu.xml is default diff --git a/displaymenu.c b/displaymenu.c index 9cfe2b7..c1c83d5 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -56,6 +56,12 @@ void cSDDisplayMenu::SetMenuCategory(eMenuCategory MenuCat) { state = vsMenuInit; } +void cSDDisplayMenu::SetMenuSortMode(eMenuSortMode MenuSortMode) { + if (!doOutput) + return; + rootView->SetSortMode(MenuSortMode); +} + void cSDDisplayMenu::SetPluginMenu(string name, int menu, int type, bool init) { pluginName = name; pluginMenu = menu; diff --git a/displaymenu.h b/displaymenu.h index 850b7e9..c30ce17 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -30,6 +30,7 @@ public: virtual int MaxItems(void); virtual void Clear(void); virtual void SetMenuCategory(eMenuCategory MenuCat); + virtual void SetMenuSortMode(eMenuSortMode MenuSortMode); virtual void SetPluginMenu(string name, int menu, int type, bool init); virtual void SetTitle(const char *Title); virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL); diff --git a/dtd/displaymenu.dtd b/dtd/displaymenu.dtd index ead958c..a8aa362 100644 --- a/dtd/displaymenu.dtd +++ b/dtd/displaymenu.dtd @@ -2,7 +2,7 @@ <!ENTITY % functions SYSTEM "functions.dtd">
-<!ELEMENT displaymenu (background,header,datetime,time*,message,colorbuttons,
+<!ELEMENT displaymenu (background,header,datetime,time*,message,sortmode*,colorbuttons,
menudefault,menumain*,menusetup*,menuschedules*,
menutimers*,menuchannels*,menurecordings*,
menudetailedepg,menudetailedrecording,
@@ -45,6 +45,12 @@ condition CDATA #IMPLIED
>
+<!ELEMENT sortmode (area|areascroll)*>
+<!ATTLIST sortmode
+ debug CDATA #IMPLIED
+ condition CDATA #IMPLIED
+>
+
<!ELEMENT colorbuttons (area|areascroll)*>
<!ATTLIST colorbuttons
debug CDATA #IMPLIED
@@ -159,7 +165,7 @@ condition CDATA #IMPLIED
>
-<!ELEMENT menudefault (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menudefault (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menudefault
x CDATA #REQUIRED
y CDATA #REQUIRED
@@ -172,7 +178,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menumain (background | header | datetime | time | colorbuttons | scrollbar | timers |
+<!ELEMENT menumain (background | header | datetime | time | colorbuttons | scrollbar | sortmode | timers |
discusage | devices | systemload | systemmemory | temperatures | currentschedule |
currentweather | lastrecordings | customtokens | menuitems)*>
<!ATTLIST menumain
@@ -187,7 +193,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menusetup (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menusetup (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menusetup
x CDATA #REQUIRED
y CDATA #REQUIRED
@@ -200,7 +206,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menuschedules (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menuschedules (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menuschedules
x CDATA #REQUIRED
y CDATA #REQUIRED
@@ -213,7 +219,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menutimers (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menutimers (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menutimers
x CDATA #REQUIRED
y CDATA #REQUIRED
@@ -226,7 +232,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menuchannels (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menuchannels (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menuchannels
x CDATA #REQUIRED
y CDATA #REQUIRED
@@ -239,7 +245,7 @@ scaletvheight CDATA #IMPLIED
>
-<!ELEMENT menurecordings (background | header | datetime | time | colorbuttons | scrollbar | menuitems)*>
+<!ELEMENT menurecordings (background | header | datetime | time | colorbuttons | scrollbar | sortmode | menuitems)*>
<!ATTLIST menurecordings
x CDATA #REQUIRED
y CDATA #REQUIRED
diff --git a/libtemplate/templateview.c b/libtemplate/templateview.c index 380c965..b20796f 100644 --- a/libtemplate/templateview.c +++ b/libtemplate/templateview.c @@ -1123,17 +1123,6 @@ cTemplateViewMenu::cTemplateViewMenu(void) { attributes.insert("scaletvheight"); funcsAllowed.insert(pair< string, set<string> >(subViewName, attributes)); - //definition of allowed parameters for timerlist viewlist - attributes.clear(); - attributes.insert("x"); - attributes.insert("y"); - attributes.insert("width"); - attributes.insert("height"); - attributes.insert("orientation"); - attributes.insert("align"); - attributes.insert("numlistelements"); - funcsAllowed.insert(pair< string, set<string> >("timerlist", attributes)); - //definition of allowed parameters for menuitems viewlist attributes.clear(); attributes.insert("x"); @@ -1209,6 +1198,7 @@ void cTemplateViewMenu::SetViewElements(void) { viewElementsAllowed.insert("header"); viewElementsAllowed.insert("colorbuttons"); viewElementsAllowed.insert("message"); + viewElementsAllowed.insert("sortmode"); viewElementsAllowed.insert("discusage"); viewElementsAllowed.insert("systemload"); viewElementsAllowed.insert("systemmemory"); @@ -1290,6 +1280,9 @@ string cTemplateViewMenu::GetViewElementName(eViewElement ve) { case veMessage: name = "Message"; break; + case veSortMode: + name = "Sort Mode"; + break; case veDiscUsage: name = "Disc Usage"; break; @@ -1419,6 +1412,8 @@ void cTemplateViewMenu::AddPixmap(string sViewElement, cTemplatePixmap *pix, vec ve = veButtons; } else if (!sViewElement.compare("message")) { ve = veMessage; + } else if (!sViewElement.compare("sortmode")) { + ve = veSortMode; } else if (!sViewElement.compare("discusage")) { ve = veDiscUsage; } else if (!sViewElement.compare("systemload")) { diff --git a/libtemplate/templateviewelement.h b/libtemplate/templateviewelement.h index 6d3b921..93ef28a 100644 --- a/libtemplate/templateviewelement.h +++ b/libtemplate/templateviewelement.h @@ -25,6 +25,7 @@ enum eViewElement { veDateTime,
veTime,
veMessage,
+ veSortMode,
veDevices,
veCurrentWeather,
veCustomTokens,
diff --git a/skins/blackhole/xmlfiles/displaymenu.xml b/skins/blackhole/xmlfiles/displaymenu.xml index 04a3838..22e80a5 100644 --- a/skins/blackhole/xmlfiles/displaymenu.xml +++ b/skins/blackhole/xmlfiles/displaymenu.xml @@ -105,6 +105,22 @@ <drawtext align="center" valign="center" font="{regular}" fontsize="40%" color="{clrWhite}" text="{text}" /> </area> </message> + + <!-- Available Variables sortmode: + {sortnumber} true if menu is sorted by number + {sortname} true if menu is sorted alphabetical + {sorttime} true if menu is sorted by time + {sortprovider} true if menu is sorted by provider + --> + <sortmode> + <area x="44%" y="1%" width="6%" height="6%" layer="3"> + <drawimage condition="{sortnumber}" imagetype="icon" path="ico_sort_number" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sortname}" imagetype="icon" path="ico_sort_name" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sorttime}" imagetype="icon" path="ico_sort_time" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sortprovider}" imagetype="icon" path="ico_sort_provider" x="0" y="0" width="100%" height="100%"/> + </area> + </sortmode> + <!-- Available Variables colorbuttons: {red1} true if red button is button 1 {red2} true if red button is button 2 diff --git a/skins/metrixhd/xmlfiles/displaymenu.xml b/skins/metrixhd/xmlfiles/displaymenu.xml index d51cfbf..1389bef 100644 --- a/skins/metrixhd/xmlfiles/displaymenu.xml +++ b/skins/metrixhd/xmlfiles/displaymenu.xml @@ -84,6 +84,21 @@ <drawtext align="center" valign="center" font="{light}" fontsize="50%" color="{clrWhite}" text="{text}" /> </area> </message> + + <!-- Available Variables sortmode: + {sortnumber} true if menu is sorted by number + {sortname} true if menu is sorted alphabetical + {sorttime} true if menu is sorted by time + {sortprovider} true if menu is sorted by provider + --> + <sortmode> + <area x="35%" y="2%" width="6%" height="6%" layer="4"> + <drawimage condition="{sortnumber}" imagetype="icon" path="ico_sort_number" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sortname}" imagetype="icon" path="ico_sort_name" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sorttime}" imagetype="icon" path="ico_sort_time" x="0" y="0" width="100%" height="100%"/> + <drawimage condition="{sortprovider}" imagetype="icon" path="ico_sort_provider" x="0" y="0" width="100%" height="100%"/> + </area> + </sortmode> <!-- Available Variables colorbuttons: {red1} true if red button is button 1 {red2} true if red button is button 2 diff --git a/skinskeleton/xmlfiles/displaymenu.xml b/skinskeleton/xmlfiles/displaymenu.xml index 1a31df0..0962e99 100644 --- a/skinskeleton/xmlfiles/displaymenu.xml +++ b/skinskeleton/xmlfiles/displaymenu.xml @@ -55,6 +55,14 @@ --> <time> </time> + <!-- Available Variables sortmode: + {sortnumber} true if menu is sorted by number + {sortname} true if menu is sorted alphabetical + {sorttime} true if menu is sorted by time + {sortprovider} true if menu is sorted by provider + --> + <sortmode> + </sortmode> <!-- Available Variables message: {text} message text {status} true if message is an status message diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c index efe7816..3455d09 100644 --- a/views/displaymenurootview.c +++ b/views/displaymenurootview.c @@ -7,6 +7,8 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) { cat = mcUndefined; + sortMode = msmUnknown; + sortModeLast = msmUnknown; menuTitle = ""; viewType = svUndefined; subView = NULL; @@ -27,6 +29,7 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root defaultButtonsDrawn = false; defaultDateTimeDrawn = false; defaultMessageDrawn = false; + defaultSortmodeDrawn = false; DeleteOsdOnExit(); SetFadeTime(tmplView->GetNumericParameter(ptFadeTime)); } @@ -212,6 +215,13 @@ void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) { } } +void cDisplayMenuRootView::SetSortMode(eMenuSortMode sortMode) { + this->sortMode = sortMode; + if (!view) + return; + view->SetSortMode(sortMode); +} + void cDisplayMenuRootView::CorrectDefaultMenu(void) { if (viewType > svMenuDefault && viewType != svMenuPlugin) { SetMenu(mcUnknown, true); @@ -355,6 +365,8 @@ void cDisplayMenuRootView::ClearRootView(void) { ClearViewElement(veDateTime); if (defaultMessageDrawn) ClearViewElement(veMessage); + if (defaultSortmodeDrawn) + ClearViewElement(veSortMode); } int cDisplayMenuRootView::GetMaxItems(void) { @@ -417,6 +429,13 @@ void cDisplayMenuRootView::Render(void) { defaultHeaderDrawn = false; } + if (!view->DrawSortMode()) { + defaultSortmodeDrawn = true; + DrawSortMode(); + } else { + defaultSortmodeDrawn = false; + } + if (!view->DrawColorButtons()) { defaultButtonsDrawn = true; DrawColorButtons(); @@ -476,6 +495,7 @@ void cDisplayMenuRootView::DrawBackground(void) { map < string, int > intTokens; DrawViewElement(veBackground, &stringTokens, &intTokens); } + void cDisplayMenuRootView::DrawHeader(void) { if (!ExecuteViewElement(veHeader)) { return; @@ -520,6 +540,38 @@ bool cDisplayMenuRootView::DrawTime(void) { return true; } +void cDisplayMenuRootView::DrawSortMode(void) { + if (!ExecuteViewElement(veSortMode)) { + return; + } + if (sortMode == msmUnknown) { + if (sortModeLast != msmUnknown) + ClearViewElement(veSortMode); + sortModeLast = msmUnknown; + return; + } + if (sortMode == sortModeLast) { + return; + } + sortModeLast = sortMode; + + map < string, string > stringTokens; + map < string, int > intTokens; + + bool sortNumber = (sortMode == msmNumber) ? true : false; + bool sortName = (sortMode == msmName) ? true : false; + bool sortTime = (sortMode == msmTime) ? true : false; + bool sortProvider = (sortMode == msmProvider) ? true : false; + + intTokens.insert(pair<string, int>("sortnumber", sortNumber)); + intTokens.insert(pair<string, int>("sortname", sortName)); + intTokens.insert(pair<string, int>("sorttime", sortTime)); + intTokens.insert(pair<string, int>("sortprovider", sortProvider)); + + ClearViewElement(veSortMode); + DrawViewElement(veSortMode, &stringTokens, &intTokens); + return; +} void cDisplayMenuRootView::DrawColorButtons(void) { if (!ExecuteViewElement(veButtons)) { diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h index b9c8c81..f636d90 100644 --- a/views/displaymenurootview.h +++ b/views/displaymenurootview.h @@ -15,6 +15,8 @@ enum ePluginMenuType { class cDisplayMenuRootView : public cView, public cViewHelpers { private: eMenuCategory cat; + eMenuSortMode sortMode; + eMenuSortMode sortModeLast; eSubView viewType; cTemplateView *subView; bool subViewAvailable; @@ -32,10 +34,12 @@ private: bool defaultButtonsDrawn; bool defaultDateTimeDrawn; bool defaultMessageDrawn; + bool defaultSortmodeDrawn; void DrawBackground(void); void DrawHeader(void); void DrawDateTime(void); bool DrawTime(void); + void DrawSortMode(void); void DrawColorButtons(void); void DrawMessage(eMessageType type, const char *text); void ClearRootView(void); @@ -45,6 +49,7 @@ public: virtual ~cDisplayMenuRootView(); bool createOsd(void); void SetMenu(eMenuCategory menuCat, bool menuInit); + void SetSortMode(eMenuSortMode sortMode); void CorrectDefaultMenu(void); void SetPluginMenu(string name, int menu, int type); void SetTitle(const char *title); diff --git a/views/displaymenuview.c b/views/displaymenuview.c index 408c088..88192fa 100644 --- a/views/displaymenuview.c +++ b/views/displaymenuview.c @@ -13,6 +13,8 @@ cDisplayMenuView::cDisplayMenuView(cTemplateView *tmplView, bool menuInit) : cVi else SetFadeTime(0); cat = mcUndefined; + sortMode = msmUnknown; + sortModeLast = msmUnknown; buttonTexts = NULL; } @@ -175,6 +177,38 @@ void cDisplayMenuView::DrawScrollbar(int numMax, int numDisplayed, int offset) { DrawViewElement(veScrollbar, &stringTokens, &intTokens); } +bool cDisplayMenuView::DrawSortMode(void) { + if (!ExecuteViewElement(veSortMode)) { + return false; + } + if (sortMode == msmUnknown) { + if (sortModeLast != msmUnknown) + ClearViewElement(veSortMode); + sortModeLast = msmUnknown; + return true; + } + if (sortMode == sortModeLast) + return true; + sortModeLast = sortMode; + + map < string, string > stringTokens; + map < string, int > intTokens; + + bool sortNumber = (sortMode == msmNumber) ? true : false; + bool sortName = (sortMode == msmName) ? true : false; + bool sortTime = (sortMode == msmTime) ? true : false; + bool sortProvider = (sortMode == msmProvider) ? true : false; + + intTokens.insert(pair<string, int>("sortnumber", sortNumber)); + intTokens.insert(pair<string, int>("sortname", sortName)); + intTokens.insert(pair<string, int>("sorttime", sortTime)); + intTokens.insert(pair<string, int>("sortprovider", sortProvider)); + + ClearViewElement(veSortMode); + DrawViewElement(veSortMode, &stringTokens, &intTokens); + return true; +} + bool cDisplayMenuView::BackgroundImplemented(void) { if (!ExecuteViewElement(veBackground)) { return false; diff --git a/views/displaymenuview.h b/views/displaymenuview.h index ecea005..e75973b 100644 --- a/views/displaymenuview.h +++ b/views/displaymenuview.h @@ -5,9 +5,21 @@ #include "viewhelpers.h" #include "displaymenulistview.h" +#if APIVERSNUM < 20107 +enum eMenuSortMode { + msmUnknown = 0, + msmNumber, + msmName, + msmTime, + msmProvider +}; +#endif + class cDisplayMenuView : public cView, public cViewHelpers { protected: eMenuCategory cat; + eMenuSortMode sortMode; + eMenuSortMode sortModeLast; string menuTitle; string *buttonTexts; virtual void Action(void); @@ -15,6 +27,7 @@ public: cDisplayMenuView(cTemplateView *tmplView, bool menuInit); virtual ~cDisplayMenuView(); void SetMenuCat(eMenuCategory newCat) { cat = newCat; }; + void SetSortMode(eMenuSortMode sortMode) { this->sortMode = sortMode; }; void SetTitle(const char *title) {menuTitle = title; }; virtual void SetChannel(const cChannel *channel) {}; virtual const cChannel *GetChannel(void) { return NULL; }; @@ -29,6 +42,7 @@ public: bool DrawColorButtons(void); bool DrawMessage(eMessageType type, const char *text); void DrawScrollbar(int numMax, int numDisplayed, int offset); + bool DrawSortMode(void); virtual void DrawStaticViewElements(void) {}; virtual bool DrawDynamicViewElements(void) { return false; }; bool BackgroundImplemented(void); |
