mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
added category indicator token to default menus
This commit is contained in:
parent
7bc7304d84
commit
3a53ab95b6
2
HISTORY
2
HISTORY
@ -276,3 +276,5 @@ Version 0.4.0
|
||||
its own datetime display
|
||||
- adapted Makefiles to work also in a LCLBLD environment
|
||||
- reverted Makefile changes in parts
|
||||
- added category indicator token to default menus
|
||||
|
||||
|
@ -202,7 +202,10 @@ void cSDDisplayMenu::SetItem(const char *Text, int Index, bool Current, bool Sel
|
||||
rootView->LockFlush();
|
||||
eMenuCategory cat = MenuCategory();
|
||||
if (cat == mcMain && rootView->SubViewAvailable()) {
|
||||
list->AddMainMenuItem(Index, Text, Current, Selectable);
|
||||
string plugName = list->AddMainMenuItem(Index, Text, Current, Selectable);
|
||||
if (Current) {
|
||||
rootView->SetSelectedPluginMainMenu(plugName);
|
||||
}
|
||||
} else if (cat == mcSetup && rootView->SubViewAvailable()) {
|
||||
list->AddSetupMenuItem(Index, Text, Current, Selectable);
|
||||
} else {
|
||||
|
@ -188,7 +188,7 @@ cImage *cImageCache::GetIcon(eImageType type, string name, int width, int height
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string cImageCache::GetIconName(string label, eMenuCategory cat) {
|
||||
string cImageCache::GetIconName(string label, eMenuCategory cat, string plugName) {
|
||||
//if cat is set, use standard menu entries
|
||||
switch (cat) {
|
||||
case mcSchedule:
|
||||
@ -267,6 +267,9 @@ string cImageCache::GetIconName(string label, eMenuCategory cat) {
|
||||
}
|
||||
} catch (...) {}
|
||||
//check for Plugins
|
||||
if (plugName.size() > 0) {
|
||||
return *cString::sprintf("pluginicons/%s", plugName.c_str());
|
||||
}
|
||||
for (int i = 0; ; i++) {
|
||||
cPlugin *p = cPluginManager::GetPlugin(i);
|
||||
if (p) {
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
//icons
|
||||
void CacheIcon(eImageType type, string path, int width, int height);
|
||||
cImage *GetIcon(eImageType type, string name, int width, int height);
|
||||
string GetIconName(string label, eMenuCategory cat = mcUndefined);
|
||||
string GetIconName(string label, eMenuCategory cat = mcUndefined, string plugName = "");
|
||||
bool MenuIconExists(string name);
|
||||
//skinparts
|
||||
void CacheSkinpart(string path, int width, int height);
|
||||
|
@ -637,6 +637,11 @@ void cTemplateView::SetFunctionDefinitions(void) {
|
||||
attributes.insert("mode");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "listelement";
|
||||
attributes.clear();
|
||||
attributes.insert("debug");
|
||||
funcsAllowed.insert(pair< string, set<string> >(name, attributes));
|
||||
|
||||
name = "area";
|
||||
attributes.clear();
|
||||
attributes.insert("debug");
|
||||
@ -1147,6 +1152,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
|
||||
|
||||
//definition of allowed parameters for currentitems viewlist
|
||||
attributes.clear();
|
||||
attributes.insert("debug");
|
||||
attributes.insert("delay");
|
||||
attributes.insert("fadetime");
|
||||
funcsAllowed.insert(pair< string, set<string> >("currentelement", attributes));
|
||||
|
@ -59,6 +59,7 @@
|
||||
<drawimage condition="not{current}" imagetype="skinpart" path="menubutton" x="0" y="0" width="100%" height="100%"/>
|
||||
<drawimage condition="{current}" imagetype="skinpart" path="menubuttonactive" x="0" y="0" width="100%" height="100%"/>
|
||||
</area>
|
||||
|
||||
<areascroll scrollelement="column1" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="{column1width}" layer="3">
|
||||
<drawtext name="column1" x="{column1x}" width="{column1width}" valign="center" font="{regular}" fontsize="90%" color="{clrWhite}" text="{column1}" />
|
||||
</areascroll>
|
||||
|
@ -113,7 +113,7 @@
|
||||
<!-- IMPORTANT: menuitemwidth and determinatefont have to be defined here. menuitemwidth defines the total width of the
|
||||
default menu items, determinatefont the function which sets the actual font to use. With that it is possible to determinate
|
||||
the correct column widths -->
|
||||
<menuitems x="0" y="10%" orientation="vertical" width="100%" height="82%" align="center" menuitemwidth="94%" determinatefont="column1" numlistelements="16">
|
||||
<menuitems x="0" y="10%" orientation="vertical" width="94%" height="82%" align="center" menuitemwidth="94%" determinatefont="column1" numlistelements="16">
|
||||
<!-- Available Variables default menu listelement:
|
||||
{nummenuitem} number of item in list, starts with 1
|
||||
{column1} text of column1
|
||||
@ -140,18 +140,48 @@
|
||||
{column6width} proposed width of column6
|
||||
{columnscroll} number of column which should have scrollable text
|
||||
{current} true if column is currently selected
|
||||
{separator} true if column is a list separator
|
||||
{separator} true if column is a list separator
|
||||
|
||||
A dynamic token is set to indicate the current menu category or the plugin which is currently running.
|
||||
With that it is possible to display different default menus with an individual style.
|
||||
If a setup menu is diplayed, the token
|
||||
{setup} is set to true
|
||||
For the commands menu
|
||||
{commands} is set to true
|
||||
If a plugin is running, a token called as the name of the plugin is set to true
|
||||
{pluginname} is set to true
|
||||
-->
|
||||
<listelement>
|
||||
<area x="0" width="95%" layer="2">
|
||||
<area x="0" condition="not{separator}" width="100%" layer="2">
|
||||
<fill condition="not{current}" color="{clrTransparent}" />
|
||||
<fill condition="{current}" color="{clrTransBlueLight}" />
|
||||
</area>
|
||||
|
||||
<areascroll scrollelement="column1" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="{column1width}" layer="3">
|
||||
<!-- Separators -->
|
||||
<area x="0" condition="{separator}" width="100%" layer="2">
|
||||
<fill color="{clrDarkGray}" />
|
||||
</area>
|
||||
<area x="1%" condition="{separator}" width="98%" layer="3">
|
||||
<drawtext align="left" valign="center" font="{light}" fontsize="90%" width="98%" color="{clrWhite}" text="{column1}" />
|
||||
</area>
|
||||
|
||||
<!-- Setup Menus -->
|
||||
<areascroll condition="not{separator} ++ {setup} ++ {column2set}" scrollelement="column1" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="59%" layer="3">
|
||||
<drawtext name="column1" x="0" width="99%" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{column1}" />
|
||||
</areascroll>
|
||||
<area x="60%" condition="not{separator} ++ {setup} ++ {column2set}" width="39%" layer="3">
|
||||
<drawtext align="right" valign="center" font="{light}" fontsize="90%" width="99%" color="{clrWhite}" text="{column2}" />
|
||||
</area>
|
||||
|
||||
<area x="1%" condition="not{separator} ++ {setup} ++ not{column2set}" width="98%" layer="3">
|
||||
<drawtext align="left" valign="center" font="{light}" fontsize="90%" width="99%" color="{clrWhite}" text="{column1}" />
|
||||
</area>
|
||||
|
||||
<!-- Default Menus -->
|
||||
<areascroll condition="not{separator} ++ not{setup}" scrollelement="column1" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="medium" x="1%" width="{column1width}" layer="3">
|
||||
<drawtext name="column1" x="{column1x}" width="{column1width}" valign="center" font="{light}" fontsize="90%" color="{clrWhite}" text="{column1}" />
|
||||
</areascroll>
|
||||
<area x="1%" width="100%" layer="3">
|
||||
<area condition="not{separator} ++ not{setup}" x="1%" width="100%" layer="3">
|
||||
<drawtext condition="{column2set}" x="{column2x}" valign="center" font="{light}" fontsize="90%" width="{column2width}" color="{clrWhite}" text="{column2}" />
|
||||
<drawtext condition="{column3set}" x="{column3x}" valign="center" font="{light}" fontsize="90%" width="{column3width}" color="{clrWhite}" text="{column3}" />
|
||||
<drawtext condition="{column4set}" x="{column4x}" valign="center" font="{light}" fontsize="90%" width="{column4width}" color="{clrWhite}" text="{column4}" />
|
||||
|
@ -28,7 +28,16 @@
|
||||
{column5width} proposed width of column5
|
||||
{column6width} proposed width of column6
|
||||
{current} true if column is currently selected
|
||||
{separator} true if column is a list separator
|
||||
{separator} true if column is a list separator
|
||||
|
||||
A dynamic token is set to indicate the current menu category or the plugin which is currently running.
|
||||
With that it is possible to display different default menus with an individual style.
|
||||
If a setup menu is diplayed, the token
|
||||
{setup} is set to true
|
||||
For the commands menu
|
||||
{commands} is set to true
|
||||
If a plugin is running, a token called as the name of the plugin is set to true
|
||||
{pluginname} is set to true
|
||||
-->
|
||||
<listelement>
|
||||
</listelement>
|
||||
|
@ -106,6 +106,7 @@ cDisplayMenuItemDefaultView::cDisplayMenuItemDefaultView(cTemplateViewList *tmpl
|
||||
this->tabs = tabs;
|
||||
this->tabWidths = tabWidths;
|
||||
maxTabs = cSkinDisplayMenu::MaxTabs;
|
||||
menuCategory = "";
|
||||
}
|
||||
|
||||
cDisplayMenuItemDefaultView::~cDisplayMenuItemDefaultView() {
|
||||
@ -138,6 +139,9 @@ void cDisplayMenuItemDefaultView::SetTokens(void) {
|
||||
intTokens.insert(pair<string,int>("current", current));
|
||||
intTokens.insert(pair<string,int>("separator", !selectable));
|
||||
intTokens.insert(pair<string,int>("nummenuitem", num+1));
|
||||
if (menuCategory.size() > 0) {
|
||||
intTokens.insert(pair<string,int>(menuCategory, 1));
|
||||
}
|
||||
}
|
||||
|
||||
void cDisplayMenuItemDefaultView::Prepare(void) {
|
||||
@ -173,6 +177,10 @@ cDisplayMenuItemMainView::cDisplayMenuItemMainView(cTemplateViewList *tmplList,
|
||||
number = "";
|
||||
label = "";
|
||||
icon = "";
|
||||
isPlugin = false;
|
||||
plugName = "";
|
||||
SplitMenuText();
|
||||
CheckPlugins();
|
||||
}
|
||||
|
||||
cDisplayMenuItemMainView::~cDisplayMenuItemMainView() {
|
||||
@ -193,8 +201,11 @@ void cDisplayMenuItemMainView::SetTokens(void) {
|
||||
|
||||
void cDisplayMenuItemMainView::Prepare(void) {
|
||||
ArrangeContainer();
|
||||
SplitMenuText();
|
||||
icon = imgCache->GetIconName(label);
|
||||
if (isPlugin) {
|
||||
icon = imgCache->GetIconName(label, mcUnknown, plugName);
|
||||
} else {
|
||||
icon = imgCache->GetIconName(label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -214,6 +225,12 @@ void cDisplayMenuItemMainView::Render(void) {
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
string cDisplayMenuItemMainView::GetPluginName(void) {
|
||||
if (!isPlugin)
|
||||
return "";
|
||||
return plugName;
|
||||
}
|
||||
|
||||
void cDisplayMenuItemMainView::Debug(void) {
|
||||
esyslog("skindesigner: Main Menu Item ---------------");
|
||||
cDisplayMenuItemView::Debug();
|
||||
@ -266,6 +283,24 @@ void cDisplayMenuItemMainView::SplitMenuText(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void cDisplayMenuItemMainView::CheckPlugins(void) {
|
||||
for (int i = 0; ; i++) {
|
||||
cPlugin *p = cPluginManager::GetPlugin(i);
|
||||
if (p) {
|
||||
const char *mainMenuEntry = p->MainMenuEntry();
|
||||
if (mainMenuEntry) {
|
||||
string plugMainEntry = mainMenuEntry;
|
||||
if (label.substr(0, plugMainEntry.size()) == plugMainEntry) {
|
||||
isPlugin = true;
|
||||
plugName = p->Name() ? p->Name() : "";
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* cDisplayMenuItemSchedulesView
|
||||
*************************************************************/
|
||||
|
@ -42,11 +42,13 @@ private:
|
||||
int *tabWidths;
|
||||
string *tabTexts;
|
||||
int maxTabs;
|
||||
string menuCategory;
|
||||
public:
|
||||
cDisplayMenuItemDefaultView(cTemplateViewList *tmplList, string *tabTexts, int *tabs, int *tabWidths, bool current, bool selectable);
|
||||
virtual ~cDisplayMenuItemDefaultView();
|
||||
void SetTabTexts(string *tabTexts);
|
||||
void SetTokens(void);
|
||||
void SetMenuCategory(string cat) { menuCategory = cat; };
|
||||
void Prepare(void);
|
||||
void Render(void);
|
||||
void Debug(void);
|
||||
@ -54,17 +56,21 @@ public:
|
||||
|
||||
class cDisplayMenuItemMainView: public cDisplayMenuItemView {
|
||||
private:
|
||||
bool isPlugin;
|
||||
string plugName;
|
||||
string text;
|
||||
string number;
|
||||
string label;
|
||||
string icon;
|
||||
void SplitMenuText(void);
|
||||
void CheckPlugins(void);
|
||||
public:
|
||||
cDisplayMenuItemMainView(cTemplateViewList *tmplList, string itemText, bool current, bool selectable);
|
||||
virtual ~cDisplayMenuItemMainView();
|
||||
void SetTokens(void);
|
||||
void Prepare(void);
|
||||
void Render(void);
|
||||
string GetPluginName(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "displaymenulistview.h"
|
||||
|
||||
|
||||
cDisplayMenuListView::cDisplayMenuListView(cTemplateViewList *tmplList, int count) {
|
||||
cDisplayMenuListView::cDisplayMenuListView(cTemplateViewList *tmplList, int count, eMenuCategory cat, string currentPlug) {
|
||||
oneColumn = true;
|
||||
this->tmplList = tmplList;
|
||||
if (count < 0) {
|
||||
@ -15,6 +15,8 @@ cDisplayMenuListView::cDisplayMenuListView(cTemplateViewList *tmplList, int coun
|
||||
intTokens.insert(pair<string,int>("numelements", count));
|
||||
tmplList->CalculateListParameters(&intTokens);
|
||||
}
|
||||
this->cat = cat;
|
||||
this->currentPlug = currentPlug;
|
||||
menuItems = new cDisplayMenuItemView*[itemCount];
|
||||
for (int i=0; i<itemCount; i++)
|
||||
menuItems[i] = NULL;
|
||||
@ -111,19 +113,24 @@ void cDisplayMenuListView::AddDefaultMenuItem(int index, string *tabTexts, bool
|
||||
break;
|
||||
}
|
||||
}
|
||||
cDisplayMenuItemView *item = new cDisplayMenuItemDefaultView(tmplList, tabTexts, tabs, tabWidths, current, selectable);
|
||||
cDisplayMenuItemDefaultView *item = new cDisplayMenuItemDefaultView(tmplList, tabTexts, tabs, tabWidths, current, selectable);
|
||||
item->SetMenuCategory(GetDefaultMenuCategory());
|
||||
menuItems[index] = item;
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool current, bool selectable) {
|
||||
string cDisplayMenuListView::AddMainMenuItem(int index, const char *itemText, bool current, bool selectable) {
|
||||
if (index >= itemCount)
|
||||
return;
|
||||
return "";
|
||||
if (menuItems[index]) {
|
||||
menuItems[index]->SetCurrent(current);
|
||||
return;
|
||||
cDisplayMenuItemMainView *menuItem = dynamic_cast<cDisplayMenuItemMainView*>(menuItems[index]);
|
||||
if (!menuItem)
|
||||
return "";
|
||||
menuItem->SetCurrent(current);
|
||||
return menuItem->GetPluginName();
|
||||
}
|
||||
cDisplayMenuItemView *item = new cDisplayMenuItemMainView(tmplList, itemText, current, selectable);
|
||||
cDisplayMenuItemMainView *item = new cDisplayMenuItemMainView(tmplList, itemText, current, selectable);
|
||||
menuItems[index] = item;
|
||||
return item->GetPluginName();
|
||||
}
|
||||
|
||||
void cDisplayMenuListView::AddSetupMenuItem(int index, const char *itemText, bool current, bool selectable) {
|
||||
@ -241,3 +248,13 @@ void cDisplayMenuListView::Debug(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string cDisplayMenuListView::GetDefaultMenuCategory(void) {
|
||||
if (cat == mcSchedule || cat == mcScheduleNow || cat == mcScheduleNext)
|
||||
return "schedule";
|
||||
else if (cat >= mcPluginSetup && cat <= mcSetupPlugins)
|
||||
return "setup";
|
||||
else if (cat == mcCommand)
|
||||
return "commands";
|
||||
return currentPlug;
|
||||
}
|
||||
|
@ -8,20 +8,23 @@
|
||||
class cDisplayMenuListView {
|
||||
private:
|
||||
cTemplateViewList *tmplList;
|
||||
eMenuCategory cat;
|
||||
string currentPlug;
|
||||
int itemCount;
|
||||
cDisplayMenuItemView **menuItems;
|
||||
int *tabs;
|
||||
int *tabWidths;
|
||||
bool oneColumn;
|
||||
string GetDefaultMenuCategory(void);
|
||||
public:
|
||||
cDisplayMenuListView(cTemplateViewList *tmplList, int count = -1);
|
||||
cDisplayMenuListView(cTemplateViewList *tmplList, int count, eMenuCategory cat = mcUnknown, string currentPlug = "");
|
||||
virtual ~cDisplayMenuListView();
|
||||
void Clear(void);
|
||||
void SetTabs(int tab1, int tab2, int tab3, int tab4, int tab5);
|
||||
int GetMaxItems(void) { return itemCount; };
|
||||
int GetListWidth(void);
|
||||
void AddDefaultMenuItem(int index, string *tabTexts, bool current, bool selectable);
|
||||
void AddMainMenuItem(int index, const char *itemText, bool current, bool selectable);
|
||||
string AddMainMenuItem(int index, const char *itemText, bool current, bool selectable);
|
||||
void AddSetupMenuItem(int index, const char *itemText, bool current, bool selectable);
|
||||
void AddSchedulesMenuItem(int index, const cEvent *event, const cChannel *channel, eTimerMatch timerMatch, eMenuCategory cat, bool isEpgSearchFav, bool current, bool selectable);
|
||||
void AddChannelsMenuItem(int index, const cChannel *channel, bool withProvider, bool current, bool selectable);
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(rootView) {
|
||||
cat = mcUndefined;
|
||||
selectedPluginMainMenu = "";
|
||||
sortMode = msmUnknown;
|
||||
sortModeLast = msmUnknown;
|
||||
menuTitle = "";
|
||||
@ -208,7 +209,7 @@ void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
|
||||
cTemplateViewList *tmplMenuItems = subView->GetViewList(vlMenuItem);
|
||||
if (!tmplMenuItems)
|
||||
return;
|
||||
listView = new cDisplayMenuListView(tmplMenuItems);
|
||||
listView = new cDisplayMenuListView(tmplMenuItems, -1, menuCat, selectedPluginMainMenu);
|
||||
} else {
|
||||
//Create detailed view
|
||||
detailView = new cDisplayMenuDetailView(subView);
|
||||
|
@ -15,6 +15,7 @@ enum ePluginMenuType {
|
||||
class cDisplayMenuRootView : public cView, public cViewHelpers {
|
||||
private:
|
||||
eMenuCategory cat;
|
||||
string selectedPluginMainMenu;
|
||||
eMenuSortMode sortMode;
|
||||
eMenuSortMode sortModeLast;
|
||||
eSubView viewType;
|
||||
@ -51,6 +52,7 @@ public:
|
||||
virtual ~cDisplayMenuRootView();
|
||||
bool createOsd(void);
|
||||
void SetMenu(eMenuCategory menuCat, bool menuInit);
|
||||
void SetSelectedPluginMainMenu(string name) { selectedPluginMainMenu = name; };
|
||||
void SetSortMode(eMenuSortMode sortMode);
|
||||
void SetCurrentRecording(string rec) { currentRecording = rec; };
|
||||
void CorrectDefaultMenu(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user