1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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 <vector>
+
+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<IMainMenuItem*> 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
|