1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Implemented Channel Display

This commit is contained in:
Klaus Schmidinger 2000-04-22 13:51:48 +02:00
parent ec9cb35acb
commit c328647560
7 changed files with 75 additions and 29 deletions

19
MANUAL
View File

@ -3,9 +3,22 @@ Video Disk Recorder User's Manual
* Selecting a Channel * Selecting a Channel
You can select a channel either by pressing the "Up" or "Down" key (while There are three ways to select a channel:
no On Screen Menu is displayed), or browsing through the channel list in
the menu and pressing "Ok" on the desired 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 * Instant Recording

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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" #include "config.h"
@ -206,7 +206,6 @@ bool cChannel::Switch(void)
if (!DvbApi.Recording()) { if (!DvbApi.Recording()) {
isyslog(LOG_INFO, "switching to channel %d", Index() + 1); isyslog(LOG_INFO, "switching to channel %d", Index() + 1);
CurrentChannel = Index(); CurrentChannel = Index();
Interface.DisplayChannel(CurrentChannel + 1, name);
for (int i = 3; --i;) { for (int i = 3; --i;) {
if (DvbApi.SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr)) if (DvbApi.SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr))
return true; return true;

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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" #include "dvbapi.h"
@ -1001,7 +1001,7 @@ cDvbApi::cDvbApi(void)
memset(&colorPairs, 0, sizeof(colorPairs)); memset(&colorPairs, 0, sizeof(colorPairs));
start_color(); start_color();
leaveok(stdscr, TRUE); leaveok(stdscr, TRUE);
window = stdscr; window = NULL;
#endif #endif
} }
@ -1054,19 +1054,21 @@ void cDvbApi::Cmd(OSD_Command cmd, int color, int x0, int y0, int x1, int y1, co
} }
#endif #endif
void cDvbApi::Open(int w, int h) void cDvbApi::Open(int w, int h, int d)
{ {
cols = w; cols = w;
rows = h; rows = h;
#ifdef DEBUG_OSD #ifdef DEBUG_OSD
//XXX size... window = subwin(stdscr, h, w, d, 0);
syncok(window, TRUE);
#define B2C(b) (((b) * 1000) / 255) #define B2C(b) (((b) * 1000) / 255)
#define SETCOLOR(n, r, g, b, o) init_color(n, B2C(r), B2C(g), B2C(b)) #define SETCOLOR(n, r, g, b, o) init_color(n, B2C(r), B2C(g), B2C(b))
#else #else
w *= charWidth; w *= charWidth;
h *= lineHeight; h *= lineHeight;
int x = (720 - w) / 2; //TODO PAL vs. NTSC??? d *= lineHeight;
int y = (576 - h) / 2; 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); 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) #define SETCOLOR(n, r, g, b, o) Cmd(OSD_SetColor, n, r, g, b, o)
#endif #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'! wmove(window, y + r, x); // ncurses wants 'y' before 'x'!
whline(window, ' ', w); whline(window, ' ', w);
} }
wsyncup(window); // shouldn't be necessary because of 'syncok()', but w/o it doesn't work
#else #else
Cmd(OSD_FillBlock, color, x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1); Cmd(OSD_FillBlock, color, x * charWidth, y * lineHeight, (x + w) * charWidth - 1, (y + h) * lineHeight - 1);
#endif #endif

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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 #ifndef __DVBAPI_H
@ -21,6 +21,9 @@ typedef unsigned char __u8;
#include <stdio.h> #include <stdio.h>
#include "../DVB/driver/dvb.h" #include "../DVB/driver/dvb.h"
#define MenuLines 15
#define MenuColumns 40
enum eDvbColor { clrBackground, enum eDvbColor { clrBackground,
#ifndef DEBUG_OSD #ifndef DEBUG_OSD
clrOBSOLETE, //FIXME apparently color '1' can't be used as FgColor with e.g. clrRed as BgColor??? 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; 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); 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: public:
void Open(int w, int h); void Open(int w, int h, int d = 0);
void Close(void); void Close(void);
void Clear(void); void Clear(void);
void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground); void Fill(int x, int y, int w, int h, eDvbColor color = clrBackground);

View File

@ -4,16 +4,13 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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 "interface.h"
#include <unistd.h> #include <unistd.h>
#include "remote.h" #include "remote.h"
#define MenuLines 15
#define MenuColumns 40
#ifndef DEBUG_REMOTE #ifndef DEBUG_REMOTE
cRcIo RcIo("/dev/ttyS1"); cRcIo RcIo("/dev/ttyS1");
#endif #endif
@ -26,6 +23,7 @@ cInterface::cInterface(void)
{ {
open = 0; open = 0;
cols[0] = 0; cols[0] = 0;
keyFromWait = kNone;
} }
void cInterface::Init(void) void cInterface::Init(void)
@ -35,10 +33,10 @@ void cInterface::Init(void)
#endif #endif
} }
void cInterface::Open(void) void cInterface::Open(int NumCols, int NumLines, int StartLine)
{ {
if (!open++) if (!open++)
DvbApi.Open(MenuColumns, MenuLines); DvbApi.Open(NumCols, NumLines, StartLine);
} }
void cInterface::Close(void) void cInterface::Close(void)
@ -65,19 +63,24 @@ unsigned int cInterface::GetCh(void)
eKeys cInterface::GetKey(void) eKeys cInterface::GetKey(void)
{ {
return Keys.Get(GetCh()); eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh());
} keyFromWait = kNone;
eKeys cInterface::Wait(int Seconds)
{
int t0 = time_ms();
while (time_ms() - t0 < Seconds * 1000) {
eKeys Key = GetKey();
if (Key != kNone)
return Key; return Key;
} }
return kNone;
eKeys cInterface::Wait(int Seconds, bool KeepChar)
{
int t0 = time_ms();
eKeys Key = kNone;
while (time_ms() - t0 < Seconds * 1000) {
Key = GetKey();
if (Key != kNone)
break;
}
if (KeepChar)
keyFromWait = Key;
return Key;
} }
void cInterface::Clear(void) void cInterface::Clear(void)
@ -312,8 +315,20 @@ void cInterface::LearnKeys(void)
void cInterface::DisplayChannel(int Number, const char *Name) void cInterface::DisplayChannel(int Number, const char *Name)
{ {
//TODO
#ifndef DEBUG_REMOTE #ifndef DEBUG_REMOTE
RcIo.Number(Number); RcIo.Number(Number);
#endif #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();
}
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'osm.c' for copyright information and * See the main source file 'osm.c' for copyright information and
* how to reach the author. * 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 #ifndef __INTERFACE_H
@ -19,14 +19,15 @@ public:
private: private:
int open; int open;
int cols[MaxCols]; int cols[MaxCols];
eKeys keyFromWait;
unsigned int GetCh(void); unsigned int GetCh(void);
void QueryKeys(void); void QueryKeys(void);
void HelpButton(int Index, const char *Text, eDvbColor FgColor, eDvbColor BgColor); 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: public:
cInterface(void); cInterface(void);
void Init(void); void Init(void);
void Open(void); void Open(int NumCols = MenuColumns, int NumLines = MenuLines, int StartLine = 0);
void Close(void); void Close(void);
eKeys GetKey(void); eKeys GetKey(void);
void Clear(void); void Clear(void);

14
osm.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.cadsoft.de/people/kls/vdr * 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> #include <signal.h>
@ -67,8 +67,16 @@ int main(int argc, char *argv[])
cMenuMain *Menu = NULL; cMenuMain *Menu = NULL;
cTimer *Timer = NULL; cTimer *Timer = NULL;
int dcTime = 0, dcNumber = 0; int dcTime = 0, dcNumber = 0;
int LastChannel = -1;
while (!Interrupted) { 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): // Direct Channel Select (action):
if (dcNumber) { if (dcNumber) {
Interface.DisplayChannel(dcNumber); Interface.DisplayChannel(dcNumber);
@ -146,6 +154,7 @@ int main(int argc, char *argv[])
case kMenu: Menu = new cMenuMain; case kMenu: Menu = new cMenuMain;
Menu->Display(); Menu->Display();
break; break;
// Up/Down Channel Select:
case kUp: case kUp:
case kDown: { case kDown: {
int n = CurrentChannel + (key == kUp ? 1 : -1); int n = CurrentChannel + (key == kUp ? 1 : -1);
@ -154,6 +163,9 @@ int main(int argc, char *argv[])
channel->Switch(); channel->Switch();
} }
break; break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
//TODO if replaying switch to progress display instead
default: break; default: break;
} }
} }