diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index b4740f6c6..9b9794a84 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -335,6 +335,7 @@ int CChannelList::doChannelMenu(void) CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); menu->enableFade(false); + menu->enableSaveScreen(true); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); snprintf(cnt, sizeof(cnt), "%d", i); @@ -435,6 +436,9 @@ int CChannelList::doChannelMenu(void) { COsdSetup osd_setup; osd_setup.showContextChanlistMenu(); + //FIXME check font/options changed ? + hide(); + calcSize(); } break; default: @@ -464,24 +468,9 @@ int CChannelList::exec() return nNewChannel; } -#define CHANNEL_SMSKEY_TIMEOUT 800 -/* return: >= 0 to zap, -1 on cancel, -3 on list mode change, -4 list edited, -2 zap but no restore old list/chan ?? */ -int CChannelList::show() +void CChannelList::calcSize() { - /* temporary debugging stuff */ - struct timeval t1, t2; - gettimeofday(&t1, NULL); - - neutrino_msg_t msg; - neutrino_msg_data_t data; - bool actzap = 0; - int res = -1; const int pic_h = 39; - if (chanlist.empty()) { - return res; - } - - this->new_mode_active = 0; int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); width = w_max (((g_settings.channellist_extended)?(frameBuffer->getScreenWidth() / 20 * (fw+6)):(frameBuffer->getScreenWidth() / 20 * (fw+5))), 100); height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); @@ -518,6 +507,65 @@ int CChannelList::show() x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2; +} + +#define CHANNEL_SMSKEY_TIMEOUT 800 +/* return: >= 0 to zap, -1 on cancel, -3 on list mode change, -4 list edited, -2 zap but no restore old list/chan ?? */ +int CChannelList::show() +{ + /* temporary debugging stuff */ + struct timeval t1, t2; + gettimeofday(&t1, NULL); + + neutrino_msg_t msg; + neutrino_msg_data_t data; + bool actzap = 0; + int res = -1; + if (chanlist.empty()) { + return res; + } + + this->new_mode_active = 0; +#if 0 + const int pic_h = 39; + int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); + width = w_max (((g_settings.channellist_extended)?(frameBuffer->getScreenWidth() / 20 * (fw+6)):(frameBuffer->getScreenWidth() / 20 * (fw+5))), 100); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); + + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, name.c_str()); + + /* assuming all color icons must have same size */ + int icol_w, icol_h; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); + + theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + + theight = std::max(theight, pic_h); + + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &icol_w, &icol_h); + theight = std::max(theight, icol_h); + + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &icol_w, &icol_h); + theight = std::max(theight, icol_h); + + if(g_settings.channellist_new_zap_mode) + { + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &icol_w, &icol_h); + theight = std::max(theight, icol_h); + } + + fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); + if (fheight == 0) + fheight = 1; /* avoid crash on invalid font */ + + listmaxshow = (height - theight - footerHeight -0)/fheight; + height = theight + footerHeight + listmaxshow * fheight; + info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; + + x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; + y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 2; +#endif + calcSize(); displayNext = false; bool fadeIn = g_settings.widget_fade; diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 5a6afefec..4fc3c1ab5 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -93,6 +93,7 @@ private: void paintButtonBar(bool is_current); void hide(); void showChannelLogo(); + void calcSize(); public: CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false ); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index eefee3a0c..882ddf2fc 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -664,6 +664,7 @@ int COsdSetup::showContextChanlistMenu() static int cselected = -1; CMenuWidget * menu_chanlist = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + menu_chanlist->enableSaveScreen(true); menu_chanlist->setSelected(cselected); menu_chanlist->addIntroItems(LOCALE_MISCSETTINGS_CHANNELLIST); @@ -676,8 +677,9 @@ int COsdSetup::showContextChanlistMenu() /* TODO ? problems: * 1. channel list not re-calc sizes after menu; * 2. font menu smaller and make hole in channel list */ -#if 0 +#if 1 CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING); + fontSettingsSubMenu->enableSaveScreen(true); int i = 1; fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index f905a1ca4..062230fbb 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -501,7 +501,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) } } } - paint(); + paint(true); int retval = menu_return::RETURN_REPAINT; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); @@ -743,6 +743,8 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) } while ( msg!=CRCInput::RC_timeout ); hide(); + delete[] background; + background = NULL; if ( fadeIn || fadeOut ) { g_RCInput->killTimer(fadeTimer); @@ -889,10 +891,11 @@ void CMenuWidget::calcSize() } } -void CMenuWidget::paint() +void CMenuWidget::paint(bool save) { calcSize(); - saveScreen(); + if(save) + saveScreen(); CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, nameString.c_str()); @@ -1012,8 +1015,10 @@ void CMenuWidget::restoreScreen() if(background) { if(savescreen) frameBuffer->RestoreScreen(x, y, full_width, full_height, background); +#if 0 delete[] background; background = NULL; +#endif } } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index e5950762e..76d4ed8e6 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -451,7 +451,7 @@ class CMenuWidget : public CMenuTarget int getItemId(CMenuItem* menuItem); int getItemsCount(){return items.size();}; CMenuItem* getItem(const uint& item_id); - virtual void paint(); + virtual void paint(bool save = false); virtual void hide(); virtual int exec(CMenuTarget* parent, const std::string & actionKey); virtual std::string getName();