mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added viewelement <sortmode> in displaymenu to display the sort mode of the currently displayed menu
This commit is contained in:
parent
43422fac91
commit
203754e204
3
HISTORY
3
HISTORY
@ -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
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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")) {
|
||||
|
@ -25,6 +25,7 @@ enum eViewElement {
|
||||
veDateTime,
|
||||
veTime,
|
||||
veMessage,
|
||||
veSortMode,
|
||||
veDevices,
|
||||
veCurrentWeather,
|
||||
veCustomTokens,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user