summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-02-03 15:28:49 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2001-02-03 15:28:49 +0100
commit7f6a2a7a0c001c425efdab381914e7c297f61166 (patch)
tree044a9b08d0aef5e2aa997a1f8e2a659ef552f82f
parentcaa96c00eaecd5f0c67f0575468dd088f2c8ee1e (diff)
downloadvdr-7f6a2a7a0c001c425efdab381914e7c297f61166.tar.gz
vdr-7f6a2a7a0c001c425efdab381914e7c297f61166.tar.bz2
Implemented hotkeys for Main and Commands menu
-rw-r--r--FORMATS10
-rw-r--r--HISTORY4
-rw-r--r--menu.c27
-rw-r--r--osd.c20
-rw-r--r--osd.h5
5 files changed, 52 insertions, 14 deletions
diff --git a/FORMATS b/FORMATS
index ed52518d..a2ab7c11 100644
--- a/FORMATS
+++ b/FORMATS
@@ -86,9 +86,13 @@ Video Disk Recorder File Formats
Examples:
- Check for new mail: /usr/local/bin/checkmail 2>&1
- CPU status : /usr/loval/bin/cpustatus 2>&1
- Disk space : df -h | grep '/video' | awk '{ print 100 - $5 "% free"; }'
+ 1 Check for new mail: /usr/local/bin/checkmail 2>&1
+ 2 CPU status : /usr/loval/bin/cpustatus 2>&1
+ 3 Disk space : df -h | grep '/video' | awk '{ print 100 - $5 "% free"; }'
+
+ If the first non-blank character of the 'title' is a digit in the range
+ 1..9, the command can be selected directly by pressing the respective numerical
+ key on the remote control.
* marks.vdr
diff --git a/HISTORY b/HISTORY
index 39681c74..287006fd 100644
--- a/HISTORY
+++ b/HISTORY
@@ -367,3 +367,7 @@ Video Disk Recorder Revision History
- The "Left" and "Right" keys are now used to page up and down in lists (thanks
to Martin Hammerschmid). Since the "Timers" menu already uses these keys to
(de)activate timers, this functionality is not available here.
+- The "Main" and "Commands" menu now support "hotkeys", which means that if the
+ first non-blank character of a menu item is a digit in the range 1..9, that
+ item can be selected by pressing the respective numeric key on the remote
+ control.
diff --git a/menu.c b/menu.c
index 777bd6c3..027c4661 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.59 2001/02/03 14:28:42 kls Exp $
+ * $Id: menu.c 1.60 2001/02/03 15:28:49 kls Exp $
*/
#include "menu.h"
@@ -1620,6 +1620,7 @@ cMenuCommands::cMenuCommands(void)
Add(new cOsdItem(command->Title()));
i++;
}
+ SetHasHotkeys();
}
eOSState cMenuCommands::Execute(void)
@@ -1650,18 +1651,25 @@ eOSState cMenuCommands::ProcessKey(eKeys Key)
#define STOP_RECORDING tr("Stop recording ")
+static const char *hk(int n, const char *s)
+{
+ static char buffer[32];
+ snprintf(buffer, sizeof(buffer), " %d %s", n, s);
+ return buffer;
+}
+
cMenuMain::cMenuMain(bool Replaying)
:cOsdMenu(tr("Main"))
{
- Add(new cOsdItem(tr("Schedule"), osSchedule));
- Add(new cOsdItem(tr("Channels"), osChannels));
- Add(new cOsdItem(tr("Timers"), osTimers));
- Add(new cOsdItem(tr("Recordings"), osRecordings));
- Add(new cOsdItem(tr("Setup"), osSetup));
+ Add(new cOsdItem(hk(1, tr("Schedule")), osSchedule));
+ Add(new cOsdItem(hk(2, tr("Channels")), osChannels));
+ Add(new cOsdItem(hk(3, tr("Timers")), osTimers));
+ Add(new cOsdItem(hk(4, tr("Recordings")), osRecordings));
+ Add(new cOsdItem(hk(5, tr("Setup")), osSetup));
if (Commands.Count())
- Add(new cOsdItem(tr("Commands"), osCommands));
+ Add(new cOsdItem(hk(6, tr("Commands")), osCommands));
if (Replaying)
- Add(new cOsdItem(tr("Stop replaying"), osStopReplay));
+ Add(new cOsdItem(tr(" Stop replaying"), osStopReplay));
const char *s = NULL;
while ((s = cRecordControls::GetInstantId(s)) != NULL) {
char *buffer = NULL;
@@ -1670,10 +1678,11 @@ cMenuMain::cMenuMain(bool Replaying)
delete buffer;
}
if (cVideoCutter::Active())
- Add(new cOsdItem(tr("Cancel editing"), osCancelEdit));
+ Add(new cOsdItem(tr(" Cancel editing"), osCancelEdit));
SetHelp(tr("Record"), NULL, NULL, cReplayControl::LastReplayed() ? tr("Resume") : NULL);
Display();
lastActivity = time(NULL);
+ SetHasHotkeys();
}
eOSState cMenuMain::ProcessKey(eKeys Key)
diff --git a/osd.c b/osd.c
index 52988f2c..bc3d1878 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 1.14 2001/02/03 14:26:18 kls Exp $
+ * $Id: osd.c 1.15 2001/02/03 15:14:45 kls Exp $
*/
#include "osd.h"
@@ -77,6 +77,7 @@ eOSState cOsdItem::ProcessKey(eKeys Key)
cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
{
+ hasHotkeys = false;
visible = false;
title = strdup(Title);
cols[0] = c0;
@@ -290,6 +291,20 @@ void cOsdMenu::Mark(void)
}
}
+eOSState cOsdMenu::HotKey(eKeys Key)
+{
+ for (cOsdItem *item = First(); item; item = Next(item)) {
+ const char *s = item->Text();
+ if (s && (s = skipspace(s)) != NULL) {
+ if (*s == Key - k1 + '1') {
+ current = item->Index();
+ return ProcessKey(kOk);
+ }
+ }
+ }
+ return osContinue;
+}
+
eOSState cOsdMenu::AddSubMenu(cOsdMenu *SubMenu)
{
delete subMenu;
@@ -319,6 +334,9 @@ eOSState cOsdMenu::ProcessKey(eKeys Key)
return state;
}
switch (Key) {
+ case k1...k9: if (hasHotkeys)
+ return HotKey(Key);
+ break;
case kUp|k_Repeat:
case kUp: CursorUp(); break;
case kDown|k_Repeat:
diff --git a/osd.h b/osd.h
index 10b07147..c0fb1a1e 100644
--- a/osd.h
+++ b/osd.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.h 1.19 2001/02/03 14:14:23 kls Exp $
+ * $Id: osd.h 1.20 2001/02/03 15:13:59 kls Exp $
*/
#ifndef __OSD_H
@@ -77,6 +77,7 @@ private:
cOsdMenu *subMenu;
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
const char *status;
+ bool hasHotkeys;
protected:
bool visible;
virtual void Clear(void);
@@ -88,6 +89,7 @@ protected:
void PageUp(void);
void PageDown(void);
void Mark(void);
+ eOSState HotKey(eKeys Key);
eOSState AddSubMenu(cOsdMenu *SubMenu);
bool HasSubMenu(void) { return subMenu; }
void SetStatus(const char *s);
@@ -97,6 +99,7 @@ protected:
public:
cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
virtual ~cOsdMenu();
+ void SetHasHotkeys(void) { hasHotkeys = true; }
int Current(void) { return current; }
void Add(cOsdItem *Item, bool Current = false);
void Display(void);