From c611e004582067640111ef2f023410025201157d Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 20 May 2013 11:37:37 +0200 Subject: rewrote epg grid handling and scrolling, added status header --- headergrid.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 headergrid.c (limited to 'headergrid.c') diff --git a/headergrid.c b/headergrid.c new file mode 100644 index 0000000..41a95f4 --- /dev/null +++ b/headergrid.c @@ -0,0 +1,70 @@ +#include "headergrid.h" + +cHeaderGrid::cHeaderGrid(void) : cGrid(NULL) { + pixmap = NULL; + pixmapLogo = NULL; +} + +cHeaderGrid::~cHeaderGrid(void) { + osdManager.releasePixmap(pixmapLogo); +} + +void cHeaderGrid::createBackground(int num) { + color = theme.Color(clrHeader); + colorBlending = theme.Color(clrHeaderBlending); + pixmap = osdManager.requestPixmap(2, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, + tvguideConfig.statusHeaderHeight, + tvguideConfig.colWidth, + tvguideConfig.headerHeight) + , cRect::Null); + if (!pixmap) { + return; + } + pixmapLogo = osdManager.requestPixmap(3, cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, + tvguideConfig.statusHeaderHeight, + tvguideConfig.colWidth, + tvguideConfig.headerHeight) + , cRect::Null); + if (!pixmapLogo) { + return; + } + pixmapLogo->Fill(clrTransparent); + drawBackground(); +} + +void cHeaderGrid::drawChannel(const cChannel *channel) { + cTextWrapper tw; + cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name()); + tw.Set(*headerText, tvguideConfig.FontHeader, tvguideConfig.colWidth - 8); + int lines = tw.Lines(); + int lineHeight = tvguideConfig.FontHeader->Height(); + int yStart = (tvguideConfig.headerHeight - lines*lineHeight)/2 + 8; + if (!tvguideConfig.hideChannelLogos) { + cImageLoader imgLoader; + if (imgLoader.LoadLogo(channel->Name())) { + cImage logo = imgLoader.GetImage(); + int logoX = (tvguideConfig.colWidth - tvguideConfig.logoWidth)/2; + pixmapLogo->DrawImage(cPoint(logoX, 5), logo); + } + yStart = tvguideConfig.logoHeight + 8; + } + for (int i=0; iWidth(tw.GetLine(i)); + int xText = (tvguideConfig.colWidth - textWidth) / 2; + if (xText < 0) + xText = 0; + pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontHeader); + } + drawBorder(); +} + +void cHeaderGrid::setPosition(int num) { + pixmap->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, + tvguideConfig.statusHeaderHeight, + tvguideConfig.colWidth, + tvguideConfig.headerHeight)); + pixmapLogo->SetViewPort(cRect( tvguideConfig.timeColWidth + num*tvguideConfig.colWidth, + tvguideConfig.statusHeaderHeight, + tvguideConfig.colWidth, + tvguideConfig.headerHeight)); +} -- cgit v1.2.3