Moved handling of the Menu key entirely into vdr.c

This commit is contained in:
Klaus Schmidinger 2002-06-23 09:44:00 +02:00
parent 359e90b8a7
commit 0bb9a1a77b
7 changed files with 35 additions and 21 deletions

View File

@ -1348,8 +1348,9 @@ Video Disk Recorder Revision History
+ Switching between different language tracks doesn't work yet.
+ Cutting doesn't work yet.
2002-06-22: Version 1.1.4
2002-06-23: Version 1.1.4
- Added Hungarian language texts (thanks to Istvan Koenigsberger and Guido Josten).
- Activated cutting.
- Activated transfer mode.
- Moved handling of the Menu key entirely into vdr.c.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.h 1.26 2002/05/18 13:43:20 kls Exp $
* $Id: interface.h 1.27 2002/06/22 14:39:48 kls Exp $
*/
#ifndef __INTERFACE_H
@ -33,6 +33,7 @@ private:
public:
cInterface(int SVDRPport = 0);
~cInterface();
bool IsOpen(void) { return open > 0; }
void Open(int NumCols = 0, int NumLines = 0);
void Close(void);
void Interrupt(void) { interrupted = true; }

5
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.199 2002/06/22 13:36:10 kls Exp $
* $Id: menu.c 1.200 2002/06/23 09:09:11 kls Exp $
*/
#include "menu.h"
@ -1513,7 +1513,6 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
case kGreen: return Rewind();
case kYellow: return Del();
case kBlue: return Summary();
case kMenu: return osEnd;
default: break;
}
}
@ -2080,7 +2079,6 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
}
break;
default: switch (Key) {
case kMenu: state = osEnd; break;
case kRed: if (!HasSubMenu())
state = osRecord;
break;
@ -3062,7 +3060,6 @@ eOSState cReplayControl::ProcessKey(eKeys Key)
displayFrames = DisplayedFrames;
switch (Key) {
// Menu control:
case kMenu: Hide(); return osMenu; // allow direct switching to menu
case kOk: if (visible && !modeOnly) {
Hide();
DoShowMode = true;

4
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.h 1.44 2002/06/14 12:33:35 kls Exp $
* $Id: menu.h 1.45 2002/06/22 14:49:15 kls Exp $
*/
#ifndef __MENU_H
@ -124,7 +124,6 @@ private:
void TimeSearchProcess(eKeys Key);
void TimeSearch(void);
void Show(int Seconds = 0);
void Hide(void);
static char *fileName;
static char *title;
void DisplayAtBottom(const char *s = NULL);
@ -139,6 +138,7 @@ public:
cReplayControl(void);
virtual ~cReplayControl();
virtual eOSState ProcessKey(eKeys Key);
virtual void Hide(void);
bool Visible(void) { return visible; }
static void SetRecording(const char *FileName, const char *Title);
static const char *LastReplayed(void);

5
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.31 2002/05/18 14:00:15 kls Exp $
* $Id: osd.h 1.32 2002/06/23 09:13:17 kls Exp $
*/
#ifndef __OSD_H
@ -22,7 +22,6 @@
#define MAXOSDITEMS (Setup.OSDheight - 4)
enum eOSState { osUnknown,
osMenu,
osContinue,
osSchedule,
osChannels,
@ -115,7 +114,7 @@ public:
int Width(void) { return Interface->Width(); }
int Height(void) { return Interface->Height(); }
bool NeedsFastResponse(void) { return needsFastResponse; }
virtual eOSState ProcessKey(eKeys Key) = 0;
virtual eOSState ProcessKey(eKeys Key) { return osUnknown; }
};
class cOsdMenu : public cOsdObject, public cList<cOsdItem> {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: player.h 1.1 2002/06/16 11:52:45 kls Exp $
* $Id: player.h 1.2 2002/06/22 14:47:25 kls Exp $
*/
#ifndef __PLAYER_H
@ -46,6 +46,7 @@ class cControl : public cOsdObject {
public:
cControl(void);
virtual ~cControl();
virtual void Hide(void) = 0;
};
#endif //__PLAYER_H

33
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.115 2002/06/22 09:56:12 kls Exp $
* $Id: vdr.c 1.116 2002/06/23 09:35:08 kls Exp $
*/
#include <getopt.h>
@ -372,6 +372,7 @@ int main(int argc, char *argv[])
// Main program loop:
cOsdObject *Menu = NULL;
cOsdObject *Temp = NULL;
cReplayControl *ReplayControl = NULL;
int LastChannel = -1;
int PreviousChannel = cDevice::CurrentChannel();
@ -401,7 +402,7 @@ int main(int argc, char *argv[])
// Channel display:
if (!EITScanner.Active() && cDevice::CurrentChannel() != LastChannel) {
if (!Menu)
Menu = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
Menu = Temp = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
if (LastChannel > 0)
PreviousChannel = LastChannel;
LastChannel = cDevice::CurrentChannel();
@ -425,6 +426,18 @@ int main(int argc, char *argv[])
}
// Keys that must work independent of any interactive mode:
switch (key) {
// Menu control:
case kMenu:
if (Menu) {
DELETENULL(Menu);
if (!Temp)
break;
}
if (ReplayControl)
ReplayControl->Hide();
Menu = new cMenuMain(ReplayControl);
Temp = NULL;
break;
// Volume Control:
case kVolUp|k_Repeat:
case kVolUp:
@ -437,13 +450,14 @@ int main(int argc, char *argv[])
}
else
cDevice::PrimaryDevice()->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
if (!Menu && (!ReplayControl || !ReplayControl->Visible()))
Menu = cDisplayVolume::Create();
if (!Interface->IsOpen())
Menu = Temp = cDisplayVolume::Create();
cDisplayVolume::Process(key);
break;
// Power off:
case kPower: isyslog("Power button pressed");
DELETENULL(*Interact);
Temp = NULL;
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break;
@ -457,33 +471,36 @@ int main(int argc, char *argv[])
default:
if (*Interact) {
switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu);
Menu = new cMenuMain(ReplayControl);
break;
case osRecord: DELETENULL(Menu);
Temp = NULL;
if (!cRecordControls::Start())
Interface->Error(tr("No free DVB device to record!"));
break;
case osRecordings:
DELETENULL(Menu);
DELETENULL(ReplayControl);
Temp = NULL;
Menu = new cMenuMain(ReplayControl, osRecordings);
break;
case osReplay: DELETENULL(Menu);
DELETENULL(ReplayControl);
Temp = NULL;
ReplayControl = new cReplayControl;
break;
case osStopReplay:
DELETENULL(*Interact);
DELETENULL(ReplayControl);
Temp = NULL;
break;
case osSwitchDvb:
DELETENULL(*Interact);
Temp = NULL;
Interface->Info(tr("Switching primary DVB..."));
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
break;
case osBack:
case osEnd: DELETENULL(*Interact);
Temp = NULL;
break;
default: ;
}
@ -520,8 +537,6 @@ int main(int argc, char *argv[])
channel->Switch();
break;
}
// Menu Control:
case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display
default: break;