1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Skins can now inquire the menu category for which their cSkinDisplayMenu is currently being used

This commit is contained in:
Klaus Schmidinger 2012-04-08 11:52:56 +02:00
parent c24a891568
commit 170e05e1e6
7 changed files with 58 additions and 7 deletions

View File

@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank - Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
Schmirler). Schmirler).
2012-04-07: Version 1.7.28 2012-04-08: Version 1.7.28
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4. - Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
- Fixed getting the maximum short channel name length in case there are no short names - 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. 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 - Fixed EPG scan on systems with only a single DVB device that use software output
(reported by Juergen Lock). (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.

19
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -214,6 +214,7 @@ public:
cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New) cMenuEditChannel::cMenuEditChannel(cChannel *Channel, bool New)
:cOsdMenu(tr("Edit channel"), 16) :cOsdMenu(tr("Edit channel"), 16)
{ {
SetMenuCategory(mcChannel);
channel = Channel; channel = Channel;
sourceParam = NULL; sourceParam = NULL;
*name = 0; *name = 0;
@ -391,6 +392,7 @@ public:
cMenuChannels::cMenuChannels(void) cMenuChannels::cMenuChannels(void)
:cOsdMenu(tr("Channels"), CHNUMWIDTH) :cOsdMenu(tr("Channels"), CHNUMWIDTH)
{ {
SetMenuCategory(mcChannel);
number = 0; number = 0;
Setup(); Setup();
Channels.IncBeingEdited(); Channels.IncBeingEdited();
@ -586,6 +588,7 @@ eOSState cMenuChannels::ProcessKey(eKeys Key)
cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font) cMenuText::cMenuText(const char *Title, const char *Text, eDvbFont Font)
:cOsdMenu(Title) :cOsdMenu(Title)
{ {
SetMenuCategory(mcText);
text = NULL; text = NULL;
font = Font; font = Font;
SetText(Text); SetText(Text);
@ -674,6 +677,7 @@ public:
cMenuEditFolder::cMenuEditFolder(const char *Dir, cList<cNestedItem> *List, cNestedItem *Folder) cMenuEditFolder::cMenuEditFolder(const char *Dir, cList<cNestedItem> *List, cNestedItem *Folder)
:cOsdMenu(Folder ? tr("Edit folder") : tr("New folder"), 12) :cOsdMenu(Folder ? tr("Edit folder") : tr("New folder"), 12)
{ {
SetMenuCategory(mcFolder);
list = List; list = List;
folder = Folder; folder = Folder;
if (folder) { if (folder) {
@ -746,6 +750,7 @@ eOSState cMenuEditFolder::ProcessKey(eKeys Key)
cMenuFolder::cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path) cMenuFolder::cMenuFolder(const char *Title, cNestedItemList *NestedItemList, const char *Path)
:cOsdMenu(Title) :cOsdMenu(Title)
{ {
SetMenuCategory(mcFolder);
list = nestedItemList = NestedItemList; list = nestedItemList = NestedItemList;
firstFolder = NULL; firstFolder = NULL;
editing = false; 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) cMenuFolder::cMenuFolder(const char *Title, cList<cNestedItem> *List, cNestedItemList *NestedItemList, const char *Dir, const char *Path)
:cOsdMenu(Title) :cOsdMenu(Title)
{ {
SetMenuCategory(mcFolder);
list = List; list = List;
nestedItemList = NestedItemList; nestedItemList = NestedItemList;
dir = Dir; dir = Dir;
@ -907,6 +913,7 @@ eOSState cMenuFolder::ProcessKey(eKeys Key)
cMenuEditTimer::cMenuEditTimer(cTimer *Timer, bool New) cMenuEditTimer::cMenuEditTimer(cTimer *Timer, bool New)
:cOsdMenu(tr("Edit timer"), 12) :cOsdMenu(tr("Edit timer"), 12)
{ {
SetMenuCategory(mcTimer);
file = NULL; file = NULL;
day = firstday = NULL; day = firstday = NULL;
timer = Timer; timer = Timer;
@ -1105,6 +1112,7 @@ public:
cMenuTimers::cMenuTimers(void) cMenuTimers::cMenuTimers(void)
:cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6) :cOsdMenu(tr("Timers"), 2, CHNUMWIDTH, 10, 6, 6)
{ {
SetMenuCategory(mcTimer);
helpKeys = -1; helpKeys = -1;
for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) { for (cTimer *timer = Timers.First(); timer; timer = Timers.Next(timer)) {
timer->SetEventFromSchedule(); // make sure the event is current 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) cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch, bool Buttons)
:cOsdMenu(tr("Event")) :cOsdMenu(tr("Event"))
{ {
SetMenuCategory(mcEvent);
event = Event; event = Event;
if (event) { if (event) {
cChannel *channel = Channels.GetByChannelID(event->ChannelID(), true); 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) 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) :cOsdMenu(Now ? tr("What's on now?") : tr("What's on next?"), CHNUMWIDTH, CHNAMWIDTH, 6, 4)
{ {
SetMenuCategory(mcSchedule);
now = Now; now = Now;
helpKeys = -1; helpKeys = -1;
timerState = 0; timerState = 0;
@ -1554,6 +1564,7 @@ public:
cMenuSchedule::cMenuSchedule(void) cMenuSchedule::cMenuSchedule(void)
:cOsdMenu("") :cOsdMenu("")
{ {
SetMenuCategory(mcSchedule);
now = next = false; now = next = false;
otherChannel = 0; otherChannel = 0;
helpKeys = -1; helpKeys = -1;
@ -1811,6 +1822,7 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key)
cMenuCommands::cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters) cMenuCommands::cMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters)
:cOsdMenu(Title) :cOsdMenu(Title)
{ {
SetMenuCategory(mcCommand);
result = NULL; result = NULL;
SetHasHotkeys(); SetHasHotkeys();
commands = Commands; commands = Commands;
@ -1940,6 +1952,7 @@ public:
cMenuCam::cMenuCam(cCamSlot *CamSlot) cMenuCam::cMenuCam(cCamSlot *CamSlot)
:cOsdMenu("", 1) // tab necessary for enquiry! :cOsdMenu("", 1) // tab necessary for enquiry!
{ {
SetMenuCategory(mcCam);
camSlot = CamSlot; camSlot = CamSlot;
ciMenu = NULL; ciMenu = NULL;
ciEnquiry = NULL; ciEnquiry = NULL;
@ -2119,6 +2132,7 @@ public:
cMenuRecording::cMenuRecording(const cRecording *Recording, bool WithButtons) cMenuRecording::cMenuRecording(const cRecording *Recording, bool WithButtons)
:cOsdMenu(tr("Recording info")) :cOsdMenu(tr("Recording info"))
{ {
SetMenuCategory(mcRecording);
recording = Recording; recording = Recording;
withButtons = WithButtons; withButtons = WithButtons;
if (withButtons) if (withButtons)
@ -2213,6 +2227,7 @@ void cMenuRecordingItem::IncrementCounter(bool New)
cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus) cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
:cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6) :cOsdMenu(Base ? Base : tr("Recordings"), 9, 6, 6)
{ {
SetMenuCategory(mcRecording);
base = Base ? strdup(Base) : NULL; base = Base ? strdup(Base) : NULL;
level = Setup.RecordingDirs ? Level : -1; level = Setup.RecordingDirs ? Level : -1;
Recordings.StateChanged(recordingsState); // just to get the current state Recordings.StateChanged(recordingsState); // just to get the current state
@ -3243,6 +3258,7 @@ public:
cMenuSetup::cMenuSetup(void) cMenuSetup::cMenuSetup(void)
:cOsdMenu("") :cOsdMenu("")
{ {
SetMenuCategory(mcSetup);
Set(); Set();
} }
@ -3327,6 +3343,7 @@ cOsdObject *cMenuMain::pluginOsdObject = NULL;
cMenuMain::cMenuMain(eOSState State) cMenuMain::cMenuMain(eOSState State)
:cOsdMenu("") :cOsdMenu("")
{ {
SetMenuCategory(mcMain);
replaying = false; replaying = false;
stopReplayItem = NULL; stopReplayItem = NULL;
cancelEditingItem = NULL; cancelEditingItem = NULL;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menuitems.h"
@ -1126,6 +1126,7 @@ eOSState cMenuEditMapItem::ProcessKey(eKeys Key)
cMenuSetupPage::cMenuSetupPage(void) cMenuSetupPage::cMenuSetupPage(void)
:cOsdMenu("", 33) :cOsdMenu("", 33)
{ {
SetMenuCategory(mcSetup);
plugin = NULL; plugin = NULL;
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "osdbase.h"
@ -80,6 +80,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
digit = 0; digit = 0;
hasHotkeys = false; hasHotkeys = false;
title = NULL; title = NULL;
menuCategory = mcUnknown;
SetTitle(Title); SetTitle(Title);
SetCols(c0, c1, c2, c3, c4); SetCols(c0, c1, c2, c3, c4);
first = 0; first = 0;
@ -103,6 +104,11 @@ cOsdMenu::~cOsdMenu()
DELETENULL(displayMenu); DELETENULL(displayMenu);
} }
void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory)
{
menuCategory = MenuCategory;
}
void cOsdMenu::SetDisplayMenu(void) void cOsdMenu::SetDisplayMenu(void)
{ {
if (displayMenu) { if (displayMenu) {
@ -212,6 +218,8 @@ void cOsdMenu::Display(void)
displayMenu->SetMessage(mtStatus, NULL); displayMenu->SetMessage(mtStatus, NULL);
displayMenu->Clear(); displayMenu->Clear();
cStatus::MsgOsdClear(); cStatus::MsgOsdClear();
if (menuCategory != displayMenu->MenuCategory())
displayMenu->SetMenuCategory(menuCategory);
displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
displayMenu->SetTitle(title); displayMenu->SetTitle(title);
cStatus::MsgOsdTitle(title); cStatus::MsgOsdTitle(title);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __OSDBASE_H
@ -90,6 +90,7 @@ private:
char *title; char *title;
int cols[cSkinDisplayMenu::MaxTabs]; int cols[cSkinDisplayMenu::MaxTabs];
int first, current, marked; int first, current, marked;
eMenuCategory menuCategory;
cOsdMenu *subMenu; cOsdMenu *subMenu;
const char *helpRed, *helpGreen, *helpYellow, *helpBlue; const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
bool helpDisplayed; 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); cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
virtual ~cOsdMenu(); virtual ~cOsdMenu();
virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); } virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); }
void SetMenuCategory(eMenuCategory MenuCategory);
int Current(void) const { return current; } int Current(void) const { return current; }
void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL); void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL); void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "skins.h"
@ -67,9 +67,15 @@ cSkinDisplay::~cSkinDisplay()
cSkinDisplayMenu::cSkinDisplayMenu(void) cSkinDisplayMenu::cSkinDisplayMenu(void)
{ {
menuCategory = mcUnknown;
SetTabs(0); SetTabs(0);
} }
void cSkinDisplayMenu::SetMenuCategory(eMenuCategory MenuCategory)
{
menuCategory = MenuCategory;
}
void cSkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5) void cSkinDisplayMenu::SetTabs(int Tab1, int Tab2, int Tab3, int Tab4, int Tab5)
{ {
tabs[0] = 0; tabs[0] = 0;

15
skins.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #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 { class cSkinDisplayMenu : public cSkinDisplay {
///< This class implements the general purpose menu display, which is ///< This class implements the general purpose menu display, which is
///< used throughout the program to display information and let the ///< used throughout the program to display information and let the
@ -92,6 +94,7 @@ class cSkinDisplayMenu : public cSkinDisplay {
public: public:
enum { MaxTabs = 6 }; enum { MaxTabs = 6 };
private: private:
eMenuCategory menuCategory;
int tabs[MaxTabs]; int tabs[MaxTabs];
protected: protected:
cTextScroller textScroller; cTextScroller textScroller;
@ -104,6 +107,16 @@ protected:
///< part can be found, NULL will be returned. ///< part can be found, NULL will be returned.
public: public:
cSkinDisplayMenu(void); 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); 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 ///< Sets the tab columns to the given values, which are the number of
///< characters in each column. ///< characters in each column.