2013-05-20 11:37:37 +02:00
|
|
|
#include "dummygrid.h"
|
|
|
|
|
2019-07-11 15:06:07 +02:00
|
|
|
cDummyGrid::cDummyGrid(cChannelEpg *c, time_t start, time_t end) : cGridElement(c) {
|
2013-05-20 11:37:37 +02:00
|
|
|
this->start = start;
|
|
|
|
this->end = end;
|
|
|
|
strText = tr("No EPG Information available");
|
|
|
|
dummy = true;
|
2013-07-09 00:17:42 +02:00
|
|
|
hasTimer = false;
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cDummyGrid::~cDummyGrid(void) {
|
|
|
|
}
|
|
|
|
|
2013-07-12 16:00:18 +02:00
|
|
|
time_t cDummyGrid::Duration(void) {
|
|
|
|
//max Duration 5h
|
|
|
|
if (end - start > 18000)
|
|
|
|
return 18000;
|
|
|
|
return (end - start);
|
|
|
|
};
|
|
|
|
|
2013-05-20 11:37:37 +02:00
|
|
|
void cDummyGrid::SetViewportHeight() {
|
2013-05-26 11:38:05 +02:00
|
|
|
int viewportHeightOld = viewportHeight;
|
2013-12-21 11:25:03 +01:00
|
|
|
viewportHeight = Duration() / 60 * geoManager.minutePixel;
|
2013-05-20 11:37:37 +02:00
|
|
|
if (viewportHeight != viewportHeightOld)
|
2013-05-26 11:38:05 +02:00
|
|
|
dirty = true;
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::PositionPixmap() {
|
2013-05-24 16:23:23 +02:00
|
|
|
int x0, y0;
|
2019-07-11 11:28:11 +02:00
|
|
|
if (config.displayMode == eVertical) {
|
2013-05-24 16:23:23 +02:00
|
|
|
x0 = column->getX();
|
2013-12-21 11:25:03 +01:00
|
|
|
y0 = geoManager.statusHeaderHeight + geoManager.channelHeaderHeight + geoManager.channelGroupsHeight;
|
2013-05-24 16:23:23 +02:00
|
|
|
if ( column->Start() < StartTime() ) {
|
2013-12-21 11:25:03 +01:00
|
|
|
y0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
if (!pixmap) {
|
2019-11-10 15:37:28 +01:00
|
|
|
pixmap = osdManager.CreatePixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
} else if (dirty) {
|
2019-11-10 15:37:28 +01:00
|
|
|
osdManager.DestroyPixmap(pixmap);
|
|
|
|
pixmap = osdManager.CreatePixmap(-1, cRect(x0, y0, geoManager.colWidth, viewportHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
} else {
|
2013-12-21 11:25:03 +01:00
|
|
|
pixmap->SetViewPort(cRect(x0, y0, geoManager.colWidth, viewportHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
2019-07-11 11:28:11 +02:00
|
|
|
} else if (config.displayMode == eHorizontal) {
|
2013-12-21 11:25:03 +01:00
|
|
|
x0 = geoManager.channelHeaderWidth + geoManager.channelGroupsWidth;
|
2013-05-24 16:23:23 +02:00
|
|
|
y0 = column->getY();
|
|
|
|
if ( column->Start() < StartTime() ) {
|
2013-12-21 11:25:03 +01:00
|
|
|
x0 += (StartTime() - column->Start())/60*geoManager.minutePixel;
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
if (!pixmap) {
|
2019-11-10 15:37:28 +01:00
|
|
|
pixmap = osdManager.CreatePixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
} else if (dirty) {
|
2019-11-10 15:37:28 +01:00
|
|
|
osdManager.DestroyPixmap(pixmap);
|
|
|
|
pixmap = osdManager.CreatePixmap(-1, cRect(x0, y0, viewportHeight, geoManager.rowHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
} else {
|
2013-12-21 11:25:03 +01:00
|
|
|
pixmap->SetViewPort(cRect(x0, y0, viewportHeight, geoManager.rowHeight));
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::setText() {
|
2019-07-11 11:28:11 +02:00
|
|
|
if (config.displayMode == eVertical) {
|
2013-12-21 11:25:03 +01:00
|
|
|
text->Set(*strText, fontManager.FontGrid, geoManager.colWidth-2*borderWidth);
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::drawText() {
|
2013-05-28 17:06:53 +02:00
|
|
|
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
|
2014-01-29 17:38:51 +01:00
|
|
|
tColor colorTextBack;
|
2019-07-11 11:28:11 +02:00
|
|
|
if (config.style == eStyleFlat)
|
2014-01-29 17:38:51 +01:00
|
|
|
colorTextBack = color;
|
2019-07-11 11:28:11 +02:00
|
|
|
else if (config.style == eStyleGraphical)
|
2014-01-29 17:38:51 +01:00
|
|
|
colorTextBack = (active)?theme.Color(clrGridActiveFontBack):theme.Color(clrGridFontBack);
|
|
|
|
else
|
|
|
|
colorTextBack = clrTransparent;
|
2019-07-11 11:28:11 +02:00
|
|
|
if (config.displayMode == eVertical) {
|
2013-12-21 11:25:03 +01:00
|
|
|
if (Height()/geoManager.minutePixel < 6)
|
2013-05-24 16:23:23 +02:00
|
|
|
return;
|
2013-12-21 11:25:03 +01:00
|
|
|
int textHeight = fontManager.FontGrid->Height();
|
2013-05-24 16:23:23 +02:00
|
|
|
int textLines = text->Lines();
|
|
|
|
for (int i=0; i<textLines; i++) {
|
2013-12-21 11:25:03 +01:00
|
|
|
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid);
|
2013-05-24 16:23:23 +02:00
|
|
|
|
|
|
|
}
|
2019-07-11 11:28:11 +02:00
|
|
|
} else if (config.displayMode == eHorizontal) {
|
2013-12-21 11:25:03 +01:00
|
|
|
if (Width()/geoManager.minutePixel < 10) {
|
|
|
|
int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
|
|
|
|
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal);
|
2013-05-26 17:11:36 +02:00
|
|
|
return;
|
|
|
|
}
|
2013-12-21 11:25:03 +01:00
|
|
|
int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2;
|
|
|
|
pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, fontManager.FontGridHorizontal);
|
2013-05-24 16:23:23 +02:00
|
|
|
}
|
2013-05-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
cString cDummyGrid::getText(void) {
|
|
|
|
return strText;
|
|
|
|
}
|
|
|
|
|
|
|
|
cString cDummyGrid::getTimeString(void) {
|
|
|
|
return cString::sprintf("%s - %s", *TimeString(start), *TimeString(end));
|
|
|
|
}
|
|
|
|
|
|
|
|
void cDummyGrid::debug() {
|
2013-05-26 11:38:05 +02:00
|
|
|
esyslog("tvguide dummygrid: %s: %s, %s, viewportHeight: %d px, Duration: %ld min, active: %d",
|
2013-05-20 11:37:37 +02:00
|
|
|
column->Name(),
|
2019-07-11 14:34:31 +02:00
|
|
|
*cTimeManager::printTime(start),
|
|
|
|
*cTimeManager::printTime(end),
|
2013-05-20 11:37:37 +02:00
|
|
|
viewportHeight,
|
|
|
|
Duration()/60,
|
|
|
|
active);
|
2019-07-11 11:07:13 +02:00
|
|
|
}
|