From 69e478c1955249c92f6583cc7ef420ec8e512bd9 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 10 Apr 2017 10:26:21 +0200 Subject: [PATCH] - epgplus: fix text offsets in secontary timeline --- src/gui/epgplus.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index e4d4072c6..f402b687d 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -220,21 +220,25 @@ void EpgPlus::TimeLine::paintMark(time_t _startTime, int pduration, int px, int this->font->RenderString(px - textWidth - OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), textWidth, timeStr, COL_MENUCONTENT_TEXT); - // display end time after mark + // display end time timeStr = EpgPlus::getTimeString(_startTime + pduration, "%H:%M"); textWidth = font->getRenderWidth(timeStr); + int textX = 0; - if (px + pwidth + textWidth < this->x + this->width) + if (px + pwidth + textWidth + OFFSET_INNER_MIN < this->x + this->width) { - this->font->RenderString(px + pwidth + OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), - textWidth, timeStr, COL_MENUCONTENT_TEXT); + // display end time after mark + textX = px + pwidth + OFFSET_INNER_MIN; } - else if (textWidth < pwidth - OFFSET_INNER_MID) + else if (textWidth < pwidth - 2*OFFSET_INNER_MIN) { - this->font->RenderString(px + pwidth - textWidth - OFFSET_INNER_MIN, this->y + this->font->getHeight() + this->font->getHeight(), - textWidth, timeStr, COL_MENUCONTENTSELECTED_TEXT); + // display end time before mark + textX = px + pwidth - textWidth - OFFSET_INNER_MIN; } + if (textX) + this->font->RenderString(textX, this->y + this->font->getHeight() + this->font->getHeight(), textWidth, timeStr, COL_MENUCONTENT_TEXT); + // paint the separation line if (separationLineThickness > 0) {