]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/QLPopupMenu.C
rename LFUN enum values according to their command (as used in th minibuffer/bind...
[lyx.git] / src / frontends / qt4 / QLPopupMenu.C
index a12ea9e25b85c3f7fc672246420dd7204a291301..892e6b0103abfcca18494b2eddf1acfc15898b3c 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <config.h>
 
+#include <boost/current_function.hpp>
+
 // Qt defines a macro 'signals' that clashes with a boost namespace.
 // All is well if the namespace is visible first.
 #include "QtView.h"
@@ -48,9 +50,9 @@ namespace frontend {
 
 // MacOSX specific stuff is at the end.
 
-QLPopupMenu::QLPopupMenu(QLMenubar * owner, 
+QLPopupMenu::QLPopupMenu(QLMenubar * owner,
                                                 MenuItem const & mi, bool topLevelMenu)
-       : owner_(owner), topLevelMenu_(topLevelMenu)
+       : owner_(owner)
 {
        name_ = mi.submenuname();
 
@@ -68,18 +70,17 @@ void QLPopupMenu::update()
        lyxerr[Debug::GUI] << "\tTriggered menu: " << name_ << endl;
 
        clear();
-       topLevelMenu.clear();
 
        if (name_.empty())
                return;
 
        Menu const & fromLyxMenu = owner_->backend().getMenu(name_);
-       owner_->backend().expand(fromLyxMenu, topLevelMenu, owner_->view());
-       
-       if (!owner_->backend().hasMenu(topLevelMenu.name())) {
-               lyxerr[Debug::GUI] << "\tWARNING: menu seems empty" << topLevelMenu.name() << endl;
+       owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view());
+
+       if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
+               lyxerr[Debug::GUI] << "\tWARNING: menu seems empty" << topLevelMenu_.name() << endl;
        }
-       populate(this, &topLevelMenu);
+       populate(this, &topLevelMenu_);
 
        specialMacXmenuHack();
 }
@@ -97,28 +98,28 @@ void QLPopupMenu::populate(QMenu* qMenu, Menu * menu)
 
        Menu::const_iterator m = menu->begin();
        Menu::const_iterator end = menu->end();
-       
+
        for (; m != end; ++m) {
 
                if (m->kind() == MenuItem::Separator) {
-               
+
                        qMenu->addSeparator();
                        lyxerr[Debug::GUI] << "adding Menubar Separator" << endl;
 
                } else if (m->kind() == MenuItem::Submenu) {
-                       
+
                        lyxerr[Debug::GUI] << "** creating New Sub-Menu " << getLabel(*m) << endl;
                        QMenu * subMenu = qMenu->addMenu(toqstr(getLabel(*m)));
                        populate(subMenu, m->submenu());
-                       
+
                } else { // we have a MenuItem::Command
 
                        FuncStatus status = m->status();
                        lyxerr[Debug::GUI] << "creating Menu Item " << m->label() << endl;
-                       
+
                        string label = getLabel(*m);
                        addBinding(label, *m);
-                       
+
                        QLAction * action = new QLAction(*(owner_->view()), label, m->func());
                        action->setEnabled(m->status().enabled());
                        action->setChecked(m->status().onoff(true));