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

Switching through channel groups now starts at current channel's group

This commit is contained in:
Klaus Schmidinger 2001-09-08 14:39:09 +02:00
parent c7bb0bb739
commit 9d509c37e7
6 changed files with 47 additions and 29 deletions

View File

@ -732,3 +732,5 @@ Video Disk Recorder Revision History
a menu or a replay session active. Note the additional remarks in INSTALL a menu or a replay session active. Note the additional remarks in INSTALL
regarding the values of the two parameters given to the shutdown program regarding the values of the two parameters given to the shutdown program
in case of a currently recording timer. in case of a currently recording timer.
- Switching through channel groups with the "Left" and "Right" keys now
always starts at the group that contains the current channel.

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: config.c 1.66 2001/09/08 11:41:12 kls Exp $ * $Id: config.c 1.67 2001/09/08 14:12:43 kls Exp $
*/ */
#include "config.h" #include "config.h"
@ -654,8 +654,6 @@ cCommands Commands;
// -- cChannels -------------------------------------------------------------- // -- cChannels --------------------------------------------------------------
int CurrentGroup = -1;
cChannels Channels; cChannels Channels;
bool cChannels::Load(const char *FileName) bool cChannels::Load(const char *FileName)

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: config.h 1.73 2001/09/03 15:31:06 kls Exp $ * $Id: config.h 1.74 2001/09/08 14:12:30 kls Exp $
*/ */
#ifndef __CONFIG_H #ifndef __CONFIG_H
@ -61,9 +61,9 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
#define kEditCut k2 #define kEditCut k2
#define kEditTest k8 #define kEditTest k8
#define RAWKEY(k) ((k) & ~k_Flags) #define RAWKEY(k) (eKeys((k) & ~k_Flags))
#define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0) #define ISRAWKEY(k) ((k) != kNone && ((k) & k_Flags) == 0)
#define NORMALKEY(k) ((k) & ~k_Repeat) #define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
struct tKey { struct tKey {
eKeys type; eKeys type;
@ -262,8 +262,6 @@ public:
class cCommands : public cConfig<cCommand> {}; class cCommands : public cConfig<cCommand> {};
extern int CurrentGroup;
extern cChannels Channels; extern cChannels Channels;
extern cTimers Timers; extern cTimers Timers;
extern cKeys Keys; extern cKeys Keys;

41
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.115 2001/09/02 15:27:54 kls Exp $ * $Id: menu.c 1.116 2001/09/08 14:39:09 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -1920,14 +1920,14 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
#define DIRECTCHANNELTIMEOUT 1000 //ms #define DIRECTCHANNELTIMEOUT 1000 //ms
#define INFOTIMEOUT 5000 //ms #define INFOTIMEOUT 5000 //ms
cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group) cDisplayChannel::cDisplayChannel(int Number, bool Switched)
:cOsdBase(true) :cOsdBase(true)
{ {
group = Group; group = -1;
withInfo = !group && (!Switched || Setup.ShowInfoOnChSwitch); withInfo = !Switched || Setup.ShowInfoOnChSwitch;
lines = 0; lines = 0;
oldNumber = number = 0; oldNumber = number = 0;
cChannel *channel = Group ? Channels.Get(Number) : Channels.GetByNumber(Number); cChannel *channel = Channels.GetByNumber(Number);
Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5); Interface->Open(Setup.OSDwidth, Setup.ChannelInfoPos ? 5 : -5);
if (channel) { if (channel) {
DisplayChannel(channel); DisplayChannel(channel);
@ -1939,6 +1939,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group)
cDisplayChannel::cDisplayChannel(eKeys FirstKey) cDisplayChannel::cDisplayChannel(eKeys FirstKey)
:cOsdBase(true) :cOsdBase(true)
{ {
group = -1;
oldNumber = cDvbApi::CurrentChannel(); oldNumber = cDvbApi::CurrentChannel();
number = 0; number = 0;
lastTime = time_ms(); lastTime = time_ms();
@ -2049,6 +2050,32 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
} }
} }
break; break;
case kLeft:
case kRight:
withInfo = false;
if (group < 0) {
cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel());
if (channel)
group = channel->Index();
}
if (group >= 0) {
int SaveGroup = group;
if (Key == kRight)
group = Channels.GetNextGroup(group) ;
else
group = Channels.GetPrevGroup(group < 1 ? 1 : group);
if (group < 0)
group = SaveGroup;
cChannel *channel = Channels.Get(group);
if (channel) {
Interface->Clear();
DisplayChannel(channel);
if (!channel->groupSep)
group = -1;
}
}
lastTime = time_ms();
break;
case kNone: case kNone:
if (number && time_ms() - lastTime > DIRECTCHANNELTIMEOUT) { if (number && time_ms() - lastTime > DIRECTCHANNELTIMEOUT) {
if (number > 0 && !Channels.SwitchTo(number)) if (number > 0 && !Channels.SwitchTo(number))
@ -2059,8 +2086,8 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
//TODO //TODO
//XXX case kGreen: return osEventNow; //XXX case kGreen: return osEventNow;
//XXX case kYellow: return osEventNext; //XXX case kYellow: return osEventNext;
case kOk: if (group) case kOk: if (group >= 0)
Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number); Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(group))->number);
return osEnd; return osEnd;
default: Interface->PutKey(Key); default: Interface->PutKey(Key);
return osEnd; return osEnd;

7
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.25 2001/09/01 14:52:48 kls Exp $ * $Id: menu.h 1.26 2001/09/08 13:58:46 kls Exp $
*/ */
#ifndef _MENU_H #ifndef _MENU_H
@ -31,14 +31,15 @@ public:
class cDisplayChannel : public cOsdBase { class cDisplayChannel : public cOsdBase {
private: private:
bool withInfo, group; int group;
bool withInfo;
int lines; int lines;
int lastTime; int lastTime;
int oldNumber, number; int oldNumber, number;
void DisplayChannel(const cChannel *Channel); void DisplayChannel(const cChannel *Channel);
void DisplayInfo(void); void DisplayInfo(void);
public: public:
cDisplayChannel(int Number, bool Switched, bool Group = false); cDisplayChannel(int Number, bool Switched);
cDisplayChannel(eKeys FirstKey); cDisplayChannel(eKeys FirstKey);
virtual ~cDisplayChannel(); virtual ~cDisplayChannel();
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);

14
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.71 2001/09/08 12:49:38 kls Exp $ * $Id: vdr.c 1.72 2001/09/08 14:34:29 kls Exp $
*/ */
#define _GNU_SOURCE #define _GNU_SOURCE
@ -406,17 +406,9 @@ int main(int argc, char *argv[])
case kLeft|k_Repeat: case kLeft|k_Repeat:
case kLeft: case kLeft:
case kRight|k_Repeat: case kRight|k_Repeat:
case kRight: { case kRight:
int SaveGroup = CurrentGroup; Menu = new cDisplayChannel(NORMALKEY(key));
if (NORMALKEY(key) == kRight)
CurrentGroup = Channels.GetNextGroup(CurrentGroup) ;
else
CurrentGroup = Channels.GetPrevGroup(CurrentGroup < 1 ? 1 : CurrentGroup);
if (CurrentGroup < 0)
CurrentGroup = SaveGroup;
Menu = new cDisplayChannel(CurrentGroup, false, true);
break; break;
}
// Up/Down Channel Select: // Up/Down Channel Select:
case kUp|k_Repeat: case kUp|k_Repeat:
case kUp: case kUp: