diff options
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | config.c | 4 | ||||
-rw-r--r-- | config.h | 1 | ||||
-rw-r--r-- | displaychannel.c | 102 | ||||
-rw-r--r-- | displaychannel.h | 4 | ||||
-rw-r--r-- | displaymenu.c | 3 | ||||
-rw-r--r-- | imageloader.c | 19 | ||||
-rw-r--r-- | imageloader.h | 4 | ||||
-rw-r--r-- | menudetailview.c | 516 | ||||
-rw-r--r-- | menudetailview.h | 33 | ||||
-rw-r--r-- | menuitem.c | 71 | ||||
-rw-r--r-- | menuitem.h | 6 | ||||
-rw-r--r-- | po/ca_CA.po | 8 | ||||
-rw-r--r-- | po/de_DE.po | 8 | ||||
-rw-r--r-- | po/it_IT.po | 8 | ||||
-rw-r--r-- | po/sk_SK.po | 8 | ||||
-rw-r--r-- | setup.c | 2 | ||||
-rw-r--r-- | skinnopacity.c | 2 | ||||
-rw-r--r-- | textwindow.c | 149 | ||||
-rw-r--r-- | textwindow.h | 17 |
20 files changed, 804 insertions, 165 deletions
@@ -219,3 +219,7 @@ Version 0.1.2 - Added optional dedicated status icons in channel display - Added optional display of channel source information in channel display - Fixed a bug if switching to a invalid channel + +Version 0.1.3 +- Added TVScrapper support, if TVScrapper is used scrapped images are + displayed in various EPG views @@ -143,6 +143,7 @@ cNopacityConfig::cNopacityConfig() { fontButtons = 0; fontMessageMenu = 0; fontDetailView = 0; + fontDetailViewSmall = 0; fontDetailViewHeader = 0; fontDetailViewHeaderLarge = 0; fontEPGInfoWindow = 0; @@ -254,7 +255,7 @@ void cNopacityConfig::loadRssFeeds(void) { fclose(f); } if (foundEntries) { - dsyslog("nopacity: loaded %d rss feeds from %s", rssFeeds.size(), *rssconf); + dsyslog("nopacity: loaded %u rss feeds from %s", rssFeeds.size(), *rssconf); int i = 1; for (std::vector<RssFeed>::iterator it = rssFeeds.begin(); it != rssFeeds.end(); it++) { dsyslog("nopacity: RssFeed %d: name %s, URL: %s", i, it->name.c_str(), it->url.c_str()); @@ -422,6 +423,7 @@ bool cNopacityConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "fontButtons") == 0) fontButtons = atoi(Value); else if (strcmp(Name, "fontMessageMenu") == 0) fontMessageMenu = atoi(Value); else if (strcmp(Name, "fontDetailView") == 0) fontDetailView = atoi(Value); + else if (strcmp(Name, "fontDetailViewSmall") == 0) fontDetailViewSmall = atoi(Value); else if (strcmp(Name, "fontDetailViewHeader") == 0) fontDetailViewHeader = atoi(Value); else if (strcmp(Name, "fontDetailViewHeaderLarge") == 0) fontDetailViewHeaderLarge = atoi(Value); else if (strcmp(Name, "fontEPGInfoWindow") == 0) fontEPGInfoWindow = atoi(Value); @@ -176,6 +176,7 @@ class cNopacityConfig { int fontButtons;
int fontMessageMenu;
int fontDetailView;
+ int fontDetailViewSmall;
int fontDetailViewHeader;
int fontDetailViewHeaderLarge;
int fontEPGInfoWindow;
diff --git a/displaychannel.c b/displaychannel.c index 0d8208a..f0af9ac 100644 --- a/displaychannel.c +++ b/displaychannel.c @@ -2,6 +2,7 @@ #include "symbols/dolbydigital.xpm" #include "displaychannel.h" +#include "services/tvscrapper.h" cNopacityDisplayChannel::cNopacityDisplayChannel(bool WithInfo) { if (firstDisplay) { @@ -65,6 +66,8 @@ cNopacityDisplayChannel::~cNopacityDisplayChannel() { osd->DestroyPixmap(pixmapSignalMeter); osd->DestroyPixmap(pixmapSignalLabel); } + if (pixmapPoster) + osd->DestroyPixmap(pixmapPoster); if (config.displaySignalStrength && showSignal) { delete fontInfoline; } @@ -79,8 +82,8 @@ cNopacityDisplayChannel::~cNopacityDisplayChannel() { void cNopacityDisplayChannel::SetGeometry(void) { height = cOsd::OsdHeight() * config.channelHeight / 100; - int top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.channelBorderBottom; - osd = CreateOsd(cOsd::OsdLeft(), top, cOsd::OsdWidth(), height); + top = cOsd::OsdTop() + cOsd::OsdHeight() - height - config.channelBorderBottom; + osd = CreateOsd(cOsd::OsdLeft(), cOsd::OsdTop(), cOsd::OsdWidth(), cOsd::OsdHeight()); switch (config.logoPosition) { case lpLeft: infoWidth = osd->Width() - (config.logoWidth + 2 * config.channelBorderVertical + config.logoBorder); @@ -115,40 +118,40 @@ void cNopacityDisplayChannel::SetGeometry(void) { void cNopacityDisplayChannel::CreatePixmaps(void) { int channelInfoY = 0; if (withInfo) { - pixmapProgressBar = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight)); - pixmapEPGInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoHeight + progressBarHeight, infoWidth, epgInfoHeight)); - pixmapBackgroundMiddle = osd->CreatePixmap(1, cRect(infoX, channelInfoHeight, infoWidth, progressBarHeight + epgInfoHeight)); + pixmapProgressBar = osd->CreatePixmap(2, cRect(infoX, top + channelInfoHeight, infoWidth, progressBarHeight)); + pixmapEPGInfo = osd->CreatePixmap(2, cRect(infoX, top + channelInfoHeight + progressBarHeight, infoWidth, epgInfoHeight)); + pixmapBackgroundMiddle = osd->CreatePixmap(1, cRect(infoX, top + channelInfoHeight, infoWidth, progressBarHeight + epgInfoHeight)); } else { channelInfoY = (height - channelInfoHeight) / 3; streamInfoY = (height - channelInfoHeight) / 3 + channelInfoHeight; } - pixmapBackgroundTop = osd->CreatePixmap(1, cRect(infoX, channelInfoY, infoWidth, channelInfoHeight)); - pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); + pixmapBackgroundTop = osd->CreatePixmap(1, cRect(infoX, top + channelInfoY, infoWidth, channelInfoHeight)); + pixmapBackgroundBottom = osd->CreatePixmap(1, cRect(infoX, top + streamInfoY, infoWidth, streamInfoHeight)); - pixmapChannelInfo = osd->CreatePixmap(2, cRect(infoX, channelInfoY, channelInfoWidth, channelInfoHeight)); - pixmapDate = osd->CreatePixmap(2, cRect(infoX + channelInfoWidth, channelInfoY, dateWidth, channelInfoHeight)); - pixmapFooter = osd->CreatePixmap(2, cRect(infoX, streamInfoY, infoWidth, streamInfoHeight)); - pixmapStreamInfo = osd->CreatePixmap(4, cRect(infoX + (infoWidth - iconsWidth - config.resolutionIconSize - 35), height - iconSize - 10, iconsWidth, iconSize)); - pixmapStreamInfoBack = osd->CreatePixmap(3, cRect(infoX + (infoWidth - iconsWidth - config.resolutionIconSize - 35), height - iconSize - 10, iconsWidth, iconSize)); + pixmapChannelInfo = osd->CreatePixmap(2, cRect(infoX, top + channelInfoY, channelInfoWidth, channelInfoHeight)); + pixmapDate = osd->CreatePixmap(2, cRect(infoX + channelInfoWidth, top + channelInfoY, dateWidth, channelInfoHeight)); + pixmapFooter = osd->CreatePixmap(2, cRect(infoX, top + streamInfoY, infoWidth, streamInfoHeight)); + pixmapStreamInfo = osd->CreatePixmap(4, cRect(infoX + (infoWidth - iconsWidth - config.resolutionIconSize - 35), top + height - iconSize - 10, iconsWidth, iconSize)); + pixmapStreamInfoBack = osd->CreatePixmap(3, cRect(infoX + (infoWidth - iconsWidth - config.resolutionIconSize - 35), top + height - iconSize - 10, iconsWidth, iconSize)); switch (config.logoPosition) { case lpLeft: - pixmapLogoBackgroundTop = osd->CreatePixmap(1, cRect(config.channelBorderVertical, 0, infoX - config.channelBorderVertical, channelInfoHeight)); - pixmapLogoBackground = osd->CreatePixmap(1, cRect(config.channelBorderVertical, channelInfoHeight, infoX - config.channelBorderVertical, progressBarHeight + epgInfoHeight)); - pixmapLogoBackgroundBottom = osd->CreatePixmap(1, cRect(config.channelBorderVertical, streamInfoY, infoX - config.channelBorderVertical, streamInfoHeight)); - pixmapLogo = osd->CreatePixmap(2, cRect(0, 0, config.logoWidth + 2 * config.logoBorder, height)); + pixmapLogoBackgroundTop = osd->CreatePixmap(1, cRect(config.channelBorderVertical, top, infoX - config.channelBorderVertical, channelInfoHeight)); + pixmapLogoBackground = osd->CreatePixmap(1, cRect(config.channelBorderVertical, top + channelInfoHeight, infoX - config.channelBorderVertical, progressBarHeight + epgInfoHeight)); + pixmapLogoBackgroundBottom = osd->CreatePixmap(1, cRect(config.channelBorderVertical, top + streamInfoY, infoX - config.channelBorderVertical, streamInfoHeight)); + pixmapLogo = osd->CreatePixmap(2, cRect(0, top, config.logoWidth + 2 * config.logoBorder, height)); break; case lpRight: - pixmapLogoBackgroundTop = osd->CreatePixmap(1, cRect(infoX + infoWidth, 0, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, channelInfoHeight)); - pixmapLogoBackground = osd->CreatePixmap(1, cRect(infoX + infoWidth, channelInfoHeight, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, progressBarHeight + epgInfoHeight)); - pixmapLogoBackgroundBottom = osd->CreatePixmap(1, cRect(infoX + infoWidth, streamInfoY, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, streamInfoHeight)); - pixmapLogo = osd->CreatePixmap(2, cRect(infoX + infoWidth, 0, config.logoWidth + 2 * config.logoBorder, height)); + pixmapLogoBackgroundTop = osd->CreatePixmap(1, cRect(infoX + infoWidth, top, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, channelInfoHeight)); + pixmapLogoBackground = osd->CreatePixmap(1, cRect(infoX + infoWidth, top + channelInfoHeight, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, progressBarHeight + epgInfoHeight)); + pixmapLogoBackgroundBottom = osd->CreatePixmap(1, cRect(infoX + infoWidth, top + streamInfoY, cOsd::OsdWidth() - 2*config.channelBorderVertical - infoWidth, streamInfoHeight)); + pixmapLogo = osd->CreatePixmap(2, cRect(infoX + infoWidth, top, config.logoWidth + 2 * config.logoBorder, height)); break; case lpNone: - pixmapLogo = osd->CreatePixmap(-1, cRect(0, 0, 1, 1)); - pixmapLogoBackground = osd->CreatePixmap(-1, cRect(0, 0, 1, 1)); - pixmapLogoBackgroundTop = osd->CreatePixmap(-1, cRect(0, 0, 1, 1)); - pixmapLogoBackgroundBottom = osd->CreatePixmap(-1, cRect(0, 0, 1, 1)); + pixmapLogo = osd->CreatePixmap(-1, cRect(0, top, 1, 1)); + pixmapLogoBackground = osd->CreatePixmap(-1, cRect(0, top, 1, 1)); + pixmapLogoBackgroundTop = osd->CreatePixmap(-1, cRect(0, top, 1, 1)); + pixmapLogoBackgroundBottom = osd->CreatePixmap(-1, cRect(0, top, 1, 1)); break; } @@ -176,6 +179,7 @@ void cNopacityDisplayChannel::CreatePixmaps(void) { } pixmapScreenResolution = NULL; pixmapSignalMeter = NULL; + pixmapPoster = NULL; } void cNopacityDisplayChannel::CreateFonts(void) { @@ -377,7 +381,7 @@ void cNopacityDisplayChannel::DrawScreenResolution(void) { if (!pixmapScreenResolution) { int x = infoX + infoWidth - config.resolutionIconSize - 2*spacing; - int y = height - config.resolutionIconSize - 10; + int y = top + height - config.resolutionIconSize - 10; pixmapScreenResolution = osd->CreatePixmap(3, cRect(x, y, config.resolutionIconSize, config.resolutionIconSize)); pixmapScreenResolution->Fill(clrTransparent); if ((initial)&&(config.channelFadeTime)) @@ -441,10 +445,10 @@ void cNopacityDisplayChannel::DrawSignalMeter(void) { int labelWidth = max(fontInfoline->Width(*signalStrength), fontInfoline->Width(*signalQuality)) + 2; signalX = streamInfoHeight / 2 + labelWidth; showSignal = true; - pixmapSignalStrength = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + 2, signalWidth + 2, signalHeight + 2)); - pixmapSignalQuality = osd->CreatePixmap(3, cRect(infoX + signalX, signalMeterY + signalHeight + 5, signalWidth + 2, signalHeight + 2)); - pixmapSignalMeter = osd->CreatePixmap(4, cRect(infoX + signalX + 1, signalMeterY + 3, signalWidth, 2*signalHeight + 3)); - pixmapSignalLabel = osd->CreatePixmap(3, cRect(infoX + streamInfoHeight / 2, signalMeterY + 2, labelWidth, 2*signalHeight + 3)); + pixmapSignalStrength = osd->CreatePixmap(3, cRect(infoX + signalX, top + signalMeterY + 2, signalWidth + 2, signalHeight + 2)); + pixmapSignalQuality = osd->CreatePixmap(3, cRect(infoX + signalX, top + signalMeterY + signalHeight + 5, signalWidth + 2, signalHeight + 2)); + pixmapSignalMeter = osd->CreatePixmap(4, cRect(infoX + signalX + 1, top + signalMeterY + 3, signalWidth, 2*signalHeight + 3)); + pixmapSignalLabel = osd->CreatePixmap(3, cRect(infoX + streamInfoHeight / 2, top + signalMeterY + 2, labelWidth, 2*signalHeight + 3)); pixmapSignalStrength->Fill(Theme.Color(clrProgressBarBack)); pixmapSignalQuality->Fill(Theme.Color(clrProgressBarBack)); pixmapSignalMeter->Fill(clrTransparent); @@ -655,6 +659,7 @@ void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fol int remaining = (int)(e->EndTime() - time(NULL))/60; strSeen = cString::sprintf("-%d/%dmin", remaining, e->Duration()/60); } + DrawPoster(e); } else { strSeen = cString::sprintf("%dmin", e->Duration()/60); } @@ -679,6 +684,43 @@ void cNopacityDisplayChannel::SetEvents(const cEvent *Present, const cEvent *Fol } } +void cNopacityDisplayChannel::DrawPoster(const cEvent *event) { + if (pixmapPoster) { + osd->DestroyPixmap(pixmapPoster); + pixmapPoster = NULL; + } + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper) { + TVScrapperGetPosterOrBanner call; + call.event = event; + if (pTVScrapper->Service("TVScrapperGetPosterOrBanner", &call)) { + int mediaWidth = 0; + int mediaHeight = 0; + if (call.type == typeSeries) { + mediaWidth = call.media.width; + mediaHeight = call.media.height; + } else if (call.type == typeMovie) { + double ratio = (double)(cOsd::OsdHeight()/3) / (double)call.media.height; + mediaWidth = ratio * call.media.width; + mediaHeight = ratio * call.media.height; + } + pixmapPoster = osd->CreatePixmap(1, cRect(config.channelBorderVertical, + config.channelBorderBottom, + mediaWidth + 2*config.channelBorderVertical, + mediaHeight + 2*config.channelBorderBottom)); + if (initial) + pixmapPoster->SetAlpha(0); + cImageLoader imgLoader; + if (imgLoader.LoadPoster(call.media.path.c_str(), mediaWidth, mediaHeight)) { + pixmapPoster->Fill(Theme.Color(clrChannelBackground)); + pixmapPoster->DrawImage(cPoint(config.channelBorderVertical, config.channelBorderBottom), imgLoader.GetImage()); + } else { + pixmapPoster->Fill(clrTransparent); + } + } + } +} + void cNopacityDisplayChannel::DrawProgressBar(int Current, int Total) { if ((Current < currentLast + 3) && !channelChange) return; @@ -806,6 +848,8 @@ void cNopacityDisplayChannel::Action(void) { pixmapSignalMeter->SetAlpha(Alpha); pixmapSignalLabel->SetAlpha(Alpha); } + if (pixmapPoster) + pixmapPoster->SetAlpha(Alpha); if (Running()) osd->Flush(); cPixmap::Unlock(); diff --git a/displaychannel.h b/displaychannel.h index 547dfde..73a285e 100644 --- a/displaychannel.h +++ b/displaychannel.h @@ -44,7 +44,8 @@ private: cPixmap *pixmapSignalMeter; cPixmap *pixmapSignalLabel; cPixmap *pixmapScreenResolution; - int height; + cPixmap *pixmapPoster; + int top, height; int infoWidth; int infoX; int channelInfoWidth; @@ -82,6 +83,7 @@ private: void DrawSourceInfo(const cChannel *Channel); void DrawChannelGroups(const cChannel *Channel, cString ChannelName); cString GetChannelSep(const cChannel *channel, bool prev); + void DrawPoster(const cEvent *event); public: cNopacityDisplayChannel(bool WithInfo); virtual ~cNopacityDisplayChannel(); diff --git a/displaymenu.c b/displaymenu.c index 6add8b8..b25b1a1 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -524,6 +524,7 @@ bool cNopacityDisplayMenu::SetItemRecording(const cRecording *Recording, int Ind item->SetCurrent(Current); item->SetBackgrounds(handleBackgrounds); item->CreateText(); + item->SetPoster(); int textWidth = item->CheckScrollable(false); item->CreatePixmap(); item->CreatePixmapIcon(); @@ -686,6 +687,7 @@ void cNopacityDisplayMenu::SetEvent(const cEvent *Event) { double offset = 0.0; menuView->DrawScrollbar(height, offset); } + detailView->Start(); } void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { @@ -708,6 +710,7 @@ void cNopacityDisplayMenu::SetRecording(const cRecording *Recording) { double offset = 0.0; menuView->DrawScrollbar(height, offset); } + detailView->Start(); } void cNopacityDisplayMenu::SetText(const char *Text, bool FixedFont) { diff --git a/imageloader.c b/imageloader.c index bfc4ce5..ba90353 100644 --- a/imageloader.c +++ b/imageloader.c @@ -159,6 +159,14 @@ bool cImageLoader::LoadAdditionalRecordingImage(cString path, cString name) { return false; } +bool cImageLoader::LoadPoster(const char *poster, int width, int height) { + if (LoadImage(poster)) { + buffer.sample(Geometry(width, height)); + return true; + } + return false; +} + void cImageLoader::DrawBackground(tColor back, tColor blend, int width, int height, bool mirror) { Color Back = Argb2Color(back); Color Blend = Argb2Color(blend); @@ -230,6 +238,17 @@ bool cImageLoader::LoadImage(cString FileName, cString Path, cString Extension) return true; } +bool cImageLoader::LoadImage(const char *fullpath) { + try { + dsyslog("nopacity: trying to load: %s", fullpath); + buffer.read(fullpath); + dsyslog("nopacity: %s sucessfully loaded", fullpath); + } catch (...) { + return false; + } + return true; +} + bool cImageLoader::FirstImageInFolder(cString Path, cString Extension, cString *recImage) { DIR *folder; struct dirent *file; diff --git a/imageloader.h b/imageloader.h index a5a0b5f..27b90d9 100644 --- a/imageloader.h +++ b/imageloader.h @@ -21,6 +21,7 @@ public: bool LoadAdditionalEPGImage(cString name); bool LoadRecordingImage(cString Path); bool LoadAdditionalRecordingImage(cString path, cString name); + bool LoadPoster(const char *poster, int width, int height); void DrawBackground(tColor back, tColor blend, int width, int height, bool mirror = false); void DrawBackground2(tColor back, tColor blend, int width, int height); private: @@ -28,7 +29,8 @@ private: Color Argb2Color(tColor col); void toLowerCase(std::string &str); bool LoadImage(cString FileName, cString Path, cString Extension); - bool FirstImageInFolder(cString Path, cString Extension, cString *recImage); + bool LoadImage(const char *fullpath); + bool FirstImageInFolder(cString Path, cString Extension, cString *recImage); }; #endif //__NOPACITY_IMAGELOADER_H diff --git a/menudetailview.c b/menudetailview.c index 7b104aa..2f5af0c 100644 --- a/menudetailview.c +++ b/menudetailview.c @@ -8,10 +8,14 @@ cNopacityMenuDetailView::cNopacityMenuDetailView(cOsd *osd) { this->osd = osd; hasScrollbar = false; + hasAdditionalMedia = false; + pixmapPoster = NULL; } cNopacityMenuDetailView::~cNopacityMenuDetailView(void) { delete font; + if (fontSmall) + delete fontSmall; if (fontHeader) delete fontHeader; if (fontHeaderLarge) @@ -26,17 +30,182 @@ void cNopacityMenuDetailView::SetGeometry(int x, int width, int height, int top, this->border = contentBorder; this->headerHeight = headerHeight; contentHeight = height - headerHeight; + widthPoster = 30 * width / 100; } -int cNopacityMenuDetailView::DrawTextWrapper(cTextWrapper *wrapper, int top) { +void cNopacityMenuDetailView::DrawTextWrapper(cTextWrapper *wrapper, int top) { int linesText = wrapper->Lines(); int textHeight = font->Height(); - int currentHeight = 0; + int currentHeight = top; for (int i=0; i < linesText; i++) { - currentHeight = (i+1)*textHeight + top; - pixmapContent->DrawText(cPoint(2*border, currentHeight), wrapper->GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font); + pixmapContent->DrawText(cPoint(border, currentHeight), wrapper->GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrTransparent, font); + currentHeight += textHeight; + } +} + +int cNopacityMenuDetailView::HeightActorPics(void) { + int numActors = mediaInfo.actors.size(); + if (numActors < 1) + return 0; + if (mediaInfo.type == typeMovie) { + actorThumbWidth = mediaInfo.actors[0].thumb.width/2; + actorThumbHeight = mediaInfo.actors[0].thumb.height/2; + } else if (mediaInfo.type == typeSeries) { + actorThumbWidth = mediaInfo.actors[0].thumb.width/2; + actorThumbHeight = mediaInfo.actors[0].thumb.height/2; + } + int picsPerLine = contentWidth / (actorThumbWidth + 2*border); + int picLines = numActors / picsPerLine; + if (numActors%picsPerLine != 0) + picLines++; + int actorsHeight = picLines * (actorThumbHeight + 2*fontSmall->Height()) + font->Height() + fontHeader->Height(); + return actorsHeight; +} + +int cNopacityMenuDetailView::HeightFanart(void) { + int retVal = 0; + if (mediaInfo.fanart.size() >= 1) { + int fanartWidthOrig = mediaInfo.fanart[0].width; + int fanartHeightOrig = mediaInfo.fanart[0].height; + int fanartWidth = fanartWidthOrig; + int fanartHeight = fanartHeightOrig; + retVal = fanartHeight; + if (fanartWidthOrig > (contentWidth - 2*border)) { + fanartWidth = contentWidth - 2*border; + fanartHeight = fanartHeightOrig * ((double)fanartWidth / (double)fanartWidthOrig); + retVal = fanartHeight; + } + } + return retVal; +} + +void cNopacityMenuDetailView::DrawPoster(void) { + if (mediaInfo.posters.size() < 1) + return; + int posterWidthOrig = mediaInfo.posters[0].width; + int posterHeightOrig = mediaInfo.posters[0].height; + int posterWidth = posterWidthOrig; + int posterHeight = posterHeightOrig; + + if ((posterWidthOrig > widthPoster) && (posterHeightOrig < contentHeight)) { + posterWidth = widthPoster - 2*border; + posterHeight = posterHeightOrig * ((double)posterWidth / (double)posterWidthOrig); + } else if ((posterWidthOrig < widthPoster) && (posterHeightOrig > contentHeight)) { + posterHeight = contentHeight - 2*border; + posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); + } else if ((posterWidthOrig > widthPoster) && (posterHeightOrig > contentHeight)) { + int overlapWidth = posterWidthOrig - widthPoster; + int overlapHeight = posterHeightOrig - contentHeight; + if (overlapWidth >= overlapHeight) { + posterWidth = widthPoster - 2*border; + posterHeight = posterHeightOrig * ((double)posterWidth / (double)posterWidthOrig); + } else { + posterHeight = contentHeight - 2*border; + posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); + } + } + if (!Running()) + return; + cImageLoader imgLoader; + if (imgLoader.LoadPoster(mediaInfo.posters[0].path.c_str(), posterWidth, posterHeight)) { + int posterX = (widthPoster - posterWidth) / 2; + int posterY = (contentHeight - posterHeight) / 2; + if (Running() && pixmapPoster) + pixmapPoster->DrawImage(cPoint(posterX, posterY), imgLoader.GetImage()); + } +} + +void cNopacityMenuDetailView::DrawBanner(int height) { + int bannerWidthOrig = mediaInfo.banner.width; + int bannerHeightOrig = mediaInfo.banner.height; + int bannerWidth = bannerWidthOrig; + int bannerHeight = bannerHeightOrig; + + if (bannerWidthOrig > contentWidth - 2*border) { + bannerWidth = contentWidth - 2*border; + bannerHeight = bannerHeightOrig * ((double)bannerWidth / (double)bannerWidthOrig); + } + if (!Running()) + return; + cImageLoader imgLoader; + if (imgLoader.LoadPoster(mediaInfo.banner.path.c_str(), bannerWidth, bannerHeight)) { + int bannerX = (contentWidth - bannerWidth) / 2; + if (Running() && pixmapContent) + pixmapContent->DrawImage(cPoint(bannerX, height), imgLoader.GetImage()); + } +} + +void cNopacityMenuDetailView::DrawActors(int height) { + int numActors = mediaInfo.actors.size(); + if (numActors < 1) + return; + + cString header = cString::sprintf("%s:", tr("Actors")); + pixmapContent->DrawText(cPoint(border, height), *header, Theme.Color(clrMenuFontDetailViewText), clrTransparent, fontHeader); + + int picsPerLine = contentWidth / (actorThumbWidth + 2*border); + int picLines = numActors / picsPerLine; + if (numActors%picsPerLine != 0) + picLines++; + int x = 0; + int y = height + fontHeader->Height(); + if (!Running()) + return; + cImageLoader imgLoader; + int actor = 0; + for (int row = 0; row < picLines; row++) { + for (int col = 0; col < picsPerLine; col++) { + if (!Running()) + return; + if (actor == numActors) + break; + std::string path = mediaInfo.actors[actor].thumb.path; + if (imgLoader.LoadPoster(path.c_str(), actorThumbWidth, actorThumbHeight)) { + if (Running() && pixmapContent) + pixmapContent->DrawImage(cPoint(x + border, y), imgLoader.GetImage()); + } + std::string name = mediaInfo.actors[actor].name; + std::stringstream sstrRole; + sstrRole << "\"" << mediaInfo.actors[actor].role << "\""; + std::string role = sstrRole.str(); + if (fontSmall->Width(name.c_str()) > actorThumbWidth + 2*border) + name = CutText(name, actorThumbWidth + 2*border, fontSmall); + if (fontSmall->Width(role.c_str()) > actorThumbWidth + 2*border) + role = CutText(role, actorThumbWidth + 2*border, fontSmall); + int xName = x + ((actorThumbWidth+2*border) - fontSmall->Width(name.c_str()))/2; + int xRole = x + ((actorThumbWidth+2*border) - fontSmall->Width(role.c_str()))/2; + if (Running() && pixmapContent) { + pixmapContent->DrawText(cPoint(xName, y + actorThumbHeight), name.c_str(), Theme.Color(clrMenuFontDetailViewText), clrTransparent, fontSmall); + pixmapContent->DrawText(cPoint(xRole, y + actorThumbHeight + fontSmall->Height()), role.c_str(), Theme.Color(clrMenuFontDetailViewText), clrTransparent, fontSmall); + x += actorThumbWidth + 2*border; + } + actor++; + } + x = 0; + y += actorThumbHeight + 2 * fontSmall->Height(); + } +} + +void cNopacityMenuDetailView::DrawFanart(int height) { + if (mediaInfo.fanart.size() < 1) + return; + int fanartWidthOrig = mediaInfo.fanart[0].width; + int fanartHeightOrig = mediaInfo.fanart[0].height; + int fanartWidth = fanartWidthOrig; + int fanartHeight = fanartHeightOrig; + + if (fanartWidthOrig > contentWidth - 2*border) { + fanartWidth = contentWidth - 2*border; + fanartHeight = fanartHeightOrig * ((double)fanartWidth / (double)fanartWidthOrig); + } + if (!Running()) + return; + cImageLoader imgLoader; + if (imgLoader.LoadPoster(mediaInfo.fanart[0].path.c_str(), fanartWidth, fanartHeight)) { + int fanartX = (contentWidth - fanartWidth) / 2; + if (Running() && pixmapContent) + pixmapContent->DrawImage(cPoint(fanartX, height), imgLoader.GetImage()); } - return currentHeight + textHeight; } double cNopacityMenuDetailView::ScrollbarSize(void) { @@ -54,7 +223,6 @@ double cNopacityMenuDetailView::Offset(void) { } bool cNopacityMenuDetailView::Scroll(bool Up, bool Page) { - int aktHeight = pixmapContent->DrawPort().Point().Y(); int totalHeight = pixmapContent->DrawPort().Height(); int screenHeight = pixmapContent->ViewPort().Height(); @@ -98,33 +266,47 @@ cNopacityMenuDetailEventView::cNopacityMenuDetailEventView(cOsd *osd, const cEve } cNopacityMenuDetailEventView::~cNopacityMenuDetailEventView(void) { + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); osd->DestroyPixmap(pixmapHeader); + pixmapHeader = NULL; osd->DestroyPixmap(pixmapContent); + pixmapContent = NULL; osd->DestroyPixmap(pixmapLogo); -} - -void cNopacityMenuDetailEventView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(3, cRect(x, top, width, headerHeight)); - pixmapContent = osd->CreatePixmap(3, cRect(x, top + headerHeight, width, contentHeight), - cRect(0, 0, width, contentDrawPortHeight)); - pixmapLogo = osd->CreatePixmap(4, cRect(x + border, top + max((headerHeight-config.logoHeight)/2,1), config.detailViewLogoWidth, config.detailViewLogoHeight)); - - pixmapHeader->Fill(clrTransparent); - pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); - pixmapContent->Fill(clrTransparent); - pixmapLogo->Fill(clrTransparent); - + pixmapLogo = NULL; + if (pixmapPoster) { + osd->DestroyPixmap(pixmapPoster); + pixmapLogo = NULL; + } } void cNopacityMenuDetailEventView::SetFonts(void) { font = cFont::CreateFont(config.fontName, contentHeight / 25 + 3 + config.fontDetailView); + fontSmall = cFont::CreateFont(config.fontName, contentHeight / 30 + config.fontDetailViewSmall); fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); } void cNopacityMenuDetailEventView::SetContent(void) { if (event) { - content.Set(event->Description(), font, width - 4 * border); + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper) { + mediaInfo.event = event; + mediaInfo.isRecording = false; + if (pTVScrapper->Service("TVScrapperGetFullInformation", &mediaInfo)) { + hasAdditionalMedia = true; + } + } + contentWidth = width; + contentX = 0; + if (hasAdditionalMedia) { + if (mediaInfo.posters.size() >= 1) { + contentWidth -= widthPoster; + contentX = widthPoster; + } + } + epgText.Set(event->Description(), font, contentWidth - 2 * border); if (config.displayRerunsDetailEPGView) { LoadReruns(); } @@ -133,24 +315,105 @@ void cNopacityMenuDetailEventView::SetContent(void) { void cNopacityMenuDetailEventView::SetContentHeight(void) { int lineHeight = font->Height(); - int linesContent = content.Lines() + 1; + //Height of banner (only for series) + int heightBanner = 0; + if (hasAdditionalMedia && (mediaInfo.type == typeSeries)) { + heightBanner = mediaInfo.banner.height + lineHeight; + } + //Height of EPG Text + int heightEPG = (epgText.Lines()+1) * lineHeight; + //Height of rerun information + int heightReruns = 0; if (config.displayRerunsDetailEPGView) { - linesContent+= reruns.Lines() + 2; + heightReruns = reruns.Lines() * lineHeight; } - int heightContentText = linesContent * lineHeight; - - if (config.displayAdditionalEPGPictures) { - heightContentText += HeightEPGPics(); + //Height of actor pictures + int heightActors = 0; + if (hasAdditionalMedia) { + heightActors = HeightActorPics(); } - - if (heightContentText > contentHeight) { - contentDrawPortHeight = heightContentText; + //Height of fanart + int heightFanart = 0; + if (hasAdditionalMedia) { + heightFanart = HeightFanart() + lineHeight; + } + //Height of EPG Pictures + int heightEPGPics = 0; + if (!hasAdditionalMedia && config.displayAdditionalEPGPictures) { + heightEPGPics = HeightEPGPics(); + } + + yBanner = 0; + yEPGText = heightBanner; + yActors = heightBanner + heightEPG; + yFanart = heightBanner + heightEPG + heightActors; + yAddInf = heightBanner + heightEPG + heightActors + heightFanart; + yEPGPics = heightBanner + heightEPG + heightActors + heightFanart + heightReruns; + + int totalHeight = heightBanner + heightEPG + heightActors + heightFanart + heightReruns + heightEPGPics; + //check if pixmap content has to be scrollable + if (totalHeight > contentHeight) { + contentDrawPortHeight = totalHeight; hasScrollbar = true; } else { contentDrawPortHeight = contentHeight; } } +void cNopacityMenuDetailEventView::CreatePixmaps(void) { + pixmapHeader = osd->CreatePixmap(3, cRect(x, top, width, headerHeight)); + pixmapContent = osd->CreatePixmap(3, cRect(x + contentX, top + headerHeight, contentWidth, contentHeight), + cRect(0, 0, contentWidth, contentDrawPortHeight)); + pixmapLogo = osd->CreatePixmap(4, cRect(x + border, top + max((headerHeight-config.logoHeight)/2,1), config.detailViewLogoWidth, config.detailViewLogoHeight)); + + pixmapHeader->Fill(clrTransparent); + pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); + pixmapContent->Fill(clrTransparent); + pixmapLogo->Fill(clrTransparent); + + if (hasAdditionalMedia) { + pixmapPoster = osd->CreatePixmap(4, cRect(x, top + headerHeight, widthPoster, contentHeight)); + pixmapPoster->Fill(clrTransparent); + } +} + +void cNopacityMenuDetailEventView::Render(void) { + DrawHeader(); + //draw EPG text + DrawTextWrapper(&epgText, yEPGText); + //draw reruns + if (config.displayRerunsDetailEPGView) { + DrawTextWrapper(&reruns, yAddInf); + } +} + +void cNopacityMenuDetailEventView::Action(void) { + if (hasAdditionalMedia && Running()) { + DrawPoster(); + osd->Flush(); + } + //draw banner only for series + if (hasAdditionalMedia && (mediaInfo.type == typeSeries) && Running()) { + DrawBanner(yBanner); + osd->Flush(); + } + //draw actors + if (hasAdditionalMedia && Running()) { + DrawActors(yActors); + osd->Flush(); + } + //draw fanart + if (hasAdditionalMedia && Running()) { + DrawFanart(yFanart); + osd->Flush(); + } + //draw additional EPG Pictures only if no media is available + if (!hasAdditionalMedia && config.displayAdditionalEPGPictures && Running()) { + DrawEPGPictures(yEPGPics); + osd->Flush(); + } +} + int cNopacityMenuDetailEventView::HeightEPGPics(void) { int numPicsAvailable = 0; for (int i=1; i <= config.numAdditionalEPGPictures; i++) { @@ -169,24 +432,13 @@ int cNopacityMenuDetailEventView::HeightEPGPics(void) { } } numEPGPics = numPicsAvailable; - int picsPerLine = width / (config.epgImageWidthLarge + border); + int picsPerLine = contentWidth / (config.epgImageWidthLarge + border); int picLines = numPicsAvailable / picsPerLine; if (numPicsAvailable%picsPerLine != 0) picLines++; return picLines * (config.epgImageHeightLarge + border) + 2*border; } -void cNopacityMenuDetailEventView::Render(void) { - DrawHeader(); - int currentHight = DrawTextWrapper(&content, 0); - if (config.displayRerunsDetailEPGView) { - currentHight = DrawTextWrapper(&reruns, currentHight); - } - if (config.displayAdditionalEPGPictures) { - DrawEPGPictures(currentHight); - } -} - void cNopacityMenuDetailEventView::DrawHeader(void) { cImageLoader imgLoader; int logoWidth = config.detailViewLogoWidth; @@ -195,22 +447,23 @@ void cNopacityMenuDetailEventView::DrawHeader(void) { pixmapLogo->DrawImage(cPoint(0, max((headerHeight - config.detailViewLogoHeight - border)/2, 0)), imgLoader.GetImage()); } int widthTextHeader = width - 4 * border - logoWidth; - if (imgLoader.LoadEPGImage(event->EventID())) { - pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage()); - if (config.roundedCorners) { - int radius = config.cornerRadius; - if (radius > 2) { - int x = width - config.epgImageWidth - border; - int y = (headerHeight-config.epgImageHeight)/2; - pixmapHeader->DrawEllipse(cRect(x,y,radius,radius), clrTransparent, -2); - pixmapHeader->DrawEllipse(cRect(x + config.epgImageWidth - radius,y,radius,radius), clrTransparent, -1); - pixmapHeader->DrawEllipse(cRect(x,y + config.epgImageHeight - radius,radius,radius), clrTransparent, -3); - pixmapHeader->DrawEllipse(cRect(x + config.epgImageWidth - radius,y + config.epgImageHeight - radius,radius,radius), clrTransparent, -4); + if (!hasAdditionalMedia) { + if (imgLoader.LoadEPGImage(event->EventID())) { + pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage()); + if (config.roundedCorners) { + int radius = config.cornerRadius; + if (radius > 2) { + int x = width - config.epgImageWidth - border; + int y = (headerHeight-config.epgImageHeight)/2; + pixmapHeader->DrawEllipse(cRect(x,y,radius,radius), clrTransparent, -2); + pixmapHeader->DrawEllipse(cRect(x + config.epgImageWidth - radius,y,radius,radius), clrTransparent, -1); + pixmapHeader->DrawEllipse(cRect(x,y + config.epgImageHeight - radius,radius,radius), clrTransparent, -3); + pixmapHeader->DrawEllipse(cRect(x + config.epgImageWidth - radius,y + config.epgImageHeight - radius,radius,radius), clrTransparent, -4); + } } + widthTextHeader -= config.epgImageWidth; } - widthTextHeader -= config.epgImageWidth; } - int lineHeight = fontHeaderLarge->Height(); cString dateTime = cString::sprintf("%s %s - %s", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString()); @@ -280,13 +533,13 @@ void cNopacityMenuDetailEventView::LoadReruns(void) { delete list; } } - reruns.Set(sstrReruns.str().c_str(), font, width - 4 * border); + reruns.Set(sstrReruns.str().c_str(), font, contentWidth - 4 * border); } else - reruns.Set("", font, width - 4 * border); + reruns.Set("", font, contentWidth); } void cNopacityMenuDetailEventView::DrawEPGPictures(int height) { - int picsPerLine = width / (config.epgImageWidthLarge + border); + int picsPerLine = contentWidth / (config.epgImageWidthLarge + border); int currentX = border; int currentY = height + border; int currentPicsPerLine = 1; @@ -326,48 +579,147 @@ cNopacityMenuDetailRecordingView::cNopacityMenuDetailRecordingView(cOsd *osd, co } cNopacityMenuDetailRecordingView::~cNopacityMenuDetailRecordingView(void) { + Cancel(-1); + while (Active()) + cCondWait::SleepMs(10); osd->DestroyPixmap(pixmapHeader); + pixmapHeader = NULL; osd->DestroyPixmap(pixmapContent); -} - -void cNopacityMenuDetailRecordingView::CreatePixmaps(void) { - pixmapHeader = osd->CreatePixmap(3, cRect(x, top, width, headerHeight)); - pixmapContent = osd->CreatePixmap(3, cRect(x, top + headerHeight, width, contentHeight), - cRect(0, 0, width, contentDrawPortHeight)); - - pixmapHeader->Fill(clrTransparent); - pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); - pixmapContent->Fill(clrTransparent); + pixmapContent = NULL; + if (pixmapPoster) { + osd->DestroyPixmap(pixmapPoster); + pixmapLogo = NULL; + } } void cNopacityMenuDetailRecordingView::SetFonts(void) { font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); + fontSmall = cFont::CreateFont(config.fontName, contentHeight / 30 + config.fontDetailViewSmall); fontHeaderLarge = cFont::CreateFont(config.fontName, headerHeight / 4 + config.fontDetailViewHeaderLarge); fontHeader = cFont::CreateFont(config.fontName, headerHeight / 6 + config.fontDetailViewHeader); } void cNopacityMenuDetailRecordingView::SetContent(void) { if (recording) { - content.Set(recording->Info()->Description(), font, width - 4 * border); + const cEvent *event = info->GetEvent(); + if (event) { + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper) { + mediaInfo.event = event; + mediaInfo.isRecording = true; + if (pTVScrapper->Service("TVScrapperGetFullInformation", &mediaInfo)) { + hasAdditionalMedia = true; + } + } + contentWidth = width; + contentX = 0; + if (hasAdditionalMedia) { + if (mediaInfo.posters.size() >= 1) { + contentWidth -= widthPoster; + contentX = widthPoster; + } + } + } + recInfo.Set(recording->Info()->Description(), font, contentWidth - 2 * border); LoadRecordingInformation(); - } + } } void cNopacityMenuDetailRecordingView::SetContentHeight(void) { int lineHeight = font->Height(); - int linesContent = content.Lines() + 1; - linesContent+= additionalInfo.Lines() + 1; - int heightContentText = linesContent * lineHeight; - if (config.displayAdditionalRecEPGPictures) { + //Height of banner (only for series) + int heightBanner = 0; + if (hasAdditionalMedia && (mediaInfo.type == typeSeries)) { + heightBanner = mediaInfo.banner.height + lineHeight; + } + //Height of Recording EPG Info + int heightEPG = (recInfo.Lines()+1) * lineHeight; + //Height of actor pictures + int heightActors = 0; + if (hasAdditionalMedia) { + heightActors = HeightActorPics(); + } + //Height of fanart + int heightFanart = 0; + if (hasAdditionalMedia) { + heightFanart = HeightFanart() + lineHeight; + } + //Height of EPG Pictures + int heightEPGPics = 0; + if (!hasAdditionalMedia && config.displayAdditionalEPGPictures) { if (LoadEPGPics()) - heightContentText += HeightEPGPics(); + heightEPGPics = HeightEPGPics(); } - if (heightContentText > contentHeight) { - contentDrawPortHeight = heightContentText; + //additional recording Info + int heightAdditionalInfo = (additionalInfo.Lines() + 1) * lineHeight; + + yBanner = 0; + yEPGText = heightBanner; + yActors = heightBanner + heightEPG; + yFanart = heightBanner + heightEPG + heightActors; + yAddInf = heightBanner + heightEPG + heightActors + heightFanart; + yEPGPics = heightBanner + heightEPG + heightActors + heightFanart + heightAdditionalInfo; + + int totalHeight = heightBanner + heightEPG + heightActors + heightFanart + heightAdditionalInfo + heightEPGPics; + //check if pixmap content has to be scrollable + if (totalHeight > contentHeight) { + contentDrawPortHeight = totalHeight; hasScrollbar = true; } else { contentDrawPortHeight = contentHeight; } + +} + +void cNopacityMenuDetailRecordingView::CreatePixmaps(void) { + pixmapHeader = osd->CreatePixmap(3, cRect(x, top, width, headerHeight)); + pixmapContent = osd->CreatePixmap(3, cRect(x + contentX, top + headerHeight, contentWidth, contentHeight), + cRect(0, 0, contentWidth, contentDrawPortHeight)); + + pixmapHeader->Fill(clrTransparent); + pixmapHeader->DrawRectangle(cRect(0, headerHeight - 2, width, 2), Theme.Color(clrMenuBorder)); + pixmapContent->Fill(clrTransparent); + if (hasAdditionalMedia) { + pixmapPoster = osd->CreatePixmap(4, cRect(x, top + headerHeight, widthPoster, contentHeight)); + pixmapPoster->Fill(clrTransparent); + } +} + +void cNopacityMenuDetailRecordingView::Render(void) { + DrawHeader(); + //draw Recording EPG text + DrawTextWrapper(&recInfo, yEPGText); + //draw additional Info + if (config.displayRerunsDetailEPGView) { + DrawTextWrapper(&additionalInfo, yAddInf); + } +} + +void cNopacityMenuDetailRecordingView::Action(void) { + if (hasAdditionalMedia && Running()) { + DrawPoster(); + osd->Flush(); + } + //draw banner only for series + if (hasAdditionalMedia && (mediaInfo.type == typeSeries) && Running()) { + DrawBanner(yBanner); + osd->Flush(); + } + //draw actors + if (hasAdditionalMedia && Running()) { + DrawActors(yActors); + osd->Flush(); + } + //draw fanart + if (hasAdditionalMedia && Running()) { + DrawFanart(yFanart); + osd->Flush(); + } + //draw additional EPG Pictures only if no media is available + if (!hasAdditionalMedia && config.displayAdditionalEPGPictures && Running()) { + DrawEPGPictures(yEPGPics); + osd->Flush(); + } } bool cNopacityMenuDetailRecordingView::LoadEPGPics(void) { @@ -438,18 +790,9 @@ void cNopacityMenuDetailRecordingView::DrawEPGPictures(int height) { } } -void cNopacityMenuDetailRecordingView::Render(void) { - DrawHeader(); - int currentHeight = DrawTextWrapper(&content, 0); - currentHeight = DrawTextWrapper(&additionalInfo, currentHeight); - if (epgpics.size() > 0) { - DrawEPGPictures(currentHeight); - } -} - void cNopacityMenuDetailRecordingView::DrawHeader(void) { cImageLoader imgLoader; - int widthTextHeader = width - 4 * border; + int widthTextHeader = width - 4 * border; if (imgLoader.LoadRecordingImage(recording->FileName())) { pixmapHeader->DrawImage(cPoint(width - config.epgImageWidth - border, (headerHeight-config.epgImageHeight)/2), imgLoader.GetImage()); if (config.roundedCorners) { @@ -634,6 +977,7 @@ cNopacityMenuDetailTextView::~cNopacityMenuDetailTextView(void) { void cNopacityMenuDetailTextView::SetFonts(void) { font = cFont::CreateFont(config.fontName, contentHeight / 25 + config.fontDetailView); + fontSmall = NULL; fontHeaderLarge = NULL; fontHeader = NULL; } diff --git a/menudetailview.h b/menudetailview.h index 9fae59e..4f30759 100644 --- a/menudetailview.h +++ b/menudetailview.h @@ -1,21 +1,41 @@ #ifndef __NOPACITY_MENUDETAILVIEW_H #define __NOPACITY_MENUDETAILVIEW_H -class cNopacityMenuDetailView { +class cNopacityMenuDetailView : public cThread { protected: cOsd *osd; bool hasScrollbar; int x, width, height, top; int headerHeight; + int contentWidth; + int contentX; int contentHeight; int contentDrawPortHeight; + int widthPoster; int border; - cFont *font, *fontHeader, *fontHeaderLarge; + int yBanner; + int yEPGText; + int yActors; + int yFanart; + int yAddInf; + int yEPGPics; + int actorThumbWidth; + int actorThumbHeight; + cFont *font, *fontSmall, *fontHeader, *fontHeaderLarge; cPixmap *pixmapHeader; cPixmap *pixmapLogo; cPixmap *pixmapContent; - cTextWrapper content; - int DrawTextWrapper(cTextWrapper *wrapper, int top); + cPixmap *pixmapPoster; + TVScrapperGetFullInformation mediaInfo; + bool hasAdditionalMedia; + void DrawTextWrapper(cTextWrapper *wrapper, int top); + int HeightActorPics(void); + int HeightFanart(void); + void DrawPoster(void); + void DrawBanner(int height); + void DrawActors(int height); + void DrawFanart(int height); + virtual void Action(void) {}; public: cNopacityMenuDetailView(cOsd *osd); virtual ~cNopacityMenuDetailView(void); @@ -34,12 +54,14 @@ public: class cNopacityMenuDetailEventView : public cNopacityMenuDetailView { private: const cEvent *event; + cTextWrapper epgText; cTextWrapper reruns; int numEPGPics; void DrawHeader(void); void LoadReruns(void); int HeightEPGPics(void); void DrawEPGPictures(int height); + void Action(void); public: cNopacityMenuDetailEventView(cOsd *osd, const cEvent *Event); virtual ~cNopacityMenuDetailEventView(void); @@ -54,6 +76,7 @@ class cNopacityMenuDetailRecordingView : public cNopacityMenuDetailView { private: const cRecording *recording; const cRecordingInfo *info; + cTextWrapper recInfo; cTextWrapper additionalInfo; void DrawHeader(void); void LoadRecordingInformation(void); @@ -62,6 +85,7 @@ private: bool LoadEPGPics(void); int HeightEPGPics(void); void DrawEPGPictures(int height); + void Action(void); public: cNopacityMenuDetailRecordingView(cOsd *osd, const cRecording *Recording); virtual ~cNopacityMenuDetailRecordingView(void); @@ -75,6 +99,7 @@ public: class cNopacityMenuDetailTextView : public cNopacityMenuDetailView { private: const char *text; + cTextWrapper content; public: cNopacityMenuDetailTextView(cOsd *osd, const char *text); virtual ~cNopacityMenuDetailTextView(void); @@ -480,6 +480,7 @@ void cNopacityScheduleMenuItem::Render() { infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin); infoTextWindow->SetGeometry(textWindow); infoTextWindow->SetText(Event->Description()); + infoTextWindow->SetPoster(Event, false); infoTextWindow->Start(); } } else { @@ -716,7 +717,6 @@ std::string cNopacityChannelMenuItem::readEPG(void) { } void cNopacityChannelMenuItem::Render() { - if (selectable) { //Channels DrawBackground(); int logoWidth = config.menuItemLogoWidth; @@ -933,8 +933,11 @@ void cNopacityRecordingMenuItem::CreatePixmapTextScroller(int totalWidth) { } else { pixmapLeft = left + 10; pixmapWidth = width - 10; + if (hasPoster) { + pixmapLeft += posterWidth+10; + pixmapWidth -= (posterWidth+10); + } } - pixmapTextScroller = osd->CreatePixmap(4, cRect(pixmapLeft, top + index * (height + spaceMenu), pixmapWidth, height), cRect(0, 0, drawPortWidth, height)); pixmapTextScroller->Fill(clrTransparent); } @@ -957,6 +960,35 @@ void cNopacityRecordingMenuItem::CreateText() { } } +void cNopacityRecordingMenuItem::SetPoster(void) { + const cRecordingInfo *info = Recording->Info(); + if (info) { + const cEvent *event = info->GetEvent(); + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper && event) { + poster.event = event; + poster.isRecording = true; + if (pTVScrapper->Service("TVScrapperGetPoster", &poster)) { + hasPoster = true; + int posterWidthOrig = poster.media.width; + int posterHeightOrig = poster.media.height; + if ((posterWidthOrig > 10) && (posterHeightOrig > 10)) { + posterHeight = height - 10; + posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); + } else { + hasPoster = false; + posterHeight = 0; + posterWidth = 0; + } + } else { + hasPoster = false; + posterHeight = 0; + posterWidth = 0; + } + } + } +} + int cNopacityRecordingMenuItem::CheckScrollable(bool hasIcon) { int totalWidth = 0; if (isFolder) @@ -968,6 +1000,8 @@ int cNopacityRecordingMenuItem::CheckScrollable(bool hasIcon) { int cNopacityRecordingMenuItem::CheckScrollableRecording(void) { int spaceLeft = spaceMenu; + if (hasPoster) + spaceLeft += posterWidth + 15; int iconWidth = 0; if (Recording->IsNew()) iconWidth += font->Height() + 10; @@ -1019,7 +1053,10 @@ void cNopacityRecordingMenuItem::DrawBackground(void) { void cNopacityRecordingMenuItem::SetTextFullFolder(void) { tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); pixmapTextScroller->Fill(clrTransparent); - DrawFolderIcon(); + if (hasPoster) + DrawPoster(); + else + DrawFolderIcon(); int heightRecName = (2*height/3 - font->Height())/2 + 10; pixmapTextScroller->DrawText(cPoint(0, heightRecName), strRecNameFull.c_str(), clrFont, clrTransparent, font); } @@ -1049,7 +1086,10 @@ void cNopacityRecordingMenuItem::SetTextShort(void) { void cNopacityRecordingMenuItem::SetTextShortFolder(void) { tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); pixmapTextScroller->Fill(clrTransparent); - DrawFolderIcon(); + if (hasPoster) + DrawPoster(); + else + DrawFolderIcon(); int heightRecName = (2*height/3 - font->Height())/2 + 10; pixmapTextScroller->DrawText(cPoint(0, heightRecName), strRecName.c_str(), clrFont, clrTransparent, font); } @@ -1099,14 +1139,18 @@ void cNopacityRecordingMenuItem::DrawFolderIcon(void) { void cNopacityRecordingMenuItem::DrawRecDateTime(void) { int iconDateTimeSize = config.menuRecFolderSize / 2; int iconHeight = height/2 + (height/2 - iconDateTimeSize)/2; + int left = 10; + if (hasPoster) { + left += posterWidth + 10; + } if (!drawn) { cImageLoader imgLoader; if (imgLoader.LoadIcon("skinIcons/recordingdatetime", iconDateTimeSize)) { - pixmapIcon->DrawImage(cPoint(3, iconHeight), imgLoader.GetImage()); + pixmapIcon->DrawImage(cPoint(left, iconHeight), imgLoader.GetImage()); } drawn = true; } - pixmapIcon->DrawRectangle(cRect(iconHeight, 0, width-iconHeight, height), clrTransparent); + pixmapIcon->DrawRectangle(cRect(iconHeight+left, 0, width-iconHeight, height), clrTransparent); const cEvent *Event = NULL; Event = Recording->Info()->GetEvent(); cString strDateTime(""); @@ -1123,9 +1167,9 @@ void cNopacityRecordingMenuItem::DrawRecDateTime(void) { int textHeight = height/2 + (height/4 - fontSmall->Height())/2; tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem); - pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10, textHeight), *strDateTime, clrFont, clrTransparent, fontSmall); + pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10 + left, textHeight), *strDateTime, clrFont, clrTransparent, fontSmall); textHeight += height/4; - pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10, textHeight), *strDuration, clrFont, clrTransparent, fontSmall); + pixmapIcon->DrawText(cPoint(iconDateTimeSize + 10 + left, textHeight), *strDuration, clrFont, clrTransparent, fontSmall); } @@ -1136,6 +1180,13 @@ void cNopacityRecordingMenuItem::DrawFolderNewSeen(void) { pixmapIcon->DrawText(cPoint(config.menuRecFolderSize + 10, textHeight), *strTotalNew, clrFont, clrTransparent, fontSmall); } +void cNopacityRecordingMenuItem::DrawPoster(void) { + cImageLoader imgLoader; + if (imgLoader.LoadPoster(poster.media.path.c_str(), posterWidth, posterHeight)) { + pixmapIcon->DrawImage(cPoint(10, 5), imgLoader.GetImage()); + } +} + void cNopacityRecordingMenuItem::Render() { if (selectable) { DrawBackground(); @@ -1143,6 +1194,9 @@ void cNopacityRecordingMenuItem::Render() { DrawFolderNewSeen(); SetTextShort(); } else { + if (hasPoster) { + DrawPoster(); + } DrawRecDateTime(); SetTextShort(); } @@ -1164,6 +1218,7 @@ void cNopacityRecordingMenuItem::Render() { infoTextWindow = new cNopacityTextWindow(osd, fontEPGWindow, vidWin); infoTextWindow->SetGeometry(textWindow); infoTextWindow->SetText(Recording->Info()->Description()); + infoTextWindow->SetPoster(Recording->Info()->GetEvent(), true); infoTextWindow->Start(); } } @@ -51,6 +51,7 @@ public: void SetBackgrounds(int *handleBackgrounds); void SetTextWindow(cRect *window) {textWindow = window;}; virtual void CreateText(void) {}; + virtual void SetPoster(void) {}; virtual int CheckScrollable(bool hasIcon) {return 0;}; virtual void Render() = 0; }; @@ -154,6 +155,9 @@ class cNopacityRecordingMenuItem : public cNopacityMenuItem { private: const cRecording *Recording; bool isFolder; + bool hasPoster; + int posterWidth, posterHeight; + TVScrapperGetPoster poster; int Level, Total, New; cRect *vidWin; std::string strRecName; @@ -170,6 +174,7 @@ private: void DrawFolderIcon(void); void DrawRecDateTime(void); void DrawFolderNewSeen(void); + void DrawPoster(void); int CheckScrollableRecording(void); int CheckScrollableFolder(void); public: @@ -177,6 +182,7 @@ public: ~cNopacityRecordingMenuItem(void); void CreatePixmapTextScroller(int totalWidth); void CreateText(void); + void SetPoster(void); int CheckScrollable(bool hasIcon); void Render(); }; diff --git a/po/ca_CA.po b/po/ca_CA.po index 4f9969a..08aa3ef 100644 --- a/po/ca_CA.po +++ b/po/ca_CA.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-05-10 12:52+0200\n" +"POT-Creation-Date: 2013-08-18 15:18+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Gabychan <gbonich@gmail.com>\n" "Language-Team: \n" @@ -26,6 +26,9 @@ msgstr "lliure" msgid "Volume" msgstr "Volum" +msgid "Actors" +msgstr "" + msgid "RERUNS OF THIS SHOW" msgstr "REEMISSIONS" @@ -179,6 +182,9 @@ msgstr "Ajusta mida de la Font - Missatges" msgid "Adjust Font Size - Detail View Text" msgstr "Ajusta mida de la Font - Vista detall del text" +msgid "Adjust Font Size - Detail View Text Small" +msgstr "" + msgid "Adjust Font Size - Detail View Header" msgstr "Ajusta mida de la Font - Vista detall capçalera" diff --git a/po/de_DE.po b/po/de_DE.po index 830b20c..c2dd47d 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-05-10 12:52+0200\n" +"POT-Creation-Date: 2013-08-18 15:18+0200\n" "PO-Revision-Date: 2012-11-11 17:49+0200\n" "Last-Translator: louis\n" "Language-Team: \n" @@ -23,6 +23,9 @@ msgstr "frei" msgid "Volume" msgstr "Lautstärke" +msgid "Actors" +msgstr "Schauspieler" + msgid "RERUNS OF THIS SHOW" msgstr "Wiederholungen dieser Sendung" @@ -176,6 +179,9 @@ msgstr "Schriftgröße anpassen - Nachrichten" msgid "Adjust Font Size - Detail View Text" msgstr "Schriftgröße anpassen - Text EPG Detailanzeige" +msgid "Adjust Font Size - Detail View Text Small" +msgstr "Schriftgröße anpassen - Text EPG Detailanzeige klein" + msgid "Adjust Font Size - Detail View Header" msgstr "Schriftgröße anpassen - Header EPG Detailanzeige" diff --git a/po/it_IT.po b/po/it_IT.po index ac658e4..1e33fc6 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: skinnopacity 0.0.1\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-05-10 12:52+0200\n" +"POT-Creation-Date: 2013-08-18 15:18+0200\n" "PO-Revision-Date: 2013-03-19 22:56+0100\n" "Last-Translator: Diego Pierotto <vdr-italian@tiscali.it>\n" "Language-Team: \n" @@ -26,6 +26,9 @@ msgstr "disponibili" msgid "Volume" msgstr "Volume" +msgid "Actors" +msgstr "" + msgid "RERUNS OF THIS SHOW" msgstr "REPLICHE DI QUESTO SPETTACOLO" @@ -179,6 +182,9 @@ msgstr "Adatta dim. caratteri - Messaggi" msgid "Adjust Font Size - Detail View Text" msgstr "Adatta dim. caratteri - Testo vista dettagli" +msgid "Adjust Font Size - Detail View Text Small" +msgstr "" + msgid "Adjust Font Size - Detail View Header" msgstr "Adatta dim. caratteri - Intestazione vista dettagli" diff --git a/po/sk_SK.po b/po/sk_SK.po index cc6f77b..13089ce 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinnopacity 0.0.6\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-05-10 12:52+0200\n" +"POT-Creation-Date: 2013-08-18 15:18+0200\n" "PO-Revision-Date: 2013-03-12 15:59+0100\n" "Last-Translator: Milan Hrala <hrala.milan@gmail.com>\n" "Language-Team: \n" @@ -26,6 +26,9 @@ msgstr "voµné" msgid "Volume" msgstr "Hlasitos»" +msgid "Actors" +msgstr "" + msgid "RERUNS OF THIS SHOW" msgstr "Repríza" @@ -179,6 +182,9 @@ msgstr "Nastavenie veµkosti písma - správy" msgid "Adjust Font Size - Detail View Text" msgstr "Nastavenie veµkosti písma - Podrobné zobrazenie textu" +msgid "Adjust Font Size - Detail View Text Small" +msgstr "" + msgid "Adjust Font Size - Detail View Header" msgstr "Nastavenie veµkosti písma - Podrobné zobrazenie hlavièky" @@ -198,6 +198,7 @@ void cNopacitySetup::Store(void) { SetupStore("fontButtons", config.fontButtons); SetupStore("fontMessageMenu", config.fontMessageMenu); SetupStore("fontDetailView", config.fontDetailView); + SetupStore("fontDetailViewSmall", config.fontDetailViewSmall); SetupStore("fontDetailViewHeader", config.fontDetailViewHeader); SetupStore("fontDetailViewHeaderLarge", config.fontDetailViewHeaderLarge); SetupStore("fontEPGInfoWindow", config.fontEPGInfoWindow); @@ -281,6 +282,7 @@ void cNopacitySetupMenuDisplay::Set(void) { Add(new cMenuEditIntItem(tr("Adjust Font Size - Color Buttons"), &tmpNopacityConfig->fontButtons, -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Messages"), &tmpNopacityConfig->fontMessageMenu, -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Text"), &tmpNopacityConfig->fontDetailView, -20, 20)); + Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Text Small"), &tmpNopacityConfig->fontDetailViewSmall, -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header"), &tmpNopacityConfig->fontDetailViewHeader, -20, 20)); Add(new cMenuEditIntItem(tr("Adjust Font Size - Detail View Header Large"), &tmpNopacityConfig->fontDetailViewHeaderLarge, -20, 20)); diff --git a/skinnopacity.c b/skinnopacity.c index 514c748..37e575e 100644 --- a/skinnopacity.c +++ b/skinnopacity.c @@ -15,7 +15,7 @@ #endif -static const char *VERSION = "0.1.2"; +static const char *VERSION = "0.1.3"; static const char *DESCRIPTION = "'nOpacity' Skin"; static const char *MAINMENUENTRY = "nOpacity"; diff --git a/textwindow.c b/textwindow.c index 6e55ef9..013f19d 100644 --- a/textwindow.c +++ b/textwindow.c @@ -7,6 +7,7 @@ cNopacityTextWindow::cNopacityTextWindow(cOsd *osd, cFont *font, cRect *vidWin) pixmapBackground = NULL; pixmap = NULL; scaledWindow = false; + hasPoster = false; } cNopacityTextWindow::~cNopacityTextWindow(void) { @@ -32,16 +33,85 @@ cNopacityTextWindow::~cNopacityTextWindow(void) { } } -bool cNopacityTextWindow::CreatePixmap(int border) { +void cNopacityTextWindow::SetPoster(const cEvent *event, bool isRecording) { + static cPlugin *pTVScrapper = cPluginManager::GetPlugin("tvscrapper"); + if (pTVScrapper && event) { + poster.event = event; + poster.isRecording = isRecording; + if (pTVScrapper->Service("TVScrapperGetPoster", &poster)) { + hasPoster = true; + int posterWidthOrig = poster.media.width; + int posterHeightOrig = poster.media.height; + posterHeight = geometry->Height() - 5; + posterWidth = posterWidthOrig * ((double)posterHeight / (double)posterHeightOrig); + } else { + hasPoster = false; + posterHeight = 0; + posterWidth = 0; + } + } +} + +bool cNopacityTextWindow::SetTextScroller(int border, int left) { int lineHeight = font->Height(); bool scrolling = false; - twText.Set(*text, font, geometry->Width() - 2*border); - int pixmapTotalHeight = lineHeight * (twText.Lines()+1); - int drawportHeight = geometry->Height(); - if ((pixmapTotalHeight - (lineHeight/2)) > drawportHeight) { - drawportHeight = pixmapTotalHeight; - scrolling = true; + drawportHeight = geometry->Height(); + if (!hasPoster) { + drawTextTall = false; + drawTextFull = true; + twTextTall.Set("", font, 5); + twTextFull.Set(*text, font, geometry->Width() - 2*border); + int pixmapTotalHeight = lineHeight * (twTextFull.Lines()+1); + if ((pixmapTotalHeight - (lineHeight/2)) > drawportHeight) { + drawportHeight = pixmapTotalHeight; + scrolling = true; + } + } else { + cTextWrapper test; + int widthTall = geometry->Width() - 2*border - left; + test.Set(*text, font, widthTall); + int linesTotal = test.Lines(); + int textHeight = linesTotal * lineHeight; + if (textHeight > posterHeight) { + drawTextTall = true; + drawTextFull = true; + int lineSplit = posterHeight / lineHeight + 1; + std::stringstream textTall; + std::stringstream textFull; + for (int line = 0; line < linesTotal; line++) { + bool lineWrap = false; + if (font->Width(test.GetLine(line)) < (widthTall - 100)) + lineWrap = true; + if (line < lineSplit) { + textTall << test.GetLine(line); + if (lineWrap) + textTall << "\n"; + else + textTall << " "; + } else { + textFull << test.GetLine(line); + if (lineWrap) + textFull << "\n"; + else + textFull << " "; + } + } + twTextTall.Set(textTall.str().c_str(), font, widthTall); + twTextFull.Set(textFull.str().c_str(), font, geometry->Width() - 2*border); + scrolling = true; + drawportHeight = lineHeight * (twTextTall.Lines() + twTextFull.Lines() + 1); + } else { + scrolling = false; + drawTextTall = true; + drawTextFull = false; + twTextTall.Set(*text, font, geometry->Width() - 2*border - left); + twTextFull.Set("", font, 5); + } } + return scrolling; +} + +void cNopacityTextWindow::CreatePixmap(void) { cPixmap::Lock(); pixmapBackground = osd->CreatePixmap(4, cRect(geometry->X()-1, geometry->Y()-1, geometry->Width()+2, geometry->Height()+2)); pixmap = osd->CreatePixmap(5, cRect(geometry->X(), geometry->Y(), geometry->Width(), geometry->Height()), @@ -52,27 +122,57 @@ bool cNopacityTextWindow::CreatePixmap(int border) { pixmap->SetAlpha(0); pixmap->Fill(Theme.Color(clrMenuBack)); cPixmap::Unlock(); - return scrolling; } -void cNopacityTextWindow::DrawText(int border) { +void cNopacityTextWindow::DrawText(int border, int left) { int lineHeight = font->Height(); int currentLineHeight = lineHeight/2; tColor clrFontBack = (config.doBlending)?(clrTransparent):(Theme.Color(clrMenuBack)); cPixmap::Lock(); - for (int i=0; (i < twText.Lines()) && Running(); i++) { - pixmap->DrawText(cPoint(border, currentLineHeight), twText.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrFontBack, font); - currentLineHeight += lineHeight; + if (drawTextTall) { + for (int i=0; (i < twTextTall.Lines()) && Running(); i++) { + pixmap->DrawText(cPoint(border + left, currentLineHeight), twTextTall.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrFontBack, font); + currentLineHeight += lineHeight; + } + } + if (drawTextFull) { + for (int i=0; (i < twTextFull.Lines()) && Running(); i++) { + pixmap->DrawText(cPoint(border, currentLineHeight), twTextFull.GetLine(i), Theme.Color(clrMenuFontDetailViewText), clrFontBack, font); + currentLineHeight += lineHeight; + } } cPixmap::Unlock(); } +void cNopacityTextWindow::DrawPoster(int border) { + cImageLoader imgLoader; + if (imgLoader.LoadPoster(poster.media.path.c_str(), posterWidth, posterHeight)) { + pixmap->DrawImage(cPoint(border, font->Height()), imgLoader.GetImage()); + } +} + void cNopacityTextWindow::DoSleep(int duration) { int sleepSlice = 10; for (int i = 0; Running() && (i*sleepSlice < duration); i++) cCondWait::SleepMs(sleepSlice); } +void cNopacityTextWindow::ScaleVideoWindow(void) { + oldVidWin.SetX(vidWin->X()); + oldVidWin.SetY(vidWin->Y()); + oldVidWin.SetWidth(vidWin->Width()); + oldVidWin.SetHeight(vidWin->Height()); + cRect availableRect(vidWin->X(), vidWin->Y(), vidWin->Width(), vidWin->Height() - geometry->Height()); + cRect vidWinNew = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); + if (vidWinNew != cRect::Null) { + vidWin->SetX(vidWinNew.X()); + vidWin->SetY(vidWinNew.Y()); + vidWin->SetWidth(vidWinNew.Width()); + vidWin->SetHeight(vidWinNew.Height()); + scaledWindow = true; + } +} + void cNopacityTextWindow::Action(void) { if (! *text) return; @@ -80,28 +180,23 @@ void cNopacityTextWindow::Action(void) { DoSleep(config.menuInfoTextDelay*1000); if (config.scalePicture == 2) { - oldVidWin.SetX(vidWin->X()); - oldVidWin.SetY(vidWin->Y()); - oldVidWin.SetWidth(vidWin->Width()); - oldVidWin.SetHeight(vidWin->Height()); - cRect availableRect(vidWin->X(), vidWin->Y(), vidWin->Width(), vidWin->Height() - geometry->Height()); - cRect vidWinNew = cDevice::PrimaryDevice()->CanScaleVideo(availableRect); - if (vidWinNew != cRect::Null) { - vidWin->SetX(vidWinNew.X()); - vidWin->SetY(vidWinNew.Y()); - vidWin->SetWidth(vidWinNew.Width()); - vidWin->SetHeight(vidWinNew.Height()); - scaledWindow = true; - } + ScaleVideoWindow(); } int border = 5; + int left = 0; + if (hasPoster) + left = 10 + posterWidth; bool scrolling = false; if (Running()) { - scrolling = CreatePixmap(border); + scrolling = SetTextScroller(border, left); + CreatePixmap(); } if (Running()) { - DrawText(border); + DrawText(border, left); + } + if (Running() && hasPoster) { + DrawPoster(border); } //FadeIn if (config.menuEPGWindowFadeTime) { diff --git a/textwindow.h b/textwindow.h index 321a0fe..e499553 100644 --- a/textwindow.h +++ b/textwindow.h @@ -7,20 +7,31 @@ private: cPixmap *pixmapBackground; cPixmap *pixmap; cRect *geometry; + int drawportHeight; cRect *vidWin; cRect oldVidWin; bool scaledWindow; cString text; - cTextWrapper twText; - bool CreatePixmap(int border); - void DrawText(int border); + cTextWrapper twTextTall; + cTextWrapper twTextFull; + bool drawTextTall; + bool drawTextFull; + bool hasPoster; + TVScrapperGetPoster poster; + int posterWidth, posterHeight; + bool SetTextScroller(int border, int left); + void CreatePixmap(void); + void DrawText(int border, int left); + void DrawPoster(int border); void DoSleep(int duration); virtual void Action(void); + void ScaleVideoWindow(void); public: cNopacityTextWindow(cOsd *osd, cFont *font, cRect *vidWin); virtual ~cNopacityTextWindow(void); void SetGeometry(cRect *geo) {geometry = geo;}; void SetText(cString Text) {text = Text;}; + void SetPoster(const cEvent *event, bool isRecording); }; #endif //__NOPACITY_TEXTWINDOW_H
\ No newline at end of file |