Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] [PATCH] calendar 0.1.3 under vdr 1.3.4



Hi,

please find attached a quick patch for the calendar plugin to run under vdr development version 1.3.4.

The patch applies to version 0.1.3 of the calendar plugins.

I did only minimal testing, but for me it looks ok. If you find bugs fix or report them to me ;-)

JAN: Maybe you can incorporate it into the main source (BTW i did not include a version checking ;-))

--
So long
.\\urray
diff -rub calendar-0.1.3.org/config.c calendar-0.1.3/config.c
--- calendar-0.1.3.org/config.c	2003-12-26 14:39:51.000000000 +0100
+++ calendar-0.1.3/config.c	2004-02-21 12:17:42.000000000 +0100
@@ -36,15 +36,15 @@
 
 class cMenuWhatsOn : public cOsdMenu {
 public:
-  static const cEventInfo *scheduleEventInfo;
+  static const cEvent *scheduleEvent;
 
   cMenuWhatsOn() : cOsdMenu( NULL ) {}
 };
 
 
 
-void CalendarSetEventInfo(const cEventInfo* eventInfo) {
-  cMenuWhatsOn::scheduleEventInfo = eventInfo;
+void CalendarSetEvent(const cEvent* event) {
+  cMenuWhatsOn::scheduleEvent = event;
 }
 
 
diff -rub calendar-0.1.3.org/config.h calendar-0.1.3/config.h
--- calendar-0.1.3.org/config.h	2003-12-26 14:39:51.000000000 +0100
+++ calendar-0.1.3/config.h	2004-02-21 12:17:52.000000000 +0100
@@ -50,8 +50,8 @@
 
 
 
-class cEventInfo;
-void CalendarSetEventInfo(const cEventInfo* eventInfo);
+class cEvent;
+void CalendarSetEvent(const cEvent* event);
 
 
 
diff -rub calendar-0.1.3.org/menu.c calendar-0.1.3/menu.c
--- calendar-0.1.3.org/menu.c	2004-01-01 13:37:20.000000000 +0100
+++ calendar-0.1.3/menu.c	2004-02-21 12:18:23.000000000 +0100
@@ -36,11 +36,11 @@
   int c1nr = 9999; // there should be no one with more than 9999 channels
   int c2nr = 9999;
   
-  cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->GetChannelID(), true);
+  cChannel* c1 = Channels.GetByChannelID((*(const cSchedule**)p1)->ChannelID(), true);
   if (c1)
     c1nr = c1->Number();
 
-  cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->GetChannelID(), true);
+  cChannel* c2 = Channels.GetByChannelID((*(const cSchedule**)p2)->ChannelID(), true);
   if (c2)
     c2nr = c2->Number();
 
@@ -67,7 +67,7 @@
   _currentEvent = eventNow;
 
 
-  const cSchedules* Schedules = cSIProcessor::Schedules(_mutexLock);
+  const cSchedules* Schedules = cSchedules::Schedules(_schedulesLock);
 
   _currentChannel = Channels.GetByNumber(cDevice::CurrentChannel())->Number();
 
@@ -89,7 +89,7 @@
       // check if we can get a channel NAME ( XXX )
       // I thougt that this must always work , but doesn't
       pArray[num] = 0;
