channellist: fix display of very long channelnames

Origin commit data
------------------
Branch: ni/coolstream
Commit: ff1db4da8b
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-06-26 (Tue, 26 Jun 2018)

Origin message was:
------------------
- channellist: fix display of very long channelnames

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-06-26 00:02:15 +02:00
parent bab8cf8e31
commit d12b8301c7

View File

@@ -2117,14 +2117,20 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
pb.setFrameThickness(pb_frame); pb.setFrameThickness(pb_frame);
pb.doPaintBg(false); pb.doPaintBg(false);
if (!(p_event->description.empty())) if (!p_event->description.empty())
{
snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l, g_settings.channellist_epgtext_align_right ? " " : " - "); snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l, g_settings.channellist_epgtext_align_right ? " " : " - ");
unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription); unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription);
int max_name_len = width - numwidth - prg_offset - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - offset_right;
if (max_name_len < 0)
max_name_len = 0;
if ((int) ch_name_len > max_name_len)
ch_name_len = max_name_len;
if (!p_event->description.empty())
{
unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description); unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description);
int max_desc_len = width - numwidth - prg_offset - ch_name_len - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - offset_right; int max_desc_len = max_name_len - ch_name_len;
if (max_desc_len < 0) if (max_desc_len < 0)
max_desc_len = 0; max_desc_len = 0;
if ((int) ch_desc_len > max_desc_len) if ((int) ch_desc_len > max_desc_len)
@@ -2154,7 +2160,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
} }
} }
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, ch_name_len, nameAndDescription, color);
if (g_settings.channellist_epgtext_align_right) if (g_settings.channellist_epgtext_align_right)
{ {
// align right // align right
@@ -2174,7 +2180,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
pb.paint(); pb.paint();
} }
//name //name
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, ch_name_len, nameAndDescription, color);
} }
if (!firstpaint && curr == selected) if (!firstpaint && curr == selected)
updateVfd(); updateVfd();