From b856b0d5f6a3ea5cd52640bb3e200e5c7045b704 Mon Sep 17 00:00:00 2001 From: Ulrich Eckhardt Date: Sun, 23 Apr 2017 16:51:05 +0200 Subject: Updated VDR Patch for 2.3.x --- vdr-patch/vdr-menuorg-0.4.2.diff | 270 -------------------------------------- vdr-patch/vdr-menuorg-2.3.x.diff | 275 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+), 270 deletions(-) delete mode 100644 vdr-patch/vdr-menuorg-0.4.2.diff create mode 100644 vdr-patch/vdr-menuorg-2.3.x.diff diff --git a/vdr-patch/vdr-menuorg-0.4.2.diff b/vdr-patch/vdr-menuorg-0.4.2.diff deleted file mode 100644 index b24b848..0000000 --- a/vdr-patch/vdr-menuorg-0.4.2.diff +++ /dev/null @@ -1,270 +0,0 @@ -diff -Nur vdr-1.5.18.orig/mainmenuitemsprovider.h vdr-1.5.18/mainmenuitemsprovider.h ---- vdr-1.5.18.orig/mainmenuitemsprovider.h 1970-01-01 01:00:00.000000000 +0100 -+++ vdr-1.5.18/mainmenuitemsprovider.h 2008-03-25 21:17:28.000000000 +0100 -@@ -0,0 +1,60 @@ -+/* -+ * vdr-menuorg - A plugin for the Linux Video Disk Recorder -+ * Copyright (c) 2007 - 2008 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., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ * $Id$ -+ * -+ */ -+ -+#ifndef __MAINMENUITEMSPROVIDER_H -+#define __MAINMENUITEMSPROVIDER_H -+ -+#include -+ -+class cOsdItem; -+class cOsdMenu; -+ -+class IMenuItemDefinition -+{ -+ public: -+ virtual ~IMenuItemDefinition() {}; -+ virtual bool IsCustomOsdItem() = 0; -+ virtual bool IsPluginItem() = 0; -+ virtual bool IsSeparatorItem() = 0; -+ virtual cOsdItem* CustomOsdItem() = 0; -+ virtual const char* PluginMenuEntry() = 0; -+ virtual bool IsSelected() = 0; -+ virtual int PluginIndex() = 0; -+}; -+ -+typedef std::vector MenuItemDefinitions; -+ -+#define MENU_ITEMS_PROVIDER_SERVICE_ID "MenuOrgPatch-v0.4.2::MainMenuItemsProvider" -+ -+class IMainMenuItemsProvider -+{ -+ public: -+ virtual ~IMainMenuItemsProvider() {}; -+ virtual bool IsCustomMenuAvailable() = 0; -+ virtual MenuItemDefinitions* MainMenuItems() = 0; -+ virtual void EnterRootMenu() = 0; -+ virtual void EnterSubMenu(cOsdItem* item) = 0; -+ virtual bool LeaveSubMenu() = 0; -+ virtual cOsdMenu* Execute(cOsdItem* item) = 0; -+}; -+ -+#endif //__MAINMENUITEMSPROVIDER_H -diff -Nur vdr-1.5.18.orig/menu.c vdr-1.5.18/menu.c ---- vdr-1.5.18.orig/menu.c 2008-03-16 12:15:28.000000000 +0100 -+++ vdr-1.5.18/menu.c 2008-03-25 21:17:28.000000000 +0100 -@@ -29,6 +29,7 @@ - #include "timers.h" - #include "transfer.h" - #include "videodir.h" -+#include "menuorgpatch.h" - - #define MAXWAIT4EPGINFO 3 // seconds - #define MODETIMEOUT 3 // seconds -@@ -2969,6 +2970,9 @@ - cancelEditingItem = NULL; - stopRecordingItem = NULL; - recordControlsState = 0; -+ -+ MenuOrgPatch::EnterRootMenu(); -+ - Set(); - - // Initial submenus: -@@ -2997,6 +3001,29 @@ - SetTitle("VDR"); - SetHasHotkeys(); - -+ if (MenuOrgPatch::IsCustomMenuAvailable()) { -+ MenuItemDefinitions* menuItems = MenuOrgPatch::MainMenuItems(); -+ for (MenuItemDefinitions::iterator i = menuItems->begin(); i != menuItems->end(); i++) { -+ cOsdItem* osdItem = NULL; -+ if ((*i)->IsCustomOsdItem()) { -+ osdItem = (*i)->CustomOsdItem(); -+ if (osdItem && !(*i)->IsSeparatorItem()) -+ osdItem->SetText(hk(osdItem->Text())); -+ } -+ else if ((*i)->IsPluginItem()) { -+ const char *item = (*i)->PluginMenuEntry(); -+ if (item) -+ osdItem = new cMenuPluginItem(hk(item), (*i)->PluginIndex()); -+ } -+ if (osdItem) { -+ Add(osdItem); -+ if ((*i)->IsSelected()) -+ SetCurrent(osdItem); -+ } -+ } -+ } -+ else { -+ - // Basic menu items: - - Add(new cOsdItem(hk(tr("Schedule")), osSchedule)); -@@ -3023,6 +3050,8 @@ - if (Commands.Count()) - Add(new cOsdItem(hk(tr("Commands")), osCommands)); - -+ } -+ - Update(true); - - Display(); -@@ -3135,6 +3164,41 @@ - state = osEnd; - } - break; -+ case osBack: { -+ if (MenuOrgPatch::IsCustomMenuAvailable()) -+ { -+ bool leavingMenuSucceeded = MenuOrgPatch::LeaveSubMenu(); -+ Set(); -+ stopReplayItem = NULL; -+ cancelEditingItem = NULL; -+ stopRecordingItem = NULL; -+ recordControlsState = 0; -+ Update(true); -+ Display(); -+ if (leavingMenuSucceeded) -+ return osContinue; -+ else -+ return osEnd; -+ } -+ } -+ break; -+ case osUser1: { -+ if (MenuOrgPatch::IsCustomMenuAvailable()) { -+ MenuOrgPatch::EnterSubMenu(Get(Current())); -+ Set(); -+ return osContinue; -+ } -+ } -+ break; -+ case osUser2: { -+ if (MenuOrgPatch::IsCustomMenuAvailable()) { -+ cOsdMenu* osdMenu = MenuOrgPatch::Execute(Get(Current())); -+ if (osdMenu) -+ return AddSubMenu(osdMenu); -+ return osEnd; -+ } -+ } -+ break; - default: switch (Key) { - case kRecord: - case kRed: if (!HadSubMenu) -diff -Nur vdr-1.5.18.orig/menuorgpatch.h vdr-1.5.18/menuorgpatch.h ---- vdr-1.5.18.orig/menuorgpatch.h 1970-01-01 01:00:00.000000000 +0100 -+++ vdr-1.5.18/menuorgpatch.h 2008-03-25 21:17:28.000000000 +0100 -@@ -0,0 +1,100 @@ -+/* -+ * vdr-menuorg - A plugin for the Linux Video Disk Recorder -+ * Copyright (c) 2007 - 2008 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., -+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ * $Id$ -+ * -+ */ -+ -+#ifndef __MENUORGPATCH_H -+#define __MENUORGPATCH_H -+ -+#include "mainmenuitemsprovider.h" -+ -+class MenuOrgPatch -+{ -+ private: -+ static IMainMenuItemsProvider* _mainMenuItemsProvider; -+ -+ private: -+ static IMainMenuItemsProvider* MainMenuItemsProvider() -+ { -+ if (!_mainMenuItemsProvider) -+ { -+ IMainMenuItemsProvider* mainMenuItemsProvider; -+ -+ if (cPluginManager::CallFirstService(MENU_ITEMS_PROVIDER_SERVICE_ID, &mainMenuItemsProvider)) -+ { -+ _mainMenuItemsProvider = mainMenuItemsProvider; -+ } -+ } -+ return _mainMenuItemsProvider; -+ } -+ -+ public: -+ static bool IsCustomMenuAvailable() -+ { -+ return (MainMenuItemsProvider() != NULL) && (MainMenuItemsProvider()->IsCustomMenuAvailable()); -+ } -+ -+ static void EnterRootMenu() -+ { -+ if (MainMenuItemsProvider()) -+ { -+ MainMenuItemsProvider()->EnterRootMenu(); -+ } -+ } -+ -+ static bool LeaveSubMenu() -+ { -+ if (MainMenuItemsProvider()) -+ { -+ return MainMenuItemsProvider()->LeaveSubMenu(); -+ } -+ return false; -+ } -+ -+ static void EnterSubMenu(cOsdItem* item) -+ { -+ if (MainMenuItemsProvider()) -+ { -+ MainMenuItemsProvider()->EnterSubMenu(item); -+ } -+ } -+ -+ static MenuItemDefinitions* MainMenuItems() -+ { -+ if (MainMenuItemsProvider()) -+ { -+ return MainMenuItemsProvider()->MainMenuItems(); -+ } -+ return NULL; -+ } -+ -+ static cOsdMenu* Execute(cOsdItem* item) -+ { -+ if (MainMenuItemsProvider()) -+ { -+ return MainMenuItemsProvider()->Execute(item); -+ } -+ return NULL; -+ } -+}; -+ -+IMainMenuItemsProvider* MenuOrgPatch::_mainMenuItemsProvider = NULL; -+ -+#endif //__MENUORGPATCH_H diff --git a/vdr-patch/vdr-menuorg-2.3.x.diff b/vdr-patch/vdr-menuorg-2.3.x.diff new file mode 100644 index 0000000..5eeb0fa --- /dev/null +++ b/vdr-patch/vdr-menuorg-2.3.x.diff @@ -0,0 +1,275 @@ +diff --git a/mainmenuitemsprovider.h b/mainmenuitemsprovider.h +new file mode 100644 +index 0000000..aaba5e9 +--- /dev/null ++++ b/mainmenuitemsprovider.h +@@ -0,0 +1,60 @@ ++/* ++ * vdr-menuorg - A plugin for the Linux Video Disk Recorder ++ * Copyright (c) 2007 - 2008 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., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * $Id$ ++ * ++ */ ++ ++#ifndef __MAINMENUITEMSPROVIDER_H ++#define __MAINMENUITEMSPROVIDER_H ++ ++#include ++ ++class cOsdItem; ++class cOsdMenu; ++ ++class IMenuItemDefinition ++{ ++ public: ++ virtual ~IMenuItemDefinition() {}; ++ virtual bool IsCustomOsdItem() = 0; ++ virtual bool IsPluginItem() = 0; ++ virtual bool IsSeparatorItem() = 0; ++ virtual cOsdItem* CustomOsdItem() = 0; ++ virtual const char* PluginMenuEntry() = 0; ++ virtual bool IsSelected() = 0; ++ virtual int PluginIndex() = 0; ++}; ++ ++typedef std::vector MenuItemDefinitions; ++ ++#define MENU_ITEMS_PROVIDER_SERVICE_ID "MenuOrgPatch-v0.4.2::MainMenuItemsProvider" ++ ++class IMainMenuItemsProvider ++{ ++ public: ++ virtual ~IMainMenuItemsProvider() {}; ++ virtual bool IsCustomMenuAvailable() = 0; ++ virtual MenuItemDefinitions* MainMenuItems() = 0; ++ virtual void EnterRootMenu() = 0; ++ virtual void EnterSubMenu(cOsdItem* item) = 0; ++ virtual bool LeaveSubMenu() = 0; ++ virtual cOsdMenu* Execute(cOsdItem* item) = 0; ++}; ++ ++#endif //__MAINMENUITEMSPROVIDER_H +diff --git a/menu.c b/menu.c +index 233b025..396bbea 100644 +--- a/menu.c ++++ b/menu.c +@@ -32,6 +32,7 @@ + #include "timers.h" + #include "transfer.h" + #include "videodir.h" ++#include "menuorgpatch.h" + + #define MAXWAIT4EPGINFO 3 // seconds + #define MODETIMEOUT 3 // seconds +@@ -4289,6 +4290,9 @@ cMenuMain::cMenuMain(eOSState State, bool OpenSubMenus) + cancelEditingItem = NULL; + stopRecordingItem = NULL; + recordControlsState = 0; ++ ++ MenuOrgPatch::EnterRootMenu(); ++ + Set(); + + // Initial submenus: +@@ -4317,6 +4321,29 @@ void cMenuMain::Set(void) + SetTitle("VDR"); + SetHasHotkeys(); + ++ if (MenuOrgPatch::IsCustomMenuAvailable()) { ++ MenuItemDefinitions* menuItems = MenuOrgPatch::MainMenuItems(); ++ for (MenuItemDefinitions::iterator i = menuItems->begin(); i != menuItems->end(); i++) { ++ cOsdItem* osdItem = NULL; ++ if ((*i)->IsCustomOsdItem()) { ++ osdItem = (*i)->CustomOsdItem(); ++ if (osdItem && !(*i)->IsSeparatorItem()) ++ osdItem->SetText(hk(osdItem->Text())); ++ } ++ else if ((*i)->IsPluginItem()) { ++ const char *item = (*i)->PluginMenuEntry(); ++ if (item) ++ osdItem = new cMenuPluginItem(hk(item), (*i)->PluginIndex()); ++ } ++ if (osdItem) { ++ Add(osdItem); ++ if ((*i)->IsSelected()) ++ SetCurrent(osdItem); ++ } ++ } ++ } ++ else { ++ + // Basic menu items: + + Add(new cOsdItem(hk(tr("Schedule")), osSchedule)); +@@ -4343,6 +4370,8 @@ void cMenuMain::Set(void) + if (Commands.Count()) + Add(new cOsdItem(hk(tr("Commands")), osCommands)); + ++ } ++ + Update(true); + + Display(); +@@ -4447,6 +4476,41 @@ eOSState cMenuMain::ProcessKey(eKeys Key) + state = osEnd; + } + break; ++ case osBack: { ++ if (MenuOrgPatch::IsCustomMenuAvailable()) ++ { ++ bool leavingMenuSucceeded = MenuOrgPatch::LeaveSubMenu(); ++ Set(); ++ stopReplayItem = NULL; ++ cancelEditingItem = NULL; ++ stopRecordingItem = NULL; ++ recordControlsState = 0; ++ Update(true); ++ Display(); ++ if (leavingMenuSucceeded) ++ return osContinue; ++ else ++ return osEnd; ++ } ++ } ++ break; ++ case osUser1: { ++ if (MenuOrgPatch::IsCustomMenuAvailable()) { ++ MenuOrgPatch::EnterSubMenu(Get(Current())); ++ Set(); ++ return osContinue; ++ } ++ } ++ break; ++ case osUser2: { ++ if (MenuOrgPatch::IsCustomMenuAvailable()) { ++ cOsdMenu* osdMenu = MenuOrgPatch::Execute(Get(Current())); ++ if (osdMenu) ++ return AddSubMenu(osdMenu); ++ return osEnd; ++ } ++ } ++ break; + default: switch (Key) { + case kRecord: + case kRed: if (!HadSubMenu) +diff --git a/menuorgpatch.h b/menuorgpatch.h +new file mode 100644 +index 0000000..37fa0a7 +--- /dev/null ++++ b/menuorgpatch.h +@@ -0,0 +1,100 @@ ++/* ++ * vdr-menuorg - A plugin for the Linux Video Disk Recorder ++ * Copyright (c) 2007 - 2008 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., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * $Id$ ++ * ++ */ ++ ++#ifndef __MENUORGPATCH_H ++#define __MENUORGPATCH_H ++ ++#include "mainmenuitemsprovider.h" ++ ++class MenuOrgPatch ++{ ++ private: ++ static IMainMenuItemsProvider* _mainMenuItemsProvider; ++ ++ private: ++ static IMainMenuItemsProvider* MainMenuItemsProvider() ++ { ++ if (!_mainMenuItemsProvider) ++ { ++ IMainMenuItemsProvider* mainMenuItemsProvider; ++ ++ if (cPluginManager::CallFirstService(MENU_ITEMS_PROVIDER_SERVICE_ID, &mainMenuItemsProvider)) ++ { ++ _mainMenuItemsProvider = mainMenuItemsProvider; ++ } ++ } ++ return _mainMenuItemsProvider; ++ } ++ ++ public: ++ static bool IsCustomMenuAvailable() ++ { ++ return (MainMenuItemsProvider() != NULL) && (MainMenuItemsProvider()->IsCustomMenuAvailable()); ++ } ++ ++ static void EnterRootMenu() ++ { ++ if (MainMenuItemsProvider()) ++ { ++ MainMenuItemsProvider()->EnterRootMenu(); ++ } ++ } ++ ++ static bool LeaveSubMenu() ++ { ++ if (MainMenuItemsProvider()) ++ { ++ return MainMenuItemsProvider()->LeaveSubMenu(); ++ } ++ return false; ++ } ++ ++ static void EnterSubMenu(cOsdItem* item) ++ { ++ if (MainMenuItemsProvider()) ++ { ++ MainMenuItemsProvider()->EnterSubMenu(item); ++ } ++ } ++ ++ static MenuItemDefinitions* MainMenuItems() ++ { ++ if (MainMenuItemsProvider()) ++ { ++ return MainMenuItemsProvider()->MainMenuItems(); ++ } ++ return NULL; ++ } ++ ++ static cOsdMenu* Execute(cOsdItem* item) ++ { ++ if (MainMenuItemsProvider()) ++ { ++ return MainMenuItemsProvider()->Execute(item); ++ } ++ return NULL; ++ } ++}; ++ ++IMainMenuItemsProvider* MenuOrgPatch::_mainMenuItemsProvider = NULL; ++ ++#endif //__MENUORGPATCH_H -- cgit v1.2.3