summaryrefslogtreecommitdiff
path: root/interface.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-04-24 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-04-24 18:00:00 +0200
commit85b8e41e8bb16e4e66561768026456ec5f0ee276 (patch)
treedd52f93f8db69b395ed2170d641a3e9d574ed039 /interface.c
parent37250a0568d5b1d689d5c59f983e9be228ed49c2 (diff)
downloadvdr-patch-lnbsharing-85b8e41e8bb16e4e66561768026456ec5f0ee276.tar.gz
vdr-patch-lnbsharing-85b8e41e8bb16e4e66561768026456ec5f0ee276.tar.bz2
Version 0.04vdr-0.04
- Changed name from 'osm' to 'vdr' to avoid mixups with the 'oms' program that appears to be in use with DVD replay. - Implemented a channel display in the top menu line. - Implemented replay progress display (press "Ok" when replaying to bring it up). - Implemented direct channel selecting by pressing the numeric keys. - Added several 'const' keywords to please stricter compilers. - The repeat function for the remote control no longer adapts dynamically to the timing of the RCU (this sometimes caused the repeat function to kick in too early). - Channel selection is now blocked when recording or replaying. - Improved process handling.
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/interface.c b/interface.c
index a546513..446f9c4 100644
--- a/interface.c
+++ b/interface.c
@@ -1,19 +1,16 @@
/*
* interface.c: Abstract user interface layer
*
- * See the main source file 'osm.c' for copyright information and
+ * See the main source file 'vdr.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.6 2000/04/24 09:44:23 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)
{
if (!open++)
- DvbApi.Open(MenuColumns, MenuLines);
+ DvbApi.Open(NumCols, NumLines);
}
void cInterface::Close(void)
@@ -49,35 +47,45 @@ void cInterface::Close(void)
DvbApi.Close();
}
-unsigned int cInterface::GetCh(void)
+unsigned int cInterface::GetCh(bool Wait)
{
#ifdef DEBUG_REMOTE
+ timeout(Wait ? 1000 :10);
int c = getch();
return (c > 0) ? c : 0;
#else
-//XXX #ifdef DEBUG_OSD
-//XXX wrefresh(window);//XXX
-//XXX #endif
- unsigned int Command;
- return RcIo.GetCommand(&Command) ? Command : 0;
+#ifdef DEBUG_OSD
+ timeout(0);
+ getch(); // just to make 'ncurses' display the window:
+#endif
+ if (Wait || RcIo.InputAvailable()) {
+ unsigned int Command;
+ return RcIo.GetCommand(&Command, NULL) ? Command : 0;
+ }
+ return 0;
#endif
}
-eKeys cInterface::GetKey(void)
+eKeys cInterface::GetKey(bool Wait)
{
- return Keys.Get(GetCh());
+ eKeys Key = keyFromWait != kNone ? keyFromWait : Keys.Get(GetCh(Wait));
+ 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 +320,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();
+ }
}