on reconfigure, save all of the open submenus instead of just one, and then reopen them all as best as possible.

This commit is contained in:
Dana Jansens 2002-06-01 17:14:32 +00:00
parent e149ab6c29
commit 20bac0772c
2 changed files with 23 additions and 3 deletions

View file

@ -67,7 +67,6 @@ private:
Basemenu& operator=(const Basemenu&); Basemenu& operator=(const Basemenu&);
protected: protected:
BasemenuItem *find(int index);
inline void setTitleVisibility(bool b) { title_vis = b; } inline void setTitleVisibility(bool b) { title_vis = b; }
inline void setMovable(bool b) { movable = b; } inline void setMovable(bool b) { movable = b; }
inline void setHideTree(bool h) { hide_tree = h; } inline void setHideTree(bool h) { hide_tree = h; }
@ -106,6 +105,7 @@ public:
inline int getY(void) const { return menu.y; } inline int getY(void) const { return menu.y; }
inline unsigned int getCount(void) { return menuitems.size(); } inline unsigned int getCount(void) { return menuitems.size(); }
inline int getCurrentSubmenu(void) const { return which_sub; } inline int getCurrentSubmenu(void) const { return which_sub; }
BasemenuItem *find(int index);
inline unsigned int getWidth(void) const { return menu.width; } inline unsigned int getWidth(void) const { return menu.width; }
inline unsigned int getHeight(void) const { return menu.height; } inline unsigned int getHeight(void) const { return menu.height; }

View file

@ -681,11 +681,31 @@ void BScreen::reconfigure(void) {
workspacemenu->reconfigure(); workspacemenu->reconfigure();
iconmenu->reconfigure(); iconmenu->reconfigure();
int remember_sub = rootmenu->getCurrentSubmenu(); typedef std::vector<int> SubList;
SubList remember_subs;
// save the current open menus
Basemenu *menu = rootmenu;
int submenu;
while ((submenu = menu->getCurrentSubmenu()) >= 0) {
remember_subs.push_back(submenu);
menu = menu->find(submenu)->submenu();
assert(menu);
}
InitMenu(); InitMenu();
raiseWindows(0, 0); raiseWindows(0, 0);
rootmenu->reconfigure(); rootmenu->reconfigure();
rootmenu->drawSubmenu(remember_sub);
// reopen the saved menus
menu = rootmenu;
const SubList::iterator subs_end = remember_subs.end();
for (SubList::iterator it = remember_subs.begin(); it != subs_end; ++it) {
menu->drawSubmenu(*it);
menu = menu->find(*it)->submenu();
if (! menu)
break;
}
configmenu->reconfigure(); configmenu->reconfigure();