diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-04-08 11:52:56 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-04-08 11:52:56 +0200 |
commit | 170e05e1e651a46740ab231e43f3d33b805926ec (patch) | |
tree | fb7ac1d5c5bfd275f4a1e6a4bd5256ac65eb55d0 | |
parent | c24a89156857e91787e8a1ccaaffc085de41ae04 (diff) | |
download | vdr-170e05e1e651a46740ab231e43f3d33b805926ec.tar.gz vdr-170e05e1e651a46740ab231e43f3d33b805926ec.tar.bz2 |
Skins can now inquire the menu category for which their cSkinDisplayMenu is currently being used
-rw-r--r-- | HISTORY | 6 | ||||
-rw-r--r-- | menu.c | 19 | ||||
-rw-r--r-- | menuitems.c | 3 | ||||
-rw-r--r-- | osdbase.c | 10 | ||||
-rw-r--r-- | osdbase.h | 4 | ||||
-rw-r--r-- | skins.c | 8 | ||||
-rw-r--r-- | skins.h | 15 |
7 files changed, 58 insertions, 7 deletions
@@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History - Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank Schmirler). -2012-04-07: Version 1.7.28 +2012-04-08: Version 1.7.28 - Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4. - Fixed getting the maximum short channel name length in case there are no short names @@ -7064,3 +7064,7 @@ Video Disk Recorder Revision History a channel with a very long name that has no short name. - Fixed EPG scan on systems with only a single DVB device that use software output (reported by Juergen Lock). +- Skins can now inquire the menu category for which their cSkinDisplayMenu is currently + being used. This can be done either through a call to cSkinDisplayMenu::MenuCategory() + or by reimplementing cSkinDisplayMenu::SetMenuCategory(). This information allows a + skin to use special icons or decorations for the various types of menus in VDR. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 2.46 2012/04/06 12:33:40 kls Exp $ + * $Id: menu.c 2.47 2012/04/08 11:52:56 kls Exp $ */ #include "menu.h" @@ -214,6 +214,7 @@ public: cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New) :cOsdMenu(tr("Edit channel"), 16) { + SetMenuCategory(mcChannel); channel = Channel; sourceParam = NULL; *name = 0; @@ -391,6 +392,7 @@ public: cMenuChannels::cMenuChannels(void) :cOsdMenu(tr("Channels"), CHNUMWIDTH) { + SetMenuCategory(mcChannel); number = 0; Setup(); Channels.IncBeingEdited(); @@ -586,6 +588,7 @@ eOSState cMenuChannels::ProcessKey(eKeys Key) cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font) :cOsdMenu(Title) { + SetMenuCategory(mcText); text = NULL; font = Font; SetText(Text); @@ -674,6 +677,7 @@ public: cMenuEditFolder::cMenuEditFolder(const char *Dir, cList<cNestedItem> *List, cNestedItem *Folder) :cOsdMenu(Folder ? tr("Edit folder") : tr("New folder"), 12) { + SetMenuCategory(mcFolder); list = List; folder = Folder; if (folder) { @@ -746,6 +750,7 @@ eOSState cMenuEditFolder::ProcessKey(eKeys Key) cMenuFolder::cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path) :cOsdMenu(Title) { + SetMenuCategory(mcFolder); list = nestedItemList = NestedItemList; firstFolder = NULL; editing = false; @@ -757,6 +762,7 @@ cMenuFolder::cMenuFolder(const char *Title, cNestedItemList *NestedItemList, con cMenuFolder::cMenuFolder(const char *Title, cList<cNestedItem> *List, cNestedItemList *NestedItemList, const char *Dir, const char *Path) :cOsdMenu(Title) { + SetMenuCategory(mcFolder); list = List; nestedItemList = NestedItemList; dir = Dir; @@ -907,6 +913,7 @@ eOSState cMenuFolder::ProcessKey(eKeys Key) cMenuEditTimer::cMenuEditTimer(cTimer *Timer, bool New) :cOsdMenu(tr("Edit timer"), 12) { + SetMenuCategory(mcTimer); file = NULL; day = firstday = NULL; timer = Timer; @@ -1105,6 +1112,7 @@ public: cMenuTimers::cMenuTimers(void) :cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6) { + SetMenuCategory(mcTimer); helpKeys = -1; for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { timer->SetEventFromSchedule(); // make sure the event is current @@ -1243,6 +1251,7 @@ eOSState cMenuTimers::ProcessKey(eKeys Key) cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch, bool Buttons) :cOsdMenu(tr("Event")) { + SetMenuCategory(mcEvent); event = Event; if (event) { cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); @@ -1390,6 +1399,7 @@ const cEvent *cMenuWhatsOn::scheduleEvent = NULL; cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentChannelNr) :cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, CHNAMWIDTH, 6, 4) { + SetMenuCategory(mcSchedule); now = Now; helpKeys = -1; timerState = 0; @@ -1554,6 +1564,7 @@ public: cMenuSchedule::cMenuSchedule(void) :cOsdMenu("") { + SetMenuCategory(mcSchedule); now = next = false; otherChannel = 0; helpKeys = -1; @@ -1811,6 +1822,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) cMenuCommands::cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters) :cOsdMenu(Title) { + SetMenuCategory(mcCommand); result = NULL; SetHasHotkeys(); commands = Commands; @@ -1940,6 +1952,7 @@ public: cMenuCam::cMenuCam(cCamSlot *CamSlot) :cOsdMenu("", 1) // tab necessary for enquiry! { + SetMenuCategory(mcCam); camSlot = CamSlot; ciMenu = NULL; ciEnquiry = NULL; @@ -2119,6 +2132,7 @@ public: cMenuRecording::cMenuRecording(const cRecording *Recording, bool WithButtons) :cOsdMenu(tr("Recording info")) { + SetMenuCategory(mcRecording); recording = Recording; withButtons = WithButtons; if (withButtons) @@ -2213,6 +2227,7 @@ void cMenuRecordingItem::IncrementCounter(bool New) cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) :cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6) { + SetMenuCategory(mcRecording); base = Base ? strdup(Base) : NULL; level = Setup.RecordingDirs ? Level : -1; Recordings.StateChanged(recordingsState); // just to get the current state @@ -3243,6 +3258,7 @@ public: cMenuSetup::cMenuSetup(void) :cOsdMenu("") { + SetMenuCategory(mcSetup); Set(); } @@ -3327,6 +3343,7 @@ cOsdObject *cMenuMain::pluginOsdObject = NULL; cMenuMain::cMenuMain(eOSState State) :cOsdMenu("") { + SetMenuCategory(mcMain); replaying = false; stopReplayItem = NULL; cancelEditingItem = NULL; diff --git a/menuitems.c b/menuitems.c index ba205c0f..416c2beb 100644 --- a/menuitems.c +++ b/menuitems.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menuitems.c 2.13 2012/03/13 11:21:57 kls Exp $ + * $Id: menuitems.c 2.14 2012/04/08 11:20:37 kls Exp $ */ #include "menuitems.h" @@ -1126,6 +1126,7 @@ eOSState cMenuEditMapItem::ProcessKey(eKeys Key) cMenuSetupPage::cMenuSetupPage(void) :cOsdMenu("", 33) { + SetMenuCategory(mcSetup); plugin = NULL; } @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 2.4 2012/03/02 15:49:57 kls Exp $ + * $Id: osdbase.c 2.5 2012/04/08 11:19:46 kls Exp $ */ #include "osdbase.h" @@ -80,6 +80,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) digit = 0; hasHotkeys = false; title = NULL; + menuCategory = mcUnknown; SetTitle(Title); SetCols(c0, c1, c2, c3, c4); first = 0; @@ -103,6 +104,11 @@ cOsdMenu::~cOsdMenu() DELETENULL(displayMenu); } +void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory) +{ + menuCategory = MenuCategory; +} + void cOsdMenu::SetDisplayMenu(void) { if (displayMenu) { @@ -212,6 +218,8 @@ void cOsdMenu::Display(void) displayMenu->SetMessage(mtStatus, NULL); displayMenu->Clear(); cStatus::MsgOsdClear(); + if (menuCategory != displayMenu->MenuCategory()) + displayMenu->SetMenuCategory(menuCategory); displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTitle(title); cStatus::MsgOsdTitle(title); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 2.2 2012/03/02 15:49:57 kls Exp $ + * $Id: osdbase.h 2.3 2012/04/08 11:18:38 kls Exp $ */ #ifndef __OSDBASE_H @@ -90,6 +90,7 @@ private: char *title; int cols[cSkinDisplayMenu::MaxTabs]; int first, current, marked; + eMenuCategory menuCategory; cOsdMenu *subMenu; const char *helpRed, *helpGreen, *helpYellow, *helpBlue; bool helpDisplayed; @@ -128,6 +129,7 @@ public: cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0); virtual ~cOsdMenu(); virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); } + void SetMenuCategory(eMenuCategory MenuCategory); int Current(void) const { return current; } void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL); void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL); @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.c 2.5 2012/03/11 14:36:11 kls Exp $ + * $Id: skins.c 2.6 2012/04/08 11:38:57 kls Exp $ */ #include "skins.h" @@ -67,9 +67,15 @@ cSkinDisplay::~cSkinDisplay() cSkinDisplayMenu::cSkinDisplayMenu(void) { + menuCategory = mcUnknown; SetTabs(0); } +void cSkinDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory) +{ + menuCategory = MenuCategory; +} + void cSkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) { tabs[0] = 0; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 2.2 2012/03/11 14:38:23 kls Exp $ + * $Id: skins.h 2.3 2012/04/08 11:24:59 kls Exp $ */ #ifndef __SKINS_H @@ -72,6 +72,8 @@ public: */ }; +enum eMenuCategory { mcUnknown = 0, mcMain, mcSchedule, mcChannel, mcTimer, mcRecording, mcPlugin, mcSetup, mcCommand, mcEvent, mcText, mcFolder, mcCam }; + class cSkinDisplayMenu : public cSkinDisplay { ///< This class implements the general purpose menu display, which is ///< used throughout the program to display information and let the @@ -92,6 +94,7 @@ class cSkinDisplayMenu : public cSkinDisplay { public: enum { MaxTabs = 6 }; private: + eMenuCategory menuCategory; int tabs[MaxTabs]; protected: cTextScroller textScroller; @@ -104,6 +107,16 @@ protected: ///< part can be found, NULL will be returned. public: cSkinDisplayMenu(void); + eMenuCategory MenuCategory(void) const { return menuCategory; } + ///< Returns the menu category, set by a previous call to SetMenuCategory(). + virtual void SetMenuCategory(eMenuCategory MenuCategory); + ///< Sets the current menu category. This allows skins to handle known + ///< types of menus in different ways, for instance by displaying icons + ///< or special decorations. + ///< A derived class can reimplement this function to be informed of any + ///< changes in the menu category. If it does, it shall call the base class + ///< function in order to set the members accordingly for later calls to the + ///< MenuCategory() function. virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); ///< Sets the tab columns to the given values, which are the number of ///< characters in each column. |