diff options
-rw-r--r-- | MANUAL | 19 | ||||
-rw-r--r-- | config.c | 3 | ||||
-rw-r--r-- | dvbapi.c | 15 | ||||
-rw-r--r-- | dvbapi.h | 7 | ||||
-rw-r--r-- | interface.c | 39 | ||||
-rw-r--r-- | interface.h | 7 | ||||
-rw-r--r-- | osm.c | 14 |
7 files changed, 75 insertions, 29 deletions
@@ -3,9 +3,22 @@ Video Disk Recorder User's Manual * Selecting a Channel - You can select a channel either by pressing the "Up" or "Down" key (while - no On Screen Menu is displayed), or browsing through the channel list in - the menu and pressing "Ok" on the desired channel. + There are three ways to select a channel: + + 1. With no On Screen Menu displayed press the "Up" or "Down" key to switch + to the next higher or lower channel. + 2. Press the "Menu" button to bring up the On Screen Menu, select "Channels" + and browse through the list with the "Up" and "Down" key; to switch to the + selected channel press "Ok". + 2. Directly type in the channel number with the numeric keys ('0'..'9'); + if no key is pressed for about half a second, the digits collected so + far will define the channel number. + + After switching to a different channel the channel number and name, as well + as the current time are displayed at the top of the screen. This line + automatically goes away after about two seconds, or if any key is pressed. + To bring up the channel display without switching channels you can press + the "Ok" button. * Instant Recording @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: config.c 1.3 2000/04/15 12:48:00 kls Exp $ + * $Id: config.c 1.4 2000/04/22 13:32:27 kls Exp $ */ #include "config.h" @@ -206,7 +206,6 @@ bool cChannel::Switch(void) if (!DvbApi.Recording()) { isyslog(LOG_INFO, "switching to channel %d", Index() + 1); CurrentChannel = Index(); - Interface.DisplayChannel(CurrentChannel + 1, name); for (int i = 3; --i;) { if (DvbApi.SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr)) return true; @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.3 2000/04/15 14:45:04 kls Exp $ + * $Id: dvbapi.c 1.4 2000/04/22 13:09:49 kls Exp $ */ #include "dvbapi.h" @@ -1001,7 +1001,7 @@ cDvbApi::cDvbApi(void) memset(&colorPairs, 0, sizeof(colorPairs)); start_color(); leaveok(stdscr, TRUE); - window = stdscr; + window = NULL; #endif } @@ -1054,19 +1054,21 @@ void cDvbApi::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, co } #endif -void cDvbApi::Open(int w, int h) +void cDvbApi::Open(int w, int h, int d) { cols = w; rows = h; #ifdef DEBUG_OSD - //XXX size... + window = subwin(stdscr, h, w, d, 0); + syncok(window, TRUE); #define B2C(b) (((b) * 1000) / 255) #define SETCOLOR(n, r, g, b, o) init_color(n, B2C(r), B2C(g), B2C(b)) #else w *= charWidth; h *= lineHeight; - int x = (720 - w) / 2; //TODO PAL vs. NTSC??? - int y = (576 - h) / 2; + d *= lineHeight; + int x = (720 - MenuColumns * charWidth) / 2; //TODO PAL vs. NTSC??? + int y = (576 - MenuLines * lineHeight) / 2 + d; Cmd(OSD_Open, 4, x, y, x + w - 1, y + h - 1); #define SETCOLOR(n, r, g, b, o) Cmd(OSD_SetColor, n, r, g, b, o) #endif @@ -1108,6 +1110,7 @@ void cDvbApi::Fill(int x, int y, int w, int h, eDvbColor color) wmove(window, y + r, x); // ncurses wants 'y' before 'x'! whline(window, ' ', w); } + wsyncup(window); // shouldn't be necessary because of 'syncok()', but w/o it doesn't work #else Cmd(OSD_FillBlock, color, x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1); #endif @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.h 1.3 2000/04/15 13:36:10 kls Exp $ + * $Id: dvbapi.h 1.4 2000/04/22 13:07:34 kls Exp $ */ #ifndef __DVBAPI_H @@ -21,6 +21,9 @@ typedef unsigned char __u8; #include <stdio.h> #include "../DVB/driver/dvb.h" +#define MenuLines 15 +#define MenuColumns 40 + enum eDvbColor { clrBackground, #ifndef DEBUG_OSD clrOBSOLETE, //FIXME apparently color '1' can't be used as FgColor with e.g. clrRed as BgColor??? @@ -59,7 +62,7 @@ private: int cols, rows; void Cmd(OSD_Command cmd, int color = 0, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, const void *data = NULL); public: - void Open(int w, int h); + void Open(int w, int h, int d = 0); void Close(void); void Clear(void); void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground); diff --git a/interface.c b/interface.c index a5465135..fd1fa2dc 100644 --- a/interface.c +++ b/interface.c @@ -4,16 +4,13 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: interface.c 1.3 2000/04/15 17:38:11 kls Exp $ + * $Id: interface.c 1.4 2000/04/22 13:51:48 kls Exp $ */ #include "interface.h" #include <unistd.h> #include "remote.h" -#define MenuLines 15 -#define MenuColumns 40 - #ifndef DEBUG_REMOTE cRcIo RcIo("/dev/ttyS1"); #endif @@ -26,6 +23,7 @@ cInterface::cInterface(void) { open = 0; cols[0] = 0; + keyFromWait = kNone; } void cInterface::Init(void) @@ -35,10 +33,10 @@ void cInterface::Init(void) #endif } -void cInterface::Open(void) +void cInterface::Open(int NumCols, int NumLines, int StartLine) { if (!open++) - DvbApi.Open(MenuColumns, MenuLines); + DvbApi.Open(NumCols, NumLines, StartLine); } void cInterface::Close(void) @@ -65,19 +63,24 @@ unsigned int cInterface::GetCh(void) eKeys cInterface::GetKey(void) { - return Keys.Get(GetCh()); + eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh()); + keyFromWait = kNone; + return Key; } -eKeys cInterface::Wait(int Seconds) +eKeys cInterface::Wait(int Seconds, bool KeepChar) { int t0 = time_ms(); + eKeys Key = kNone; while (time_ms() - t0 < Seconds * 1000) { - eKeys Key = GetKey(); + Key = GetKey(); if (Key != kNone) - return Key; + break; } - return kNone; + if (KeepChar) + keyFromWait = Key; + return Key; } void cInterface::Clear(void) @@ -312,8 +315,20 @@ void cInterface::LearnKeys(void) void cInterface::DisplayChannel(int Number, const char *Name) { -//TODO #ifndef DEBUG_REMOTE RcIo.Number(Number); #endif + if (Name) { + Open(MenuColumns, 1); + char buffer[MenuColumns + 1]; + snprintf(buffer, sizeof(buffer), "%d %s", Number, Name ? Name : ""); + Write(0, 0, buffer); + time_t t = time(NULL); + struct tm *now = localtime(&t); + snprintf(buffer, sizeof(buffer), "%02d:%02d", now->tm_hour, now->tm_min); + Write(-5, 0, buffer); + if (Wait(2, true) == kOk) + GetKey(); + Close(); + } } diff --git a/interface.h b/interface.h index 1707c46e..76fdab8d 100644 --- a/interface.h +++ b/interface.h @@ -4,7 +4,7 @@ * See the main source file 'osm.c' for copyright information and * how to reach the author. * - * $Id: interface.h 1.4 2000/04/22 09:55:52 kls Exp $ + * $Id: interface.h 1.5 2000/04/22 13:07:16 kls Exp $ */ #ifndef __INTERFACE_H @@ -19,14 +19,15 @@ public: private: int open; int cols[MaxCols]; + eKeys keyFromWait; unsigned int GetCh(void); void QueryKeys(void); void HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor); - eKeys Wait(int Seconds = 1); + eKeys Wait(int Seconds = 1, bool KeepChar = false); public: cInterface(void); void Init(void); - void Open(void); + void Open(int NumCols = MenuColumns, int NumLines = MenuLines, int StartLine = 0); void Close(void); eKeys GetKey(void); void Clear(void); @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: osm.c 1.6 2000/04/22 09:56:33 kls Exp $ + * $Id: osm.c 1.7 2000/04/22 13:35:37 kls Exp $ */ #include <signal.h> @@ -67,8 +67,16 @@ int main(int argc, char *argv[]) cMenuMain *Menu = NULL; cTimer *Timer = NULL; int dcTime = 0, dcNumber = 0; + int LastChannel = -1; while (!Interrupted) { + // Channel display: + if (CurrentChannel != LastChannel) { + cChannel *channel = Channels.Get(CurrentChannel); + if (channel) + Interface.DisplayChannel(CurrentChannel + 1, channel->name); + LastChannel = CurrentChannel; + } // Direct Channel Select (action): if (dcNumber) { Interface.DisplayChannel(dcNumber); @@ -146,6 +154,7 @@ int main(int argc, char *argv[]) case kMenu: Menu = new cMenuMain; Menu->Display(); break; + // Up/Down Channel Select: case kUp: case kDown: { int n = CurrentChannel + (key == kUp ? 1 : -1); @@ -154,6 +163,9 @@ int main(int argc, char *argv[]) channel->Switch(); } break; + // Viewing Control: + case kOk: LastChannel = -1; break; // forces channel display + //TODO if replaying switch to progress display instead default: break; } } |