Free GuiPopupMenu from GuiMenubar.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22301 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-25 20:51:05 +00:00
parent 02110a3d5b
commit 3ffd3f51a1
3 changed files with 12 additions and 13 deletions

View File

@ -87,7 +87,7 @@ void GuiMenubar::init()
Menu menu;
menubackend_.expand(menubackend_.getMenubar(), menu, owner_->buffer());
GuiPopupMenu * qMenu = new GuiPopupMenu(this, *m, true);
GuiPopupMenu * qMenu = new GuiPopupMenu(owner_, *m, true);
owner_->menuBar()->addMenu(qMenu);
name_map_[toqstr(name)] = qMenu;

View File

@ -15,7 +15,6 @@
#include "Action.h"
#include "GuiPopupMenu.h"
#include "GuiMenubar.h"
#include "qt_helpers.h"
#include "LyXFunc.h"
#include "MenuBackend.h"
@ -28,9 +27,9 @@
namespace lyx {
namespace frontend {
GuiPopupMenu::GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi,
bool topLevelMenu)
: QMenu(owner->menuBar()), owner_(owner)
: QMenu(owner), owner_(owner)
{
name_ = mi.submenuname();
@ -52,12 +51,12 @@ void GuiPopupMenu::updateView()
return;
// Here, We make sure that theLyXFunc points to the correct LyXView.
theLyXFunc().setLyXView(owner_->view());
theLyXFunc().setLyXView(owner_);
Menu const & fromLyxMenu = owner_->backend().getMenu(name_);
owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer());
Menu const & fromLyxMenu = menubackend.getMenu(name_);
menubackend.expand(fromLyxMenu, topLevelMenu_, owner_->buffer());
if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
if (!menubackend.hasMenu(topLevelMenu_.name())) {
LYXERR(Debug::GUI, "\tWARNING: menu seems empty"
<< to_utf8(topLevelMenu_.name()));
}
@ -99,7 +98,7 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
docstring label = getLabel(*m);
addBinding(label, *m);
Action * action = new Action(*(owner_->view()),
Action * action = new Action(*(owner_),
QIcon(), toqstr(label), m->func(), QString());
qMenu->addAction(action);
}

View File

@ -20,7 +20,7 @@
namespace lyx {
namespace frontend {
class GuiMenubar;
class GuiView;
/// a submenu
class GuiPopupMenu : public QMenu
@ -28,7 +28,7 @@ class GuiPopupMenu : public QMenu
Q_OBJECT
public:
///
GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
GuiPopupMenu(GuiView * owner, MenuItem const & mi,
bool topLevelMenu = false);
/// populates the menu or one of its submenu
@ -45,8 +45,8 @@ private:
/// add binding keys a the menu item label.
void addBinding(docstring & label, MenuItem const & mi);
/// our owning menubar
GuiMenubar * owner_;
/// our owning view
GuiView * owner_;
/// the name of this menu
docstring name_;
/// Top Level Menu