summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürgen Schmitz <vdr@dolze.de>2004-03-23 20:15:00 +0100
committerJürgen Schmitz <vdr@dolze.de>2004-03-23 20:15:00 +0100
commit48a28f4fa2c3b8ba0b3d913d0e233d904a545051 (patch)
tree499ec4e30fdab3537c76251923927e44e9f62698
parent03b56d7b7969e9fbec4cbcb3ad273bc9d1de9311 (diff)
downloadvdr-plugin-tvonscreen-48a28f4fa2c3b8ba0b3d913d0e233d904a545051.tar.gz
vdr-plugin-tvonscreen-48a28f4fa2c3b8ba0b3d913d0e233d904a545051.tar.bz2
Version 0.5.1
-rw-r--r--HISTORY8
-rw-r--r--magazine.c198
-rw-r--r--magazine.h31
-rw-r--r--magazine.h.orig97
-rw-r--r--tvonscreen.c4
-rwxr-xr-xvdr-136-tvonscreen-0.5.0-patch.diff567
6 files changed, 901 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index 317210e..b997c49 100644
--- a/HISTORY
+++ b/HISTORY
@@ -5,3 +5,11 @@ VDR Plugin 'tvonscreen' Revision History
- Initial revision.
+2004-03-21: Version 0.5.0
+
+- First public release
+
+2004-03-23: Version 0.5.1
+
+- added patch for vdr 1.3.x (not tested, don't have 1.3.x)
+
diff --git a/magazine.c b/magazine.c
index 88148b4..ef0d924 100644
--- a/magazine.c
+++ b/magazine.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: magazine.c,v 1.7 2004/03/05 12:16:26 schmitzj Exp $
+ * $Id: magazine.c,v 1.10 2004/03/23 14:08:25 schmitzj Exp $
*
*/
@@ -14,11 +14,19 @@ static int CompareSchedules(const void *p1, const void *p2) {
int c1nr = 9999; // there should be no one with more than 9999 channels
int c2nr = 9999;
+#if VDRVERSNUM >= 10300
+ cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->ChannelID(), true);
+#else
cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->GetChannelID(), true);
+#endif
if (c1)
c1nr = c1->Number();
+#if VDRVERSNUM >= 10300
+ cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->ChannelID(), true);
+#else
cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->GetChannelID(), true);
+#endif
if (c2)
c2nr = c2->Number();
@@ -30,7 +38,11 @@ magazine::magazine(class cPlugin *p)
{
parent=p;
+#if VDRVERSNUM >= 10300
+ const cSchedules* Schedules = cSchedules::Schedules(_schedulesLock);
+#else
const cSchedules* Schedules = cSIProcessor::Schedules(_mutexLock);
+#endif
curmode=SHOW;
EDIT_curEvent=0;
@@ -57,7 +69,11 @@ magazine::magazine(class cPlugin *p)
{ // if there exist an event -> add to array
// check if we can get a channel NAME ( XXX )
// I thougt that this must always work , but doesn't
+#if VDRVERSNUM >= 10300
+ cChannel *c = Channels.GetByChannelID(Schedule->ChannelID(), true);
+#else
cChannel *c = Channels.GetByChannelID(Schedule->GetChannelID(), true);
+#endif
if (c)
{
schedArray[num] = Schedule;
@@ -73,7 +89,11 @@ magazine::magazine(class cPlugin *p)
int currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
for(int i=0;i<schedArrayNum;i++)
{
+#if VDRVERSNUM >= 10300
+ cChannel *channel = Channels.GetByChannelID(schedArray[i]->ChannelID(), true);
+#else
cChannel *channel = Channels.GetByChannelID(schedArray[i]->GetChannelID(), true);
+#endif
if (channel->Number()==currentChannel)
{
currentFirst=i-1;
@@ -125,7 +145,11 @@ magazine::~magazine(void)
osd->Fill(0,0,184,20,clrBlue,sched);
if (s!=NULL)
{
+#if VDRVERSNUM >= 10300
+ channel = Channels.GetByChannelID(s->ChannelID(), true);
+#else
channel = Channels.GetByChannelID(s->GetChannelID(), true);
+#endif
txt=channel->Name();
if (f3->LargeWidth(txt)>184)
f3->Text((184-f3->Width(txt))/2,0,txt,clrWhite,clrBlue,sched);
@@ -147,7 +171,11 @@ void magazine::printHead(const cSchedule *s,int p)
enum eDvbColor col=clrWhite;
currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
+#if VDRVERSNUM >= 10300
+ channel = Channels.GetByChannelID(s->ChannelID(), true);
+#else
channel = Channels.GetByChannelID(s->GetChannelID(), true);
+#endif
if (currentChannel==channel->Number())
{
col=clrCyan;
@@ -229,9 +257,15 @@ void magazine::showTimeline(void)
}
osd->Flush();
}
+#if VDRVERSNUM >= 10300
+void magazine::showSched(const cSchedule *s,cEvent **ev,tWindowHandle sched)
+{
+ cEvent *oldev=NULL,*cev=NULL;
+#else
void magazine::showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched)
{
cEventInfo *oldev=NULL,*cev=NULL;
+#endif
int j=0;
const char *txt;
int lh=-1;
@@ -261,20 +295,32 @@ void magazine::showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched)
{
if (oldev)
{
+#if VDRVERSNUM >= 10300
+ txt=oldev->ShortText();
+#else
txt=oldev->GetSubtitle();
+#endif
int cc=f2->TextHeight(184-f1->Width("00:0"),txt);
if (cc<=i-j)
f2->Text(f1->Width("00:0"),(j)*f1->Height()/*+24*/,184-f1->Width("00:0"),i-j,txt,col,clrBackground,sched);
}
col=clrWhite;
+#if VDRVERSNUM >= 10300
+ if (EDIT_curEvent==cev->EventID())
+#else
if (EDIT_curEvent==cev->GetEventID())
+#endif
{
col=clrYellow;
EDIT_curEVI=i;
}
txt=cev->GetTimeString();
f1->Text(0,y,txt,col,clrBackground,sched);
+#if VDRVERSNUM >= 10300
+ txt=cev->Title();
+#else
txt=cev->GetTitle();
+#endif
j=i+f1->Text(f1->Width("00:00 "),y,184-f1->Width("00:00 "),20,txt,col,clrBackground,sched);
oldev=cev;
}
@@ -282,7 +328,11 @@ void magazine::showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched)
}
if (oldev)
{
+#if VDRVERSNUM >= 10300
+ txt=oldev->ShortText();
+#else
txt=oldev->GetSubtitle();
+#endif
f2->Text(f1->Width("00:0"),j*f1->Height()/*+24*/,184-f1->Width("00:0"),evnum-j,txt,col,clrBackground,sched);
}
}
@@ -307,17 +357,38 @@ void magazine::showScheds()
showSched(s3,ev3,sched3);
}
}
+#if VDRVERSNUM >= 10300
+const cEvent *magazine::getNext(const cSchedule *s,const cEvent *e)
+{
+ const cEvent *pe = NULL;
+ time_t ref = e->StartTime();
+#else
const cEventInfo *magazine::getNext(const cSchedule *s,const cEventInfo *e)
{
const cEventInfo *pe = NULL;
time_t ref = e->GetTime();
+#endif
time_t delta = INT_MAX;
+#if VDRVERSNUM >= 10306
+ for (int i=0;i< (s->Events())->Count();i++)
+ {
+ const cEvent *p = (s->Events())->Get(i);
+#else
for (int i=0;i<s->NumEvents();i++)
{
+#if VDRVERSNUM >= 10300
+ const cEvent *p = s->GetEventNumber(i);
+#else
const cEventInfo *p = s->GetEventNumber(i);
+#endif // VDRVERSNUM >= 10300
+#endif // VDRVERSNUM >= 10306
if (p!=e)
{
+#if VDRVERSNUM >= 10300
+ time_t dt = p->StartTime() - ref;
+#else
time_t dt = p->GetTime() - ref;
+#endif
if (dt > 0 && dt < delta)
{
delta = dt;
@@ -327,17 +398,38 @@ const cEventInfo *magazine::getNext(const cSchedule *s,const cEventInfo *e)
}
return pe;
}
+#if VDRVERSNUM >= 10300
+const cEvent *magazine::getPrev(const cSchedule *s,const cEvent *e)
+{
+ const cEvent *pe = NULL;
+ time_t ref = e->StartTime();
+#else
const cEventInfo *magazine::getPrev(const cSchedule *s,const cEventInfo *e)
{
const cEventInfo *pe = NULL;
time_t ref = e->GetTime();
+#endif
time_t delta = INT_MAX;
+#if VDRVERSNUM >= 10306
+ for (int i=0;i< (s->Events())->Count();i++)
+ {
+ const cEvent *p = (s->Events())->Get(i);
+#else
for (int i=0;i<s->NumEvents();i++)
{
+#if VDRVERSNUM >= 10300
+ const cEvent *p = s->GetEventNumber(i);
+#else
const cEventInfo *p = s->GetEventNumber(i);
+#endif // VDRVERSNUM >= 10300
+#endif // VDRVERSNUM >= 10306
if (p!=e)
{
+#if VDRVERSNUM >= 10300
+ time_t dt = ref - p->StartTime();
+#else
time_t dt = ref - p->GetTime();
+#endif
if (dt > 0 && dt < delta)
{
delta = dt;
@@ -347,10 +439,17 @@ const cEventInfo *magazine::getPrev(const cSchedule *s,const cEventInfo *e)
}
return pe;
}
+#if VDRVERSNUM >= 10300
+void magazine::calcSched(const cSchedule *s,cEvent **ev)
+{
+ const cEvent *cev=NULL;
+ const cEvent *cev2=NULL;
+#else
void magazine::calcSched(const cSchedule *s,cEventInfo **ev)
{
const cEventInfo *cev=NULL;
const cEventInfo *cev2=NULL;
+#endif
int cc=0;
for(int i=0;i<evnum;i++)
@@ -362,11 +461,19 @@ void magazine::calcSched(const cSchedule *s,cEventInfo **ev)
cev2=NULL;
if (cev)
{
+#if VDRVERSNUM >= 10300
+ cc=f1->TextHeight(184-f1->Width("00:00 "),cev->Title());
+ time_t t=cev->StartTime();
+ struct tm tm_r;
+ localtime_r(&t,&tm_r);
+ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->Title());
+#else
cc=f1->TextHeight(184-f1->Width("00:00 "),cev->GetTitle());
time_t t=cev->GetTime();
struct tm tm_r;
localtime_r(&t,&tm_r);
fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->GetTitle());
+#endif
}
}
else
@@ -375,6 +482,19 @@ void magazine::calcSched(const cSchedule *s,cEventInfo **ev)
cev2=getNext(s,cev);
if (cev2 && cc--<=1)
{
+#if VDRVERSNUM >= 10300
+ int z=(cev2->StartTime()-currentFirstTime)*6/60/60;
+ if (z<i)
+ {
+ cev=cev2;
+ cev2=NULL;
+ cc=f1->TextHeight(184-f1->Width("00:00 "),cev->Title());
+ time_t t=cev->StartTime();
+ struct tm tm_r;
+ localtime_r(&t,&tm_r);
+ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->Title());
+ }
+#else
int z=(cev2->GetTime()-currentFirstTime)*6/60/60;
if (z<i)
{
@@ -386,9 +506,14 @@ void magazine::calcSched(const cSchedule *s,cEventInfo **ev)
localtime_r(&t,&tm_r);
fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->GetTitle());
}
+#endif
}
}
+#if VDRVERSNUM >= 10300
+ ev[i]=(cEvent *)cev;
+#else
ev[i]=(cEventInfo *)cev;
+#endif
}
}
void magazine::calcScheds()
@@ -479,9 +604,15 @@ void magazine::Show(void)
osd->Clear();
evnum=(384)/f1->Height();
+#if VDRVERSNUM >= 10300
+ ev1=new (cEvent*)[evnum];
+ ev2=new (cEvent*)[evnum];
+ ev3=new (cEvent*)[evnum];
+#else
ev1=new (cEventInfo*)[evnum];
ev2=new (cEventInfo*)[evnum];
ev3=new (cEventInfo*)[evnum];
+#endif
fullHours=new int[evnum];
showHeads();
@@ -493,9 +624,15 @@ void magazine::Show(void)
showTimeline();
}
}
+#if VDRVERSNUM >= 10300
+cEvent **magazine::ev4ch(int p)
+{
+ cEvent **ev=NULL;
+#else
cEventInfo **magazine::ev4ch(int p)
{
cEventInfo **ev=NULL;
+#endif
if (p==currentFirst)
ev=ev1;
else if (p==currentFirst+1)
@@ -506,12 +643,20 @@ cEventInfo **magazine::ev4ch(int p)
}
void magazine::searchcEvt(void)
{
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
+#endif
for(int i=EDIT_curEVI;i>=0;i--)
{
if (ev[i])
{
+#if VDRVERSNUM >= 10300
+ EDIT_curEvent=ev[i]->EventID();
+#else
EDIT_curEvent=ev[i]->GetEventID();
+#endif
break;
}
}
@@ -544,8 +689,13 @@ eOSState magazine::ProcessKey(eKeys Key)
break;
case kBlue: // Umschalten
{
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+ cChannel *channel = Channels.GetByChannelID(ev[EDIT_curEVI]->ChannelID(), true);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
cChannel *channel = Channels.GetByChannelID(ev[EDIT_curEVI]->GetChannelID(), true);
+#endif
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
{
delete me;
@@ -559,7 +709,11 @@ eOSState magazine::ProcessKey(eKeys Key)
{
delete me;
me=NULL;
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
+#endif
cTimer *timer = new cTimer(ev[EDIT_curEVI]);
cTimer *t = Timers.GetTimer(timer);
if (t)
@@ -619,7 +773,11 @@ eOSState magazine::ProcessKey(eKeys Key)
{
if (ev1[i])
{
+#if VDRVERSNUM >= 10300
+ EDIT_curEvent=ev1[i]->EventID();
+#else
EDIT_curEvent=ev1[i]->GetEventID();
+#endif
break;
}
}
@@ -707,7 +865,11 @@ eOSState magazine::ProcessKey(eKeys Key)
int currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
for(int i=0;i<schedArrayNum;i++)
{
+#if VDRVERSNUM >= 10300
+ cChannel *channel = Channels.GetByChannelID(schedArray[i]->ChannelID(), true);
+#else
cChannel *channel = Channels.GetByChannelID(schedArray[i]->GetChannelID(), true);
+#endif
if (channel->Number()==currentChannel)
{
currentFirst=i-1;
@@ -757,7 +919,11 @@ eOSState magazine::ProcessKey(eKeys Key)
{
delete osd;
osd=NULL;
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
+#endif
me=new cMenuEvent(ev[EDIT_curEVI], true);
me->Display();
curmode=SHOW;
@@ -810,8 +976,13 @@ eOSState magazine::ProcessKey(eKeys Key)
break;
case kUp:
{
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+ const cEvent *e=getPrev(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
const cEventInfo *e=getPrev(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
+#endif
if (e)
{
@@ -821,10 +992,18 @@ eOSState magazine::ProcessKey(eKeys Key)
found=0;
for(int i=0;i<evnum;i++)
{
+#if VDRVERSNUM >= 10300
+ if (ev[i] && ev[i]->EventID()==e->EventID())
+#else
if (ev[i] && ev[i]->GetEventID()==e->GetEventID())
+#endif
{
found=1;
+#if VDRVERSNUM >= 10300
+ EDIT_curEvent=e->EventID();
+#else
EDIT_curEvent=e->GetEventID();
+#endif
}
}
if (!found)
@@ -848,12 +1027,21 @@ eOSState magazine::ProcessKey(eKeys Key)
break;
case kDown:
{
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+ const cEvent *e=getNext(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
const cEventInfo *e=getNext(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
+#endif
if (e)
{
+#if VDRVERSNUM >= 10300
+ EDIT_curEvent=e->EventID();
+#else
EDIT_curEvent=e->GetEventID();
+#endif
int found,cc=0;
do
{
@@ -861,7 +1049,11 @@ eOSState magazine::ProcessKey(eKeys Key)
cc++;
for(int i=0;i<evnum;i++)
{
+#if VDRVERSNUM >= 10300
+ if (ev[i] && ev[i]->EventID()==EDIT_curEvent)
+#else
if (ev[i] && ev[i]->GetEventID()==EDIT_curEvent)
+#endif
{
found=1;
}
@@ -912,7 +1104,11 @@ eOSState magazine::ProcessKey(eKeys Key)
{
delete osd;
osd=NULL;
+#if VDRVERSNUM >= 10300
+ cEvent **ev=ev4ch(EDIT_curChannel);
+#else
cEventInfo **ev=ev4ch(EDIT_curChannel);
+#endif
cTimer *timer = new cTimer(ev[EDIT_curEVI]);
cTimer *t = Timers.GetTimer(timer);
if (t)
diff --git a/magazine.h b/magazine.h
index 7e3ae94..b5b6b46 100644
--- a/magazine.h
+++ b/magazine.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: magazine.h,v 1.4 2004/03/05 12:16:26 schmitzj Exp $
+ * $Id: magazine.h,v 1.7 2004/03/23 14:08:25 schmitzj Exp $
*
*/
@@ -31,16 +31,26 @@ class magazine : public cOsdObject
tWindowHandle sched1,sched2,sched3;
tWindowHandle control;
+#if VDRVERSNUM >= 10300
+ cSchedulesLock _schedulesLock;
+#else
cMutexLock _mutexLock;
+#endif
const cSchedule** schedArray;
int schedArrayNum;
int currentFirst;
time_t currentFirstTime;
int evnum;
+#if VDRVERSNUM >= 10300
+ class cEvent **ev1;
+ class cEvent **ev2;
+ class cEvent **ev3;
+#else
class cEventInfo **ev1;
class cEventInfo **ev2;
class cEventInfo **ev3;
+#endif
int *fullHours;
enum modes {SHOW,EDIT};
@@ -50,9 +60,15 @@ class magazine : public cOsdObject
int EDIT_curChannel;
int EDIT_curEVI;
+#if VDRVERSNUM >= 10300
+ const class cEvent *getNext(const cSchedule *s,const cEvent *e);
+ const class cEvent *getPrev(const cSchedule *s,const cEvent *e);
+ cEvent **ev4ch(int);
+#else
const class cEventInfo *getNext(const cSchedule *s,const cEventInfo *e);
const class cEventInfo *getPrev(const cSchedule *s,const cEventInfo *e);
cEventInfo **ev4ch(int);
+#endif
void searchcEvt();
// void printHead(const cSchedule *s,tWindowHandle sched);
@@ -61,8 +77,13 @@ class magazine : public cOsdObject
void showTimeline(void);
void showHeads(void);
void showScheds(void);
+#if VDRVERSNUM >= 10300
+ void showSched(const cSchedule *s,cEvent **ev,tWindowHandle sched);
+ void calcSched(const cSchedule *s,cEvent **ev);
+#else
void showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched);
void calcSched(const cSchedule *s,cEventInfo **ev);
+#endif
void calcScheds(void);
public:
@@ -74,9 +95,17 @@ public:
class cMenuEvent : public cOsdMenu {
private:
+#if VDRVERSNUM >= 10300
+ const class cEvent *eventInfo;
+#else
const class cEventInfo *eventInfo;
+#endif
public:
+#if VDRVERSNUM >= 10300
+ cMenuEvent(const class cEvent *EventInfo, bool CanSwitch = false);
+#else
cMenuEvent(const class cEventInfo *EventInfo, bool CanSwitch = false);
+#endif
cMenuEvent(bool Now);
virtual eOSState ProcessKey(eKeys Key);
};
diff --git a/magazine.h.orig b/magazine.h.orig
new file mode 100644
index 0000000..ea932e1
--- /dev/null
+++ b/magazine.h.orig
@@ -0,0 +1,97 @@
+/*
+ * magazine.h
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ * $Id: magazine.h,v 1.5 2004/03/23 09:26:46 schmitzj Exp $
+ *
+ */
+
+#ifndef MAGAZINE_H
+#define MAGAZINE_H
+
+#include <vdr/plugin.h>
+#include <time.h>
+#include "anyfont.h"
+
+void mzlog(int level, const char *fmt, ...);
+
+class magazine : public cOsdObject
+{
+ cPlugin *parent;
+ cOsdBase *osd;
+
+ class cMenuEvent *me;
+ class cMenuEditTimer *met;
+
+ anyFont *f1,*f2,*f3,*f4;
+
+ tWindowHandle timeline;
+ tWindowHandle names;
+ tWindowHandle sched1,sched2,sched3;
+ tWindowHandle control;
+
+ cMutexLock _mutexLock;
+ const cSchedule** schedArray;
+ int schedArrayNum;
+ int currentFirst;
+ time_t currentFirstTime;
+
+ int evnum;
+ class cEventInfo **ev1;
+ class cEventInfo **ev2;
+ class cEventInfo **ev3;
+ int *fullHours;
+
+ enum modes {SHOW,EDIT};
+ enum modes curmode;
+
+ unsigned short EDIT_curEvent;
+ int EDIT_curChannel;
+ int EDIT_curEVI;
+
+ const class cEventInfo *getNext(const cSchedule *s,const cEventInfo *e);
+ const class cEventInfo *getPrev(const cSchedule *s,const cEventInfo *e);
+ cEventInfo **ev4ch(int);
+ void searchcEvt();
+
+// void printHead(const cSchedule *s,tWindowHandle sched);
+ void printHead(const cSchedule *s,int p);
+ void showKeys(void);
+ void showTimeline(void);
+ void showHeads(void);
+ void showScheds(void);
+ void showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched);
+ void calcSched(const cSchedule *s,cEventInfo **ev);
+ void calcScheds(void);
+
+public:
+ magazine(class cPlugin *);
+ virtual ~magazine();
+ virtual void Show(void);
+ virtual eOSState ProcessKey(eKeys Key);
+};
+
+class cMenuEvent : public cOsdMenu {
+private:
+ const class cEventInfo *eventInfo;
+public:
+ cMenuEvent(const class cEventInfo *EventInfo, bool CanSwitch = false);
+ cMenuEvent(bool Now);
+ virtual eOSState ProcessKey(eKeys Key);
+};
+class cMenuEditTimer : public cOsdMenu {
+private:
+ cTimer *timer;
+ cTimer data;
+ int channel;
+ bool addIfConfirmed;
+ class cMenuEditDateItem *firstday;
+ void SetFirstDayItem(void);
+public:
+ cMenuEditTimer(cTimer *Timer, bool New = false);
+ virtual ~cMenuEditTimer();
+ virtual eOSState ProcessKey(eKeys Key);
+ };
+
+#endif
diff --git a/tvonscreen.c b/tvonscreen.c
index 598ec14..0c4af78 100644
--- a/tvonscreen.c
+++ b/tvonscreen.c
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: tvonscreen.c,v 1.5 2004/03/05 12:17:31 schmitzj Exp $
+ * $Id: tvonscreen.c,v 1.7 2004/03/23 09:28:47 schmitzj Exp $
*
*/
@@ -11,7 +11,7 @@
#include "magazine.h"
#include "i18n.h"
-static const char *VERSION = "0.5.0";
+static const char *VERSION = "0.5.1";
static const char *DESCRIPTION = "Shows the EPG info in form of a typical TV magazine";
static const char *MAINMENUENTRY = "TV-OnScreen";
diff --git a/vdr-136-tvonscreen-0.5.0-patch.diff b/vdr-136-tvonscreen-0.5.0-patch.diff
new file mode 100755
index 0000000..60e787d
--- /dev/null
+++ b/vdr-136-tvonscreen-0.5.0-patch.diff
@@ -0,0 +1,567 @@
+diff -Nur tvonscreen-0.5.0/magazine.c tvonscreen-0.5.0-1.3.6/magazine.c
+--- tvonscreen-0.5.0/magazine.c Fri Mar 5 13:28:30 2004
++++ tvonscreen-0.5.0-1.3.6/magazine.c Tue Mar 23 11:40:45 2004
+@@ -14,11 +14,19 @@
+ int c1nr = 9999; // there should be no one with more than 9999 channels
+ int c2nr = 9999;
+
++#if VDRVERSNUM >= 10300
++ cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->ChannelID(), true);
++#else
+ cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->GetChannelID(), true);
++#endif
+ if (c1)
+ c1nr = c1->Number();
+
++#if VDRVERSNUM >= 10300
++ cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->ChannelID(), true);
++#else
+ cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->GetChannelID(), true);
++#endif
+ if (c2)
+ c2nr = c2->Number();
+
+@@ -30,7 +38,11 @@
+ {
+ parent=p;
+
++#if VDRVERSNUM >= 10300
++ const cSchedules* Schedules = cSchedules::Schedules(_schedulesLock);
++#else
+ const cSchedules* Schedules = cSIProcessor::Schedules(_mutexLock);
++#endif
+
+ curmode=SHOW;
+ EDIT_curEvent=0;
+@@ -57,7 +69,11 @@
+ { // if there exist an event -> add to array
+ // check if we can get a channel NAME ( XXX )
+ // I thougt that this must always work , but doesn't
++#if VDRVERSNUM >= 10300
++ cChannel *c = Channels.GetByChannelID(Schedule->ChannelID(), true);
++#else
+ cChannel *c = Channels.GetByChannelID(Schedule->GetChannelID(), true);
++#endif
+ if (c)
+ {
+ schedArray[num] = Schedule;
+@@ -73,7 +89,11 @@
+ int currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
+ for(int i=0;i<schedArrayNum;i++)
+ {
++#if VDRVERSNUM >= 10300
++ cChannel *channel = Channels.GetByChannelID(schedArray[i]->ChannelID(), true);
++#else
+ cChannel *channel = Channels.GetByChannelID(schedArray[i]->GetChannelID(), true);
++#endif
+ if (channel->Number()==currentChannel)
+ {
+ currentFirst=i-1;
+@@ -125,7 +145,11 @@
+ osd->Fill(0,0,184,20,clrBlue,sched);
+ if (s!=NULL)
+ {
++#if VDRVERSNUM >= 10300
++ channel = Channels.GetByChannelID(s->ChannelID(), true);
++#else
+ channel = Channels.GetByChannelID(s->GetChannelID(), true);
++#endif
+ txt=channel->Name();
+ if (f3->LargeWidth(txt)>184)
+ f3->Text((184-f3->Width(txt))/2,0,txt,clrWhite,clrBlue,sched);
+@@ -147,7 +171,11 @@
+ enum eDvbColor col=clrWhite;
+
+ currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
++#if VDRVERSNUM >= 10300
++ channel = Channels.GetByChannelID(s->ChannelID(), true);
++#else
+ channel = Channels.GetByChannelID(s->GetChannelID(), true);
++#endif
+ if (currentChannel==channel->Number())
+ {
+ col=clrCyan;
+@@ -229,9 +257,15 @@
+ }
+ osd->Flush();
+ }
++#if VDRVERSNUM >= 10300
++void magazine::showSched(const cSchedule *s,cEvent **ev,tWindowHandle sched)
++{
++ cEvent *oldev=NULL,*cev=NULL;
++#else
+ void magazine::showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched)
+ {
+ cEventInfo *oldev=NULL,*cev=NULL;
++#endif
+ int j=0;
+ const char *txt;
+ int lh=-1;
+@@ -261,20 +295,32 @@
+ {
+ if (oldev)
+ {
++#if VDRVERSNUM >= 10300
++ txt=oldev->ShortText();
++#else
+ txt=oldev->GetSubtitle();
++#endif
+ int cc=f2->TextHeight(184-f1->Width("00:0"),txt);
+ if (cc<=i-j)
+ f2->Text(f1->Width("00:0"),(j)*f1->Height()/*+24*/,184-f1->Width("00:0"),i-j,txt,col,clrBackground,sched);
+ }
+ col=clrWhite;
++#if VDRVERSNUM >= 10300
++ if (EDIT_curEvent==cev->EventID())
++#else
+ if (EDIT_curEvent==cev->GetEventID())
++#endif
+ {
+ col=clrYellow;
+ EDIT_curEVI=i;
+ }
+ txt=cev->GetTimeString();
+ f1->Text(0,y,txt,col,clrBackground,sched);
++#if VDRVERSNUM >= 10300
++ txt=cev->Title();
++#else
+ txt=cev->GetTitle();
++#endif
+ j=i+f1->Text(f1->Width("00:00 "),y,184-f1->Width("00:00 "),20,txt,col,clrBackground,sched);
+ oldev=cev;
+ }
+@@ -282,7 +328,11 @@
+ }
+ if (oldev)
+ {
++#if VDRVERSNUM >= 10300
++ txt=oldev->ShortText();
++#else
+ txt=oldev->GetSubtitle();
++#endif
+ f2->Text(f1->Width("00:0"),j*f1->Height()/*+24*/,184-f1->Width("00:0"),evnum-j,txt,col,clrBackground,sched);
+ }
+ }
+@@ -307,17 +357,38 @@
+ showSched(s3,ev3,sched3);
+ }
+ }
++#if VDRVERSNUM >= 10300
++const cEvent *magazine::getNext(const cSchedule *s,const cEvent *e)
++{
++ const cEvent *pe = NULL;
++ time_t ref = e->StartTime();
++#else
+ const cEventInfo *magazine::getNext(const cSchedule *s,const cEventInfo *e)
+ {
+ const cEventInfo *pe = NULL;
+ time_t ref = e->GetTime();
++#endif
+ time_t delta = INT_MAX;
++#if VDRVERSNUM >= 10306
++ for (int i=0;i< (s->Events())->Count();i++)
++ {
++ const cEvent *p = (s->Events())->Get(i);
++#else
+ for (int i=0;i<s->NumEvents();i++)
+ {
++#if VDRVERSNUM >= 10300
++ const cEvent *p = s->GetEventNumber(i);
++#else
+ const cEventInfo *p = s->GetEventNumber(i);
++#endif // VDRVERSNUM >= 10300
++#endif // VDRVERSNUM >= 10306
+ if (p!=e)
+ {
++#if VDRVERSNUM >= 10300
++ time_t dt = p->StartTime() - ref;
++#else
+ time_t dt = p->GetTime() - ref;
++#endif
+ if (dt > 0 && dt < delta)
+ {
+ delta = dt;
+@@ -327,17 +398,38 @@
+ }
+ return pe;
+ }
++#if VDRVERSNUM >= 10300
++const cEvent *magazine::getPrev(const cSchedule *s,const cEvent *e)
++{
++ const cEvent *pe = NULL;
++ time_t ref = e->StartTime();
++#else
+ const cEventInfo *magazine::getPrev(const cSchedule *s,const cEventInfo *e)
+ {
+ const cEventInfo *pe = NULL;
+ time_t ref = e->GetTime();
++#endif
+ time_t delta = INT_MAX;
++#if VDRVERSNUM >= 10306
++ for (int i=0;i< (s->Events())->Count();i++)
++ {
++ const cEvent *p = (s->Events())->Get(i);
++#else
+ for (int i=0;i<s->NumEvents();i++)
+ {
++#if VDRVERSNUM >= 10300
++ const cEvent *p = s->GetEventNumber(i);
++#else
+ const cEventInfo *p = s->GetEventNumber(i);
++#endif // VDRVERSNUM >= 10300
++#endif // VDRVERSNUM >= 10306
+ if (p!=e)
+ {
++#if VDRVERSNUM >= 10300
++ time_t dt = ref - p->StartTime();
++#else
+ time_t dt = ref - p->GetTime();
++#endif
+ if (dt > 0 && dt < delta)
+ {
+ delta = dt;
+@@ -347,10 +439,17 @@
+ }
+ return pe;
+ }
++#if VDRVERSNUM >= 10300
++void magazine::calcSched(const cSchedule *s,cEvent **ev)
++{
++ const cEvent *cev=NULL;
++ const cEvent *cev2=NULL;
++#else
+ void magazine::calcSched(const cSchedule *s,cEventInfo **ev)
+ {
+ const cEventInfo *cev=NULL;
+ const cEventInfo *cev2=NULL;
++#endif
+ int cc=0;
+
+ for(int i=0;i<evnum;i++)
+@@ -362,11 +461,19 @@
+ cev2=NULL;
+ if (cev)
+ {
++#if VDRVERSNUM >= 10300
++ cc=f1->TextHeight(184-f1->Width("00:00 "),cev->Title());
++ time_t t=cev->StartTime();
++ struct tm tm_r;
++ localtime_r(&t,&tm_r);
++ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->Title());
++#else
+ cc=f1->TextHeight(184-f1->Width("00:00 "),cev->GetTitle());
+ time_t t=cev->GetTime();
+ struct tm tm_r;
+ localtime_r(&t,&tm_r);
+ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->GetTitle());
++#endif
+ }
+ }
+ else
+@@ -375,6 +482,19 @@
+ cev2=getNext(s,cev);
+ if (cev2 && cc--<=1)
+ {
++#if VDRVERSNUM >= 10300
++ int z=(cev2->StartTime()-currentFirstTime)*6/60/60;
++ if (z<i)
++ {
++ cev=cev2;
++ cev2=NULL;
++ cc=f1->TextHeight(184-f1->Width("00:00 "),cev->Title());
++ time_t t=cev->StartTime();
++ struct tm tm_r;
++ localtime_r(&t,&tm_r);
++ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->Title());
++ }
++#else
+ int z=(cev2->GetTime()-currentFirstTime)*6/60/60;
+ if (z<i)
+ {
+@@ -386,9 +506,14 @@
+ localtime_r(&t,&tm_r);
+ fullHours[i]=tm_r.tm_hour; //mzlog(0," fH[%d]=%d '%s'",i,tm_r.tm_hour,cev->GetTitle());
+ }
++#endif
+ }
+ }
++#if VDRVERSNUM >= 10300
++ ev[i]=(cEvent *)cev;
++#else
+ ev[i]=(cEventInfo *)cev;
++#endif
+ }
+ }
+ void magazine::calcScheds()
+@@ -479,9 +604,15 @@
+ osd->Clear();
+
+ evnum=(384)/f1->Height();
++#if VDRVERSNUM >= 10300
++ ev1=new (cEvent*)[evnum];
++ ev2=new (cEvent*)[evnum];
++ ev3=new (cEvent*)[evnum];
++#else
+ ev1=new (cEventInfo*)[evnum];
+ ev2=new (cEventInfo*)[evnum];
+ ev3=new (cEventInfo*)[evnum];
++#endif
+ fullHours=new int[evnum];
+
+ showHeads();
+@@ -493,9 +624,15 @@
+ showTimeline();
+ }
+ }
++#if VDRVERSNUM >= 10300
++cEvent **magazine::ev4ch(int p)
++{
++ cEvent **ev=NULL;
++#else
+ cEventInfo **magazine::ev4ch(int p)
+ {
+ cEventInfo **ev=NULL;
++#endif
+ if (p==currentFirst)
+ ev=ev1;
+ else if (p==currentFirst+1)
+@@ -506,12 +643,20 @@
+ }
+ void magazine::searchcEvt(void)
+ {
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
++#endif
+ for(int i=EDIT_curEVI;i>=0;i--)
+ {
+ if (ev[i])
+ {
++#if VDRVERSNUM >= 10300
++ EDIT_curEvent=ev[i]->EventID();
++#else
+ EDIT_curEvent=ev[i]->GetEventID();
++#endif
+ break;
+ }
+ }
+@@ -544,8 +689,13 @@
+ break;
+ case kBlue: // Umschalten
+ {
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++ cChannel *channel = Channels.GetByChannelID(ev[EDIT_curEVI]->ChannelID(), true);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
+ cChannel *channel = Channels.GetByChannelID(ev[EDIT_curEVI]->GetChannelID(), true);
++#endif
+ if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
+ {
+ delete me;
+@@ -559,7 +709,11 @@
+ {
+ delete me;
+ me=NULL;
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
++#endif
+ cTimer *timer = new cTimer(ev[EDIT_curEVI]);
+ cTimer *t = Timers.GetTimer(timer);
+ if (t)
+@@ -619,7 +773,11 @@
+ {
+ if (ev1[i])
+ {
++#if VDRVERSNUM >= 10300
++ EDIT_curEvent=ev1[i]->EventID();
++#else
+ EDIT_curEvent=ev1[i]->GetEventID();
++#endif
+ break;
+ }
+ }
+@@ -707,7 +865,11 @@
+ int currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
+ for(int i=0;i<schedArrayNum;i++)
+ {
++#if VDRVERSNUM >= 10300
++ cChannel *channel = Channels.GetByChannelID(schedArray[i]->ChannelID(), true);
++#else
+ cChannel *channel = Channels.GetByChannelID(schedArray[i]->GetChannelID(), true);
++#endif
+ if (channel->Number()==currentChannel)
+ {
+ currentFirst=i-1;
+@@ -757,7 +919,11 @@
+ {
+ delete osd;
+ osd=NULL;
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
++#endif
+ me=new cMenuEvent(ev[EDIT_curEVI], true);
+ me->Display();
+ curmode=SHOW;
+@@ -810,8 +976,13 @@
+ break;
+ case kUp:
+ {
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++ const cEvent *e=getPrev(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
+ const cEventInfo *e=getPrev(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
++#endif
+
+ if (e)
+ {
+@@ -821,10 +992,18 @@
+ found=0;
+ for(int i=0;i<evnum;i++)
+ {
++#if VDRVERSNUM >= 10300
++ if (ev[i] && ev[i]->EventID()==e->EventID())
++#else
+ if (ev[i] && ev[i]->GetEventID()==e->GetEventID())
++#endif
+ {
+ found=1;
++#if VDRVERSNUM >= 10300
++ EDIT_curEvent=e->EventID();
++#else
+ EDIT_curEvent=e->GetEventID();
++#endif
+ }
+ }
+ if (!found)
+@@ -848,12 +1027,21 @@
+ break;
+ case kDown:
+ {
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++ const cEvent *e=getNext(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
+ const cEventInfo *e=getNext(schedArray[EDIT_curChannel],ev[EDIT_curEVI]);
++#endif
+
+ if (e)
+ {
++#if VDRVERSNUM >= 10300
++ EDIT_curEvent=e->EventID();
++#else
+ EDIT_curEvent=e->GetEventID();
++#endif
+ int found,cc=0;
+ do
+ {
+@@ -861,7 +1049,11 @@
+ cc++;
+ for(int i=0;i<evnum;i++)
+ {
++#if VDRVERSNUM >= 10300
++ if (ev[i] && ev[i]->EventID()==EDIT_curEvent)
++#else
+ if (ev[i] && ev[i]->GetEventID()==EDIT_curEvent)
++#endif
+ {
+ found=1;
+ }
+@@ -912,7 +1104,11 @@
+ {
+ delete osd;
+ osd=NULL;
++#if VDRVERSNUM >= 10300
++ cEvent **ev=ev4ch(EDIT_curChannel);
++#else
+ cEventInfo **ev=ev4ch(EDIT_curChannel);
++#endif
+ cTimer *timer = new cTimer(ev[EDIT_curEVI]);
+ cTimer *t = Timers.GetTimer(timer);
+ if (t)
+diff -Nur tvonscreen-0.5.0/magazine.h tvonscreen-0.5.0-1.3.6/magazine.h
+--- tvonscreen-0.5.0/magazine.h Mon Mar 22 01:38:37 2004
++++ tvonscreen-0.5.0-1.3.6/magazine.h Tue Mar 23 11:17:37 2004
+@@ -31,16 +31,26 @@
+ tWindowHandle sched1,sched2,sched3;
+ tWindowHandle control;
+
++#if VDRVERSNUM >= 10300
++ cSchedulesLock _schedulesLock;
++#else
+ cMutexLock _mutexLock;
++#endif
+ const cSchedule** schedArray;
+ int schedArrayNum;
+ int currentFirst;
+ time_t currentFirstTime;
+
+ int evnum;
++#if VDRVERSNUM >= 10300
++ class cEvent **ev1;
++ class cEvent **ev2;
++ class cEvent **ev3;
++#else
+ class cEventInfo **ev1;
+ class cEventInfo **ev2;
+ class cEventInfo **ev3;
++#endif
+ int *fullHours;
+
+ enum modes {SHOW,EDIT};
+@@ -50,9 +60,15 @@
+ int EDIT_curChannel;
+ int EDIT_curEVI;
+
++#if VDRVERSNUM >= 10300
++ const class cEvent *getNext(const cSchedule *s,const cEvent *e);
++ const class cEvent *getPrev(const cSchedule *s,const cEvent *e);
++ cEvent **ev4ch(int);
++#else
+ const class cEventInfo *getNext(const cSchedule *s,const cEventInfo *e);
+ const class cEventInfo *getPrev(const cSchedule *s,const cEventInfo *e);
+ cEventInfo **ev4ch(int);
++#endif
+ void searchcEvt();
+
+ // void printHead(const cSchedule *s,tWindowHandle sched);
+@@ -61,8 +77,13 @@
+ void showTimeline(void);
+ void showHeads(void);
+ void showScheds(void);
++#if VDRVERSNUM >= 10300
++ void showSched(const cSchedule *s,cEvent **ev,tWindowHandle sched);
++ void calcSched(const cSchedule *s,cEvent **ev);
++#else
+ void showSched(const cSchedule *s,cEventInfo **ev,tWindowHandle sched);
+ void calcSched(const cSchedule *s,cEventInfo **ev);
++#endif
+ void calcScheds(void);
+
+ public:
+@@ -74,9 +95,17 @@
+
+ class cMenuEvent : public cOsdMenu {
+ private:
++#if VDRVERSNUM >= 10300
++ const class cEvent *eventInfo;
++#else
+ const class cEventInfo *eventInfo;
++#endif
+ public:
++#if VDRVERSNUM >= 10300
++ cMenuEvent(const class cEvent *EventInfo, bool CanSwitch = false);
++#else
+ cMenuEvent(const class cEventInfo *EventInfo, bool CanSwitch = false);
++#endif
+ cMenuEvent(bool Now);
+ virtual eOSState ProcessKey(eKeys Key);
+ }; \ No newline at end of file