- epgplus: replace timeline fonts with FONT_TYPE_EPG_DATE

This commit is contained in:
vanhofen
2017-04-08 14:11:27 +02:00
committed by svenhoefer
parent 6f62ccfc1a
commit 13b957204f
2 changed files with 22 additions and 29 deletions

View File

@@ -72,8 +72,6 @@ int EpgPlus::channelsTableWidth = 0;
static EpgPlus::FontSetting fontSettingTable[] = static EpgPlus::FontSetting fontSettingTable[] =
{ {
{ EpgPlus::EPGPlus_timeline_fonttime, "Bold", 16 },
{ EpgPlus::EPGPlus_timeline_fontdate, "Bold", 14 },
{ EpgPlus::EPGPlus_channelentry_font, "Bold", 16 }, { EpgPlus::EPGPlus_channelentry_font, "Bold", 16 },
{ EpgPlus::EPGPlus_channelevententry_font, "Regular", 16 }, { EpgPlus::EPGPlus_channelevententry_font, "Regular", 16 },
{ EpgPlus::EPGPlus_footer_fontbouquetchannelname, "Bold", 24 }, { EpgPlus::EPGPlus_footer_fontbouquetchannelname, "Bold", 24 },
@@ -124,8 +122,7 @@ int EpgPlus::Header::getUsedHeight()
return font->getHeight(); return font->getHeight();
} }
Font *EpgPlus::TimeLine::fontTime = NULL; Font *EpgPlus::TimeLine::font = NULL;
Font *EpgPlus::TimeLine::fontDate = NULL;
EpgPlus::TimeLine::TimeLine(CFrameBuffer * pframeBuffer, int px, int py, int pwidth, int pstartX, int pdurationX) EpgPlus::TimeLine::TimeLine(CFrameBuffer * pframeBuffer, int px, int py, int pwidth, int pstartX, int pdurationX)
{ {
@@ -139,8 +136,7 @@ EpgPlus::TimeLine::TimeLine(CFrameBuffer * pframeBuffer, int px, int py, int pwi
void EpgPlus::TimeLine::init() void EpgPlus::TimeLine::init()
{ {
fontTime = fonts[EPGPlus_timeline_fonttime]; font = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE];
fontDate = fonts[EPGPlus_timeline_fontdate];
} }
EpgPlus::TimeLine::~TimeLine() EpgPlus::TimeLine::~TimeLine()
@@ -160,10 +156,10 @@ void EpgPlus::TimeLine::paint(time_t _startTime, int pduration)
bool toggleColor = false; bool toggleColor = false;
// display date of begin // display date of begin
this->frameBuffer->paintBoxRel(this->x, this->y, this->width, this->fontTime->getHeight(), this->frameBuffer->paintBoxRel(this->x, this->y, this->width, this->font->getHeight(),
toggleColor ? COL_MENUCONTENT_PLUS_2 : COL_MENUCONTENT_PLUS_1); toggleColor ? COL_MENUCONTENT_PLUS_2 : COL_MENUCONTENT_PLUS_1);
this->fontDate->RenderString(this->x + 4, this->y + this->fontDate->getHeight(), this->font->RenderString(this->x + 4, this->y + this->font->getHeight(),
this->width, EpgPlus::getTimeString(_startTime, "%d-%b") , COL_MENUCONTENT_TEXT); this->width, EpgPlus::getTimeString(_startTime, "%d-%b") , COL_MENUCONTENT_TEXT);
// paint ticks // paint ticks
@@ -173,19 +169,19 @@ void EpgPlus::TimeLine::paint(time_t _startTime, int pduration)
if (xPos + xWidth > this->x + width) if (xPos + xWidth > this->x + width)
xWidth = this->x + width - xPos; xWidth = this->x + width - xPos;
this->frameBuffer->paintBoxRel(xPos, this->y, xWidth, this->fontTime->getHeight(), this->frameBuffer->paintBoxRel(xPos, this->y, xWidth, this->font->getHeight(),
toggleColor ? COL_MENUCONTENT_PLUS_1 : COL_MENUCONTENT_PLUS_2); toggleColor ? COL_MENUCONTENT_PLUS_1 : COL_MENUCONTENT_PLUS_2);
std::string timeStr = EpgPlus::getTimeString(tickTime, "%H"); std::string timeStr = EpgPlus::getTimeString(tickTime, "%H");
int textWidth = this->fontTime->getRenderWidth(timeStr); int textWidth = this->font->getRenderWidth(timeStr);
this->fontTime->RenderString(xPos - textWidth - 4, this->y + this->fontTime->getHeight(), this->font->RenderString(xPos - textWidth - 4, this->y + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENT_TEXT); textWidth, timeStr, COL_MENUCONTENT_TEXT);
timeStr = EpgPlus::getTimeString(tickTime, "%M"); timeStr = EpgPlus::getTimeString(tickTime, "%M");
textWidth = this->fontTime->getRenderWidth(timeStr); textWidth = this->font->getRenderWidth(timeStr);
this->fontTime->RenderString(xPos + 4, this->y + this->fontTime->getHeight(), this->font->RenderString(xPos + 4, this->y + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENT_TEXT); textWidth, timeStr, COL_MENUCONTENT_TEXT);
toggleColor = !toggleColor; toggleColor = !toggleColor;
@@ -201,7 +197,7 @@ void EpgPlus::TimeLine::paintGrid()
for (int i = 0; i < numberOfTicks; ++i, xPos += tickDist) for (int i = 0; i < numberOfTicks; ++i, xPos += tickDist)
{ {
// display a line for the tick // display a line for the tick
this->frameBuffer->paintVLineRel(xPos, this->y, this->fontTime->getHeight(), COL_MENUCONTENT_PLUS_5); this->frameBuffer->paintVLineRel(xPos, this->y, this->font->getHeight(), COL_MENUCONTENT_PLUS_5);
} }
} }
@@ -211,41 +207,41 @@ void EpgPlus::TimeLine::paintMark(time_t _startTime, int pduration, int px, int
this->clearMark(); this->clearMark();
// paint new mark // paint new mark
this->frameBuffer->paintBoxRel(px, this->y + this->fontTime->getHeight(), this->frameBuffer->paintBoxRel(px, this->y + this->font->getHeight(),
pwidth, this->fontTime->getHeight() , COL_MENUCONTENTSELECTED_PLUS_0); pwidth, this->font->getHeight() , COL_MENUCONTENTSELECTED_PLUS_0);
// display start time before mark // display start time before mark
std::string timeStr = EpgPlus::getTimeString(_startTime, "%H:%M"); std::string timeStr = EpgPlus::getTimeString(_startTime, "%H:%M");
int textWidth = this->fontTime->getRenderWidth(timeStr); int textWidth = this->font->getRenderWidth(timeStr);
this->fontTime->RenderString(px - textWidth, this->y + this->fontTime->getHeight() + this->fontTime->getHeight(), this->font->RenderString(px - textWidth, this->y + this->font->getHeight() + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENT_TEXT); textWidth, timeStr, COL_MENUCONTENT_TEXT);
// display end time after mark // display end time after mark
timeStr = EpgPlus::getTimeString(_startTime + pduration, "%H:%M"); timeStr = EpgPlus::getTimeString(_startTime + pduration, "%H:%M");
textWidth = fontTime->getRenderWidth(timeStr); textWidth = font->getRenderWidth(timeStr);
if (px + pwidth + textWidth < this->x + this->width) if (px + pwidth + textWidth < this->x + this->width)
{ {
this->fontTime->RenderString(px + pwidth, this->y + this->fontTime->getHeight() + this->fontTime->getHeight(), this->font->RenderString(px + pwidth, this->y + this->font->getHeight() + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENT_TEXT); textWidth, timeStr, COL_MENUCONTENT_TEXT);
} }
else if (textWidth < pwidth - 10) else if (textWidth < pwidth - 10)
{ {
this->fontTime->RenderString(px + pwidth - textWidth, this->y + this->fontTime->getHeight() + this->fontTime->getHeight(), this->font->RenderString(px + pwidth - textWidth, this->y + this->font->getHeight() + this->font->getHeight(),
textWidth, timeStr, COL_MENUCONTENTSELECTED_TEXT); textWidth, timeStr, COL_MENUCONTENTSELECTED_TEXT);
} }
} }
void EpgPlus::TimeLine::clearMark() void EpgPlus::TimeLine::clearMark()
{ {
this->frameBuffer->paintBoxRel(this->x, this->y + this->fontTime->getHeight(), this->frameBuffer->paintBoxRel(this->x, this->y + this->font->getHeight(),
this->width, this->fontTime->getHeight() , COL_MENUCONTENT_PLUS_0); this->width, this->font->getHeight() , COL_MENUCONTENT_PLUS_0);
} }
int EpgPlus::TimeLine::getUsedHeight() int EpgPlus::TimeLine::getUsedHeight()
{ {
return std::max(fontDate->getHeight(), fontTime->getHeight()) + fontTime->getHeight(); return 2*font->getHeight();
} }
Font *EpgPlus::ChannelEventEntry::font = NULL; Font *EpgPlus::ChannelEventEntry::font = NULL;

View File

@@ -41,9 +41,7 @@ class EpgPlus
public: public:
enum FontSettingID enum FontSettingID
{ {
EPGPlus_timeline_fonttime = 0, EPGPlus_channelentry_font = 0,
EPGPlus_timeline_fontdate,
EPGPlus_channelentry_font,
EPGPlus_channelevententry_font, EPGPlus_channelevententry_font,
EPGPlus_footer_fontbouquetchannelname, EPGPlus_footer_fontbouquetchannelname,
EPGPlus_footer_fonteventdescription, EPGPlus_footer_fonteventdescription,
@@ -154,8 +152,7 @@ class EpgPlus
int y; int y;
int width; int width;
static Font* fontTime; static Font* font;
static Font* fontDate;
int startX; int startX;
int durationX; int durationX;