From 152d40c6cd17d8fd6c8a2586e655a7cde066d455 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 25 Feb 2013 20:23:10 +0100 Subject: [PATCH] Bedit: adapt for infobox The combination of infobox handling and screen size management doesn't really fit together. Particular it could be better implemented some inheritance, because incorporated functions and variables are redundant and so the classes can be better coordinated. Moreover, it doesn't seem sensible to use only a part of the display. The use of full screen instead of window could simplify a lot. --- src/gui/bedit/bouqueteditor_bouquets.cpp | 6 +++--- src/gui/bedit/bouqueteditor_channels.cpp | 24 +++++++++++++--------- src/gui/bedit/bouqueteditor_chanselect.cpp | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 157723695..2710eb4f0 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -123,6 +123,7 @@ void CBEBouquetWidget::paint() float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); + //scrollbar frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); } @@ -226,9 +227,8 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* iconoffset = std::max(iconoffset, icol_w); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); - int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - width = w_max (64 * fw, 20); - height = h_max (20 * fh, 50); + width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 18), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-0)/iheight; height = theight+0+listmaxshow*iheight; // recalc height x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 72efda90d..14639c2d0 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -84,7 +84,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou bouquet = Bouquet; mode = CZapitClient::MODE_TV; dline = NULL; - ibox = new CComponentsInfoBox(); + ibox = NULL; Channels = NULL; } @@ -211,7 +211,7 @@ void CBEChannelWidget::paintDetails(int index) //info box ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); - ibox->paint(false); + ibox->paint(CC_SAVE_SCREEN_YES); } void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) @@ -235,15 +235,19 @@ void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) dline->setYPos(ypos1a); //infobox - if (ibox){ - ibox->setDimensionsAll(x, ypos2, width, info_height); - ibox->setFrameThickness(2); + if (ibox == NULL) + ibox = new CComponentsInfoBox(); + + if (ibox->isPainted()) + ibox->hide(CC_SAVE_SCREEN_NO); + + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); #if 0 ibox->paint(false,true); #endif - ibox->setCornerRadius(RADIUS_LARGE); - ibox->setShadowOnOff(CC_SHADOW_OFF); - } + ibox->setCornerRadius(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); } } @@ -295,10 +299,10 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2)); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 10; + info_height = 2*iheight + 4; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 79ba2d8c6..7925ff8d6 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -164,10 +164,10 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & action { int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2)); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 10; + info_height = 2*iheight + 4; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2;