diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index d52259a0a..0eac1f10f 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -196,6 +196,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* parent->hide(); Bouquets = &g_bouquetManager->Bouquets; + init(); paintHead(); paintBody(); @@ -379,6 +380,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } } hide(); + ResetModules(); return res; } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index f30904477..c2d670f5a 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -70,7 +70,6 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou frameBuffer->getIconSize(NEUTRINO_ICON_LOCK, &iw, &ih); status_icon_width = std::max(status_icon_width, iw); - header.addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT); } CBEChannelWidget::~CBEChannelWidget() @@ -142,6 +141,8 @@ void CBEChannelWidget::paintItems() void CBEChannelWidget::paintHead() { + if (!header->isPainted()) + header->addContextButton(CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT); CBEGlobals::paintHead(caption + (mode == CZapitClient::MODE_TV ? " - TV" : " - Radio"), mode == CZapitClient::MODE_TV ? NEUTRINO_ICON_VIDEO : NEUTRINO_ICON_AUDIO); } diff --git a/src/gui/bedit/bouqueteditor_globals.cpp b/src/gui/bedit/bouqueteditor_globals.cpp index 3df2c9dd7..8e0235edc 100644 --- a/src/gui/bedit/bouqueteditor_globals.cpp +++ b/src/gui/bedit/bouqueteditor_globals.cpp @@ -34,16 +34,33 @@ CBEGlobals::CBEGlobals() { frameBuffer = CFrameBuffer::getInstance(); + timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU]; + header = NULL; + footer = NULL; + dline = NULL; + ibox = NULL; + + init(); +} + +void CBEGlobals::init() +{ item_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]; info_font = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]; width = frameBuffer->getScreenWidthRel(); height = frameBuffer->getScreenHeightRel(); - header_height = header.getHeight(); + if (!header) + header = new CComponentsHeader(); + header_height = header->getHeight(); item_height = item_font->getHeight(); - footer_height = footer.getHeight(); + + if (!footer) + footer = new CComponentsFooter(); + footer_height = footer->getHeight(); + info_height = 2*info_font->getHeight() + 2*OFFSET_INNER_SMALL; items_count = (height - header_height - footer_height - OFFSET_INTER - info_height - 2*OFFSET_SHADOW) / item_height; @@ -52,17 +69,27 @@ CBEGlobals::CBEGlobals() x = getScreenStartX(width); y = getScreenStartY(height); - - timeout_ptr = &g_settings.timing[SNeutrinoSettings::TIMING_MENU]; - - dline = NULL; - ibox = NULL; } CBEGlobals::~CBEGlobals() { - delete dline; - delete ibox; + ResetModules(); +} + +void CBEGlobals::ResetModules() +{ + if (dline){ + delete dline; dline = NULL; + } + if (ibox){ + delete ibox; ibox = NULL; + } + if (header){ + delete header; header = NULL; + } + if (footer){ + delete footer; footer = NULL; + } } void CBEGlobals::paintDetails(int pos, int current) @@ -131,17 +158,21 @@ void CBEGlobals::killDetails() void CBEGlobals::paintFoot(const size_t& label_count, const struct button_label * const content) { - footer.setCorner(RADIUS_LARGE, CORNER_BOTTOM); - footer.enableShadow(CC_SHADOW_ON, -1, true); - footer.paintButtons(x, y + header_height + body_height, width, footer_height, label_count, content); + if (!footer) + footer = new CComponentsFooter(); + footer->setCorner(RADIUS_LARGE, CORNER_BOTTOM); + footer->enableShadow(CC_SHADOW_ON, -1, true); + footer->paintButtons(x, y + header_height + body_height, width, footer_height, label_count, content); } void CBEGlobals::paintHead(const std::string& Caption, const char* Icon) { - header.setCaption(Caption); - header.setIcon(Icon); - header.setDimensionsAll(x, y, width, header_height); - header.setCorner(RADIUS_LARGE, CORNER_TOP); - header.enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); - header.paint(CC_SAVE_SCREEN_NO); + if (!header) + header = new CComponentsHeader(); + header->setCaption(Caption); + header->setIcon(Icon); + header->setDimensionsAll(x, y, width, header_height); + header->setCorner(RADIUS_LARGE, CORNER_TOP); + header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT, -1, true); + header->paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bedit/bouqueteditor_globals.h b/src/gui/bedit/bouqueteditor_globals.h index 6a3182873..5b8d4f9d7 100644 --- a/src/gui/bedit/bouqueteditor_globals.h +++ b/src/gui/bedit/bouqueteditor_globals.h @@ -31,8 +31,8 @@ class CBEGlobals protected: CComponentsDetailsLine *dline; CComponentsInfoBox *ibox; - CComponentsHeader header; - CComponentsFooter footer; + CComponentsHeader *header; + CComponentsFooter *footer; CFrameBuffer *frameBuffer; @@ -56,6 +56,8 @@ class CBEGlobals unsigned int items_count; int* timeout_ptr; + void init(); + void paintHead(const std::string& Caption, const char* Icon); void paintBody(); void paintFoot(const size_t& label_count, const struct button_label * const content); @@ -69,6 +71,7 @@ class CBEGlobals virtual ~CBEGlobals(); void hide(); + void ResetModules(); }; #endif