From 2299c1e099d7a5190f9bfdc8b76315bbc86bd179 Mon Sep 17 00:00:00 2001 From: svntobi Date: Sat, 11 Aug 2007 19:02:56 +0000 Subject: some renamings git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5681 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f --- NAMINGSUGGESTIONS | 7 -- src/custommainmenuitem.h | 6 +- src/menunode.cpp | 4 +- src/menunode.h | 6 +- src/menuorg.cpp | 74 ++++-------------- src/menuorg.h | 13 +--- src/pluginmainmenuitem.h | 6 +- src/pluginmenuitem.cpp | 6 +- src/pluginmenuitem.h | 6 +- src/submenuprovider.cpp | 14 ++-- src/submenuprovider.h | 14 ++-- src/vdrmenuitem.cpp | 6 +- src/vdrmenuitem.h | 6 +- vdr-patch/menuorg-0.1.diff | 162 ++++++++++++++++++++++++++++++++++++++ vdr-patch/opt-37_submenu.dpatch | 167 ---------------------------------------- 15 files changed, 219 insertions(+), 278 deletions(-) delete mode 100644 NAMINGSUGGESTIONS create mode 100755 vdr-patch/menuorg-0.1.diff delete mode 100755 vdr-patch/opt-37_submenu.dpatch diff --git a/NAMINGSUGGESTIONS b/NAMINGSUGGESTIONS deleted file mode 100644 index 64d34fe..0000000 --- a/NAMINGSUGGESTIONS +++ /dev/null @@ -1,7 +0,0 @@ -vdr-plugin-menuorg -vdr-plugin-custommenu -vdr-plugin-alacarte -vdr-plugin-menucustomizer -vdr-plugin-yasm (yet another sub menu) -vdr-plugin-fleximenu - diff --git a/src/custommainmenuitem.h b/src/custommainmenuitem.h index b46be85..11316dd 100644 --- a/src/custommainmenuitem.h +++ b/src/custommainmenuitem.h @@ -16,13 +16,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ -#include +#include -class CustomMainMenuItem: public SubMenuPatch::IMainMenuItem +class CustomMainMenuItem: public MenuOrgPatch::IMainMenuItem { private: cOsdItem* _osdItem; diff --git a/src/menunode.cpp b/src/menunode.cpp index f76f6eb..e813c1c 100644 --- a/src/menunode.cpp +++ b/src/menunode.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -58,7 +58,7 @@ void MenuNode::SetParent(MenuNode* parent) _parent = parent; } -SubMenuPatch::IMainMenuItem* MenuNode::CreateMainMenuItem() +MenuOrgPatch::IMainMenuItem* MenuNode::CreateMainMenuItem() { return NULL; } diff --git a/src/menunode.h b/src/menunode.h index 56c5ecd..160e75c 100644 --- a/src/menunode.h +++ b/src/menunode.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -24,7 +24,7 @@ #define ___MENUNODE_H #include -#include +#include class MenuNode; @@ -45,7 +45,7 @@ class MenuNode MenuNode* Parent(); MenuNodeList& Childs(); MenuNode* AddChild(MenuNode* child); - virtual SubMenuPatch::IMainMenuItem* CreateMainMenuItem(); + virtual MenuOrgPatch::IMainMenuItem* CreateMainMenuItem(); }; #endif diff --git a/src/menuorg.cpp b/src/menuorg.cpp index 1a25475..47b6476 100644 --- a/src/menuorg.cpp +++ b/src/menuorg.cpp @@ -16,14 +16,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ #include #include #include -#include +#include #include #include "version.h" #include "menuorg.h" @@ -31,7 +31,7 @@ #include using namespace std; -using namespace SubMenuPatch; +using namespace MenuOrgPatch; MenuOrgPlugin::MenuOrgPlugin(void) { @@ -58,14 +58,7 @@ const char* MenuOrgPlugin::Description(void) const char* MenuOrgPlugin::MainMenuEntry(void) { - if (!_subMenuProvider) - { - return tr("Failed to load config file"); - } - else - { - return NULL; - } + return NULL; } const char *MenuOrgPlugin::CommandLineHelp(void) @@ -89,7 +82,7 @@ bool MenuOrgPlugin::Initialize(void) MenuNode* menu = xmlMenu.LoadXmlMenu(configFile); if (menu) { - _subMenuProvider = new SubMenuProvider(menu); + _subMenuProvider = new MainMenuItemsProvider(menu); } else { @@ -101,34 +94,6 @@ bool MenuOrgPlugin::Initialize(void) return true; } -bool MenuOrgPlugin::Start(void) -{ - // Start any background activities the plugin shall perform. - return true; -} - -void MenuOrgPlugin::Stop(void) -{ - // Stop any background activities the plugin shall perform. -} - -void MenuOrgPlugin::Housekeeping(void) -{ - // Perform any cleanup or other regular tasks. -} - -void MenuOrgPlugin::MainThreadHook(void) -{ - // Perform actions in the context of the main program thread. - // WARNING: Use with great care - see PLUGINS.html! -} - -cString MenuOrgPlugin::Active(void) -{ - // Return a message string if shutdown should be postponed - return NULL; -} - cOsdObject *MenuOrgPlugin::MainMenuAction(void) { // Perform the action when selected from the main VDR menu. @@ -151,25 +116,20 @@ bool MenuOrgPlugin::SetupParse(const char *Name, const char *Value) bool MenuOrgPlugin::Service(const char *Id, void *Data) { - if (strcmp(Id, "SubMenuPatch-v0.1::SubMenuProvider") == 0 && _subMenuProvider) + if (strcmp(Id, "MenuOrgPatch-v0.1::MainMenuItemsProvider") == 0) { - ISubMenuProvider** ptr = (ISubMenuProvider**)Data; - *ptr = _subMenuProvider; - - return true; + if (_subMenuProvider) + { + IMainMenuItemsProvider** ptr = (IMainMenuItemsProvider**)Data; + *ptr = _subMenuProvider; + + return true; + } + else + { + Skins.Message(mtError, tr("Failed to load MenuOrg's config file!")); + } } return false; } - -const char **MenuOrgPlugin::SVDRPHelpPages(void) -{ - // Return help text for SVDRP commands this plugin implements - return NULL; -} - -cString MenuOrgPlugin::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) -{ - // Process SVDRP commands this plugin implements - return NULL; -} diff --git a/src/menuorg.h b/src/menuorg.h index 821ed5b..12ae279 100644 --- a/src/menuorg.h +++ b/src/menuorg.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -26,12 +26,12 @@ #include #include "submenuprovider.h" -using namespace SubMenuPatch; +using namespace MenuOrgPatch; class MenuOrgPlugin : public cPlugin { private: - SubMenuProvider* _subMenuProvider; + MainMenuItemsProvider* _subMenuProvider; public: MenuOrgPlugin(void); @@ -41,18 +41,11 @@ class MenuOrgPlugin : public cPlugin virtual const char *CommandLineHelp(void); virtual bool ProcessArgs(int argc, char *argv[]); virtual bool Initialize(void); - virtual bool Start(void); - virtual void Stop(void); - virtual void Housekeeping(void); - virtual void MainThreadHook(void); - virtual cString Active(void); virtual const char *MainMenuEntry(void); virtual cOsdObject *MainMenuAction(void); virtual cMenuSetupPage *SetupMenu(void); virtual bool SetupParse(const char *Name, const char *Value); virtual bool Service(const char *Id, void *Data = NULL); - virtual const char **SVDRPHelpPages(void); - virtual cString SVDRPCommand(const char *Command, const char *Option, int &ReplyCode); }; extern "C" void* VDRPluginCreator(); diff --git a/src/pluginmainmenuitem.h b/src/pluginmainmenuitem.h index e51633b..ce54e3b 100644 --- a/src/pluginmainmenuitem.h +++ b/src/pluginmainmenuitem.h @@ -16,13 +16,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ -#include +#include -class PluginMainMenuItem: public SubMenuPatch::IMainMenuItem +class PluginMainMenuItem: public MenuOrgPatch::IMainMenuItem { private: const char* _mainMenuEntry; diff --git a/src/pluginmenuitem.cpp b/src/pluginmenuitem.cpp index 7589ee7..36bbfa6 100644 --- a/src/pluginmenuitem.cpp +++ b/src/pluginmenuitem.cpp @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ #include "pluginmenuitem.h" -#include +#include #include "pluginmainmenuitem.h" PluginMenuItem::PluginMenuItem(const char* pluginMainMenuEntry, int pluginIndex) @@ -30,7 +30,7 @@ PluginMenuItem::PluginMenuItem(const char* pluginMainMenuEntry, int pluginIndex) _pluginIndex = pluginIndex; } -SubMenuPatch::IMainMenuItem* PluginMenuItem::CreateMainMenuItem() +MenuOrgPatch::IMainMenuItem* PluginMenuItem::CreateMainMenuItem() { return new PluginMainMenuItem(_pluginMainMenuEntry, _pluginIndex); } diff --git a/src/pluginmenuitem.h b/src/pluginmenuitem.h index ef8bdf3..11085b7 100644 --- a/src/pluginmenuitem.h +++ b/src/pluginmenuitem.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -25,7 +25,7 @@ #include "menunode.h" #include -#include +#include class PluginMenuItem: public MenuNode { @@ -35,7 +35,7 @@ class PluginMenuItem: public MenuNode public: PluginMenuItem(const char* pluginMainMenuEntry, int pluginIndex); - SubMenuPatch::IMainMenuItem* CreateMainMenuItem(); + MenuOrgPatch::IMainMenuItem* CreateMainMenuItem(); }; #endif diff --git a/src/submenuprovider.cpp b/src/submenuprovider.cpp index 56ab329..36cdc43 100644 --- a/src/submenuprovider.cpp +++ b/src/submenuprovider.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -26,12 +26,12 @@ #include "pluginmenuitem.h" #include -SubMenuProvider::SubMenuProvider(MenuNode* rootMenu) +MainMenuItemsProvider::MainMenuItemsProvider(MenuNode* rootMenu) { _currentMenu = _rootMenu = rootMenu; } -MainMenuItemsList* SubMenuProvider::MainMenuItems() +MainMenuItemsList* MainMenuItemsProvider::MainMenuItems() { ResetMainMenuItemsList(); @@ -44,7 +44,7 @@ MainMenuItemsList* SubMenuProvider::MainMenuItems() return &_currentMainMenuItems; } -void SubMenuProvider::ResetMainMenuItemsList() +void MainMenuItemsProvider::ResetMainMenuItemsList() { for( MainMenuItemsList::iterator i = _currentMainMenuItems.begin(); @@ -55,12 +55,12 @@ void SubMenuProvider::ResetMainMenuItemsList() _currentMainMenuItems.clear(); } -void SubMenuProvider::EnterRootMenu() +void MainMenuItemsProvider::EnterRootMenu() { _currentMenu = _rootMenu; } -void SubMenuProvider::EnterSubMenu(cOsdItem* item) +void MainMenuItemsProvider::EnterSubMenu(cOsdItem* item) { for(unsigned int itemIndex=0; itemIndex < _currentMainMenuItems.size(); itemIndex++) { @@ -73,7 +73,7 @@ void SubMenuProvider::EnterSubMenu(cOsdItem* item) } } -bool SubMenuProvider::LeaveSubMenu() +bool MainMenuItemsProvider::LeaveSubMenu() { if (_currentMenu->Parent()) { diff --git a/src/submenuprovider.h b/src/submenuprovider.h index ff2e8dc..4a9e50e 100644 --- a/src/submenuprovider.h +++ b/src/submenuprovider.h @@ -16,20 +16,20 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ -#ifndef ___SUBMENUPROVIDER_H -#define ___SUBMENUPROVIDER_H +#ifndef ___MAINMENUITEMSPROVIDER_H +#define ___MAINMENUITEMSPROVIDER_H -#include +#include #include "menunode.h" #include "xmlmenu.h" -using namespace SubMenuPatch; +using namespace MenuOrgPatch; -class SubMenuProvider: public ISubMenuProvider +class MainMenuItemsProvider: public IMainMenuItemsProvider { private: MenuNode* _rootMenu; @@ -37,7 +37,7 @@ class SubMenuProvider: public ISubMenuProvider MainMenuItemsList _currentMainMenuItems; public: - SubMenuProvider(MenuNode* rootMenu); + MainMenuItemsProvider(MenuNode* rootMenu); virtual MainMenuItemsList* MainMenuItems(); virtual void EnterRootMenu(); virtual void EnterSubMenu(cOsdItem* item); diff --git a/src/vdrmenuitem.cpp b/src/vdrmenuitem.cpp index f8af0ad..36dfe0d 100644 --- a/src/vdrmenuitem.cpp +++ b/src/vdrmenuitem.cpp @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ #include "vdrmenuitem.h" -#include +#include #include "custommainmenuitem.h" VdrMenuItem::VdrMenuItem(std::string itemText, eOSState itemState) @@ -30,7 +30,7 @@ VdrMenuItem::VdrMenuItem(std::string itemText, eOSState itemState) _itemState = itemState; } -SubMenuPatch::IMainMenuItem* VdrMenuItem::CreateMainMenuItem() +MenuOrgPatch::IMainMenuItem* VdrMenuItem::CreateMainMenuItem() { return new CustomMainMenuItem(new cOsdItem(tr(_itemText.c_str()), _itemState)); } diff --git a/src/vdrmenuitem.h b/src/vdrmenuitem.h index d0f069e..8582e7c 100644 --- a/src/vdrmenuitem.h +++ b/src/vdrmenuitem.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ @@ -25,7 +25,7 @@ #include "menunode.h" #include -#include +#include #include class VdrMenuItem: public MenuNode @@ -36,7 +36,7 @@ class VdrMenuItem: public MenuNode public: VdrMenuItem(std::string itemText, eOSState itemState); - SubMenuPatch::IMainMenuItem* CreateMainMenuItem(); + MenuOrgPatch::IMainMenuItem* CreateMainMenuItem(); }; #endif diff --git a/vdr-patch/menuorg-0.1.diff b/vdr-patch/menuorg-0.1.diff new file mode 100755 index 0000000..3c1fcb1 --- /dev/null +++ b/vdr-patch/menuorg-0.1.diff @@ -0,0 +1,162 @@ +diff -urNad vdr-1.4.7~/menu.c vdr-1.4.7/menu.c +--- vdr-1.4.7~/menu.c 2007-08-11 20:48:29.000000000 +0200 ++++ vdr-1.4.7/menu.c 2007-08-11 20:48:29.000000000 +0200 +@@ -31,6 +31,7 @@ + #include "vdrttxtsubshooks.h" + #include "dvbsub.h" + #include "videodir.h" ++#include "menuorgpatch.h" + + #define MAXWAIT4EPGINFO 3 // seconds + #define MODETIMEOUT 3 // seconds +@@ -3057,6 +3058,13 @@ + cancelEditingItem = NULL; + stopRecordingItem = NULL; + recordControlsState = 0; ++ ++ MenuOrgPatch::IMainMenuItemsProvider* mainMenuItemsProvider; ++ ++ if (cPluginManager::CallFirstService("MenuOrgPatch-v0.1::MainMenuitemsProvider", &mainMenuItemsProvider)) { ++ mainMenuItemsProvider->EnterRootMenu(); ++ } ++ + Set(); + + // Initial submenus: +@@ -3084,6 +3092,29 @@ + Clear(); + SetTitle("VDR"); + SetHasHotkeys(); ++ ++ MenuOrgPatch::IMainMenuItemsProvider* mainMenuItemsProvider; ++ ++ if (cPluginManager::CallFirstService("MenuOrgPatch-v0.1::MainMenuItemsProvider", &mainMenuItemsProvider)) { ++ MenuOrgPatch::MainMenuItemsList* menuItems = mainMenuItemsProvider->MainMenuItems(); ++ MenuOrgPatch::MainMenuItemsList::iterator i; ++ ++ for (i = menuItems->begin(); i != menuItems->end(); i++) { ++ if ((*i)->IsCustomMenuItem()) { ++ cOsdItem* osdItem = (*i)->CustomMenuItem(); ++ if (osdItem) { ++ osdItem->SetText(hk(osdItem->Text())); ++ Add(osdItem); ++ } ++ } ++ else if ((*i)->IsPluginMenuItem()) { ++ const char *item = (*i)->PluginMenuEntry(); ++ if (item) ++ Add(new cMenuPluginItem(hk(item), (*i)->PluginIndex())); ++ } ++ } ++ } ++ else { + + // Basic menu items: + +@@ -3111,6 +3142,8 @@ + if (Commands.Count()) + Add(new cOsdItem(hk(tr("Commands")), osCommands)); + ++ } ++ + Update(true); + + Display(); +@@ -3238,6 +3271,35 @@ + state = osEnd; + } + break; ++ case osBack: { ++ MenuOrgPatch::IMainMenuItemsProvider* mainMenuItemsProvider; ++ ++ if (cPluginManager::CallFirstService("MenuOrgPatch-v0.1::MainMenuItemsProvider", &mainMenuItemsProvider)) { ++ bool leavingMenuSucceeded = mainMenuItemsProvider->LeaveSubMenu(); ++ Set(); ++ stopReplayItem = NULL; ++ cancelEditingItem = NULL; ++ stopRecordingItem = NULL; ++ recordControlsState = 0; ++ Update(true); ++ Display(); ++ if (leavingMenuSucceeded) ++ return osContinue; ++ else ++ return osEnd; ++ } ++ } ++ break; ++ case osUser1: { ++ MenuOrgPatch::IMainMenuItemsProvider* mainMenuItemsProvider; ++ ++ if (cPluginManager::CallFirstService("MenuOrgPatch-v0.1::MainMenuItemsProvider", &mainMenuItemsProvider)) { ++ mainMenuItemsProvider->EnterSubMenu(Get(Current())); ++ Set(); ++ return osContinue; ++ } ++ } ++ break; + default: switch (Key) { + case kRecord: + case kRed: if (!HadSubMenu) +diff -urNad vdr-1.4.7~/menuorgpatch.h vdr-1.4.7/menuorgpatch.h +--- vdr-1.4.7~/menuorgpatch.h 1970-01-01 01:00:00.000000000 +0100 ++++ vdr-1.4.7/menuorgpatch.h 2007-08-11 20:48:58.000000000 +0200 +@@ -0,0 +1,58 @@ ++/* ++ * vdr-menuorg - A plugin for the Linux Video Disk Recorder ++ * Copyright (C) 2007 Thomas Creutz, Tobias Grimm ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * ++ * $Id:$ ++ * ++ */ ++ ++#ifndef __MENUORGPATCH_H ++#define __MENUORGPATCH_H ++ ++#include ++ ++class cOsdItem; ++ ++namespace MenuOrgPatch ++{ ++ ++class IMainMenuItem ++{ ++ public: ++ virtual ~IMainMenuItem() {}; ++ virtual bool IsCustomMenuItem() = 0; ++ virtual bool IsPluginMenuItem() = 0; ++ virtual cOsdItem* CustomMenuItem() = 0; ++ virtual const char* PluginMenuEntry() = 0; ++ virtual int PluginIndex() = 0; ++}; ++ ++typedef std::vector MainMenuItemsList; ++ ++class IMainMenuItemsProvider ++{ ++ public: ++ virtual ~IMainMenuItemsProvider() {}; ++ virtual MainMenuItemsList* MainMenuItems() = 0; ++ virtual void EnterRootMenu() = 0; ++ virtual void EnterSubMenu(cOsdItem* item) = 0; ++ virtual bool LeaveSubMenu() = 0; ++}; ++ ++}; ++ ++#endif //__MENUORGPATCH_H diff --git a/vdr-patch/opt-37_submenu.dpatch b/vdr-patch/opt-37_submenu.dpatch deleted file mode 100755 index 826dc8b..0000000 --- a/vdr-patch/opt-37_submenu.dpatch +++ /dev/null @@ -1,167 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## opt-37_submenu.dpatch by Tobias Grimm -## DP: This patch is needed for the submenu plugin. - -@DPATCH@ -diff -urNad vdr-1.4.7~/menu.c vdr-1.4.7/menu.c ---- vdr-1.4.7~/menu.c 2007-07-28 15:20:41.000000000 +0200 -+++ vdr-1.4.7/menu.c 2007-07-28 15:20:41.000000000 +0200 -@@ -31,6 +31,7 @@ - #include "vdrttxtsubshooks.h" - #include "dvbsub.h" - #include "videodir.h" -+#include "submenupatch.h" - - #define MAXWAIT4EPGINFO 3 // seconds - #define MODETIMEOUT 3 // seconds -@@ -3057,6 +3058,13 @@ - cancelEditingItem = NULL; - stopRecordingItem = NULL; - recordControlsState = 0; -+ -+ SubMenuPatch::ISubMenuProvider* subMenuProvider; -+ -+ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { -+ subMenuProvider->EnterRootMenu(); -+ } -+ - Set(); - - // Initial submenus: -@@ -3084,6 +3092,29 @@ - Clear(); - SetTitle("VDR"); - SetHasHotkeys(); -+ -+ SubMenuPatch::ISubMenuProvider* subMenuProvider; -+ -+ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { -+ SubMenuPatch::MainMenuItemsList* menuItems = subMenuProvider->MainMenuItems(); -+ SubMenuPatch::MainMenuItemsList::iterator i; -+ -+ for (i = menuItems->begin(); i != menuItems->end(); i++) { -+ if ((*i)->IsCustomMenuItem()) { -+ cOsdItem* osdItem = (*i)->CustomMenuItem(); -+ if (osdItem) { -+ osdItem->SetText(hk(osdItem->Text())); -+ Add(osdItem); -+ } -+ } -+ else if ((*i)->IsPluginMenuItem()) { -+ const char *item = (*i)->PluginMenuEntry(); -+ if (item) -+ Add(new cMenuPluginItem(hk(item), (*i)->PluginIndex())); -+ } -+ } -+ } -+ else { - - // Basic menu items: - -@@ -3111,6 +3142,8 @@ - if (Commands.Count()) - Add(new cOsdItem(hk(tr("Commands")), osCommands)); - -+ } -+ - Update(true); - - Display(); -@@ -3238,6 +3271,35 @@ - state = osEnd; - } - break; -+ case osBack: { -+ SubMenuPatch::ISubMenuProvider* subMenuProvider; -+ -+ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { -+ bool leavingMenuSucceeded = subMenuProvider->LeaveSubMenu(); -+ Set(); -+ stopReplayItem = NULL; -+ cancelEditingItem = NULL; -+ stopRecordingItem = NULL; -+ recordControlsState = 0; -+ Update(true); -+ Display(); -+ if (leavingMenuSucceeded) -+ return osContinue; -+ else -+ return osEnd; -+ } -+ } -+ break; -+ case osUser1: { -+ SubMenuPatch::ISubMenuProvider* subMenuProvider; -+ -+ if (cPluginManager::CallFirstService("SubMenuPatch-v0.1::SubMenuProvider", &subMenuProvider)) { -+ subMenuProvider->EnterSubMenu(Get(Current())); -+ Set(); -+ return osContinue; -+ } -+ } -+ break; - default: switch (Key) { - case kRecord: - case kRed: if (!HadSubMenu) -diff -urNad vdr-1.4.7~/submenupatch.h vdr-1.4.7/submenupatch.h ---- vdr-1.4.7~/submenupatch.h 1970-01-01 01:00:00.000000000 +0100 -+++ vdr-1.4.7/submenupatch.h 2007-07-28 15:23:23.000000000 +0200 -@@ -0,0 +1,58 @@ -+/* -+ * vdr-submenu - A plugin for the Linux Video Disk Recorder -+ * Copyright (c) 2007 Tobias Grimm -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+ * -+ * $Id$ -+ * -+ */ -+ -+#ifndef __SUBMENUPATCH_H -+#define __SUBMENUPATCH_H -+ -+#include -+ -+class cOsdItem; -+ -+namespace SubMenuPatch -+{ -+ -+class IMainMenuItem -+{ -+ public: -+ virtual ~IMainMenuItem() {}; -+ virtual bool IsCustomMenuItem() = 0; -+ virtual bool IsPluginMenuItem() = 0; -+ virtual cOsdItem* CustomMenuItem() = 0; -+ virtual const char* PluginMenuEntry() = 0; -+ virtual int PluginIndex() = 0; -+}; -+ -+typedef std::vector MainMenuItemsList; -+ -+class ISubMenuProvider -+{ -+ public: -+ virtual ~ISubMenuProvider() {}; -+ virtual MainMenuItemsList* MainMenuItems() = 0; -+ virtual void EnterRootMenu() = 0; -+ virtual void EnterSubMenu(cOsdItem* item) = 0; -+ virtual bool LeaveSubMenu() = 0; -+}; -+ -+}; -+ -+#endif //__SUBMENUPATCH_H -- cgit v1.2.3