From 5350dbb9f1be4625a3322386184e6abab9924e17 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 17 Oct 2016 11:00:18 +0200 Subject: [PATCH 01/17] upnpbrowser: use stopAudio() function; was missing in 1f4372f Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/119cb608cf7529af2b9b0b88c253edd3d607e519 Author: vanhofen Date: 2016-10-17 (Mon, 17 Oct 2016) Origin message was: ------------------ - upnpbrowser: use stopAudio() function; was missing in 1f4372f ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 83f714faf..12362a1c4 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -1306,8 +1306,7 @@ void CUpnpBrowserGui::playVideo(std::string name, std::string url) { CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_ts); - if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) - CAudioPlayer::getInstance()->stop(); + stopAudio(); m_frameBuffer->stopFrame(); CMoviePlayerGui::getInstance().SetFile(name, url); From 79615a5774487ecdd498a52e7436f3bf64b7138e Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 02/17] color: add getItemColors function to simplify color handling Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/56126c6a61144bdbc33e891f518830171b61fa45 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - color: add getItemColors function to simplify color handling ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/color.cpp | 28 ++++++++++++++++++++++++++++ src/gui/color.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/gui/color.cpp b/src/gui/color.cpp index 4b632f3d3..07f0bda01 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -228,3 +228,31 @@ void Rgb2Hsv(RgbColor *rgb, HsvColor *hsv) hsv->s = f_S; hsv->v = f_V; } + +void getItemColors(fb_pixel_t &t, fb_pixel_t &b, bool selected, bool marked, bool switch_background) +{ + if (selected && marked) + { + t = COL_MENUCONTENTSELECTED_TEXT_PLUS_2; + b = COL_MENUCONTENTSELECTED_PLUS_2; + return; + } + + if (selected) + { + t = COL_MENUCONTENTSELECTED_TEXT; + b = COL_MENUCONTENTSELECTED_PLUS_0; + return; + } + + if (marked) + { + t = COL_MENUCONTENT_TEXT_PLUS_2; + b = COL_MENUCONTENT_PLUS_2; + return; + } + + // default + t = COL_MENUCONTENT_TEXT; + b = switch_background ? COL_MENUCONTENTDARK_PLUS_0 : COL_MENUCONTENT_PLUS_0; +} diff --git a/src/gui/color.h b/src/gui/color.h index e707c4318..61305ca4e 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -161,4 +161,6 @@ uint8_t SysColor2Hsv(fb_pixel_t color, HsvColor *hsv); void Hsv2Rgb(HsvColor *hsv, RgbColor *rgb); void Rgb2Hsv(RgbColor *rgb, HsvColor *hsv); +void getItemColors(fb_pixel_t &t, fb_pixel_t &b, bool selected = false, bool marked = false, bool switch_background = false); + #endif From 471e199565634f2054461596a2ab52a240635a1d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 03/17] audioplayer: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3a80241b0cf1444826a5f09ed0fb11102fdfe69f Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - audioplayer: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/audioplayer.cpp | 83 +++++++++++++---------------------------- 1 file changed, 26 insertions(+), 57 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index ebb947153..95d11cbbe 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1485,83 +1485,52 @@ void CAudioPlayerGui::paintItem(int pos) return; int ypos = m_y + m_title_height + m_theight + pos*m_fheight; - int c_rad_small; + unsigned int currpos = m_liststart + pos; + + bool i_selected = currpos == m_selected; + bool i_marked = currpos == (unsigned) m_current; + bool i_switch = false; //(currpos < m_playlist.size()) && (pos & 1); + int i_radius = RADIUS_NONE; + fb_pixel_t color; fb_pixel_t bgcolor; - if ((pos + m_liststart) == m_selected) - { - if ((pos + m_liststart) == (unsigned)m_current) - { - color = COL_MENUCONTENTSELECTED_TEXT_PLUS_2; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_2; - } - else - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } + getItemColors(color, bgcolor, i_selected, i_marked, i_switch); + + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; + + if (i_selected) paintItemID3DetailsLine(pos); - c_rad_small = RADIUS_SMALL; - } - else - { - if (((pos + m_liststart) < m_playlist.size()) && (pos & 1)) - { - if ((pos + m_liststart) == (unsigned)m_current) - { - color = COL_MENUCONTENTDARK_TEXT_PLUS_2; - bgcolor = COL_MENUCONTENTDARK_PLUS_2; - } - else - { - color = COL_MENUCONTENTDARK_TEXT; - bgcolor = COL_MENUCONTENTDARK_PLUS_0; - } - } - else - { - if ((pos + m_liststart) == (unsigned)m_current) - { - color = COL_MENUCONTENT_TEXT_PLUS_2; - bgcolor = COL_MENUCONTENT_PLUS_2; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } - } - c_rad_small = 0; - } - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, COL_MENUCONTENT_PLUS_0); - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, bgcolor, c_rad_small); + if (i_radius) + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, bgcolor, i_radius); - if ((pos + m_liststart) < m_playlist.size()) + if (currpos < m_playlist.size()) { char sNr[20]; - sprintf(sNr, "%2d : ", pos + m_liststart + 1); + sprintf(sNr, "%2d : ", currpos + 1); std::string tmp = sNr; - getFileInfoToDisplay(tmp, m_playlist[pos + m_liststart]); + getFileInfoToDisplay(tmp, m_playlist[currpos]); char dura[9]; if (m_inetmode) - snprintf(dura, 8, "%ldk", m_playlist[pos + m_liststart].MetaData.total_time); + snprintf(dura, 8, "%ldk", m_playlist[currpos].MetaData.total_time); else - snprintf(dura, 8, "%ld:%02ld", m_playlist[pos + m_liststart].MetaData.total_time / 60, - m_playlist[pos + m_liststart].MetaData.total_time % 60); + snprintf(dura, 8, "%ld:%02ld", m_playlist[currpos].MetaData.total_time / 60, + m_playlist[currpos].MetaData.total_time % 60); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(dura) + 5; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos + m_fheight, m_width - 30 - w, tmp, color, m_fheight); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + m_width - 15 - w, ypos + m_fheight, w, dura, color, m_fheight); - if ((pos + m_liststart) == m_selected) + if (currpos == m_selected) { if (m_state == CAudioPlayerGui::STOP) - CVFD::getInstance()->showAudioTrack(m_playlist[pos + m_liststart].MetaData.artist, - m_playlist[pos + m_liststart].MetaData.title, - m_playlist[pos + m_liststart].MetaData.album); + CVFD::getInstance()->showAudioTrack(m_playlist[currpos].MetaData.artist, + m_playlist[currpos].MetaData.title, + m_playlist[currpos].MetaData.album); } } } From e472bfc2e72e35ae8028fd937e8474337ceab922 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 04/17] bouqueteditor_bouquets: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cd20c34e9874d32b5b62460e765b94817f37bb44 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - bouqueteditor_bouquets: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_bouquets.cpp | 36 +++++++++++++++--------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 8d5f5f64c..4138c987d 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -66,27 +66,37 @@ CBEBouquetWidget::CBEBouquetWidget() void CBEBouquetWidget::paintItem(int pos) { - fb_pixel_t color; - fb_pixel_t bgcolor; int ypos = y+ theight+0 + pos*iheight; unsigned int current = liststart + pos; - if (current == selected) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); - } else { + bool i_selected = current == selected; + int i_radius = RADIUS_NONE; + + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected); + + if (i_selected) + { + i_radius = RADIUS_LARGE; + } + else + { bool has_channels = true; if(current < Bouquets->size()) has_channels = (!(*Bouquets)[current]->tvChannels.empty() ) || (!(*Bouquets)[current]->radioChannels.empty()); - color = has_channels ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; - bgcolor = has_channels ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); + + if (!has_channels) + color = COL_MENUCONTENTINACTIVE_TEXT; } - if(current < Bouquets->size()) { - if ((current == selected) && (state == beMoving)) + if (i_radius) + frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + + if (current < Bouquets->size()) { + if ((i_selected) && (state == beMoving)) frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight); if ((*Bouquets)[current]->bHidden) From 49fef416c5b44b353af419b08cd246577ebfc5f0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 05/17] bouqueteditor_channels: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/00a19328333a9ba58f66d8a70a4e4256a1487362 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - bouqueteditor_channels: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_channels.cpp | 42 +++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index c50eebd95..6588801e2 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -94,35 +94,40 @@ CBEChannelWidget::~CBEChannelWidget() void CBEChannelWidget::paintItem(int pos) { - fb_pixel_t color; - fb_pixel_t bgcolor; int ypos = y+ theight+0 + pos*iheight; unsigned int current = liststart + pos; - if(current == selected) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; + bool i_selected = current == selected; + int i_radius = RADIUS_NONE; - if(current < Channels->size()) { - initItem2DetailsLine (pos, current); + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected); + + if (i_selected) + { + if (current < Channels->size()) + { + initItem2DetailsLine(pos, current); paintDetails(current); } - - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); - } else { - if(current < Channels->size() && ((*Channels)[current]->flags & CZapitChannel::NOT_PRESENT )) - color = COL_MENUCONTENTINACTIVE_TEXT;// extra color for channels not found in service - else - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); + i_radius = RADIUS_LARGE; } + else + { + if (current < Channels->size() && ((*Channels)[current]->flags & CZapitChannel::NOT_PRESENT)) + color = COL_MENUCONTENTINACTIVE_TEXT; + } + + if (i_radius) + frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, bgcolor, i_radius); if ((current == selected) && (state == beMoving)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight); } - if(current < Channels->size()) { + if (current < Channels->size()) { if ((*Channels)[current]->bLocked) { frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 22, ypos, iheight); } @@ -133,7 +138,6 @@ void CBEChannelWidget::paintItem(int pos) frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); else if (!(*Channels)[current]->getUrl().empty()) frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x+width- 15 - 28, ypos, fheight); - } } From fce20e73eaba1161ec29a47040d5617cbe8775a8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 06/17] bouqueteditor_chanselect: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2040d7558ac57713930e1d7c09c3f0e1d9880030 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - bouqueteditor_chanselect: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_chanselect.cpp | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 4ec7621fc..91e26dff3 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -106,33 +106,32 @@ bool CBEChannelSelectWidget::hasChanged() void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselected) { int ypos = y+ theight + paintNr*iheight; + int i_radius = RADIUS_NONE; fb_pixel_t color; fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, pselected); + if (pselected) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - - if(itemNr < getItemCount()) { + if (itemNr < getItemCount()) + { initItem2DetailsLine (paintNr, itemNr); paintDetails(itemNr); } - - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); + i_radius = RADIUS_LARGE; } else { if (itemNr < getItemCount() && (Channels[itemNr]->flags & CZapitChannel::NOT_PRESENT)) color = COL_MENUCONTENTINACTIVE_TEXT; - else - color = COL_MENUCONTENT_TEXT; - - bgcolor = COL_MENUCONTENT_PLUS_0; - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); } + if (i_radius) + frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + if(itemNr < getItemCount()) { if( isChannelInBouquet(itemNr)) From 241d45be02600f60eda179c7ea8b5a64cddaaa4a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 07/17] bookmarkmanager: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/89d373ed0578432bad3ad58d217465bcdbdcdfb5 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - bookmarkmanager: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bookmarkmanager.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 57f48fde3..cad6d739d 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -364,25 +364,16 @@ void CBookmarkManager::paintItem(int pos) { int ypos = y+ theight+0 + pos*fheight*2; + unsigned int currpos = liststart + pos; + + bool i_selected = currpos == selected; + bool i_marked = false; + bool i_switch = false; //(currpos < bookmarks.size()) && (pos & 1); + fb_pixel_t color; fb_pixel_t bgcolor; - if (pos & 1) - { - color = COL_MENUCONTENTDARK_TEXT; - bgcolor = COL_MENUCONTENTDARK_PLUS_0; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } - - if (liststart + pos == selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } + getItemColors(color, bgcolor, i_selected, i_marked, i_switch); int real_width=width; if (bookmarks.size()>listmaxshow) @@ -391,14 +382,14 @@ void CBookmarkManager::paintItem(int pos) } frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor); - if (liststart+posRenderString(x+10,ypos+fheight, real_width-10, theBookmark.getName(), color, fheight); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+2*fheight, real_width-10, theBookmark.getUrl(), color, fheight); // LCD Display - if (liststart+pos==selected) + if (i_selected) { CVFD::getInstance()->showMenuText(0, theBookmark.getName(), -1, true); // UTF-8 CVFD::getInstance()->showMenuText(1, theBookmark.getUrl(), -1, true); // UTF-8 From fe1510cc774238b640fc5f34bd8da061791e6454 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:35 +0200 Subject: [PATCH 08/17] bouquetlist: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6f4e7ecda82693119d7847957cd9dcb0501221ea Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - bouquetlist: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bouquetlist.cpp | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index c909a2e00..6570b0cb3 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -617,27 +617,44 @@ void CBouquetList::hide() void CBouquetList::paintItem(int pos) { int ypos = y+ theight+0 + pos*fheight; - fb_pixel_t color; - fb_pixel_t bgcolor; bool iscurrent = true; int npos = liststart + pos; const char * lname = NULL; - if(npos < (int) Bouquets.size()) + bool i_selected = npos == (int) selected; + int i_radius = RADIUS_NONE; + + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected); + + if (i_selected) + i_radius = RADIUS_LARGE; + + if (i_radius) + frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor); + frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, i_radius); + + if (npos < (int) Bouquets.size()) lname = (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bFav) ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : Bouquets[npos]->channelList->getName(); - if (npos == (int) selected) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, RADIUS_LARGE); + if (i_selected) + { if(npos < (int) Bouquets.size()) CVFD::getInstance()->showMenuText(0, lname, -1, true); - } else { + } + else + { if(!favonly && (npos < (int) Bouquets.size())) iscurrent = !Bouquets[npos]->channelList->isEmpty(); - color = iscurrent ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; - bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor); + + if (!iscurrent) + { + //inactive colors? Is this correct? + color = COL_MENUCONTENTINACTIVE_TEXT; + //bgcolor = COL_MENUCONTENTINACTIVE_PLUS_0; + } } if(npos < (int) Bouquets.size()) { From 28aa6ea0827e7707a9f8644d96b1e85f807d72ea Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 09/17] channellist: use getItemColors function; try to cleanup color mess Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c0a4815d428c12c9f8360c524f48941715aa9652 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - channellist: use getItemColors function; try to cleanup color mess ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 67 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 81ced9713..233d4df2b 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1846,12 +1846,9 @@ void CChannelList::paintItem(int pos, const bool firstpaint) return; } int ypos = y+ theight + pos*fheight; - fb_pixel_t color; - fb_pixel_t bgcolor; bool is_available = true; bool paintbuttons = false; unsigned int curr = liststart + pos; - fb_pixel_t c_radius = 0; if (curr < (*chanlist).size()) { @@ -1864,43 +1861,45 @@ void CChannelList::paintItem(int pos, const bool firstpaint) if (selected >= (*chanlist).size()) selected = (*chanlist).size()-1; - unsigned int is_tuned = (getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber() && new_zap_mode != 2 /*active*/); + bool i_selected = curr == selected; + bool i_marked = getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber() && new_zap_mode != 2 /*active*/; + int i_radius = RADIUS_NONE; - if (curr == selected) + fb_pixel_t color; + fb_pixel_t ecolor; // we need one more color for displayNext + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected, i_marked); + ecolor = color; + + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; + + if (i_selected) { - if (is_tuned) - { - color = COL_MENUCONTENTSELECTED_TEXT_PLUS_2; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_2; - } - else - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } paintItem2DetailsLine (pos); paintDetails(curr); paintAdditionals(curr); - c_radius = RADIUS_LARGE; paintbuttons = true; } - else + + if (displayNext) { - if (is_tuned) - { - color = !displayNext ? COL_MENUCONTENT_TEXT_PLUS_2 : COL_MENUCONTENTINACTIVE_TEXT; - bgcolor = !displayNext ? COL_MENUCONTENT_PLUS_2 : COL_MENUCONTENTINACTIVE_PLUS_0; - c_radius = RADIUS_LARGE; - } + /* + I think it's unnecessary to change colors in this case. + The user should know when he has pressed the blue button. + */ + if (g_settings.theme.colored_events_channellist == 2 /* next */) + ecolor = COL_COLORED_EVENTS_TEXT; else - { - color = is_available ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; - bgcolor = is_available ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; - } + ecolor = COL_MENUCONTENTINACTIVE_TEXT; } - if(!firstpaint || (curr == selected) || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()) - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_radius); + if (!is_available) + color = COL_MENUCONTENTINACTIVE_TEXT; + + if (!firstpaint || i_selected || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()) + frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); if(curr < (*chanlist).size()) { char nameAndDescription[255]; @@ -1908,8 +1907,6 @@ void CChannelList::paintItem(int pos, const bool firstpaint) CZapitChannel* chan = (*chanlist)[curr]; int prg_offset=0; int title_offset=0; - fb_pixel_t tcolor=(liststart + pos == selected) ? color : COL_MENUCONTENTINACTIVE_TEXT; - int xtheight=fheight-2; int rec_mode; if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) { @@ -2016,10 +2013,10 @@ void CChannelList::paintItem(int pos, const bool firstpaint) if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) { if(displayNext) { - struct tm *pStartZeit = localtime(&p_event->startTime); + 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+ xtheight, width- numwidth- 20- 15 -prg_offset, tmp, tcolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ 5+ numwidth+ 6, ypos + fheight, width- numwidth- 20- 15 -prg_offset, tmp, ecolor, fheight); } else { @@ -2039,11 +2036,11 @@ 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); 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, (curr == selected)?COL_MENUCONTENTSELECTED_TEXT:(!displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT)); + 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); } 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, (curr == selected)?COL_MENUCONTENTSELECTED_TEXT:(!displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT)); + 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); } } else { From bfb266f0cbe391e1cdad423a8fc167463e9f194d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 10/17] eventlist: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/fcd4246d9a36b8856d6631e40957bfe841f623f7 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - eventlist: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 64 +++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index c3aa1059d..ddb63f8cb 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -710,40 +710,32 @@ CTimerd::CTimerEventTypes CEventList::isScheduled(t_channel_id channel_id, CChan void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) { + int ypos = y+ theight+0 + pos*fheight; + unsigned int currpos = liststart + pos; + + bool i_selected = currpos == selected; + bool i_marked = currpos == current_event; + int i_radius = RADIUS_NONE; + fb_pixel_t color; fb_pixel_t bgcolor; - int ypos = y+ theight+0 + pos*fheight; - unsigned int curpos = liststart + pos; - if(RADIUS_LARGE) - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0, 0); + getItemColors(color, bgcolor, i_selected, i_marked); - if (curpos==selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - else if (curpos == current_event ) - { - color = COL_MENUCONTENT_TEXT_PLUS_1; - bgcolor = COL_MENUCONTENT_PLUS_1; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; - if (!RADIUS_LARGE || (curpos==selected && RADIUS_LARGE) || (curpos==current_event && RADIUS_LARGE)) - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, RADIUS_LARGE); + if (i_radius) + frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, i_radius); - if(curposgetText(CLocaleManager::getWeekday(tmStartZeit)); datetime1_str += strftime(", %H:%M", tmStartZeit); @@ -752,12 +744,12 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) if ( m_showChannel ) // show the channel if we made a event search only (which could be made through all channels ). { - t_channel_id channel = evtlist[curpos].channelID; + t_channel_id channel = evtlist[currpos].channelID; datetime1_str += " "; datetime1_str += CServiceManager::getInstance()->GetServiceName(channel); } - snprintf(tmpstr,sizeof(tmpstr), "[%d %s]", evtlist[curpos].duration / 60, unit_short_minute); + snprintf(tmpstr,sizeof(tmpstr), "[%d %s]", evtlist[currpos].duration / 60, unit_short_minute); duration_str = tmpstr; } @@ -766,7 +758,7 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->RenderString(x+5, ypos+ fheight1+3, fwidth1a, datetime1_str, color); - int seit = ( evtlist[curpos].startTime - time(NULL) ) / 60; + int seit = ( evtlist[currpos].startTime - time(NULL) ) / 60; if ( (seit> 0) && (seit<100) && (!duration_str.empty()) ) { char beginnt[100]; @@ -778,9 +770,9 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // 2nd line // set status icons - t_channel_id channel_tmp = m_showChannel ? evtlist[curpos].channelID : channel_idI; + t_channel_id channel_tmp = m_showChannel ? evtlist[currpos].channelID : channel_idI; int timerID = -1; - CTimerd::CTimerEventTypes etype = isScheduled(channel_tmp, &evtlist[curpos],&timerID); + CTimerd::CTimerEventTypes etype = isScheduled(channel_tmp, &evtlist[currpos],&timerID); const char * icontype = etype == CTimerd::TIMER_ZAPTO ? NEUTRINO_ICON_ZAP : 0; if(etype == CTimerd::TIMER_RECORD){ icontype = NEUTRINO_ICON_REC;// NEUTRINO_ICON_RECORDING_EVENT_MARKER @@ -795,21 +787,21 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) } // detecting timer conflict and set start position of event text depending of possible painted icon - bool conflict = HasTimerConflicts(evtlist[curpos].startTime, evtlist[curpos].duration, &item_event_ID); + bool conflict = HasTimerConflicts(evtlist[currpos].startTime, evtlist[currpos].duration, &item_event_ID); int i2w = 0, i2h; - //printf ("etype %d , conflicts %d -> %s, conflict event_ID %d -> current event_ID %d\n", etype, conflict, evtlist[curpos].description.c_str(), item_event_ID, evtlist[curpos].eventID); + //printf ("etype %d , conflicts %d -> %s, conflict event_ID %d -> current event_ID %d\n", etype, conflict, evtlist[currpos].description.c_str(), item_event_ID, evtlist[currpos].eventID); //TODO: solution for zapto timer events - if (conflict && item_event_ID != evtlist[curpos].eventID) + if (conflict && item_event_ID != evtlist[currpos].eventID) { //paint_warning = true; - frameBuffer->getIconSize(NEUTRINO_ICON_IMPORTANT, &i2w, &i2h); - frameBuffer->paintIcon(NEUTRINO_ICON_IMPORTANT, x+iw+7, ypos + fheight1+3 - (fheight1 - i2h)/2, fheight1); - iw += i2w+4; + frameBuffer->getIconSize(NEUTRINO_ICON_IMPORTANT, &i2w, &i2h); + frameBuffer->paintIcon(NEUTRINO_ICON_IMPORTANT, x+iw+7, ypos + fheight1+3 - (fheight1 - i2h)/2, fheight1); + iw += i2w+4; } // paint 2nd line text - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20 -iw, evtlist[curpos].description, color); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20 -iw, evtlist[currpos].description, color); } } From 4a9f0cad640137d243772c7b3ebcacc64d80bd00 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 11/17] filebrowser: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e9d8ab8a5e37ae44b3ca8185463faa7e8aa2a493 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - filebrowser: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 46 ++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index fdcb88083..0c3e5547e 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1167,38 +1167,32 @@ void CFileBrowser::hide() void CFileBrowser::paintItem(unsigned int pos) { int colwidth1, colwidth2, colwidth3; - int c_rad_small = 0; - fb_pixel_t color; - fb_pixel_t bgcolor; int ypos = y+ theight+0 + pos*fheight; CFile * actual_file = NULL; std::string fileicon; - unsigned int curr = liststart + pos; + unsigned int currpos = liststart + pos; - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0/*DARK*/); - - if (curr >= filelist.size()) + if (currpos >= filelist.size()) return; - actual_file = &filelist[curr]; - if (curr == selected) - { - color = actual_file->Marked ? COL_MENUCONTENTINACTIVE_TEXT : COL_MENUCONTENTSELECTED_TEXT; - bgcolor = actual_file->Marked ? COL_MENUCONTENTSELECTED_PLUS_2 : COL_MENUCONTENTSELECTED_PLUS_0; - c_rad_small = RADIUS_SMALL; - } - else if (actual_file->Marked) - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_2; - } - else - { - color = COL_MENUCONTENT_TEXT;//DARK; - bgcolor = COL_MENUCONTENT_PLUS_0;//DARK; - } + actual_file = &filelist[currpos]; - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_rad_small); + bool i_selected = currpos == selected; + bool i_marked = actual_file->Marked; + bool i_switch = false; //(currpos < filelist.size()) && (pos & 1); + int i_radius = RADIUS_NONE; + + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected, i_marked, i_switch); + + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; + + if (i_radius) + frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) colwidth2 = 0; @@ -1209,7 +1203,7 @@ void CFileBrowser::paintItem(unsigned int pos) if ( !actual_file->Name.empty() ) { - if (curr == selected) + if (currpos == selected) CVFD::getInstance()->showMenuText(0, FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()).c_str(), -1, true); // UTF-8 switch(actual_file->getType()) From 1494a8d93ec03d64f4546ee602b15b968767e5ae Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 12/17] pictureviewer: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7f23b1ca388bef2791a91de0351a414f8faf4bf8 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - pictureviewer: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/pictureviewer.cpp | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 3c8b421bd..dc4344012 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -668,36 +668,33 @@ void CPictureViewerGui::paintItem(int pos) // printf("paintItem{\n"); int ypos = y+ theight + 0 + pos*fheight; + unsigned int currpos = liststart + pos; + + bool i_selected = currpos == selected; + bool i_marked = false; + bool i_switch = false; //(currpos < playlist.size()) && (pos & 1); + int i_radius = RADIUS_NONE; + fb_pixel_t color; fb_pixel_t bgcolor; - if ((liststart+pos < playlist.size()) && (pos & 1) ) - { - color = COL_MENUCONTENTDARK_TEXT; - bgcolor = COL_MENUCONTENTDARK_PLUS_0; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } + getItemColors(color, bgcolor, i_selected, i_marked, i_switch); - if (liststart+pos == selected) - { - frameBuffer->paintBoxRel(x,ypos, width-15, fheight, bgcolor); - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; - frameBuffer->paintBoxRel(x, ypos, width-15, fheight, bgcolor, liststart+pos == selected ? RADIUS_LARGE : 0); - if (liststart+pospaintBoxRel(x, ypos, width - 15, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - 15, fheight, bgcolor, i_radius); + + if (currpos < playlist.size()) { - std::string tmp = playlist[liststart+pos].Name; + std::string tmp = playlist[currpos].Name; tmp += " ("; - tmp += playlist[liststart+pos].Type; + tmp += playlist[currpos].Type; tmp += ')'; char timestring[18]; - strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[liststart+pos].Date)); + strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[currpos].Date)); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(timestring); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, width-30 - w, tmp, color, fheight); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+width-20-w,ypos+fheight, w, timestring, color, fheight); From 21e30c43f43149e9d8719aca5362905552e070fe Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 13/17] timerlist: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a38158919d1966a1cb0da6863267c148f0349054 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - timerlist: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 02c54b7fc..8ba90569f 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -659,36 +659,36 @@ void CTimerList::paintItem(int pos) { int ypos = y+ theight+ pos*fheight*2; - fb_pixel_t color; - fb_pixel_t bgcolor; - int real_width=width; if (timerlist.size() > listmaxshow) { real_width-=15; //scrollbar } - color = COL_MENUCONTENT_TEXT; - if (pos & 1) - bgcolor = COL_MENUCONTENT_PLUS_1; - else - bgcolor = COL_MENUCONTENT_PLUS_0; + unsigned int currpos = liststart + pos; + + bool i_selected = currpos == (unsigned) selected; + bool i_marked = false; + bool i_switch = false; //pos & 1; + int i_radius = RADIUS_NONE; + + fb_pixel_t color; + fb_pixel_t bgcolor; + + getItemColors(color, bgcolor, i_selected, i_marked, i_switch); + + if (i_selected || i_marked) + i_radius = RADIUS_LARGE; + + if (i_radius) + frameBuffer->paintBoxRel(x, ypos, real_width, 2*fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, real_width, 2*fheight, bgcolor, i_radius); //shadow frameBuffer->paintBoxRel(x + width, ypos, OFFSET_SHADOW, 2*fheight, COL_SHADOW_PLUS_0); - //item - frameBuffer->paintBoxRel(x, ypos, real_width, 2*fheight, bgcolor); - if (liststart + pos == selected) + if (currpos < timerlist.size()) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - //selected item - frameBuffer->paintBoxRel(x,ypos, real_width, 2*fheight, bgcolor, RADIUS_MID); - - if (liststart + pos < (int)timerlist.size()) - { - CTimerd::responseGetTimer & timer = timerlist[liststart+pos]; + CTimerd::responseGetTimer & timer = timerlist[currpos]; char zAlarmTime[25] = {0}; struct tm *alarmTime = localtime(&(timer.alarmTime)); strftime(zAlarmTime,20,"%d.%m. %H:%M",alarmTime); @@ -802,7 +802,7 @@ void CTimerList::paintItem(int pos) } g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+fw*13,ypos+2*fheight, real_width-(fw*13+5), zAddData, color, fheight); // LCD Display - if (liststart+pos==selected) + if (currpos == (unsigned) selected) { std::string line1 = convertTimerType2String(timer.eventType); // UTF-8 //std::string line2 = zAlarmTime; From 5fd0187ecc1a893337d2901f90fbb8e251ab4b85 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 14/17] upnpbrowser: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d1eb35569e3c79c016aa4b8e0e8039cb5894adce Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - upnpbrowser: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 48 ++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 12362a1c4..3a5ba2982 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -949,22 +949,25 @@ void CUpnpBrowserGui::paintDeviceInfo() void CUpnpBrowserGui::paintDevice(unsigned int _pos) { int ypos = m_item_y + _pos*m_item_height; + unsigned int pos = m_deviceliststart + _pos; + + bool i_selected = pos == m_selecteddevice; + int i_radius = RADIUS_NONE; + fb_pixel_t color; fb_pixel_t bgcolor; - unsigned int pos = m_deviceliststart + _pos; - if (pos == m_selecteddevice) + getItemColors(color, bgcolor, i_selected); + + if (i_selected) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; paintDeviceInfo(); + i_radius = RADIUS_LARGE; } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor); + + if (i_radius) + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor, i_radius); if (pos >= m_devices.size()) return; @@ -1018,27 +1021,28 @@ void CUpnpBrowserGui::paintDevices() void CUpnpBrowserGui::paintItem(std::vector *entries, unsigned int pos, unsigned int selected) { int ypos = m_item_y + pos*m_item_height; + + bool i_selected = pos == selected; + int i_radius = RADIUS_NONE; + fb_pixel_t color; fb_pixel_t bgcolor; - if (pos == selected) - { - color = COL_MENUCONTENT_TEXT_PLUS_2; - bgcolor = COL_MENUCONTENT_PLUS_2; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor); + getItemColors(color, bgcolor, i_selected); + + if (i_selected) + i_radius = RADIUS_LARGE; + + if (i_radius) + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor, i_radius); if (pos >= (*entries).size()) return; UPnPEntry *entry = &(*entries)[pos]; - if (pos == selected) + if (i_selected) { paintItemInfo(entry); paintDetails(entry); From c0e4ec5e879a89ca22a70d4e018c685d5581159b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 15/17] keyboard_input: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a5c9602e4ba59c934018a4612adb8b5c4387e19e Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - keyboard_input: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/keyboard_input.cpp | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index c3b762e46..72cd73dfc 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -715,19 +715,10 @@ void CKeyboardInput::paintChar(int pos, std::string &c) fb_pixel_t color; fb_pixel_t bgcolor; - if (pos == selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } + getItemColors(color, bgcolor, pos == selected); - frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2); - frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor); + frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor); + frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2); int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(c); int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0); @@ -749,17 +740,14 @@ void CKeyboardInput::paintKey(int row, int column) //key_y = y+ hheight+ offset+ input_h+ offset; int ypos = key_y + (key_h + KEY_BORDER)*row; + int i_selected = (focus == FOCUS_KEY && row == srow && column == scol); + fb_pixel_t color; fb_pixel_t bgcolor; - if (focus == FOCUS_KEY && row == srow && column == scol) { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } else { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } - int radius = CORNER_RADIUS_SMALL; + getItemColors(color, bgcolor, i_selected); + + int radius = RADIUS_SMALL; frameBuffer->paintBoxRel(xpos, ypos, key_w, key_h, bgcolor, radius); frameBuffer->paintBoxFrame(xpos, ypos, key_w, key_h, KEY_FRAME_WIDTH, COL_FRAME_PLUS_0, radius); From aeb93665e9222cdfb32849d3ef6fce3700c2e8a6 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 16/17] stringinput: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7cdb8a04254399d0e8c942da83bf38d1c0613146 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - stringinput: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/stringinput.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 5863d89f7..b47a99c4e 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -601,19 +601,10 @@ void CStringInput::paintChar(int pos, const char c) fb_pixel_t color; fb_pixel_t bgcolor; - if (pos == selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } + getItemColors(color, bgcolor, pos == selected); - frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2); - frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor); + frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor); + frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2); int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch); int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0); From b2facb1e28c4a0cbd65251b2321d7d2e5cf653e8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 19 Oct 2016 10:06:36 +0200 Subject: [PATCH 17/17] stringinput_ext: use getItemColors function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/54b2a6da910c9ddc5055fb4b2a76ab0753a8c0e6 Author: vanhofen Date: 2016-10-19 (Wed, 19 Oct 2016) Origin message was: ------------------ - stringinput_ext: use getItemColors function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/stringinput_ext.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 2d04e833b..4b4923e00 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -350,19 +350,10 @@ void CExtendedInput_Item_Char::paint(int x, int y, bool focusGained ) fb_pixel_t color; fb_pixel_t bgcolor; - if (focusGained) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - else - { - color = COL_MENUCONTENT_TEXT; - bgcolor = COL_MENUCONTENT_PLUS_0; - } + getItemColors(color, bgcolor, focusGained); - frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, COL_MENUCONTENT_PLUS_2); - frameBuffer->paintBoxRel(xpos+ 1, ypos+ 1, input_w- 2, input_h- 2, bgcolor); + frameBuffer->paintBoxRel(xpos, ypos, input_w, input_h, bgcolor); + frameBuffer->paintBoxFrame(xpos, ypos, input_w, input_h, 1, COL_MENUCONTENT_PLUS_2); int ch_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(ch); int ch_x = xpos + std::max(input_w/2 - ch_w/2, 0);