Introducing GuiMenubar::init() to avoid destructing the object in order to re-initialize it.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21694 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-21 21:14:34 +00:00
parent 77a89e1486
commit a37a73e3c9
3 changed files with 13 additions and 2 deletions

View File

@ -39,6 +39,12 @@ namespace frontend {
GuiMenubar::GuiMenubar(LyXView * view, MenuBackend & mbe)
: owner_(static_cast<GuiView*>(view)), menubackend_(mbe)
{
init();
}
void GuiMenubar::init()
{
macxMenuBarInit();
@ -55,6 +61,9 @@ GuiMenubar::GuiMenubar(LyXView * view, MenuBackend & mbe)
<< menubackend_.getMenubar().size());
}
// Clear all menubar contents before filling it.
owner_->menuBar()->clear();
Menu menu;
menubackend_.expand(menubackend_.getMenubar(), menu, owner_->buffer());

View File

@ -36,6 +36,9 @@ public:
~GuiMenubar();
///
void init();
/// opens a top-level submenu given its name
void openByName(QString const & name);

View File

@ -1217,9 +1217,8 @@ void GuiView::resetDialogs()
{
// Make sure that no LFUN uses any LyXView.
theLyXFunc().setLyXView(0);
delete d.menubar_;
d.toolbars_->init();
d.menubar_ = new GuiMenubar(this, menubackend);
d.menubar_->init();
if (d.layout_)
d.layout_->updateContents(true);
}