From 5e272f90653736e6bc115660fa39cbe6d2ab0403 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 12 Nov 2000 16:48:50 +0100 Subject: The 'Schedule' button now shows the schedule of the current channel in the 'Now/Next' menu --- HISTORY | 2 ++ MANUAL | 4 ++-- menu.c | 48 +++++++++++++++++++++++++++++++++++++----------- osd.c | 9 ++++++++- osd.h | 3 ++- tools.h | 4 ++-- 6 files changed, 53 insertions(+), 17 deletions(-) diff --git a/HISTORY b/HISTORY index 6057a8ad..f1d5bad6 100644 --- a/HISTORY +++ b/HISTORY @@ -287,3 +287,5 @@ Video Disk Recorder Revision History by a timer that needs to use this specific DVB card to record an encrypted channel, if the timer currently occupying this DVB card doesn't need the CAM module (and thus can continue recording on a different DVB card). +- The "Yellow" button in the "What's on now/next?" menus now displays the + schedule of the current channel from that menu. diff --git a/MANUAL b/MANUAL index a72c580d..4de0af22 100644 --- a/MANUAL +++ b/MANUAL @@ -74,8 +74,8 @@ Video Disk Recorder User's Manual programmes that will start next on all channels. Inside the "What's on now/next?" menus the "Green" button toggles between - the "Now" and "Next" display, and the "Yellow" button gets you back to the - "Schedule" menu of the current channel. + the "Now" and "Next" display, and the "Yellow" button takes you to the + "Schedule" menu of the current channel in the list. The "Red" button allows you to instantly program a timer to record the selected programme. You will get into the "Edit Timer" menu in which diff --git a/menu.c b/menu.c index 92e715e2..08350ea3 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.47 2000/11/12 13:03:35 kls Exp $ + * $Id: menu.c 1.48 2000/11/12 16:46:19 kls Exp $ */ #include "menu.h" @@ -1160,11 +1160,15 @@ class cMenuWhatsOn : public cOsdMenu { private: eOSState Record(void); eOSState Switch(void); + static const cEventInfo *scheduleEventInfo; public: cMenuWhatsOn(const cSchedules *Schedules, bool Now); + static const cEventInfo *ScheduleEventInfo(void); virtual eOSState ProcessKey(eKeys Key); }; +const cEventInfo *cMenuWhatsOn::scheduleEventInfo = NULL; + static int CompareEventChannel(const void *p1, const void *p2) { return (int)( (*(const cEventInfo **)p1)->GetChannelNumber() - (*(const cEventInfo **)p2)->GetChannelNumber()); @@ -1200,6 +1204,13 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now) SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Schedule"), tr("Switch")); } +const cEventInfo *cMenuWhatsOn::ScheduleEventInfo(void) +{ + const cEventInfo *ei = scheduleEventInfo; + scheduleEventInfo = NULL; + return ei; +} + eOSState cMenuWhatsOn::Switch(void) { cMenuWhatsOnItem *item = (cMenuWhatsOnItem *)Get(Current()); @@ -1239,7 +1250,12 @@ eOSState cMenuWhatsOn::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { case kRed: return Record(); - case kYellow: return osBack; + case kYellow: { + cMenuWhatsOnItem *mi = (cMenuWhatsOnItem *)Get(Current()); + if (mi) + scheduleEventInfo = mi->eventInfo; + } + return osBack; case kBlue: return Switch(); case kOk: if (Count()) return AddSubMenu(new cMenuEvent(((cMenuWhatsOnItem *)Get(Current()))->eventInfo, true)); @@ -1274,7 +1290,7 @@ private: const cSchedules *schedules; bool now, next; eOSState Record(void); - void PrepareSchedule(void); + void PrepareSchedule(cChannel *Channel); void PrepareWhatsOnNext(bool On); public: cMenuSchedule(void); @@ -1287,10 +1303,8 @@ cMenuSchedule::cMenuSchedule(void) now = next = false; cChannel *channel = Channels.GetByNumber(cDvbApi::CurrentChannel()); if (channel) { - char *buffer = NULL; - asprintf(&buffer, tr("Schedule - %s"), channel->name); - SetTitle(buffer, false); - PrepareSchedule(); + schedules = cDvbApi::PrimaryDvbApi->Schedules(&threadLock); + PrepareSchedule(channel); SetHelp(tr("Record"), tr("Now"), tr("Next")); } } @@ -1300,11 +1314,14 @@ static int CompareEventTime(const void *p1, const void *p2) return (int)((*(cEventInfo **)p1)->GetTime() - (*(cEventInfo **)p2)->GetTime()); } -void cMenuSchedule::PrepareSchedule(void) +void cMenuSchedule::PrepareSchedule(cChannel *Channel) { - schedules = cDvbApi::PrimaryDvbApi->Schedules(&threadLock); + Clear(); + char *buffer = NULL; + asprintf(&buffer, tr("Schedule - %s"), Channel->name); + SetTitle(buffer, false); if (schedules) { - const cSchedule *Schedule = schedules->GetSchedule(); + const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule(); int num = Schedule->NumEvents(); const cEventInfo **pArray = (const cEventInfo **)malloc(num * sizeof(cEventInfo *)); if (pArray) { @@ -1366,8 +1383,17 @@ eOSState cMenuSchedule::ProcessKey(eKeys Key) default: break; } } - else if (!HasSubMenu()) + else if (!HasSubMenu()) { now = next = false; + const cEventInfo *ei = cMenuWhatsOn::ScheduleEventInfo(); + if (ei) { + cChannel *channel = Channels.GetByServiceID(ei->GetServiceID()); + if (channel) { + PrepareSchedule(channel); + Display(); + } + } + } return state; } diff --git a/osd.c b/osd.c index 4f4f0c3a..bc9c9485 100644 --- a/osd.c +++ b/osd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.c 1.12 2000/11/10 16:18:38 kls Exp $ + * $Id: osd.c 1.13 2000/11/12 15:29:25 kls Exp $ */ #include "osd.h" @@ -189,6 +189,13 @@ void cOsdMenu::DisplayCurrent(bool Current) item->Display(current - first, Current ? clrBlack : clrWhite, Current ? clrCyan : clrBackground); } +void cOsdMenu::Clear(void) +{ + first = 0; + current = marked = -1; + cList::Clear(); +} + bool cOsdMenu::SpecialItem(int idx) { cOsdItem *item = Get(idx); diff --git a/osd.h b/osd.h index af189584..0d8085df 100644 --- a/osd.h +++ b/osd.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osd.h 1.16 2000/11/11 14:49:29 kls Exp $ + * $Id: osd.h 1.17 2000/11/12 15:27:34 kls Exp $ */ #ifndef __OSD_H @@ -78,6 +78,7 @@ private: const char *status; protected: bool visible; + virtual void Clear(void); bool SpecialItem(int idx); void RefreshCurrent(void); void DisplayCurrent(bool Current); diff --git a/tools.h b/tools.h index 0794a1a6..f83e7da4 100644 --- a/tools.h +++ b/tools.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.h 1.19 2000/11/11 15:14:40 kls Exp $ + * $Id: tools.h 1.20 2000/11/12 15:27:06 kls Exp $ */ #ifndef __TOOLS_H @@ -96,7 +96,7 @@ public: void Del(cListObject *Object); virtual void Move(int From, int To); void Move(cListObject *From, cListObject *To); - void Clear(void); + virtual void Clear(void); cListObject *Get(int Index) const; int Count(void) const; }; -- cgit v1.2.3