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

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. + Switching between different language tracks doesn't work yet.
+ Cutting 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). - Added Hungarian language texts (thanks to Istvan Koenigsberger and Guido Josten).
- Activated cutting. - Activated cutting.
- Activated transfer mode. - 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __INTERFACE_H
@ -33,6 +33,7 @@ private:
public: public:
cInterface(int SVDRPport = 0); cInterface(int SVDRPport = 0);
~cInterface(); ~cInterface();
bool IsOpen(void) { return open > 0; }
void Open(int NumCols = 0, int NumLines = 0); void Open(int NumCols = 0, int NumLines = 0);
void Close(void); void Close(void);
void Interrupt(void) { interrupted = true; } 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -1513,7 +1513,6 @@ eOSState cMenuRecordings::ProcessKey(eKeys Key)
case kGreen: return Rewind(); case kGreen: return Rewind();
case kYellow: return Del(); case kYellow: return Del();
case kBlue: return Summary(); case kBlue: return Summary();
case kMenu: return osEnd;
default: break; default: break;
} }
} }
@ -2080,7 +2079,6 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
} }
break; break;
default: switch (Key) { default: switch (Key) {
case kMenu: state = osEnd; break;
case kRed: if (!HasSubMenu()) case kRed: if (!HasSubMenu())
state = osRecord; state = osRecord;
break; break;
@ -3062,7 +3060,6 @@ eOSState cReplayControl::ProcessKey(eKeys Key)
displayFrames = DisplayedFrames; displayFrames = DisplayedFrames;
switch (Key) { switch (Key) {
// Menu control: // Menu control:
case kMenu: Hide(); return osMenu; // allow direct switching to menu
case kOk: if (visible && !modeOnly) { case kOk: if (visible && !modeOnly) {
Hide(); Hide();
DoShowMode = true; DoShowMode = true;

4
menu.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __MENU_H
@ -124,7 +124,6 @@ private:
void TimeSearchProcess(eKeys Key); void TimeSearchProcess(eKeys Key);
void TimeSearch(void); void TimeSearch(void);
void Show(int Seconds = 0); void Show(int Seconds = 0);
void Hide(void);
static char *fileName; static char *fileName;
static char *title; static char *title;
void DisplayAtBottom(const char *s = NULL); void DisplayAtBottom(const char *s = NULL);
@ -139,6 +138,7 @@ public:
cReplayControl(void); cReplayControl(void);
virtual ~cReplayControl(); virtual ~cReplayControl();
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
virtual void Hide(void);
bool Visible(void) { return visible; } bool Visible(void) { return visible; }
static void SetRecording(const char *FileName, const char *Title); static void SetRecording(const char *FileName, const char *Title);
static const char *LastReplayed(void); 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __OSD_H
@ -22,7 +22,6 @@
#define MAXOSDITEMS (Setup.OSDheight - 4) #define MAXOSDITEMS (Setup.OSDheight - 4)
enum eOSState { osUnknown, enum eOSState { osUnknown,
osMenu,
osContinue, osContinue,
osSchedule, osSchedule,
osChannels, osChannels,
@ -115,7 +114,7 @@ public:
int Width(void) { return Interface->Width(); } int Width(void) { return Interface->Width(); }
int Height(void) { return Interface->Height(); } int Height(void) { return Interface->Height(); }
bool NeedsFastResponse(void) { return needsFastResponse; } 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> { class cOsdMenu : public cOsdObject, public cList<cOsdItem> {

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __PLAYER_H
@ -46,6 +46,7 @@ class cControl : public cOsdObject {
public: public:
cControl(void); cControl(void);
virtual ~cControl(); virtual ~cControl();
virtual void Hide(void) = 0;
}; };
#endif //__PLAYER_H #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 * 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> #include <getopt.h>
@ -372,6 +372,7 @@ int main(int argc, char *argv[])
// Main program loop: // Main program loop:
cOsdObject *Menu = NULL; cOsdObject *Menu = NULL;
cOsdObject *Temp = NULL;
cReplayControl *ReplayControl = NULL; cReplayControl *ReplayControl = NULL;
int LastChannel = -1; int LastChannel = -1;
int PreviousChannel = cDevice::CurrentChannel(); int PreviousChannel = cDevice::CurrentChannel();
@ -401,7 +402,7 @@ int main(int argc, char *argv[])
// Channel display: // Channel display:
if (!EITScanner.Active() && cDevice::CurrentChannel() != LastChannel) { if (!EITScanner.Active() && cDevice::CurrentChannel() != LastChannel) {
if (!Menu) if (!Menu)
Menu = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0); Menu = Temp = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
if (LastChannel > 0) if (LastChannel > 0)
PreviousChannel = LastChannel; PreviousChannel = LastChannel;
LastChannel = cDevice::CurrentChannel(); LastChannel = cDevice::CurrentChannel();
@ -425,6 +426,18 @@ int main(int argc, char *argv[])
} }
// Keys that must work independent of any interactive mode: // Keys that must work independent of any interactive mode:
switch (key) { 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: // Volume Control:
case kVolUp|k_Repeat: case kVolUp|k_Repeat:
case kVolUp: case kVolUp:
@ -437,13 +450,14 @@ int main(int argc, char *argv[])
} }
else else
cDevice::PrimaryDevice()->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA); cDevice::PrimaryDevice()->SetVolume(NORMALKEY(key) == kVolDn ? -VOLUMEDELTA : VOLUMEDELTA);
if (!Menu && (!ReplayControl || !ReplayControl->Visible())) if (!Interface->IsOpen())
Menu = cDisplayVolume::Create(); Menu = Temp = cDisplayVolume::Create();
cDisplayVolume::Process(key); cDisplayVolume::Process(key);
break; break;
// Power off: // Power off:
case kPower: isyslog("Power button pressed"); case kPower: isyslog("Power button pressed");
DELETENULL(*Interact); DELETENULL(*Interact);
Temp = NULL;
if (!Shutdown) { if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!")); Interface->Error(tr("Can't shutdown - option '-s' not given!"));
break; break;
@ -457,33 +471,36 @@ int main(int argc, char *argv[])
default: default:
if (*Interact) { if (*Interact) {
switch ((*Interact)->ProcessKey(key)) { switch ((*Interact)->ProcessKey(key)) {
case osMenu: DELETENULL(Menu);
Menu = new cMenuMain(ReplayControl);
break;
case osRecord: DELETENULL(Menu); case osRecord: DELETENULL(Menu);
Temp = NULL;
if (!cRecordControls::Start()) if (!cRecordControls::Start())
Interface->Error(tr("No free DVB device to record!")); Interface->Error(tr("No free DVB device to record!"));
break; break;
case osRecordings: case osRecordings:
DELETENULL(Menu); DELETENULL(Menu);
DELETENULL(ReplayControl); DELETENULL(ReplayControl);
Temp = NULL;
Menu = new cMenuMain(ReplayControl, osRecordings); Menu = new cMenuMain(ReplayControl, osRecordings);
break; break;
case osReplay: DELETENULL(Menu); case osReplay: DELETENULL(Menu);
DELETENULL(ReplayControl); DELETENULL(ReplayControl);
Temp = NULL;
ReplayControl = new cReplayControl; ReplayControl = new cReplayControl;
break; break;
case osStopReplay: case osStopReplay:
DELETENULL(*Interact); DELETENULL(*Interact);
DELETENULL(ReplayControl); DELETENULL(ReplayControl);
Temp = NULL;
break; break;
case osSwitchDvb: case osSwitchDvb:
DELETENULL(*Interact); DELETENULL(*Interact);
Temp = NULL;
Interface->Info(tr("Switching primary DVB...")); Interface->Info(tr("Switching primary DVB..."));
cDevice::SetPrimaryDevice(Setup.PrimaryDVB); cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
break; break;
case osBack: case osBack:
case osEnd: DELETENULL(*Interact); case osEnd: DELETENULL(*Interact);
Temp = NULL;
break; break;
default: ; default: ;
} }
@ -520,8 +537,6 @@ int main(int argc, char *argv[])
channel->Switch(); channel->Switch();
break; break;
} }
// Menu Control:
case kMenu: Menu = new cMenuMain(ReplayControl); break;
// Viewing Control: // Viewing Control:
case kOk: LastChannel = -1; break; // forces channel display case kOk: LastChannel = -1; break; // forces channel display
default: break; default: break;