From c75acec74d7dc2db1512c8f9e8b68c2773067c3d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 17:21:10 +0200 Subject: [PATCH] bouqueteditor: use CComponentsScrollbar Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f651556d1e3e283c8fedb39b067e16254d191a9d Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - bouqueteditor: use CComponentsScrollbar ------------------ No further description and justification available within origin commit message! ------------------ 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); } }