From 14f97d0f2a84aaca2b13638db406e629ceb4785f Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 10 Sep 2015 11:26:15 +0200 Subject: [PATCH] Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal menus --- CONTRIBUTORS | 1 + HISTORY | 2 ++ osdbase.c | 12 +++++++----- osdbase.h | 3 ++- skins.h | 11 ++++++++++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de701da9..91eccfbc 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3265,6 +3265,7 @@ Stefan Braun for suggesting to add the menu category mcRecordingEdit for marking menus that edit recording properties for suggesting to make cRecording::GetResume() public + for implementing the possibility for skins to display horizontal menus Jochen Dolze for changing cThread::SetIOPriority() from "best effort class" to "idle class" in order diff --git a/HISTORY b/HISTORY index dd449295..fd5bfb43 100644 --- a/HISTORY +++ b/HISTORY @@ -8811,3 +8811,5 @@ Video Disk Recorder Revision History - The EPG scanner no longer moves the dish if there is a positioner. - The 'newplugin' script now creates the 'po' subdirectory for translations (thanks to Thomas Reufer). +- Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal + menus (thanks to Stefan Braun). diff --git a/osdbase.c b/osdbase.c index e03f2d07..52ab240e 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 3.3 2015/01/15 10:11:11 kls Exp $ + * $Id: osdbase.c 4.1 2015/09/10 11:23:07 kls Exp $ */ #include "osdbase.h" @@ -87,6 +87,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4) title = NULL; menuCategory = mcUnknown; menuSortMode = msmUnknown; + menuOrientation = moVertical; SetTitle(Title); SetCols(c0, c1, c2, c3, c4); first = 0; @@ -231,6 +232,7 @@ void cOsdMenu::Display(void) if (menuCategory != displayMenu->MenuCategory()) displayMenu->SetMenuCategory(menuCategory); displayMenu->SetMenuSortMode(menuSortMode); + menuOrientation = displayMenu->MenuOrientation(); displayMenuItems = displayMenu->MaxItems(); displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTitle(title); @@ -541,13 +543,13 @@ eOSState cOsdMenu::ProcessKey(eKeys Key) case k0: return osUnknown; case k1...k9: return hasHotkeys ? HotKey(Key) : osUnknown; case kUp|k_Repeat: - case kUp: CursorUp(); break; + case kUp: if (menuOrientation == moHorizontal) PageUp(); else CursorUp(); break; case kDown|k_Repeat: - case kDown: CursorDown(); break; + case kDown: if (menuOrientation == moHorizontal) PageDown(); else CursorDown(); break; case kLeft|k_Repeat: - case kLeft: PageUp(); break; + case kLeft: if (menuOrientation == moHorizontal) CursorUp(); else PageUp(); break; case kRight|k_Repeat: - case kRight: PageDown(); break; + case kRight: if (menuOrientation == moHorizontal) CursorDown(); else PageDown(); break; case kBack: return osBack; case kOk: if (marked >= 0) { SetStatus(NULL); diff --git a/osdbase.h b/osdbase.h index 5b8ae1cc..5e807e76 100644 --- a/osdbase.h +++ b/osdbase.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.h 3.2 2015/01/15 10:09:18 kls Exp $ + * $Id: osdbase.h 4.1 2015/09/10 11:17:52 kls Exp $ */ #ifndef __OSDBASE_H @@ -93,6 +93,7 @@ private: int first, current, marked; eMenuCategory menuCategory; eMenuSortMode menuSortMode; + eMenuOrientation menuOrientation; cOsdMenu *subMenu; const char *helpRed, *helpGreen, *helpYellow, *helpBlue; bool helpDisplayed; diff --git a/skins.h b/skins.h index e1d12c05..2286087b 100644 --- a/skins.h +++ b/skins.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 3.4 2015/01/15 10:45:47 kls Exp $ + * $Id: skins.h 4.1 2015/09/10 11:19:48 kls Exp $ */ #ifndef __SKINS_H @@ -129,6 +129,11 @@ enum eMenuSortMode { msmProvider }; +enum eMenuOrientation { + moVertical = 0, + moHorizontal + }; + class cSkinDisplayMenu : public cSkinDisplay { ///< This class implements the general purpose menu display, which is ///< used throughout the program to display information and let the @@ -179,6 +184,10 @@ public: ///< Sets the mode by which the items in this menu are sorted. ///< This is purely informative and may be used by a skin to display the ///< current sort mode by means of some text or symbol. + virtual eMenuOrientation MenuOrientation(void) { return moVertical; } + ///< Asks the skin for the orientation of the displayed menu. + ///< If menu orientation is set to horizontal, the keys left/right + ///< and up/down are just toggled. virtual void Scroll(bool Up, bool Page); ///< If this menu contains a text area that can be scrolled, this function ///< will be called to actually scroll the text. Up indicates whether the