diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-09-10 14:56:18 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-09-10 14:56:18 +0200 |
commit | bec30645904b01f95e789f720f47b769498cb4d2 (patch) | |
tree | 21cb9d204688a0675643d2f6e8e9508a08cb7719 /menu.c | |
parent | 61c87ad6c76431bdb774e02546e8718a9bb0f602 (diff) | |
download | vdr-bec30645904b01f95e789f720f47b769498cb4d2.tar.gz vdr-bec30645904b01f95e789f720f47b769498cb4d2.tar.bz2 |
Direct channel select displays digits and name on OSD
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.24 2000/09/10 10:28:46 kls Exp $ + * $Id: menu.c 1.25 2000/09/10 14:45:29 kls Exp $ */ #include "menu.h" @@ -1163,6 +1163,60 @@ eOSState cMenuMain::ProcessKey(eKeys Key) return state; } +// --- cDirectChannelSelect -------------------------------------------------- + +#define DIRECTCHANNELTIMEOUT 500 //ms + +cDirectChannelSelect::cDirectChannelSelect(eKeys FirstKey) +:cOsdBase(true) +{ + oldNumber = CurrentChannel; + number = 0; + lastTime = time_ms(); + Interface.Open(MenuColumns, 1); + ProcessKey(FirstKey); +} + +cDirectChannelSelect::~cDirectChannelSelect() +{ + if (number < 0) + Interface.DisplayChannel(oldNumber); + Interface.Close(); +} + +eOSState cDirectChannelSelect::ProcessKey(eKeys Key) +{ + switch (Key) { + case k0: case k1: case k2: case k3: case k4: case k5: case k6: case k7: case k8: case k9: + if (number >= 0) { + number = number * 10 + Key - k0; + cChannel *channel = Channels.GetByNumber(number); + char *Name = channel ? channel->name : "*** Invalid Channel ***"; + int BufSize = MenuColumns + 1; + char buffer[BufSize]; + snprintf(buffer, BufSize, "%d %s", number, Name); + Interface.DisplayChannel(number); + Interface.Clear(); + Interface.Write(0, 0, buffer); + lastTime = time_ms(); + if (!channel) { + number = -1; + lastTime += 1000; + } + } + break; + case kNone: + if (time_ms() - lastTime > DIRECTCHANNELTIMEOUT) { + if (number > 0 && !Channels.SwitchTo(number)) + number = -1; + } + else + break; + default: return osEnd; + }; + return osContinue; +} + // --- cRecordControl -------------------------------------------------------- cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) |