From 8c2301472bbf08463390d843b6e484bc77bb7308 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 30 Nov 2016 09:17:04 +0100 Subject: [PATCH] - bouqueteditor: fix icon alignment --- src/gui/bedit/bouqueteditor_bouquets.cpp | 32 ++++++++++++++-------- src/gui/bedit/bouqueteditor_channels.cpp | 10 +++---- src/gui/bedit/bouqueteditor_chanselect.cpp | 10 +++---- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index f09ad4a66..9c7017a46 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -97,22 +97,22 @@ void CBEBouquetWidget::paintItem(int pos) if (current < Bouquets->size()) { if ((i_selected) && (state == beMoving)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 5, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); if ((*Bouquets)[current]->bHidden) - frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + 26, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_HIDDEN, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); if ((*Bouquets)[current]->bLocked != g_settings.parentallock_defaultlocked) - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 18 + iconoffset, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + 2*iconoffset, ypos, iheight); if (!(*Bouquets)[current]->tvChannels.empty() ) { - frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + 20 + 2*iconoffset - 2, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_VIDEO, x + OFFSET_INNER_MID + 3*iconoffset, ypos, iheight); } if (!(*Bouquets)[current]->radioChannels.empty()) { - frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + 20+ 3*iconoffset - 4, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_AUDIO, x + OFFSET_INNER_MID + 4*iconoffset, ypos, iheight); } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x +20 + 4*iconoffset, ypos + iheight - (iheight-fheight)/2, width-iconoffset-20, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 5*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 5*iconoffset, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); } } @@ -203,21 +203,31 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icol_w, &icol_h); - iheight = std::max(fheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &icol_w, &icol_h); - iheight = std::max(iheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); frameBuffer->getIconSize(NEUTRINO_ICON_HIDDEN, &icol_w, &icol_h); - iheight = std::max(iheight, icol_h+2); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); + iconoffset = std::max(iconoffset, icol_w); + + frameBuffer->getIconSize(NEUTRINO_ICON_VIDEO, &icol_w, &icol_h); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); + iconoffset = std::max(iconoffset, icol_w); + + frameBuffer->getIconSize(NEUTRINO_ICON_AUDIO, &icol_w, &icol_h); + iheight = std::max(fheight, icol_h + OFFSET_INNER_MIN); iconoffset = std::max(iconoffset, icol_w); width = frameBuffer->getScreenWidthRel(); height = frameBuffer->getScreenHeightRel() - ButtonHeight; - listmaxshow = (height-theight-0)/iheight; - height = theight+0+listmaxshow*iheight; // recalc height + + listmaxshow = (height-theight)/iheight; + height = theight+listmaxshow*iheight; // recalc height + x = getScreenStartX(width); y = getScreenStartY(height + ButtonHeight); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 38310c319..03f3776d8 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -125,19 +125,19 @@ void CBEChannelWidget::paintItem(int pos) 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); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); } if (current < Channels->size()) { if ((*Channels)[current]->bLocked) { - frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + 22, ypos, iheight); + 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+ 22 + iconoffset, ypos + iheight - (iheight-fheight)/2, width- iconoffset- 20, (*Channels)[current]->getName(), color); + 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 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!(*Channels)[current]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 79896b0b1..c60372450 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -135,15 +135,15 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec if(itemNr < getItemCount()) { if( isChannelInBouquet(itemNr)) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x+10, ypos, iheight); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x + OFFSET_INNER_MID, ypos, iheight); else - frameBuffer->paintBoxRel(x+10, ypos, iconoffset, iheight, bgcolor); + frameBuffer->paintBoxRel(x + OFFSET_INNER_MID, ypos, iconoffset, iheight, bgcolor); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width - 20 - iconoffset, Channels[itemNr]->getName(), color); + 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 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!Channels[itemNr]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x+width- 15 - 28, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); } }