From a17b78838e9b664c859bfbd637ab86aa0e2a1fc8 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 23 Jul 2013 19:47:40 +0200 Subject: [PATCH] Pimped timeline --- HISTORY | 1 + recmanager.c | 2 +- timeline.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++---- timeline.h | 3 +++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index fa45613..ce17278 100644 --- a/HISTORY +++ b/HISTORY @@ -59,3 +59,4 @@ VDR Plugin 'tvguide' Revision History - color buttons displayed as configured in VDR - Added Setup Option to define if tvguide closes after channel switching - Added remotetimers support (thanks @Saman for providing a patch) +- Pimped timeline diff --git a/recmanager.c b/recmanager.c index 61ad426..df3e815 100644 --- a/recmanager.c +++ b/recmanager.c @@ -542,7 +542,7 @@ std::string cRecManager::BuildEPGSearchString(cString searchString, cRecMenu *me 54 - compare date when testing for a repeat? (0=no, 1=same day, 2=same week, 3=same month) */ searchTimerString << "0::::0:::0::0:::::::::0"; - esyslog("tvguide: epgsearch String: %s", searchTimerString.str().c_str()); + //esyslog("tvguide: epgsearch String: %s", searchTimerString.str().c_str()); return searchTimerString.str(); } diff --git a/timeline.c b/timeline.c index 4355352..fbbff62 100644 --- a/timeline.c +++ b/timeline.c @@ -7,7 +7,7 @@ cTimeLine::cTimeLine(cMyTime *myTime) { tvguideConfig.statusHeaderHeight, tvguideConfig.timeLineWidth, tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight))); - timeline = osdManager.requestPixmap(1, cRect(0, + timeline = osdManager.requestPixmap(2, cRect(0, tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight, tvguideConfig.timeLineWidth, tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight) @@ -15,12 +15,16 @@ cTimeLine::cTimeLine(cMyTime *myTime) { 0, tvguideConfig.timeLineWidth, 1440*tvguideConfig.minutePixel)); + timelineBack = osdManager.requestPixmap(1, cRect(0, + tvguideConfig.statusHeaderHeight + tvguideConfig.channelHeaderHeight + tvguideConfig.channelGroupsHeight, + tvguideConfig.timeLineWidth, + tvguideConfig.osdHeight - tvguideConfig.statusHeaderHeight - tvguideConfig.channelHeaderHeight - tvguideConfig.channelGroupsHeight - tvguideConfig.footerHeight)); } else if (tvguideConfig.displayMode == eHorizontal) { dateViewer = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, tvguideConfig.statusHeaderHeight, tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, - tvguideConfig.timeLineHeight))); - timeline = osdManager.requestPixmap(1, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, + tvguideConfig.timeLineHeight-2))); + timeline = osdManager.requestPixmap(2, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, tvguideConfig.statusHeaderHeight, tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth, tvguideConfig.timeLineHeight) @@ -28,6 +32,10 @@ cTimeLine::cTimeLine(cMyTime *myTime) { 0, 1440*tvguideConfig.minutePixel, tvguideConfig.timeLineWidth)); + timelineBack = osdManager.requestPixmap(1, cRect(tvguideConfig.channelHeaderWidth + tvguideConfig.channelGroupsWidth, + tvguideConfig.statusHeaderHeight, + tvguideConfig.osdWidth - tvguideConfig.channelHeaderWidth - tvguideConfig.channelGroupsWidth, + tvguideConfig.timeLineHeight)); } clock = new cStyledPixmap(osdManager.requestPixmap(1, cRect(0, tvguideConfig.osdHeight- tvguideConfig.footerHeight, @@ -38,6 +46,7 @@ cTimeLine::cTimeLine(cMyTime *myTime) { cTimeLine::~cTimeLine(void) { delete dateViewer; osdManager.releasePixmap(timeline); + osdManager.releasePixmap(timelineBack); if (clock) delete clock; } @@ -65,6 +74,7 @@ void cTimeLine::drawDateViewer() { } void cTimeLine::drawTimeline() { + timelineBack->Fill(clrBlack); timeline->SetTile(true); timeline->Fill(theme.Color(clrBackground)); tColor colorFont, colorBackground; @@ -117,12 +127,14 @@ void cTimeLine::drawTimeline() { if (tvguideConfig.displayMode == eVertical) { posY = i*tvguideConfig.minutePixel*30; timeline->DrawImage(cPoint(2, posY), *img); + decorateTile(0, posY, imgWidth+2, imgHeight); textWidth = tvguideConfig.FontTimeLineTime->Width(timetext); timeline->DrawText(cPoint((tvguideConfig.timeLineWidth-textWidth)/2, posY + 5), timetext, colorFont, colorBackground, tvguideConfig.FontTimeLineTime); } else if (tvguideConfig.displayMode == eHorizontal) { posX = i*tvguideConfig.minutePixel*30; timeline->DrawImage(cPoint(posX, 2), *img); - timeline->DrawText(cPoint(posX + 2, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, tvguideConfig.FontTimeLineTimeHorizontal); + decorateTile(posX, 0, imgWidth, imgHeight+2); + timeline->DrawText(cPoint(posX + 15, (dateViewer->Height() - tvguideConfig.FontTimeLineTimeHorizontal->Height())/2), timetext, colorFont, colorBackground, tvguideConfig.FontTimeLineTimeHorizontal); } } setTimeline(); @@ -130,6 +142,39 @@ void cTimeLine::drawTimeline() { delete img2; } +void cTimeLine::decorateTile(int posX, int posY, int tileWidth, int tileHeight) { + timeline->DrawRectangle(cRect(posX,posY,tileWidth,2), theme.Color(clrBackground)); //top + timeline->DrawRectangle(cRect(posX,posY,2,tileHeight), theme.Color(clrBackground)); //left + timeline->DrawRectangle(cRect(posX,posY + tileHeight-2,tileWidth,2), theme.Color(clrBackground)); //bottom + timeline->DrawRectangle(cRect(posX + tileWidth-2,posY,2,tileHeight), theme.Color(clrBackground)); //right + + timeline->DrawRectangle(cRect(2+posX,posY+2,tileWidth-4,1), theme.Color(clrBorder)); //top + timeline->DrawRectangle(cRect(2+posX,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //left + timeline->DrawRectangle(cRect(2+posX,posY+tileHeight-3,tileWidth-4,1), theme.Color(clrBorder)); //bottom + timeline->DrawRectangle(cRect(posX+tileWidth-3,posY+2,1,tileHeight-4), theme.Color(clrBorder)); //right + + if (tvguideConfig.roundedCorners) { + int borderRadius = 12; + drawRoundedCorners(posX, posY, tileWidth, tileHeight, borderRadius); + } +} + +void cTimeLine::drawRoundedCorners(int posX, int posY, int width, int height, int radius) { + timeline->DrawEllipse(cRect(posX+2,posY+2,radius,radius), theme.Color(clrBorder), -2); + timeline->DrawEllipse(cRect(posX+1,posY+1,radius,radius), theme.Color(clrBackground), -2); + + timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+2,radius,radius), theme.Color(clrBorder), -1); + timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+1,radius,radius), theme.Color(clrBackground), -1); + + if( height > 2*radius) { + timeline->DrawEllipse(cRect(posX+2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -3); + timeline->DrawEllipse(cRect(posX+1,posY+height-radius - 1,radius,radius), theme.Color(clrBackground), -3); + + timeline->DrawEllipse(cRect(posX+width-radius - 2,posY+height-radius - 2,radius,radius), theme.Color(clrBorder), -4); + timeline->DrawEllipse(cRect(posX+width-radius - 1,posY+height-radius - 1,radius,radius), theme.Color(clrBackground), -4); + } +} + cImage *cTimeLine::createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend) { cImage *image = NULL; if (tvguideConfig.useBlending == 1) { diff --git a/timeline.h b/timeline.h index 267e1f7..6733322 100644 --- a/timeline.h +++ b/timeline.h @@ -8,8 +8,11 @@ private: cMyTime *myTime; cStyledPixmap *dateViewer; cPixmap *timeline; + cPixmap *timelineBack; cStyledPixmap *clock; cImage *createBackgroundImage(int width, int height, tColor clrBgr, tColor clrBlend); + void decorateTile(int posX, int posY, int tileWidth, int tileHeight); + void drawRoundedCorners(int posX, int posY, int width, int height, int radius); public: cTimeLine(cMyTime *myTime); virtual ~cTimeLine(void);