From 739fcc7aff2fdbcaf0b93e1fa2bdc9654374f042 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 5 Jan 2006 13:43:07 +0100 Subject: [PATCH] In the "Channels" menu the numeric keys now position the cursor to the channel with the given number --- HISTORY | 3 +++ MANUAL | 7 ++++++- menu.c | 37 +++++++++++++++++++++++++++++++++---- osdbase.c | 5 ++++- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/HISTORY b/HISTORY index 4977d354..da92260d 100644 --- a/HISTORY +++ b/HISTORY @@ -4097,3 +4097,6 @@ Video Disk Recorder Revision History //#define USE_FADVISE in tools.c. - Removed unused 'offset' member from cOsdItem. +- In the "Channels" menu the numeric keys now position the cursor to the channel + with the given number (see MANUAL, section "Remote Control Keys", note (3) for + details). diff --git a/MANUAL b/MANUAL index 92101973..ff706396 100644 --- a/MANUAL +++ b/MANUAL @@ -74,7 +74,12 @@ Version 1.2 to "mark" a timer for moving. (2) See "Processing Recordings" below. (3) In the "Channels" menu the '0' key switches the sort mode through "by number", - "by name" and "by provider". + "by name" and "by provider". Other numeric input positions the cursor to + the channel with the number entered so far. If there is no channel with that + number, nothing happens. While entering a channel number, the '0' key will + be treated as part of that number, not as a sort mode toggle. If no numeric + key has been pressed for more than one second, the number is reset and '0' + functions as sort mode toggle again. (4) In the "Timers" menu, when on the "Day" item, the '0' key toggles between a single shot and a repeating timer. If "Day" indicates a repeating timer, the keys '1'...'7' can be used to toggle the individual days ('1' is Monday). 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(); diff --git a/osdbase.c b/osdbase.c index 81e146a8..ecd124d2 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 1.25 2006/01/05 12:42:00 kls Exp $ + * $Id: osdbase.c 1.26 2006/01/05 13:26:00 kls Exp $ */ #include "osdbase.h" @@ -250,6 +250,8 @@ void cOsdMenu::DisplayCurrent(bool Current) void cOsdMenu::Clear(void) { + if (marked >= 0) + SetStatus(NULL); first = 0; current = marked = -1; cList::Clear(); @@ -453,6 +455,7 @@ eOSState cOsdMenu::ProcessKey(eKeys Key) } } switch (Key) { + case k0: return osUnknown; case k1...k9: return hasHotkeys ? HotKey(Key) : osUnknown; case kUp|k_Repeat: case kUp: CursorUp(); break;