]> git.lyx.org Git - lyx.git/commitdiff
* src/MenuBackend.[Ch]: the specialMenu is now a real menu, not a
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 3 Jan 2007 11:59:10 +0000 (11:59 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 3 Jan 2007 11:59:10 +0000 (11:59 +0000)
menu name.

* src/frontends/qt4/QLMenubar.C (macxMenuBarInit): hardcode the
special menu instead of reading it from ui files. Use labels that will
trigger Qt menu merging functionality onthe mac. This fixes menu
merging on LyX/Mac (but the menu names are still in english for now).

* lib/ui/stdmenus.ui: delete special menu definition "LyX".

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16479 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ui/stdmenus.ui
src/MenuBackend.C
src/MenuBackend.h
src/frontends/qt4/QLMenubar.C

index 1eb98fafa68f0ff793273454753b5f0de655b969..c96fbe8161e2f667e5b9d98522ecccf127bfab6a 100644 (file)
@@ -472,14 +472,4 @@ Menuset
                Item "About LyX|X" "dialog-show aboutlyx"
        End
 
-#
-#  LYX MENU - this menu is only used by LyX/Mac
-#
-
-       Menu "LyX"
-               Item "About LyX" "dialog-show aboutlyx"
-               Item "Preferences..." "dialog-show prefs"
-               Item "Quit LyX" "lyx-quit"
-       End
-
 End
index beaaa0cf711249e73ba6d2381f0c07b54d9e8f87..d113efda010019f7b80e9d06172464262075c42c 100644 (file)
@@ -413,10 +413,9 @@ void Menu::checkShortcuts() const
 }
 
 
-void MenuBackend::specialMenu(docstring const &name)
+void MenuBackend::specialMenu(Menu const & menu)
 {
-       if (hasMenu(name))
-               specialmenu_ = &getMenu(name);
+       specialmenu_ = menu;
 }
 
 
@@ -890,8 +889,7 @@ void MenuBackend::expand(Menu const & frommenu, Menu & tomenu,
                        break;
 
                case MenuItem::Command:
-                       if (!specialmenu_
-                           || !specialmenu_->hasFunc(cit->func()))
+                       if (!specialmenu_.hasFunc(cit->func()))
                                tomenu.addWithStatusCheck(*cit);
                }
        }
index c72546c7f8670ec13454add5ca789a1f24bd83da..7d2fd84a354d50e315e0060d5b608293d08aa012 100644 (file)
@@ -202,7 +202,7 @@ public:
        ///
        typedef MenuList::iterator iterator;
        ///
-       MenuBackend() : specialmenu_(0) {}
+       MenuBackend() {}
        ///
        void read(LyXLex &);
        ///
@@ -218,10 +218,13 @@ public:
        ///
        bool empty() const { return menulist_.empty(); }
        /** This defines a menu whose entries list the FuncRequests
-           will be removed by expand() in other menus. This is used by
-           the Qt/Mac code
+           that will be removed by expand() in other menus. This is
+           used by the Qt/Mac code
        */
-       void specialMenu(docstring const &);
+       void specialMenu(Menu const &);
+       ///
+       Menu const & specialMenu() { return specialmenu_; }
+
        /// Expands some special entries of the menu
        /** The entries with the following kind are expanded to a
            sequence of Command MenuItems: Lastfiles, Documents,
@@ -251,7 +254,7 @@ private:
        ///
        Menu menubar_;
        ///
-       Menu specialmenu_;
+       Menu specialmenu_;
 };
 
 ///
index bbe027d076540f0076a5fa4a5375fc78e93d474f..e1972e407d686358de29d32147f5b50300b16d8f 100644 (file)
@@ -179,20 +179,24 @@ void QLMenubar::macxMenuBarInit()
           build menus on demand, we add the entries to a dummy menu
           (JMarc)
        */
-
-       // this is the name of the menu that contains our special entries
-       docstring const & specialname = from_ascii("LyX");
-       if (menubackend_.hasMenu(specialname)) {
-               QMenu * qMenu = owner_->menuBar()->addMenu("special");
-               //qMenu->setVisible(false);
-
-               menubackend_.specialMenu(specialname);
-               Menu const & special = menubackend_.getMenu(specialname);
-               Menu::const_iterator end = special.end();
-               for (Menu::const_iterator cit = special.begin();
-                    cit != end ; ++cit) 
-                       qMenu->addAction(new Action(*owner_, cit->label(), cit->func()));
-       }
+       
+       Menu special;
+       special.add(MenuItem(MenuItem::Command, 
+                            qstring_to_ucs4(QMenuBar::tr("About")), 
+                            FuncRequest(LFUN_DIALOG_SHOW, "aboutlyx")));
+       special.add(MenuItem(MenuItem::Command, 
+                            qstring_to_ucs4(QMenuBar::tr("Preferences")),
+                            FuncRequest(LFUN_DIALOG_SHOW, "prefs")));
+       special.add(MenuItem(MenuItem::Command, 
+                            qstring_to_ucs4(QMenuBar::tr("Quit")),
+                            FuncRequest(LFUN_LYX_QUIT)));
+       menubackend_.specialMenu(special);
+       
+       QMenu * qMenu = owner_->menuBar()->addMenu("special");  
+       Menu::const_iterator end = menubackend_.specialMenu().end();
+       for (Menu::const_iterator cit = menubackend_.specialMenu().begin();
+            cit != end ; ++cit) 
+               qMenu->addAction(new Action(*owner_, cit->label(), cit->func()));
 # else
        qt_mac_set_menubar_merge(false);
 # endif // MERGE_MAC_MENUS