-      cChannel *c = Channels.GetByChannelID(Schedule->GetChannelID(), true);
+      cChannel *c = Channels.GetByChannelID(Schedule->ChannelID(), true);
       if (c) {
         pArray[num] = Schedule;
         ++num;
@@ -106,7 +106,7 @@
   for (int a = 0; a < num; ++a) {
 
     if( pArray[a] ) {
-      Add(new cMenuWhatsOnCalItem(pArray[a], &_now), Channels.GetByChannelID(pArray[a]->GetChannelID(), true)->Number() == _currentChannel);
+      Add(new cMenuWhatsOnCalItem(pArray[a], &_now), Channels.GetByChannelID(pArray[a]->ChannelID(), true)->Number() == _currentChannel);
     }
   }
 
@@ -223,7 +223,7 @@
       //cMenuWhatsOn::SetScheduleEventInfo(item->_schedule->GetPresentEvent());
 
       // ...but there is no set method, so we have to do the following
-      CalendarSetEventInfo(item->_schedule->GetPresentEvent());
+      CalendarSetEvent(item->_schedule->GetPresentEvent());
 //      CalendarSetEventInfo(item->_schedule->GetEventAround(_now));
 
       // Simulate a key stroke that the menu refreshes its list
@@ -257,7 +257,7 @@
   cMenuWhatsOnCalItem *item = (cMenuWhatsOnCalItem*)Get(Current());
   if (item) {
 
-    cChannel* channel =  Channels.GetByChannelID(item->_schedule->GetChannelID(), true);
+    cChannel* channel =  Channels.GetByChannelID(item->_schedule->ChannelID(), true);
 
     if (channel &&  cDevice::PrimaryDevice()->SwitchChannel(channel, true))
       return osEnd;
diff -rub calendar-0.1.3.org/menu.h calendar-0.1.3/menu.h
--- calendar-0.1.3.org/menu.h	2003-12-30 23:44:11.000000000 +0100
+++ calendar-0.1.3/menu.h	2004-02-21 11:56:49.000000000 +0100
@@ -66,7 +66,7 @@
   eWhatsOnCalEvent _currentEvent;
 
 public:
-  cMutexLock       _mutexLock;
+  cSchedulesLock       _schedulesLock;
 
 };
 
diff -rub calendar-0.1.3.org/menuitem.c calendar-0.1.3/menuitem.c
--- calendar-0.1.3.org/menuitem.c	2003-12-30 23:26:46.000000000 +0100
+++ calendar-0.1.3/menuitem.c	2004-02-21 15:02:32.000000000 +0100
@@ -57,7 +57,7 @@
 
 
 
-void WriteTextTransparent( cBitmap& bitmap, cFont& font, int x, int y, int maxx, const char* text, eDvbColor foreColor) {
+void WriteTextTransparent( cBitmap& bitmap, const cFont* font, int x, int y, int maxx, const char* text, eDvbColor foreColor) {
 
   if (!text) return;
 
@@ -68,18 +68,18 @@
 
   int scanX = x;
   int rightX = maxx;
-  int h = font.Height(*text);
+  int h = font->Height(*text);
 
 
   // Lets look, if the text fits in
   // ------------------------------
-  const int widthOfDots = font.CharData('.')->width * 3;
+  const int widthOfDots = font->CharData('.')->width * 3;
 
   const char* scanText = text;
   int lastPossibleX = 0;
   while (*scanText) {
 
-    const cFont::tCharData *pCharData = font.CharData(*scanText);
+    const cFont::tCharData *pCharData = font->CharData(*scanText);
 
     int testX = int(scanX + pCharData->width);
     if ((testX <= rightX - widthOfDots) && (strchr(" -,.:", *scanText) == 0))
@@ -104,7 +104,7 @@
   // -------------
   while (*text) {
 
-    const cFont::tCharData *pCharData = font.CharData(*text);
+    const cFont::tCharData *pCharData = font->CharData(*text);
     if ( int(x + pCharData->width) > rightX ) {
 
       // We have to break the text...
@@ -152,7 +152,7 @@
   _recordingCount = 0;
 
   char* buffer = NULL;
-  cChannel* channel = Channels.GetByChannelID(_schedule->GetChannelID(), true);
+  cChannel* channel = Channels.GetByChannelID(_schedule->ChannelID(), true);
   asprintf(&buffer, "%.*s", 10, channel ? channel->Name() : "???");
 
   SetText(buffer, false); // cOsdMenuItem takes ownership of the text and frees it if necessary.
@@ -186,7 +186,8 @@
 
   assert(_pBitmap != NULL); 
 
-  cFont font(fontOsd);
+//  cFont font(fontOsd);
+  const cFont *font = cFont::GetFont(fontOsd);
 
   const int width  = _pBitmap->Width();
   const int height = _pBitmap->Height();
@@ -294,13 +295,13 @@
 
   for (int i = 0; i < _schedule->NumEvents(); ++i) {
 
-    const cEventInfo* inf = _schedule->GetEventNumber(i);
+    const cEvent* inf = _schedule->GetEventNumber(i);
     if (inf) {
 
-      _title[_maxelem] = inf->GetTitle() ? strdup( inf->GetTitle() ) : NULL;
+      _title[_maxelem] = inf->Title() ? strdup( inf->Title() ) : NULL;
 
-      const long starttime = inf->GetTime() - *_now;
-      const long endtime   = starttime + inf->GetDuration() ;
+      const long starttime = inf->StartTime() - *_now;
+      const long endtime   = starttime + inf->Duration() ;
 
       // Is the event visible?
       if ((starttime >= 0 && starttime <  cMenuWhatsOnCalTimeIntervall) ||
@@ -339,7 +340,7 @@
 
       if (config.ShowTimers == eStAll || config.ShowTimers == eStActive && ti->Active()) {
 
-        if (ti->Channel()->GetChannelID() == _schedule->GetChannelID()) {
+        if (ti->Channel()->GetChannelID() == _schedule->ChannelID()) {
 
           if (ti->IsSingleEvent()) {
 

Home | Main Index | Thread Index