diff options
author | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-10-17 13:46:03 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2019-10-19 15:09:59 +0200 |
commit | 3f0bd7501120e3e670fb489ce75826e6881fd654 (patch) | |
tree | e2916a18519170578a4ef3ad914ba90ef1655524 /epggrid.c | |
parent | a711aed1608de564700a1e8ae058a65a2d02ff5c (diff) | |
download | vdr-plugin-tvguide-3f0bd7501120e3e670fb489ce75826e6881fd654.tar.gz vdr-plugin-tvguide-3f0bd7501120e3e670fb489ce75826e6881fd654.tar.bz2 |
Can switch off and optimize diplay time in epggrid "displayMode == Vertical"
Diffstat (limited to 'epggrid.c')
-rw-r--r-- | epggrid.c | 46 |
1 files changed, 25 insertions, 21 deletions
@@ -92,53 +92,57 @@ void cEpgGrid::SetSwitchTimer() { void cEpgGrid::setText() { if (config.displayMode == eVertical) { - cString strText; - strText = cString::sprintf("%s - %s:\n%s", *(event->GetTimeString()), *(event->GetEndTimeString()), event->Title()); - text->Set(*(strText), fontManager.FontGrid, geoManager.colWidth-2*borderWidth); - extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth-2*borderWidth); - } else if (config.displayMode == eHorizontal) { - timeString = cString::sprintf("%s - %s", *(event->GetTimeString()), *(event->GetEndTimeString())); + text->Set(event->Title(), fontManager.FontGrid, geoManager.colWidth - 2 * borderWidth); + extText->Set(event->ShortText(), fontManager.FontGridSmall, geoManager.colWidth - 2 * borderWidth); + } + if (config.showTimeInGrid) { + timeString = cString::sprintf("%s - %s:", *(event->GetTimeString()), *(event->GetEndTimeString())); } } void cEpgGrid::drawText() { - tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont); + tColor colorText = (active) ? theme.Color(clrFontActive) : theme.Color(clrFont); tColor colorTextBack; if (config.style == eStyleFlat) colorTextBack = color; else if (config.style == eStyleGraphical) - colorTextBack = (active)?theme.Color(clrGridActiveFontBack):theme.Color(clrGridFontBack); + colorTextBack = (active) ? theme.Color(clrGridActiveFontBack) : theme.Color(clrGridFontBack); else colorTextBack = clrTransparent; if (config.displayMode == eVertical) { - if (Height()/geoManager.minutePixel < 6) + if (Height() / geoManager.minutePixel < 6) return; int textHeight = fontManager.FontGrid->Height(); + int textHeightSmall = fontManager.FontGridSmall->Height(); int textLines = text->Lines(); - for (int i=0; i<textLines; i++) { - pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid); + int titleY = borderWidth; + if (config.showTimeInGrid) { // mit Zeitangabe im Grid + pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridSmall); + titleY += textHeightSmall; + } + for (int i = 0; i < textLines; i++) { + pixmap->DrawText(cPoint(borderWidth, titleY + i * textHeight), text->GetLine(i), colorText, colorTextBack, fontManager.FontGrid); } int extTextLines = extText->Lines(); - int offset = (textLines+1)*textHeight - 0.5*textHeight; - textHeight = fontManager.FontGridSmall->Height(); - if ((Height()-textHeight-10) > offset) { - for (int i=0; i<extTextLines; i++) { - pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, fontManager.FontGridSmall); + int offset = titleY + (textLines + 0.5) * textHeight; + if ((Height() - textHeightSmall - 10) > offset) { + for (int i = 0; i < extTextLines; i++) { + pixmap->DrawText(cPoint(borderWidth, offset + i * textHeightSmall), extText->GetLine(i), colorText, colorTextBack, fontManager.FontGridSmall); } } } else if (config.displayMode == eHorizontal) { - if (Width()/geoManager.minutePixel < 10) { - int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; + if (Width() / geoManager.minutePixel < 10) { + int titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height()) / 2; pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, fontManager.FontGridHorizontal); return; } cString strTitle = CutText(event->Title(), viewportHeight, fontManager.FontGridHorizontal).c_str(); int titleY = 0; - if (config.showTimeInGrid) { + if (config.showTimeInGrid) { // mit Zeitangabe im Grid pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, fontManager.FontGridHorizontalSmall); - titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height())/2; + titleY = fontManager.FontGridHorizontalSmall->Height() + (geoManager.rowHeight - fontManager.FontGridHorizontalSmall->Height() - fontManager.FontGridHorizontal->Height()) / 2; } else { - titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height())/2; + titleY = (geoManager.rowHeight - fontManager.FontGridHorizontal->Height()) / 2; } pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, fontManager.FontGridHorizontal); } |