Experimental: save/restore screen for channel list context menu

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1935 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-12-05 14:16:28 +00:00
parent 33e94fbcf0
commit e85c48501f
5 changed files with 77 additions and 21 deletions

View File

@@ -335,6 +335,7 @@ int CChannelList::doChannelMenu(void)
CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS);
menu->enableFade(false); menu->enableFade(false);
menu->enableSaveScreen(true);
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
snprintf(cnt, sizeof(cnt), "%d", i); snprintf(cnt, sizeof(cnt), "%d", i);
@@ -435,6 +436,9 @@ int CChannelList::doChannelMenu(void)
{ {
COsdSetup osd_setup; COsdSetup osd_setup;
osd_setup.showContextChanlistMenu(); osd_setup.showContextChanlistMenu();
//FIXME check font/options changed ?
hide();
calcSize();
} }
break; break;
default: default:
@@ -464,24 +468,9 @@ int CChannelList::exec()
return nNewChannel; return nNewChannel;
} }
#define CHANNEL_SMSKEY_TIMEOUT 800 void CChannelList::calcSize()
/* 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;
const int pic_h = 39; 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(); 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); 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)); 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; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2;
y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height+ info_height)) / 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; displayNext = false;
bool fadeIn = g_settings.widget_fade; bool fadeIn = g_settings.widget_fade;

View File

@@ -93,6 +93,7 @@ private:
void paintButtonBar(bool is_current); void paintButtonBar(bool is_current);
void hide(); void hide();
void showChannelLogo(); void showChannelLogo();
void calcSize();
public: public:
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false ); CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false, bool new_mode_active = false );

View File

@@ -664,6 +664,7 @@ int COsdSetup::showContextChanlistMenu()
static int cselected = -1; static int cselected = -1;
CMenuWidget * menu_chanlist = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width); CMenuWidget * menu_chanlist = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width);
menu_chanlist->enableSaveScreen(true);
menu_chanlist->setSelected(cselected); menu_chanlist->setSelected(cselected);
menu_chanlist->addIntroItems(LOCALE_MISCSETTINGS_CHANNELLIST); menu_chanlist->addIntroItems(LOCALE_MISCSETTINGS_CHANNELLIST);
@@ -676,8 +677,9 @@ int COsdSetup::showContextChanlistMenu()
/* TODO ? problems: /* TODO ? problems:
* 1. channel list not re-calc sizes after menu; * 1. channel list not re-calc sizes after menu;
* 2. font menu smaller and make hole in channel list */ * 2. font menu smaller and make hole in channel list */
#if 0 #if 1
CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING); CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING);
fontSettingsSubMenu->enableSaveScreen(true);
int i = 1; int i = 1;
fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname); fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname);

View File

@@ -501,7 +501,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
} }
} }
} }
paint(); paint(true);
int retval = menu_return::RETURN_REPAINT; 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]); 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 ); while ( msg!=CRCInput::RC_timeout );
hide(); hide();
delete[] background;
background = NULL;
if ( fadeIn || fadeOut ) { if ( fadeIn || fadeOut ) {
g_RCInput->killTimer(fadeTimer); g_RCInput->killTimer(fadeTimer);
@@ -889,9 +891,10 @@ void CMenuWidget::calcSize()
} }
} }
void CMenuWidget::paint() void CMenuWidget::paint(bool save)
{ {
calcSize(); calcSize();
if(save)
saveScreen(); saveScreen();
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, nameString.c_str()); CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, nameString.c_str());
@@ -1012,8 +1015,10 @@ void CMenuWidget::restoreScreen()
if(background) { if(background) {
if(savescreen) if(savescreen)
frameBuffer->RestoreScreen(x, y, full_width, full_height, background); frameBuffer->RestoreScreen(x, y, full_width, full_height, background);
#if 0
delete[] background; delete[] background;
background = NULL; background = NULL;
#endif
} }
} }

View File

@@ -451,7 +451,7 @@ class CMenuWidget : public CMenuTarget
int getItemId(CMenuItem* menuItem); int getItemId(CMenuItem* menuItem);
int getItemsCount(){return items.size();}; int getItemsCount(){return items.size();};
CMenuItem* getItem(const uint& item_id); CMenuItem* getItem(const uint& item_id);
virtual void paint(); virtual void paint(bool save = false);
virtual void hide(); virtual void hide();
virtual int exec(CMenuTarget* parent, const std::string & actionKey); virtual int exec(CMenuTarget* parent, const std::string & actionKey);
virtual std::string getName(); virtual std::string getName();