diff options
author | Andreas Mair <amair.sob@googlemail.com> | 2015-09-20 17:55:47 +0200 |
---|---|---|
committer | Andreas Mair <amair.sob@googlemail.com> | 2015-09-20 17:55:47 +0200 |
commit | 7dfde56156fa94d7dae72aa65c96ffcfd7f238b5 (patch) | |
tree | 0f9217dd8261785fd9b4159bf5cb35bb5ce59823 | |
parent | 73b31166140d84bff88152ed99442ea24f3d6052 (diff) | |
download | vdr-plugin-skinenigmang-7dfde56156fa94d7dae72aa65c96ffcfd7f238b5.tar.gz vdr-plugin-skinenigmang-7dfde56156fa94d7dae72aa65c96ffcfd7f238b5.tar.bz2 |
Compile under VDR 2.3.1
-rw-r--r-- | bitmap.c | 8 | ||||
-rw-r--r-- | bitmap.h | 4 | ||||
-rw-r--r-- | enigma.c | 40 | ||||
-rw-r--r-- | logo.c | 20 | ||||
-rw-r--r-- | logo.h | 6 | ||||
-rw-r--r-- | skinenigmang.c | 2 | ||||
-rw-r--r-- | status.c | 15 |
7 files changed, 71 insertions, 24 deletions
@@ -28,12 +28,12 @@ cOSDImageBitmap::cOSDImageBitmap() cOSDImageBitmap::~cOSDImageBitmap() {} -bool cOSDImageBitmap::DrawImage(const char *fileNameP, int x, int y, int w, int h, int colors, cBitmap *bmp) +bool cOSDImageBitmap::DrawImage(const char *fileNameP, int x, int y, int w, int h, int colors, cOsd *osd) { - return DrawMagick(fileNameP, x, y, w, h, colors, bmp); + return DrawMagick(fileNameP, x, y, w, h, colors, osd); } -bool cOSDImageBitmap::DrawMagick(const char *Filename, int x, int y, int width, int height, int colors, cBitmap *bmp) +bool cOSDImageBitmap::DrawMagick(const char *Filename, int x, int y, int width, int height, int colors, cOsd *osd) { Image image; try { @@ -80,7 +80,7 @@ bool cOSDImageBitmap::DrawMagick(const char *Filename, int x, int y, int width, | ((int)(pix->red * 255 / MaxRGB) << 16) | ((int)(pix->green * 255 / MaxRGB) << 8) | (int)(pix->blue * 255 / MaxRGB); - bmp->DrawPixel(x + ix, y + iy, col); + osd->DrawPixel(x + ix, y + iy, col); ++pix; } } @@ -17,11 +17,11 @@ class cOSDImageBitmap { public: cOSDImageBitmap(); ~cOSDImageBitmap(); - bool DrawImage(const char *fileNameP, int x, int y, int w, int h, int colors, cBitmap *bmp); + bool DrawImage(const char *fileNameP, int x, int y, int w, int h, int colors, cOsd *osd); static void Init(void); private: - bool DrawMagick(const char *Filename, int x, int y, int height, int width, int colors, cBitmap *bmp); + bool DrawMagick(const char *Filename, int x, int y, int height, int width, int colors, cOsd *osd); }; #endif @@ -563,8 +563,12 @@ void cSkinEnigmaDisplayChannel::DrawSymbols(const cChannel *Channel) if (EnigmaConfig.showVps) { // check if vps // get schedule +#if VDRVERSNUM >= 20301 + LOCK_SCHEDULES_READ +#else cSchedulesLock SchedulesLock; const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); +#endif if (Schedules) { const cSchedule *Schedule = Schedules->GetSchedule(Channel); if (Schedule) { @@ -1414,6 +1418,7 @@ void cSkinEnigmaDisplayMenu::SetColors(void) { debug("cSkinEnigmaDisplayMenu::SetColors()"); +#if VDRVERSNUM < 20301 if (osd->GetBitmap(1) == NULL) { //single area return; } @@ -1493,6 +1498,7 @@ void cSkinEnigmaDisplayMenu::SetColors(void) // color 14 reserved for "clrMessageStatusFg + 2 * Type" // color 15 reserved for "clrMessageStatusBg + 2 * Type" } +#endif } void cSkinEnigmaDisplayMenu::SetupAreas(void) @@ -1596,7 +1602,12 @@ void cSkinEnigmaDisplayMenu::SetupAreas(void) } #endif //USE_PLUGIN_EPGSEARCH +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_READ + if (Timers->GetNextActiveTimer()) { +#else if (Timers.GetNextActiveTimer()) { +#endif int h = pFontInfoTimerHeadline->Height(); // Show next active timers y += h / 2; @@ -2636,7 +2647,12 @@ void cSkinEnigmaDisplayMenu::SetEvent(const cEvent *Event) i++; sstrReruns << "- " << *DayDateTime(r->event->StartTime()); +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ + const cChannel *channel = Channels->GetByChannelID(r->event->ChannelID(), true, true); +#else cChannel *channel = Channels.GetByChannelID(r->event->ChannelID(), true, true); +#endif if (channel) sstrReruns << " " << channel->ShortName(true); sstrReruns << ": " << r->event->Title(); @@ -2681,7 +2697,7 @@ void cSkinEnigmaDisplayMenu::SetEvent(const cEvent *Event) if (fShowLogo) { // draw logo osd->DrawRectangle(xDateLeft + SmallGap, yDateTop, xDateRight - 1, yDateBottom - SmallGap - 1, Theme.Color(clrLogoBg)); - if (!(EnigmaConfig.showImages && EnigmaLogoCache.DrawEventImage(Event, xLogoLeft, yLogoTop, xLogoRight - xLogoLeft, yLogoBottom - yLogoTop, nNumImageColors, osd->GetBitmap(2) ? osd->GetBitmap(2) : osd->GetBitmap(0)))) { + if (!(EnigmaConfig.showImages && EnigmaLogoCache.DrawEventImage(Event, xLogoLeft, yLogoTop, xLogoRight - xLogoLeft, yLogoBottom - yLogoTop, nNumImageColors, osd))) { if (EnigmaLogoCache.LoadIcon("icons/menu/schedule")) osd->DrawBitmap(xLogoLeft + (xLogoRight - xLogoLeft - EnigmaLogoCache.Get().Width()) / 2, yLogoTop + (yLogoBottom - yLogoTop - EnigmaLogoCache.Get().Height()) / 2, @@ -2855,7 +2871,12 @@ void cSkinEnigmaDisplayMenu::SetRecording(const cRecording *Recording) } #endif +#if VDRVERSNUM >= 20301 + LOCK_CHANNELS_READ + const cChannel *channel = Channels->GetByChannelID(Info->ChannelID()); +#else cChannel *channel = Channels.GetByChannelID(Info->ChannelID()); +#endif if (channel) sstrInfo << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << std::endl; if (EnigmaConfig.showRecSize > 0) { @@ -3033,7 +3054,7 @@ void cSkinEnigmaDisplayMenu::SetRecording(const cRecording *Recording) #ifndef SKINENIGMA_NO_MENULOGO if (fShowLogo) { osd->DrawRectangle(xDateLeft + SmallGap, yDateTop, xDateRight - 1, yDateBottom - SmallGap - 1, Theme.Color(clrLogoBg)); - if (!(EnigmaConfig.showImages && EnigmaLogoCache.DrawRecordingImage(Recording, xLogoLeft, yLogoTop, xLogoRight - xLogoLeft, yLogoBottom - yLogoTop, nNumImageColors, osd->GetBitmap(2) ? osd->GetBitmap(2) : osd->GetBitmap(0)))) { + if (!(EnigmaConfig.showImages && EnigmaLogoCache.DrawRecordingImage(Recording, xLogoLeft, yLogoTop, xLogoRight - xLogoLeft, yLogoBottom - yLogoTop, nNumImageColors, osd))) { // draw logo if (EnigmaLogoCache.LoadIcon("icons/menu/recordings")) osd->DrawBitmap(xLogoLeft + (xLogoRight - xLogoLeft - EnigmaLogoCache.Get().Width()) / 2, @@ -3607,7 +3628,9 @@ cSkinEnigmaDisplayVolume::cSkinEnigmaDisplayVolume() osd->SetAreas(SingleArea, sizeof(SingleArea) / sizeof(tArea)); } else { debug("cSkinEnigmaDisplayVolume: using multiple areas"); +#if VDRVERSNUM < 20301 cBitmap *bitmap = NULL; +#endif if (fShowSymbol) { tArea Areas[] = { {xLogoLeft, yLogoTop, xLogoRight + LogoDecoGap + LogoDecoWidth - 1, yLogoBottom - 1, 4}, {xTitleLeft, yTitleTop, xTitleRight - 1, yBottomBottom - 1, 4} @@ -3622,7 +3645,9 @@ cSkinEnigmaDisplayVolume::cSkinEnigmaDisplayVolume() throw 1; return; } +#if VDRVERSNUM < 20301 bitmap = osd->GetBitmap(1); +#endif } else { tArea Areas[] = { {xTitleLeft, yTitleTop, xTitleRight - 1, yBottomBottom - 1, 4} }; @@ -3636,8 +3661,11 @@ cSkinEnigmaDisplayVolume::cSkinEnigmaDisplayVolume() throw 1; return; } +#if VDRVERSNUM < 20301 bitmap = osd->GetBitmap(0); +#endif } +#if VDRVERSNUM < 20301 if (bitmap) { // set colors bitmap->Reset(); @@ -3649,6 +3677,7 @@ cSkinEnigmaDisplayVolume::cSkinEnigmaDisplayVolume() bitmap->SetColor(5, Theme.Color(clrVolumeBarMute)); bitmap->SetColor(6, Theme.Color(clrTitleFg)); } +#endif } // clear all osd->DrawRectangle(0, 0, osd->Width(), osd->Height(), clrTransparent); @@ -4172,7 +4201,12 @@ void cSkinEnigmaDisplayMessage::Flush(void) bool cSkinEnigmaBaseOsd::HasChannelTimerRecording(const cChannel *Channel) { // try to find current channel from timers - for (cTimer * t = Timers.First(); t; t = Timers.Next(t)) { +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_READ + for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) { +#else + for (cTimer *t = Timers.First(); t; t = Timers.Next(t)) { +#endif if ((t->Channel() == Channel) && t->Recording()) return true; } @@ -44,37 +44,37 @@ bool cEnigmaLogoCache::Resize(unsigned int cacheSizeP) return true; } -bool cEnigmaLogoCache::DrawEventImage(const cEvent *Event, int x, int y, int w, int h, int c, cBitmap *bmp) +bool cEnigmaLogoCache::DrawEventImage(const cEvent *Event, int x, int y, int w, int h, int c, cOsd *osd) { - if (Event == NULL || bmp == NULL) + if (Event == NULL || osd == NULL) return false; char *strFilename = NULL; int rc = false; if (-1 != asprintf(&strFilename, "%s/%d.%s", EnigmaConfig.GetImagesDir(), Event->EventID(), EnigmaConfig.GetImageExtension())) { - rc = DrawImage(strFilename, x, y, w, h, c, bmp); + rc = DrawImage(strFilename, x, y, w, h, c, osd); free (strFilename); } return rc; } -bool cEnigmaLogoCache::DrawRecordingImage(const cRecording *Recording, int x, int y, int w, int h, int c, cBitmap *bmp) +bool cEnigmaLogoCache::DrawRecordingImage(const cRecording *Recording, int x, int y, int w, int h, int c, cOsd *osd) { - if (Recording == NULL || bmp == NULL) + if (Recording == NULL || osd == NULL) return false; char *strFilename = NULL; int rc = false; if (-1 != asprintf(&strFilename, "%s/%s.%s", Recording->FileName(), RECORDING_COVER, EnigmaConfig.GetImageExtension())) { - rc = DrawImage(strFilename, x, y, w, h, c, bmp); + rc = DrawImage(strFilename, x, y, w, h, c, osd); free (strFilename); } return rc; } -bool cEnigmaLogoCache::DrawImage(const char *fileNameP, int x, int y, int w, int h, int c, cBitmap *bmp) +bool cEnigmaLogoCache::DrawImage(const char *fileNameP, int x, int y, int w, int h, int c, cOsd *osd) { - if (fileNameP== NULL || bmp == NULL) + if (fileNameP== NULL || osd == NULL) return false; struct stat stbuf; @@ -86,11 +86,11 @@ bool cEnigmaLogoCache::DrawImage(const char *fileNameP, int x, int y, int w, int #ifdef HAVE_IMAGEMAGICK bitmapM = NULL; - return image.DrawImage(fileNameP, x, y, w, h, c, bmp); + return image.DrawImage(fileNameP, x, y, w, h, c, osd); #else int rc = LoadXpm(fileNameP, w, h); if (rc) - bmp->DrawBitmap(x, y, *bitmapM); //TODO? + osd->DrawBitmap(x, y, *bitmapM); //TODO? return rc; #endif } @@ -37,15 +37,15 @@ private: cBitmap *bmpImage; #endif std::map<std::string, cBitmap*> cacheMapM; - bool DrawImage(const char *fileNameP, int x, int y, int w, int h, int c, cBitmap *bmp); + bool DrawImage(const char *fileNameP, int x, int y, int w, int h, int c, cOsd *osd); bool LoadXpm(const char *fileNameP, int w, int h); bool Load(const char *fileNameP, int w, int h); public: cEnigmaLogoCache(unsigned int cacheSizeP); ~cEnigmaLogoCache(); bool Resize(unsigned int cacheSizeP); - bool DrawEventImage(const cEvent *Event, int x, int y, int w, int h, int c, cBitmap *bmp); - bool DrawRecordingImage(const cRecording *Recording, int x, int y, int w, int h, int c, cBitmap *bmp); + bool DrawEventImage(const cEvent *Event, int x, int y, int w, int h, int c, cOsd *osd); + bool DrawRecordingImage(const cRecording *Recording, int x, int y, int w, int h, int c, cOsd *osd); bool LoadChannelLogo(const cChannel *Channel); bool LoadSymbol(const char *fileNameP); bool LoadIcon(const char *fileNameP); diff --git a/skinenigmang.c b/skinenigmang.c index 708e7b2..5aaba45 100644 --- a/skinenigmang.c +++ b/skinenigmang.c @@ -20,7 +20,7 @@ #endif -static const char VERSION[] = "0.1.2"; +static const char VERSION[] = "0.1.3-git"; static const char DESCRIPTION[] = trNOOP("EnigmaNG skin"); class cPluginSkinEnigma : public cPlugin { @@ -28,6 +28,9 @@ void cEnigmaStatus::Replaying(const cControl * /*Control */ , const char *Name, debug("cEnigmaStatus::Replaying(%s)", Name); if (Name != NULL) { +#if VDRVERSNUM >= 20301 + LOCK_RECORDINGS_READ +#endif mReplayMode = replayMPlayer; if (strlen(Name) > 6 && Name[0] == '[' && Name[3] == ']' && Name[5] == '(') { int i; @@ -40,7 +43,11 @@ void cEnigmaStatus::Replaying(const cControl * /*Control */ , const char *Name, mReplayIsLoop = Name[1] == 'L'; mReplayIsShuffle = Name[2] == 'S'; } +#if VDRVERSNUM >= 20301 + } else if (FileName ? Recordings->GetByName(FileName) : NULL) { +#else } else if (FileName ? Recordings.GetByName(FileName) : NULL) { +#endif mReplayMode = replayNormal; } else if (strcmp(Name, "DVD") == 0) mReplayMode = replayDVD; @@ -86,9 +93,13 @@ void cEnigmaStatus::OsdItem(const char * /* Text */, int /* ItemIndex */) void cEnigmaStatus::UpdateActiveTimers(void) { mTimers.Clear(); +#if VDRVERSNUM >= 20301 + LOCK_TIMERS_READ + for (const cTimer * tim = Timers->First(); tim; tim = Timers->Next(tim)) { +#else Timers.IncBeingEdited(); - for (cTimer * tim = Timers.First(); tim; tim = Timers.Next(tim)) { +#endif if (tim->HasFlags(tfActive)) { int i = 0; cTimer dummy; @@ -112,7 +123,9 @@ void cEnigmaStatus::UpdateActiveTimers(void) } } +#if VDRVERSNUM < 20301 Timers.DecBeingEdited(); +#endif mTimers.Sort(); } // vim:et:sw=2:ts=2: |