]> 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 ecc7d0315a1475816b4e72882119976176965a71..892e6b0103abfcca18494b2eddf1acfc15898b3c 100644 (file)
@@ -28,7 +28,7 @@
 #include "debug.h"
 
 
-#ifdef Q_OS_MACX
+#ifdef Q_WS_MACX
 #include "kbmap.h"
 #include "QLyXKeySym.h"
 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
@@ -50,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();
 
@@ -70,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();
 }
@@ -99,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));
@@ -147,7 +146,7 @@ string const QLPopupMenu::getLabel(MenuItem const & mi)
 /// \todo Mac specific binding handling.
 void QLPopupMenu::addBinding(string & label, MenuItem const & mi)
 {
-#ifndef Q_OS_MACX
+#ifndef Q_WS_MACX
 
                string const binding(mi.binding());
                if (!binding.empty()) {
@@ -177,7 +176,7 @@ void QLPopupMenu::addBinding(string & label, MenuItem const & mi)
 /// \todo Fix Mac specific menu hack
 void QLPopupMenu::specialMacXmenuHack()
 {
-#ifdef Q_OS_MACX
+#ifdef Q_WS_MACX
        /* The qt/mac menu code has a very silly hack that
           moves some menu entries that it recognizes by name
           (e.g. "Preferences...") to the "LyX" menu. This