From 1a09bd719a86ff9563e5a0723c954774b1c236ec Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 20:42:18 +0200 Subject: [PATCH] CBEChannelSelectWidget: use CComponentsInfoBox to paint infobox --- src/gui/bedit/bouqueteditor_chanselect.cpp | 48 ++++++++++++++-------- src/gui/bedit/bouqueteditor_chanselect.h | 5 ++- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index d012fbbe8..79ba2d8c6 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -73,7 +73,7 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsi liststart = 0; bouquetChannels = NULL; dline = NULL; - ibox = NULL; + ibox = new CComponentsInfoBox(); } CBEChannelSelectWidget::~CBEChannelSelectWidget() @@ -114,7 +114,7 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(itemNr < getItemCount()) { - paintItem2DetailsLine (paintNr, itemNr); + initItem2DetailsLine (paintNr, itemNr); paintDetails(itemNr); } @@ -204,8 +204,10 @@ void CBEChannelSelectWidget::paintFoot() #endif } -void CBEChannelSelectWidget::paintDetails(int index) +std::string CBEChannelSelectWidget::getInfoText(int index) { + std::string res = ""; + std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); transponder t; CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); @@ -214,12 +216,25 @@ void CBEChannelSelectWidget::paintDetails(int index) desc = desc + " (" + std::string(Channels[index]->pname) + ")"; else desc = desc + " (" + satname + ")"; - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight+INFO_BOX_Y_OFFSET, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+INFO_BOX_Y_OFFSET, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); + + res = satname + "\n" + desc; + + return res; } -void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) +void CBEChannelSelectWidget::paintDetails(int index) +{ + //details line + dline->paint(); + + std::string str = getInfoText(index); + + //info box + ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); + ibox->paint(false); +} + +void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/) { #define ConnectLineBox_Width 16 @@ -229,26 +244,23 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - // clear details line if (dline) - dline->hide(); + dline->kill(); //kill details line - // clear infobox - if (ibox) - ibox->hide(); - - // paint Line if detail info (and not valid list pos) + // init Line if detail info (and not valid list pos) if (pos >= 0) { if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline->setYPos(ypos1a); - dline->paint(true); //infobox - if (ibox == NULL) - ibox = new CComponentsInfoBox(x, ypos2, width, info_height); - ibox->paint(false,true); + if (ibox){ + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); + ibox->setCornerRadius(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); + } } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index 58ad2ebf3..729c3d7af 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -54,13 +54,14 @@ class CBEChannelSelectWidget : public CListBox uint getItemCount(); void paintItem(uint32_t itemNr, int paintNr, bool selected); void paintDetails(int index); - void paintItem2DetailsLine (int pos, int ch_index); + void initItem2DetailsLine (int pos, int ch_index); void paintFoot(); void onOkKeyPressed(); int footerHeight; int info_height; - + + std::string getInfoText(int index); public: ZapitChannelList Channels; ZapitChannelList * bouquetChannels;