summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-07-31 22:32:15 +0200
committerJochen Dolze <vdr@dolze.de>2010-07-31 22:32:15 +0200
commit5785295a438e1ddd874f27b0f89b391d7c976fd7 (patch)
treecac4bb0fe2756d994cc6022e3e4b3418215be281
parenta8b393036b07f1bd05f09e71802cafe82ea50cbb (diff)
downloadvdr-plugin-tvonscreen-5785295a438e1ddd874f27b0f89b391d7c976fd7.tar.gz
vdr-plugin-tvonscreen-5785295a438e1ddd874f27b0f89b391d7c976fd7.tar.bz2
Added fPIC-fix patch, added various fixes for segfaults, added changes for VDR >= 1.5.3
-rw-r--r--Makefile2
-rw-r--r--anyfont.c36
-rw-r--r--anyfont.h8
-rw-r--r--magazine.c63
-rw-r--r--magazine.h2
5 files changed, 90 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 45ce010..f8d2dc8 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDI
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual
+CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual
### The directory environment:
diff --git a/anyfont.c b/anyfont.c
index 3c57187..9022036 100644
--- a/anyfont.c
+++ b/anyfont.c
@@ -10,20 +10,36 @@
#include "anyfont.h"
#include "magazine.h"
-#if VDRVERSNUM >= 10307
+#if VDRVERSNUM >= 10503
+anyFont::anyFont(cOsd *_osd,int fheight,int transparent)
+#elif VDRVERSNUM >= 10307
anyFont::anyFont(cOsd *_osd,const cFont::tPixelData *fd,int fheight,int transparent)
#else
anyFont::anyFont(cOsdBase *_osd,const cFont::tPixelData *fd,int fheight,int transparent)
#endif
{
osd=_osd;
+#if VDRVERSNUM >= 10503
+#if VDRVERSNUM >= 10504
+ Font = cFont::CreateFont(Setup.FontOsd, fheight);
+#else
+ Font = new cFreetypeFont(*AddDirectory(FONTDIR, Setup.FontOsd, fheight);
+#endif
+ if (!Font || !Font->Height())
+ Font = cFont::GetFont(fontSml);
+#else
FontData=fd;
FontHeight=fheight;
+#endif
trans=transparent;
}
int anyFont::Height(void)
{
+#if VDRVERSNUM >= 10503
+ return Font->Height();
+#else
return FontHeight-2-2;
+#endif
}
int anyFont::Width(const char *txt)
{
@@ -39,21 +55,29 @@ int anyFont::LargeWidth(const char *txt)
}
int anyFont::Width(char c)
{
+#if VDRVERSNUM >= 10503
+ return Font->Width(c);
+#else
if ((int)FontData[(((unsigned char)c)-32)*(FontHeight)]>100)
{
mzlog(1," big letter error %c: %d",c,(int)FontData[(((unsigned char)c)-32)*(FontHeight)]);
return 100;
}
return (int)FontData[(((unsigned char)c)-32)*(FontHeight)];
+#endif
}
int anyFont::LargeWidth(char c)
{
+#if VDRVERSNUM >= 10503
+ return Font->Width(c);
+#else
if ((int)FontData[(((unsigned char)c)-32)*(FontHeight)]>100)
{
mzlog(1," big letter error %c: %d",c,(int)FontData[(((unsigned char)c)-32)*(FontHeight)]);
return 100;
}
return (int)FontData[(((unsigned char)c)-32)*(FontHeight)]*2;
+#endif
}
#if VDRVERSNUM >= 10307
int anyFont::Text(int x, int y, const char *txt, tColor fg, tColor bg)
@@ -61,6 +85,10 @@ int anyFont::Text(int x, int y, const char *txt, tColor fg, tColor bg)
int anyFont::Text(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWindowHandle wh)
#endif
{
+#if VDRVERSNUM >= 10503
+ osd->DrawText(x, y, txt, fg, trans ? clrTransparent : bg, Font);
+ return x += Font->Width(txt);
+#else
unsigned int pxl;
int row,col;
@@ -85,6 +113,7 @@ int anyFont::Text(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWi
x += Width(*txt++);
}
return x;
+#endif
}
#if VDRVERSNUM >= 10307
int anyFont::LargeText(int x, int y, const char *txt, tColor fg, tColor bg)
@@ -92,6 +121,10 @@ int anyFont::LargeText(int x, int y, const char *txt, tColor fg, tColor bg)
int anyFont::LargeText(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg, tWindowHandle wh)
#endif
{
+#if VDRVERSNUM >= 10503
+ osd->DrawText(x, y, txt, fg, trans ? clrTransparent : bg, Font);
+ return x + Font->Width(txt);
+#else
unsigned int pxl;
int row,col;
@@ -116,6 +149,7 @@ int anyFont::LargeText(int x, int y, const char *txt, eDvbColor fg, eDvbColor bg
x += LargeWidth(*txt++);
}
return x;
+#endif
}
#if VDRVERSNUM >= 10307
int anyFont::Text(int x, int y, int w, int h, const char *txt, tColor fg, tColor bg)
diff --git a/anyfont.h b/anyfont.h
index 30268f9..187e747 100644
--- a/anyfont.h
+++ b/anyfont.h
@@ -19,11 +19,17 @@ class anyFont
#else
cOsdBase *osd;
#endif
+#if VDRVERSNUM >= 10503
+ const cFont *Font;
+#else
const cFont::tPixelData *FontData;
int FontHeight;
+#endif
int trans;
public:
-#if VDRVERSNUM >= 10307
+#if VDRVERSNUM >= 10503
+ anyFont(cOsd *o,int fheight,int transparent=0);
+#elif VDRVERSNUM >= 10307
anyFont(cOsd *o,const cFont::tPixelData *fd,int fheight,int transparent=0);
#else
anyFont(cOsdBase *o,const cFont::tPixelData *fd,int fheight,int transparent=0);
diff --git a/magazine.c b/magazine.c
index ff694f0..8dcf801 100644
--- a/magazine.c
+++ b/magazine.c
@@ -458,6 +458,9 @@ void magazine::showScheds()
}
const cEvent *magazine::getNext(const cSchedule *s,const cEvent *e)
{
+ if (e == NULL)
+ return NULL;
+
const cEvent *pe = NULL;
time_t ref = e->StartTime();
@@ -480,6 +483,9 @@ const cEvent *magazine::getNext(const cSchedule *s,const cEvent *e)
}
const cEvent *magazine::getPrev(const cSchedule *s,const cEvent *e)
{
+ if (e == NULL)
+ return NULL;
+
const cEvent *pe = NULL;
time_t ref = e->StartTime();
time_t delta = INT_MAX;
@@ -812,10 +818,12 @@ void magazine::autoTimer(const class cEvent *cev)
}
}
+#if VDRVERSNUM < 10503
#include "fontosd/fontosd-arial18.c"
#include "fontosd/fontosd-verdana16.c"
#include "fontosd/fontosd-tahoma16.c"
#include "fontosd/fontosd-timesNewRoman16.c"
+#endif
void magazine::Show(void)
{
@@ -850,10 +858,17 @@ void magazine::Show(void)
delete f3;
delete f4;
+#if VDRVERSNUM >= 10503
+ f1=new anyFont(osd,18,1); // Sendung
+ f2=new anyFont(osd,16,1); // Extra-Info
+ f3=new anyFont(osd,20,1); // Sender
+ f4=new anyFont(osd,16); // Tasten
+#else
f1=new anyFont(osd,(cFont::tPixelData *)fontosd_arial18,FONTOSD_ARIAL18,1); // Sendung
f2=new anyFont(osd,(cFont::tPixelData *)fontosd_verdana16,FONTOSD_VERDANA16,1); // Extra-Info
f3=new anyFont(osd,(cFont::tPixelData *)fontosd_tahoma16,FONTOSD_TAHOMA16,1); // Sender
f4=new anyFont(osd,(cFont::tPixelData *)fontosd_newroman16,FONTOSD_NEWROMAN16); // Tasten
+#endif
for (int i=0; i < (int)(sizeof(Areas)/sizeof(tArea)); i++)
{
// cBitmap *b=osd->GetBitmap(i);
@@ -1077,9 +1092,9 @@ eOSState magazine::ProcessKey(eKeys Key)
{
state = cOsdObject::ProcessKey(Key);
- if (state == osUnknown)
+ if (state == osUnknown && schedArrayNum>currentFirst)
{
- if (curmode==SHOW && schedArrayNum>currentFirst)
+ if (curmode==SHOW)
{
switch (Key & ~k_Repeat)
{
@@ -1111,6 +1126,8 @@ eOSState magazine::ProcessKey(eKeys Key)
currentFirst++;
if (currentFirst>schedArrayNum-3)
currentFirst=schedArrayNum-3;
+ if (currentFirst<0)
+ currentFirst=0;
output();
break;
case kUp:
@@ -1145,6 +1162,8 @@ eOSState magazine::ProcessKey(eKeys Key)
currentFirst+=3;
if (currentFirst>schedArrayNum-3)
currentFirst=schedArrayNum-3;
+ if (currentFirst<0)
+ currentFirst=0;
output();
break;
case k8: // zum aktuellen Sender
@@ -1206,14 +1225,17 @@ eOSState magazine::ProcessKey(eKeys Key)
{
case kOk:
{
- delete osd;
- osd=NULL;
cEvent **ev=ev4ch(EDIT_curChannel);
- me=new tvOcMenuEvent(ev[EDIT_curEVI]);
- me->Display();
- curmode=SHOW;
- EDIT_curEvent=0;
- return osContinue;
+ if (ev[EDIT_curEVI] != NULL)
+ {
+ delete osd;
+ osd=NULL;
+ me=new tvOcMenuEvent(ev[EDIT_curEVI]);
+ me->Display();
+ curmode=SHOW;
+ EDIT_curEvent=0;
+ return osContinue;
+ }
}
break;
case kBack:
@@ -1238,11 +1260,15 @@ eOSState magazine::ProcessKey(eKeys Key)
EDIT_curChannel++;
if (EDIT_curChannel>schedArrayNum-1)
EDIT_curChannel=schedArrayNum-1;
+ if (EDIT_curChannel<0)
+ EDIT_curChannel=0;
if (EDIT_curChannel>currentFirst+2)
{
currentFirst++;
if (currentFirst>schedArrayNum-3)
currentFirst=schedArrayNum-3;
+ if (currentFirst<0)
+ currentFirst=0;
EDIT_curChannel=currentFirst+2;
}
outputLR();
@@ -1343,17 +1369,20 @@ eOSState magazine::ProcessKey(eKeys Key)
break; */
case kRecord:
{
- delete osd;
- osd=NULL;
cEvent **ev=ev4ch(EDIT_curChannel);
- cTimer *timer = new cTimer(ev[EDIT_curEVI]);
- cTimer *t = Timers.GetTimer(timer);
- if (t)
+ if (ev[EDIT_curEVI] != NULL)
{
- delete timer;
- timer = t;
+ delete osd;
+ osd=NULL;
+ cTimer *timer = new cTimer(ev[EDIT_curEVI]);
+ cTimer *t = Timers.GetTimer(timer);
+ if (t)
+ {
+ delete timer;
+ timer = t;
+ }
+ met=new cMenuEditTimer(timer, !t);
}
- met=new cMenuEditTimer(timer, !t);
}
break;
default:
diff --git a/magazine.h b/magazine.h
index 56d1b9c..52b0ecd 100644
--- a/magazine.h
+++ b/magazine.h
@@ -70,7 +70,7 @@ class magazine : public cOsdObject
enum modes {SHOW,EDIT};
enum modes curmode;
- unsigned short EDIT_curEvent;
+ int EDIT_curEvent;
int EDIT_curChannel;
int EDIT_curEVI;