summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2006-01-05 13:43:07 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2006-01-05 13:43:07 +0100
commit739fcc7aff2fdbcaf0b93e1fa2bdc9654374f042 (patch)
tree8287511d6d3dc0a87d06d73657b1d81179972214 /menu.c
parent02ae3e98d49023353cbb7f4cb5ecdf8e7182981d (diff)
downloadvdr-739fcc7aff2fdbcaf0b93e1fa2bdc9654374f042.tar.gz
vdr-739fcc7aff2fdbcaf0b93e1fa2bdc9654374f042.tar.bz2
In the "Channels" menu the numeric keys now position the cursor to the channel with the given number
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/menu.c b/menu.c
index bb3c95e5..5fc1323d 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.384 2006/01/04 14:42:13 kls Exp $
+ * $Id: menu.c 1.385 2006/01/05 13:26:37 kls Exp $
*/
#include "menu.h"
@@ -381,12 +381,17 @@ void cMenuChannelItem::Set(void)
// --- cMenuChannels ---------------------------------------------------------
+#define CHANNELNUMBERTIMEOUT 1000 //ms
+
class cMenuChannels : public cOsdMenu {
private:
+ int number;
+ cTimeMs numberTimer;
void Setup(void);
cChannel *GetChannel(int Index);
void Propagate(void);
protected:
+ eOSState Number(eKeys Key);
eOSState Switch(void);
eOSState Edit(void);
eOSState New(void);
@@ -401,6 +406,7 @@ public:
cMenuChannels::cMenuChannels(void)
:cOsdMenu(tr("Channels"), CHNUMWIDTH)
{
+ number = 0;
Setup();
Channels.IncBeingEdited();
}
@@ -447,6 +453,30 @@ void cMenuChannels::Propagate(void)
Channels.SetModified(true);
}
+eOSState cMenuChannels::Number(eKeys Key)
+{
+ if (HasSubMenu())
+ return osContinue;
+ if (numberTimer.TimedOut())
+ number = 0;
+ if (!number && Key == k0) {
+ cMenuChannelItem::IncSortMode();
+ Setup();
+ }
+ else {
+ number = number * 10 + Key - k0;
+ for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next()) {
+ if (!ci->Channel()->GroupSep() && ci->Channel()->Number() == number) {
+ SetCurrent(ci);
+ Display();
+ break;
+ }
+ }
+ numberTimer.Set(CHANNELNUMBERTIMEOUT);
+ }
+ return osContinue;
+}
+
eOSState cMenuChannels::Switch(void)
{
if (HasSubMenu())
@@ -531,9 +561,8 @@ eOSState cMenuChannels::ProcessKey(eKeys Key)
default:
if (state == osUnknown) {
switch (Key) {
- case k0: cMenuChannelItem::IncSortMode();
- Setup();
- break;
+ case k0 ... k9:
+ return Number(Key);
case kOk: return Switch();
case kRed: return Edit();
case kGreen: return New();