channellist: try to fix right status-icon alignment

Origin commit data
------------------
Branch: ni/coolstream
Commit: 6b4ef6d3f8
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-12-12 (Mon, 12 Dec 2016)

Origin message was:
------------------
- channellist: try to fix right status-icon alignment

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-12-12 08:30:22 +01:00
parent 4164c31d7b
commit df6fc8313f
2 changed files with 93 additions and 68 deletions

View File

@@ -525,26 +525,6 @@ void CChannelList::calcSize()
else
pig_height = 0;
infozone_height = height - theight - pig_height - footerHeight;
ChannelList_Rec = 0;
int icon_w, h;
int recmode_icon_max = 0;
frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &h);
recmode_icon_max = std::max(recmode_icon_max, icon_w);
frameBuffer->getIconSize(NEUTRINO_ICON_AUTO_SHIFT, &icon_w, &h);
recmode_icon_max = std::max(recmode_icon_max, icon_w);
frameBuffer->getIconSize(NEUTRINO_ICON_PIP, &icon_w, &h);
recmode_icon_max = std::max(recmode_icon_max, icon_w);
for (uint32_t i = 0; i < (*chanlist).size(); i++) {
if (CRecordManager::getInstance()->GetRecordMode((*chanlist)[i]->getChannelID()) ||
(*chanlist)[i]->getChannelID() == CZapit::getInstance()->GetPipChannelID()) {
ChannelList_Rec = recmode_icon_max;
break;
}
}
if (ChannelList_Rec > 0)
ChannelList_Rec += 8;
}
bool CChannelList::updateSelection(int newpos)
@@ -1916,13 +1896,13 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
char nameAndDescription[255];
char tmp[10];
CZapitChannel* chan = (*chanlist)[curr];
int prg_offset=0;
int title_offset=0;
int prg_offset = 0;
int title_offset = 0;
int rec_mode;
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF)
{
prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00");
title_offset=6;
title_offset = OFFSET_INNER_SMALL;
}
snprintf(tmp, sizeof(tmp), "%d", this->historyMode ? pos : chan->number);
@@ -1937,52 +1917,99 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
rec_mode = CRecordManager::getInstance()->GetRecordMode((*chanlist)[curr]->getChannelID());
//set recording icon
std::string rec_icon;
const char *record_icon = NULL;
if (rec_mode & CRecordManager::RECMODE_REC)
rec_icon = NEUTRINO_ICON_REC;
record_icon = NEUTRINO_ICON_REC;
else if (rec_mode & CRecordManager::RECMODE_TSHIFT)
rec_icon = NEUTRINO_ICON_AUTO_SHIFT;
record_icon = NEUTRINO_ICON_AUTO_SHIFT;
//set pip icon
const char *pip_icon = NULL;
#ifdef ENABLE_PIP
else if ((*chanlist)[curr]->getChannelID() == CZapit::getInstance()->GetPipChannelID())
rec_icon = NEUTRINO_ICON_PIP;
if ((*chanlist)[curr]->getChannelID() == CZapit::getInstance()->GetPipChannelID())
pip_icon = NEUTRINO_ICON_PIP;
#endif
//calculating icons
bool isWebTV = !chan->getUrl().empty();
const char *icon = isWebTV ? NEUTRINO_ICON_STREAMING : NEUTRINO_ICON_SCRAMBLED;
int icon_x = (x+width-15-2) - RADIUS_LARGE/2;
int r_icon_w; int s_icon_h=0; int s_icon_w=0;
frameBuffer->getIconSize(icon, &s_icon_w, &s_icon_h);
r_icon_w = ChannelList_Rec;
int r_icon_x = icon_x;
//paint icon
if(chan->scrambled || isWebTV)
if (frameBuffer->paintIcon(icon, icon_x - s_icon_w, ypos, fheight))//ypos + (fheight - 16)/2);
r_icon_x = r_icon_x - s_icon_w;
//set webtv icon
const char *webtv_icon = NULL;
if (!chan->getUrl().empty())
webtv_icon = NEUTRINO_ICON_STREAMING;
//paint recording icon
if (!rec_icon.empty())
frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2);
//set scramble icon
const char *scramble_icon = NULL;
if (chan->scrambled)
scramble_icon = NEUTRINO_ICON_SCRAMBLED;
//calculate and paint right status icons
int icon_w = 0;
int icon_h = 0;
int offset_right = OFFSET_INNER_MID;
int icon_x_right = x + width - 15 - offset_right;
if (scramble_icon)
{
frameBuffer->getIconSize(scramble_icon, &icon_w, &icon_h);
if (frameBuffer->paintIcon(scramble_icon, icon_x_right - icon_w, ypos, fheight))
{
offset_right += icon_w + OFFSET_INNER_MID;
icon_x_right -= icon_w + OFFSET_INNER_MID;
}
}
if (webtv_icon)
{
frameBuffer->getIconSize(webtv_icon, &icon_w, &icon_h);
if (frameBuffer->paintIcon(webtv_icon, icon_x_right - icon_w, ypos, fheight))
{
offset_right += icon_w + OFFSET_INNER_MID;
icon_x_right -= icon_w + OFFSET_INNER_MID;
}
}
if (pip_icon)
{
frameBuffer->getIconSize(pip_icon, &icon_w, &icon_h);
if (frameBuffer->paintIcon(pip_icon, icon_x_right - icon_w, ypos, fheight))
{
offset_right += icon_w + OFFSET_INNER_MID;
icon_x_right -= icon_w + OFFSET_INNER_MID;
}
}
if (record_icon)
{
frameBuffer->getIconSize(record_icon, &icon_w, &icon_h);
if (frameBuffer->paintIcon(record_icon, icon_x_right - icon_w, ypos, fheight))
{
offset_right += icon_w + OFFSET_INNER_MID;
icon_x_right -= icon_w + OFFSET_INNER_MID;
}
}
//paint buttons
if (paintbuttons)
paintButtonBar(is_available);
int icon_space = r_icon_w+s_icon_w;
//channel numbers
int icon_w = 0, icon_h = 0;
if (curr == selected && move_state == beMoving) {
if (curr == selected && move_state == beMoving)
{
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5 + numwidth - icon_w, ypos, fheight);
} else if (edit_state && chan->bLocked) {
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight);
}
else if (edit_state && chan->bLocked)
{
frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icon_w, &icon_h);
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 5 + numwidth - icon_w, ypos, fheight);
} else if (g_settings.channellist_show_numbers) {
int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight);
} else if (!edit_state)
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_SMALL + numwidth - icon_w, ypos, fheight);
}
else if (g_settings.channellist_show_numbers)
{
int numpos = x + OFFSET_INNER_SMALL + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + fheight, numwidth + 5, tmp, color, fheight);
}
else if (!edit_state)
{
numwidth = -5;
}
int l=0;
if (this->historyMode)
@@ -1992,7 +2019,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
int pb_space = prg_offset - title_offset;
int pb_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getDigitHeight();
CProgressBar pb(x+5+numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0);
CProgressBar pb(x + OFFSET_INNER_SMALL + numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0);
pb.setType(CProgressBar::PB_TIMESCALE);
pb.setDesign(g_settings.channellist_progressbar_design);
pb.setCornerType(0);
@@ -2007,14 +2034,13 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
pb.doPaintBg(false);
int pb_max = pb_space - 4;
if (!(p_event->description.empty())) {
if (!(p_event->description.empty()))
{
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_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description);
int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 20; // 15 = scrollbar, 20 = spaces
if (chan->scrambled || g_settings.channellist_epgtext_align_right)
max_desc_len -= icon_space+g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getWidth(); /* do we need space for the lock/rec icon? */
int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 2*OFFSET_INNER_MID - offset_right; // 15 = scrollbar
if (max_desc_len < 0)
max_desc_len = 0;
@@ -2027,7 +2053,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
struct tm *pStartZeit = localtime(&p_event->startTime);
snprintf(tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ 5+ numwidth+ 6, ypos + fheight, width- numwidth- 20- 15 -prg_offset, tmp, ecolor, fheight);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_SMALL + numwidth + 6, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight);
}
else
{
@@ -2044,18 +2070,20 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
}
}
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10+prg_offset, ypos+ fheight, width- numwidth- 40- 15-prg_offset, nameAndDescription, color);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color);
if (g_settings.channellist_epgtext_align_right) {
// align right
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 20 - ch_desc_len - icon_space - 4, ypos + fheight, ch_desc_len, p_event->description, ecolor);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 15 - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor);
}
else {
// align left
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ 5+ numwidth+ 10+ ch_name_len+ 5+prg_offset, ypos+ fheight, ch_desc_len, p_event->description, ecolor);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + ch_name_len + OFFSET_INNER_SMALL + prg_offset, ypos + fheight, ch_desc_len, p_event->description, ecolor);
}
}
else {
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) {
else
{
if (g_settings.channellist_progressbar_design != CProgressBar::PB_OFF)
{
pb.setValues(0, pb_max);
pb.paint();
}