From 3f0bd7501120e3e670fb489ce75826e6881fd654 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 17 Oct 2019 13:46:03 +0200 Subject: [PATCH] Can switch off and optimize diplay time in epggrid "displayMode == Vertical" --- epggrid.c | 46 +++++++++++++++++++++++++--------------------- setup.c | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/epggrid.c b/epggrid.c index 8a88b24..a67188c 100644 --- a/epggrid.c +++ b/epggrid.c @@ -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; iDrawText(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; iDrawText(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); } diff --git a/setup.c b/setup.c index bbd2207..6bb040c 100644 --- a/setup.c +++ b/setup.c @@ -275,8 +275,8 @@ void cMenuSetupScreenLayout::Set(void) { Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Width of Channel Header (Perc. of osd width)")), &tmpConfig->channelHeaderWidthPercent, 5, 30)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Height of Timeline (Perc. of osd height)")), &tmpConfig->timeLineHeightPercent, 5, 30)); Add(new cMenuEditIntItem(*cString::sprintf("%s%s", *indent, tr("Number of Channels to display")), &tmpConfig->channelRows, 3, 12)); - Add(new cMenuEditBoolItem(*cString::sprintf("%s%s", *indent, tr("Display time in EPG Grids")), &tmpConfig->showTimeInGrid)); } + Add(new cMenuEditBoolItem(tr("Display time in EPG Grids"), &tmpConfig->showTimeInGrid)); Add(new cMenuEditIntItem(tr("Height of Headers (Status Header and EPG View, Perc. of osd height)"), &tmpConfig->headerHeightPercent, 10, 50)); Add(new cMenuEditIntItem(tr("Height of Footer (Perc. of osd height)"), &tmpConfig->footerHeightPercent, 3, 20));