summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-09-08 14:39:09 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-09-08 14:39:09 +0200
commit9d509c37e712974d653b8ccd2ceddfda7c9cccfe (patch)
tree7318c9b8e0634b003fffb8cba0a1e68c520129c0
parentc7bb0bb73964eafed5e337dc18278fa118775671 (diff)
downloadvdr-9d509c37e712974d653b8ccd2ceddfda7c9cccfe.tar.gz
vdr-9d509c37e712974d653b8ccd2ceddfda7c9cccfe.tar.bz2
Switching through channel groups now starts at current channel's group
-rw-r--r--HISTORY2
-rw-r--r--config.c4
-rw-r--r--config.h8
-rw-r--r--menu.c41
-rw-r--r--menu.h7
-rw-r--r--vdr.c14
6 files changed, 47 insertions, 29 deletions
diff --git a/HISTORY b/HISTORY
index 70e2c9a1..0c2b0554 100644
--- a/HISTORY
+++ b/HISTORY
@@ -732,3 +732,5 @@ Video Disk Recorder Revision History
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
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.
diff --git a/config.c b/config.c
index 07a291b6..e3957ac9 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -654,8 +654,6 @@ cCommands Commands;
// -- cChannels --------------------------------------------------------------
-int CurrentGroup = -1;
-
cChannels Channels;
bool cChannels::Load(const char *FileName)
diff --git a/config.h b/config.h
index 8e0d65f3..2c31a60e 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@@ -61,9 +61,9 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
#define kEditCut k2
#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 NORMALKEY(k) ((k) & ~k_Repeat)
+#define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
struct tKey {
eKeys type;
@@ -262,8 +262,6 @@ public:
class cCommands : public cConfig<cCommand> {};
-extern int CurrentGroup;
-
extern cChannels Channels;
extern cTimers Timers;
extern cKeys Keys;
diff --git a/menu.c b/menu.c
index 5ff54cbd..7036249b 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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"
@@ -1920,14 +1920,14 @@ eOSState cMenuMain::ProcessKey(eKeys Key)
#define DIRECTCHANNELTIMEOUT 1000 //ms
#define INFOTIMEOUT 5000 //ms
-cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group)
+cDisplayChannel::cDisplayChannel(int Number, bool Switched)
:cOsdBase(true)
{
- group = Group;
- withInfo = !group && (!Switched || Setup.ShowInfoOnChSwitch);
+ group = -1;
+ withInfo = !Switched || Setup.ShowInfoOnChSwitch;
lines = 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);
if (channel) {
DisplayChannel(channel);
@@ -1939,6 +1939,7 @@ cDisplayChannel::cDisplayChannel(int Number, bool Switched, bool Group)
cDisplayChannel::cDisplayChannel(eKeys FirstKey)
:cOsdBase(true)
{
+ group = -1;
oldNumber = cDvbApi::CurrentChannel();
number = 0;
lastTime = time_ms();
@@ -2049,6 +2050,32 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
}
}
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:
if (number && time_ms() - lastTime > DIRECTCHANNELTIMEOUT) {
if (number > 0 && !Channels.SwitchTo(number))
@@ -2059,8 +2086,8 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key)
//TODO
//XXX case kGreen: return osEventNow;
//XXX case kYellow: return osEventNext;
- case kOk: if (group)
- Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(CurrentGroup))->number);
+ case kOk: if (group >= 0)
+ Channels.SwitchTo(Channels.Get(Channels.GetNextNormal(group))->number);
return osEnd;
default: Interface->PutKey(Key);
return osEnd;
diff --git a/menu.h b/menu.h
index 2c5ed394..d07684ae 100644
--- a/menu.h
+++ b/menu.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* 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
@@ -31,14 +31,15 @@ public:
class cDisplayChannel : public cOsdBase {
private:
- bool withInfo, group;
+ int group;
+ bool withInfo;
int lines;
int lastTime;
int oldNumber, number;
void DisplayChannel(const cChannel *Channel);
void DisplayInfo(void);
public:
- cDisplayChannel(int Number, bool Switched, bool Group = false);
+ cDisplayChannel(int Number, bool Switched);
cDisplayChannel(eKeys FirstKey);
virtual ~cDisplayChannel();
virtual eOSState ProcessKey(eKeys Key);
diff --git a/vdr.c b/vdr.c
index 51a841ee..2ba16905 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* 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
@@ -406,17 +406,9 @@ int main(int argc, char *argv[])
case kLeft|k_Repeat:
case kLeft:
case kRight|k_Repeat:
- case kRight: {
- int SaveGroup = CurrentGroup;
- 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);
+ case kRight:
+ Menu = new cDisplayChannel(NORMALKEY(key));
break;
- }
// Up/Down Channel Select:
case kUp|k_Repeat:
case kUp: