From f34899d430101505842ae442792ac66db07c6e9b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Thu, 15 Jun 2017 16:34:19 +0200 Subject: [PATCH 01/15] [RemoteTimers] add possibility to transfer all timers at once via webif Use: http://boxip/control/sendalltimers?ip=10.1.1.xxx&force=1 http://boxip/control/sendalltimers?name=record%20box&force=true if parameter name is given, it has to be in timerlist as remote box. if parameter ip and name is given, ip is used. if parameter force is set, all checks are disabled, and the local timer will be deleted even the transfer was not successful. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7031e99573959206d0cd887f04c2ebe8d0b8d408 Author: TangoCash Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/controlapi.cpp | 28 +++++++++++++++ src/nhttpd/tuxboxapi/controlapi.h | 1 + src/nhttpd/tuxboxapi/neutrinoapi.cpp | 52 ++++++++++++++++++++++++++++ src/nhttpd/tuxboxapi/neutrinoapi.h | 2 ++ 4 files changed, 83 insertions(+) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 38e47231d..296c83ae7 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -209,6 +209,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"crypt", &CControlAPI::CryptCGI, "text/plain"}, // timer {"timer", &CControlAPI::TimerCGI, "text/plain"}, + {"sendalltimers", &CControlAPI::TimerSendCGI, "text/plain"}, // bouquet editing {"setbouquet", &CControlAPI::setBouquetCGI, "text/plain"}, {"savebouquet", &CControlAPI::saveBouquetCGI, "text/plain"}, @@ -335,7 +336,34 @@ void CControlAPI::TimerCGI(CyhookHandler *hh) hh->SendError(); } +void CControlAPI::TimerSendCGI(CyhookHandler *hh) +{ + hh->outStart(); + + if (NeutrinoAPI->Timerd->isTimerdAvailable()) + { + if (!hh->ParamList.empty()) + { + bool force = (hh->ParamList["force"] == "1") || (hh->ParamList["force"] == "true"); + if(!hh->ParamList["ip"].empty()) + { + NeutrinoAPI->SendAllTimers(hh->ParamList["ip"],force); + hh->SendOk(); + } + else if(!hh->ParamList["name"].empty()) + { + NeutrinoAPI->SendAllTimers(NeutrinoAPI->GetRemoteBoxIP(decodeString(hh->ParamList["name"])),force); + hh->SendOk(); + } + else + hh->SendError(); + } + } + else + hh->SendError(); +} //----------------------------------------------------------------------------- + void CControlAPI::SetModeCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 36873b8fc..b266e85d4 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -73,6 +73,7 @@ private: // CGI functions for ExecuteCGI void TimerCGI(CyhookHandler *hh); + void TimerSendCGI(CyhookHandler *hh); void SetModeCGI(CyhookHandler *hh); void GetModeCGI(CyhookHandler *hh); void ExecCGI(CyhookHandler *hh); diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/neutrinoapi.cpp index bfd6b216c..46f819145 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoapi.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -530,3 +531,54 @@ std::string CNeutrinoAPI::getLogoFile(t_channel_id channelId) return logoString; return ""; } + +std::string CNeutrinoAPI::GetRemoteBoxIP(std::string _rbname) +{ + std::string c_url = ""; + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) + { + if (it->rbname == _rbname) + { + if (!it->user.empty() && !it->pass.empty()) + c_url += it->user + ":" + it->pass +"@"; + c_url += it->rbaddress; + c_url += ":" + to_string(it->port); + break; + } + } + return c_url; +} + +void CNeutrinoAPI::SendAllTimers(std::string url, bool force) +{ + CTimerd::TimerList timerlist; + timerlist.clear(); + Timerd->getTimerList(timerlist); + sort(timerlist.begin(), timerlist.end()); + CTimerd::TimerList::iterator timer = timerlist.begin(); + + int pre,post; + Timerd->getRecordingSafety(pre,post); + CHTTPTool httpTool; + std::string r_url; + + for(int i = 0; timer != timerlist.end(); ++timer) + { + if (timer->eventType == CTimerd::TIMER_RECORD) { + r_url = "http://"; + r_url += url; + r_url += "/control/timer?action=new"; + r_url += "&alarm=" + to_string((int)timer->alarmTime + pre); + r_url += "&stop=" + to_string((int)timer->stopTime - post); + r_url += "&announce=" + to_string((int)timer->announceTime + pre); + r_url += "&channel_id=" + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer->channel_id); + r_url += "&aj=on"; + r_url += "&rs=on"; + + r_url = httpTool.downloadString(r_url, -1, 300); + + if ((r_url=="ok") || force) + Timerd->removeTimerEvent(timer->eventID); + } + } +} diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.h b/src/nhttpd/tuxboxapi/neutrinoapi.h index 5936e194b..77e51baa0 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/neutrinoapi.h @@ -84,6 +84,8 @@ public: std::string getAudioInfoAsString(void); std::string getCryptInfoAsString(void); std::string getLogoFile(t_channel_id channelId); + std::string GetRemoteBoxIP(std::string _rbname); + void SendAllTimers(std::string url, bool force = false); public: CNeutrinoAPI(); ~CNeutrinoAPI(void); From 8c864a4b9c4568be35d92602d4c55a7f71f0a184 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 20:56:08 +0200 Subject: [PATCH 02/15] neutrinoapi.cpp: fix possible broken build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit error: ‘to_string’ was not declared... to_string is handled inside helpers.h/cpp. include of is required here. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f0891cb76fa580d54147a0b9a1f567ffcb8b88a3 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/neutrinoapi.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/neutrinoapi.cpp index 46f819145..1e3eeeef8 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoapi.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include From 5204cf2a3bd85ba51a195a79288704084488edb8 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Thu, 15 Jun 2017 21:09:28 +0200 Subject: [PATCH 03/15] supplemental to f34899d430101505842ae442792ac66db07c6e9b Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5256a11e66e833eef00eebce16171ad0b0c5a5c2 Author: TangoCash Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/neutrinoapi.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/neutrinoapi.cpp index 1e3eeeef8..e067a7f4a 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoapi.cpp @@ -556,14 +556,13 @@ void CNeutrinoAPI::SendAllTimers(std::string url, bool force) timerlist.clear(); Timerd->getTimerList(timerlist); sort(timerlist.begin(), timerlist.end()); - CTimerd::TimerList::iterator timer = timerlist.begin(); int pre,post; Timerd->getRecordingSafety(pre,post); CHTTPTool httpTool; std::string r_url; - for(int i = 0; timer != timerlist.end(); ++timer) + for(CTimerd::TimerList::iterator timer = timerlist.begin(); timer != timerlist.end(); ++timer) { if (timer->eventType == CTimerd::TIMER_RECORD) { r_url = "http://"; From 6ff5268969c4347b5017869f7816c0ff050ea98e Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 12:13:24 +0200 Subject: [PATCH 04/15] upnpbrowser: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4d4ae277f9ef05481502ace7b8196fad65afbcbc Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - upnpbrowser: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/upnpbrowser.cpp | 47 +++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 7458db5f7..a02596374 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -966,8 +966,8 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos) } 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); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, bgcolor, i_radius); if (pos >= m_devices.size()) return; @@ -976,8 +976,8 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos) std::string name = m_devices[pos].friendlyname; int w = g_Font[font_item]->getRenderWidth(name); - g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, num, color, m_item_height); - g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, name, color, m_item_height); + g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID, ypos + m_item_height, m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, num, color, m_item_height); + g_Font[font_item]->RenderString(m_x + m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + m_item_height, w, name, color, m_item_height); } void CUpnpBrowserGui::paintDevices() @@ -999,18 +999,14 @@ void CUpnpBrowserGui::paintDevices() for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, m_item_y, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp_max = m_listmaxshow; - if(!tmp_max) - tmp_max = 1; - int sbc = ((m_devices.size() - 1) / tmp_max) + 1; - int sbs = ((m_selecteddevice) / tmp_max); - - m_frameBuffer->paintBoxRel(m_x + m_width - 13, m_item_y + 2 + sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + // scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, m_devices.size(), m_listmaxshow, m_selecteddevice); + paintScrollBar(m_x + m_width - SCROLLBAR_WIDTH, m_item_y, SCROLLBAR_WIDTH, m_item_height*m_listmaxshow, total_pages, current_page); //shadow - m_frameBuffer->paintBoxRel(m_x + m_width, m_item_y + OFFSET_SHADOW, OFFSET_SHADOW, sb, COL_SHADOW_PLUS_0); + m_frameBuffer->paintBoxRel(m_x + m_width, m_item_y + OFFSET_SHADOW, OFFSET_SHADOW, m_item_height*m_listmaxshow, COL_SHADOW_PLUS_0); // Foot footer.setCorner(RADIUS_LARGE, CORNER_BOTTOM); @@ -1035,8 +1031,8 @@ void CUpnpBrowserGui::paintItem(std::vector *entries, unsigned int po 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); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, bgcolor, i_radius); if (pos >= (*entries).size()) return; @@ -1088,8 +1084,8 @@ void CUpnpBrowserGui::paintItem(std::vector *entries, unsigned int po icon_o = icon_w + OFFSET_INNER_MID; m_frameBuffer->paintIcon(fileicon, m_x + OFFSET_INNER_MID, ypos + (m_item_height - icon_h)/2); } - g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID + icon_o, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, name, color, m_item_height); - g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, info, color, m_item_height); + g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID + icon_o, ypos + m_item_height, m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, name, color, m_item_height); + g_Font[font_item]->RenderString(m_x + m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + m_item_height, w, info, color, m_item_height); } void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry) @@ -1178,16 +1174,11 @@ void CUpnpBrowserGui::paintItems(std::vector *entry, unsigned int sel for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, m_item_y, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp = m_listmaxshow ? m_listmaxshow : 1;//avoid division by zero - int sbc = ((max + offset - 1) / tmp) + 1; - int sbs = ((selected + offset) / tmp); - - int sbh = 0; - if ((sbc > 0) && (sbc > sb-4)) - sbh = 2; - m_frameBuffer->paintBoxRel(m_x + m_width - 13, m_item_y + 2 + sbs*((sb-4)/sbc+sbh), 11, (sb-4)/sbc + sbh, COL_SCROLLBAR_ACTIVE_PLUS_0); + //scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, max + offset, m_listmaxshow, selected + offset); + paintScrollBar(m_x + m_width - SCROLLBAR_WIDTH, m_item_y, SCROLLBAR_WIDTH, m_item_height*m_listmaxshow, total_pages, current_page); // Foot buttons size_t numbuttons = sizeof(BrowseButtons)/sizeof(BrowseButtons[0]); From 5b050827a7013c84f640d274347890e6c0a18e59 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 12:59:21 +0200 Subject: [PATCH 05/15] listframe: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/217dd9636043161e08f5b150a0d7032dec1551da Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - listframe: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/widget/listframe.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/gui/widget/listframe.cpp b/src/gui/widget/listframe.cpp index 33f76ea43..2ed9085ec 100644 --- a/src/gui/widget/listframe.cpp +++ b/src/gui/widget/listframe.cpp @@ -54,11 +54,10 @@ #include #include #include "listframe.h" +#include #include #include -#define SCROLL_FRAME_WIDTH 10 - #define MAX_WINDOW_WIDTH (frameBuffer->getScreenWidth() - 40) #define MAX_WINDOW_HEIGHT (frameBuffer->getScreenHeight() - 40) @@ -270,9 +269,9 @@ void CListFrame::initFramesRel(void) if(m_nMode & SCROLL) { - m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLL_FRAME_WIDTH; + m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLLBAR_WIDTH; m_cFrameScrollRel.iY = m_cFrameTitleRel.iHeight; - m_cFrameScrollRel.iWidth = SCROLL_FRAME_WIDTH; + m_cFrameScrollRel.iWidth = SCROLLBAR_WIDTH; m_cFrameScrollRel.iHeight = m_cFrameHeaderListRel.iHeight + m_cFrameListRel.iHeight - m_nBgRadius; } else @@ -384,13 +383,9 @@ void CListFrame::refreshScroll(void) if (m_nNrOfPages > 1) { - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, - m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_SCROLLBAR_PLUS_0, RADIUS_MIN); - unsigned int marker_size = (m_cFrameScrollRel.iHeight - 2*OFFSET_INNER_MIN) / m_nNrOfPages; - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + OFFSET_INNER_MIN+m_cFrame.iX, - m_cFrameScrollRel.iY + OFFSET_INNER_MIN + m_nCurrentPage * marker_size +m_cFrame.iY, - m_cFrameScrollRel.iWidth - (2*OFFSET_INNER_MIN), - marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_MIN); + paintScrollBar(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, + m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, + m_nNrOfPages, m_nCurrentPage); } } From 599db5b01f0cbfa341b934d08c316d90e2677a8d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 13:05:39 +0200 Subject: [PATCH 06/15] textbox: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d6f3ba61d5bc1586c4a27e05eafe1b01ce0ca448 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - textbox: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/widget/textbox.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 7a9e326b1..587c237d6 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -61,6 +61,7 @@ #include #include #include "textbox.h" +#include #include #include #ifdef VISUAL_DEBUG @@ -525,14 +526,9 @@ void CTextBox::refreshScroll(void) if (m_nNrOfPages > 1) { - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, + paintScrollBar(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, - COL_SCROLLBAR_PLUS_0, RADIUS_MIN); - unsigned int marker_size = (m_cFrameScrollRel.iHeight - 2*SCROLL_MARKER_BORDER) / m_nNrOfPages; - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER + m_cFrame.iX, - m_cFrameScrollRel.iY + SCROLL_MARKER_BORDER + m_nCurrentPage * marker_size + m_cFrame.iY, - m_cFrameScrollRel.iWidth - 2*SCROLL_MARKER_BORDER, - marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_MIN); + m_nNrOfPages, m_nCurrentPage); m_has_scrolled = true; } else From a4982a5fb3255892838ee5225c82844ffaa92c6a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 13:36:12 +0200 Subject: [PATCH 07/15] channellist: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/fd84cedf90624b2bf16e9879072868956d755c00 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - channellist: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 5cb0eff49..0672956d9 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1878,7 +1878,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) color = COL_MENUCONTENTINACTIVE_TEXT; if (!firstpaint || i_selected || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()) - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor, i_radius); if(curr < (*chanlist).size()) { char nameAndDescription[255]; @@ -1932,7 +1932,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) int icon_w = 0; int icon_h = 0; int offset_right = OFFSET_INNER_MID; - int icon_x_right = x + width - 15 - offset_right; + int icon_x_right = x + width - SCROLLBAR_WIDTH - offset_right; if (scramble_icon) { @@ -2026,7 +2026,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) 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 - 3*OFFSET_INNER_MID - offset_right; // 15 = scrollbar + int max_desc_len = width - numwidth - prg_offset - ch_name_len - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - offset_right; if (max_desc_len < 0) max_desc_len = 0; @@ -2040,7 +2040,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 + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + fheight, width - numwidth - SCROLLBAR_WIDTH - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight); } else { @@ -2057,11 +2057,11 @@ 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 - 15 - 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, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); if (g_settings.channellist_epgtext_align_right) { // align right - 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); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - SCROLLBAR_WIDTH - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor); } else { @@ -2077,7 +2077,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) pb.paint(); } //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 - 15 - 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, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); } if (!firstpaint && curr == selected) updateVfd(); @@ -2209,16 +2209,11 @@ void CChannelList::paintBody() for(unsigned int count = 0; count < listmaxshow; count++) paintItem(count, true); - const int ypos = y+ theight; - const int sb = height - theight - footerHeight; // paint scrollbar over full height of main box - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int listmaxshow_tmp = listmaxshow ? listmaxshow : 1;//avoid division by zero - int sbc= (((*chanlist).size()- 1)/ listmaxshow_tmp)+ 1; - const int sbs= (selected/listmaxshow_tmp); - if (sbc < 1) - sbc = 1; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, (*chanlist).size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, height - theight - footerHeight, total_pages, current_page); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); showChannelLogo(); if ((*chanlist).empty()) paintButtonBar(false); From 625c39fa4e564411f2394d222ad37e5fc1228956 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 13:51:27 +0200 Subject: [PATCH 08/15] eventlist: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/578c7904b36454fb1e41bb6022136ad92dcf4070 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - eventlist: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 9f575f516..2bcd1094b 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -753,8 +753,8 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) 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); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor, i_radius); if(currposgetText(LOCALE_WORD_IN), seit, unit_short_minute); int w = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(beginnt); - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - 15 - 2*OFFSET_INNER_MID - fwidth2 - w, ypos + OFFSET_INNER_MIN + fheight2, w, beginnt, color); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - fwidth2 - w, ypos + OFFSET_INNER_MIN + fheight2, w, beginnt, color); } - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - 15 - OFFSET_INNER_MID - fwidth2, ypos + OFFSET_INNER_MIN + fheight2, fwidth2, duration_str, color); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - fwidth2, ypos + OFFSET_INNER_MIN + fheight2, fwidth2, duration_str, color); // 2nd line // set status icons @@ -967,17 +967,10 @@ void CEventList::paint(t_channel_id channel_id) // paint content for right box paintDescription(selected); - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((evtlist.size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); - + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, evtlist.size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, fheight*listmaxshow, total_pages, current_page); } void CEventList::showFunctionBar(t_channel_id channel_id) From f1681b87bee8e1a4fae7cdb5c62ae8235c563966 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 16:18:25 +0200 Subject: [PATCH 09/15] epgview: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4255640ce1edd49545b16d08a6dc2a23ac89e8ce Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - epgview: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 393bbb1ad..6dbda256f 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -199,7 +199,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove // check the wordwidth - add to this line if size ok int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord); - if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - 15 - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0))) + if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - SCROLLBAR_WIDTH - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0))) {//space ok, add aktWidth += aktWordWidth; aktLine += aktWord; @@ -270,12 +270,12 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) max_wday_w = std::max(max_wday_w, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getWeekday(i))) + " ")); } int offs = fullClear ? 0 : cover_offset; - frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box + frameBuffer->paintBoxRel(sx+offs, y, ox-SCROLLBAR_WIDTH-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box if (has_cover) { if (!g_PicViewer->DisplayImage(cover ,sx+OFFSET_INNER_MID ,y+OFFSET_INNER_MID+((sb-cover_height)/2), cover_width, cover_height, CFrameBuffer::TM_NONE)) { cover_offset = 0; - frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box + frameBuffer->paintBoxRel(sx, y, ox-SCROLLBAR_WIDTH, sb, COL_MENUCONTENT_PLUS_0); // background of the text box } } int logo_offset = 0; @@ -312,7 +312,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) offset += digi; break; } - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox- 15- 15, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - offset, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); count++; pos1 = epgText[i].first.find_first_not_of(tok, pos2); pos2 = epgText[i].first.find_first_of(tok, pos1); @@ -321,17 +321,14 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) count = 0; } else{ - g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); + g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); } } - - int sbc = ((textSize - 1)/ medlinecount) + 1; - int sbs= (startPos+ 1)/ medlinecount; - if (sbc < 1) - sbc = 1; - frameBuffer->paintBoxRel(sx+ ox- 15, ypos, 15, sb, COL_SCROLLBAR_PLUS_0); // scrollbar bg - frameBuffer->paintBoxRel(sx+ ox- 13, ypos+ 2+ sbs*(sb-4)/sbc , 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); // scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, textSize, medlinecount, startPos + 1); + paintScrollBar(sx + ox - SCROLLBAR_WIDTH, ypos, SCROLLBAR_WIDTH, sb, total_pages, current_page); } #define GENRE_MOVIE_COUNT 9 From e077cd09e3d63dfe72b88e1382d8413aed9964c0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 16:30:02 +0200 Subject: [PATCH 10/15] timerlist: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5d1a6a7f8b93c563bebe26fa9d598b96ceb2961d Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - timerlist: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/timerlist.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 3eda88907..2b6c5f59f 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1134,7 +1134,7 @@ void CTimerList::paintItem(int pos) int real_width=width; if (timerlist.size() > listmaxshow) { - real_width-=15; //scrollbar + real_width -= SCROLLBAR_WIDTH; //scrollbar } unsigned int currpos = liststart + pos; @@ -1425,15 +1425,10 @@ void CTimerList::paint() if (timerlist.size()>listmaxshow) { - int ypos = y+ theight; - int sb = 2*fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp_max = listmaxshow; - if (!tmp_max) - tmp_max = 1; - int sbc = ((timerlist.size()- 1)/ tmp_max)+ 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_SMALL); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, timerlist.size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, 2*fheight*listmaxshow, total_pages, current_page); } paintFoot(); From 2f80d5641d02fc619d8500550e9a6a6e1c533b96 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 16:47:19 +0200 Subject: [PATCH 11/15] listbox: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/36ebcb586ac761e08e807e4c5916dad886c360aa Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - listbox: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/widget/listbox.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index 1edcc681f..ad7c26fb9 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -67,18 +67,10 @@ void CListBox::paint() paintItem(count); } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1; - if (sbc < 1) - sbc = 1; - - int sbh= (sb- 4)/ sbc; - int sbs= (selected/listmaxshow); - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs* sbh , 11, sbh, COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, getItemCount(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, fheight*listmaxshow, total_pages, current_page); } void CListBox::paintHead() @@ -111,8 +103,9 @@ void CListBox::hide() frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight); } -unsigned int CListBox::getItemCount() +unsigned int CListBox::getItemCount() { + // WTF? Why a fixed value? return 10; } @@ -130,8 +123,8 @@ void CListBox::paintItem(unsigned int /*itemNr*/, int paintNr, bool pselected) getItemColors(color, bgcolor, pselected); - frameBuffer->paintBoxRel(x,ypos, width- 15, getItemHeight(), bgcolor); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 10, ypos+ fheight, width-20, "demo", color); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, getItemHeight(), bgcolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID, ypos + fheight, width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID, "demo", color); } void CListBox::updateSelection(unsigned int newpos) From 9270242bda48daadc157b1c91fb43412474afeaa Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 17:21:10 +0200 Subject: [PATCH 12/15] bouqueteditor: use CComponentsScrollbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c80cc2433594fe2def05f36771b4e073d3fb9158 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - bouqueteditor: use CComponentsScrollbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/bedit/bouqueteditor_bouquets.cpp | 21 ++++++----------- src/gui/bedit/bouqueteditor_channels.cpp | 26 +++++++--------------- src/gui/bedit/bouqueteditor_chanselect.cpp | 8 +++---- 3 files changed, 19 insertions(+), 36 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 0109fd340..fc2eb5994 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -66,7 +66,7 @@ CBEBouquetWidget::CBEBouquetWidget() void CBEBouquetWidget::paintItem(int pos) { - int ypos = y+ theight+0 + pos*iheight; + int ypos = y + theight + pos*iheight; unsigned int current = liststart + pos; bool i_selected = current == selected; @@ -92,8 +92,8 @@ void CBEBouquetWidget::paintItem(int pos) } if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if (current < Bouquets->size()) { if ((i_selected) && (state == beMoving)) @@ -125,17 +125,10 @@ void CBEBouquetWidget::paint() paintItem(count); } - int ypos = y+ theight; - int sb = iheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((Bouquets->size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - //scrollbar - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Bouquets->size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); } void CBEBouquetWidget::paintHead() diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 97a65de4c..8618ffca5 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -121,8 +121,8 @@ void CBEChannelWidget::paintItem(int pos) } if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if ((current == selected) && (state == beMoving)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); @@ -131,13 +131,12 @@ void CBEChannelWidget::paintItem(int pos) if ((*Channels)[current]->bLocked) { frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); } - //g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color); //FIXME numwidth ? we not show chan numbers g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color); if((*Channels)[current]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!(*Channels)[current]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } @@ -159,19 +158,10 @@ void CBEChannelWidget::paint() paintItem(count); } - int ypos = y+ theight; - int sb = iheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((Channels->size()- 1)/ listmaxshow)+ 1; - if (sbc < 1) - sbc = 1; - - int sbh= (sb- 4)/ sbc; - int sbs= (selected/listmaxshow); - - if (sbh) - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Channels->size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); } void CBEChannelWidget::paintHead() diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index c80a182b2..87227e8df 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -129,8 +129,8 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec } if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if(itemNr < getItemCount()) { @@ -141,9 +141,9 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color); if(Channels[itemNr]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!Channels[itemNr]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } From c7aee9c0e30feb1e65ec56be0888eee49b461795 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 16 Jun 2017 10:10:48 +0200 Subject: [PATCH 13/15] CComponentsHeader: fix corner type comparison Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f46a17415508ac8dead9bfde74e3055d4980ea75 Author: Thilo Graf Date: 2017-06-16 (Fri, 16 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index bce82f375..7a91fd8c5 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -258,7 +258,7 @@ void CComponentsHeader::initIcon() //set corner mode of icon item int cc_icon_corner_type = CORNER_LEFT; - if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) + if (corner_type & CORNER_TOP_LEFT || corner_type & CORNER_TOP) cc_icon_corner_type = CORNER_TOP_LEFT; cch_icon_obj->setCorner(corner_rad-fr_thickness, cc_icon_corner_type); From 1ba0a9b971bd16d78f549f0bd907d3d8379329ce Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 16 Jun 2017 11:42:21 +0200 Subject: [PATCH 14/15] CCDraw: precise function for kill handler This should fix possible artefacts or holes in some rendered boxes. Was especially striking at HD1 Hardware. e.g. was observed while right/left switching on channel list at header and without rounded corners and at certain footers. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ef4467b6da8206c0e97364d1820364b59bf34abc Author: Thilo Graf Date: 2017-06-16 (Fri, 16 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.cpp | 54 ++++++++++++++++-------------- src/gui/components/cc_draw.h | 2 +- src/gui/components/cc_frm_header.h | 2 +- src/gui/components/cc_item.h | 2 +- src/gui/components/cc_types.h | 2 +- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index c28144444..39ca711d8 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -729,14 +729,21 @@ void CCDraw::hide() //erase or paint over rendered objects void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/) { + int layers = fblayer_type; + + if (fblayer_type & ~CC_FBDATA_TYPES) + layers = CC_FBDATA_TYPES; + for(size_t i =0; i< v_fbdata.size() ;i++){ - if (fblayer_type == CC_FBDATA_TYPES || v_fbdata[i].fbdata_type & fblayer_type){ -#if 0 - if (bg_color != COL_BACKGROUND_PLUS_0) -#endif - int r = v_fbdata[i].r; - if (corner_radius > -1) - r = corner_radius; + if (v_fbdata[i].fbdata_type & layers){ + + int r = 0; + + if (corner_radius > -1){ + r = v_fbdata[i].r; + if (corner_radius != v_fbdata[i].r) + r = corner_radius; + } if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){ frameBuffer->paintBoxRel(v_fbdata[i].x, @@ -745,31 +752,28 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in v_fbdata[i].dy, bg_color, r, - corner_type); + v_fbdata[i].rtype); + + if (v_fbdata[i].fbdata_type & CC_FBDATA_TYPE_FRAME){ + if (v_fbdata[i].frame_thickness) + frameBuffer->paintBoxFrame(v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy, + v_fbdata[i].frame_thickness, + bg_color, + v_fbdata[i].r, + v_fbdata[i].rtype); + } }else dprintf(DEBUG_DEBUG, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy ); - if (v_fbdata[i].frame_thickness) - frameBuffer->paintBoxFrame(v_fbdata[i].x, - v_fbdata[i].y, - v_fbdata[i].dx, - v_fbdata[i].dy, - v_fbdata[i].frame_thickness, - bg_color, - r, - corner_type); v_fbdata[i].is_painted = false; -#if 0 - else - frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif } } - if (fblayer_type == CC_FBDATA_TYPES){ - firstPaint = true; - is_painted = false; - } + firstPaint = true; + is_painted = false; } void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius) diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 0f23e7eb4..ab7400ca8 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -396,7 +396,7 @@ class CCDraw : public COSDFader, public CComponentsSignals * Shadow paint must be reworked, because dimensions of shadow containes not the real defined size. Parts of item are killed too. * */ - virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES); + virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES); /**Erase shadow around rendered item. * This is similar with the kill() member, but shadow will be handled only. diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 29f8b8315..e1dd05f66 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -315,7 +315,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT ///hides item, arg: no_restore see hideCCItem() void hide(){disableClock(); CComponentsForm::hide();} ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer - void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true); + void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES, bool disable_clock = true); ///set color gradient on/off, returns true if gradient mode was changed virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1); diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index 9d633ad62..d168c3832 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -100,7 +100,7 @@ class CComponentsItem : public CComponents * gui/color.h * driver/framebuffer.h */ - virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = CC_FBDATA_TYPES); + virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = ~CC_FBDATA_TYPES); ///get the current item type, see attribute cc_item_type above virtual int getItemType(); diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index e24f5cc03..d73bd1549 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -100,7 +100,7 @@ typedef enum CC_FBDATA_TYPE_FRAME = 8, CC_FBDATA_TYPE_BACKGROUND = 16, - CC_FBDATA_TYPES = 32 + CC_FBDATA_TYPES = CC_FBDATA_TYPE_BOX | CC_FBDATA_TYPE_SHADOW_BOX | CC_FBDATA_TYPE_FRAME }FBDATA_TYPES; //fb color gradient types From 992e1a6613b12e358cbaacb4f0eed35b4f348015 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 16 Jun 2017 11:10:31 +0200 Subject: [PATCH 15/15] epgview: align with and height of progressbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4adea2366172af85bffb8514197b8230ffe4a270 Author: vanhofen Date: 2017-06-16 (Fri, 16 Jun 2017) Origin message was: ------------------ - epgview: align with and height of progressbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/epgview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 6dbda256f..b696c54ea 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1412,9 +1412,9 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st void CEpgData::showProgressBar() { - int w = 104; + int w = ox/10; int x = sx + (ox - w)/2; - int h = botboxheight - 12; + int h = botboxheight - 2*OFFSET_INNER_SMALL; int y = sy + oy - botboxheight + (botboxheight - h)/2; if (!pb){ pb = new CProgressBar(x, y, w, h);