From: Jean-Marc Lasgouttes Date: Wed, 3 Jan 2007 11:59:10 +0000 (+0000) Subject: * src/MenuBackend.[Ch]: the specialMenu is now a real menu, not a X-Git-Tag: 1.6.10~11378 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=94da7f7c835a9b2b45f9c8c2b1a5dd16683cc25b;p=features.git * src/MenuBackend.[Ch]: the specialMenu is now a real menu, not a 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 --- diff --git a/lib/ui/stdmenus.ui b/lib/ui/stdmenus.ui index 1eb98fafa6..c96fbe8161 100644 --- a/lib/ui/stdmenus.ui +++ b/lib/ui/stdmenus.ui @@ -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 diff --git a/src/MenuBackend.C b/src/MenuBackend.C index beaaa0cf71..d113efda01 100644 --- a/src/MenuBackend.C +++ b/src/MenuBackend.C @@ -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); } } diff --git a/src/MenuBackend.h b/src/MenuBackend.h index c72546c7f8..7d2fd84a35 100644 --- a/src/MenuBackend.h +++ b/src/MenuBackend.h @@ -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_; }; /// diff --git a/src/frontends/qt4/QLMenubar.C b/src/frontends/qt4/QLMenubar.C index bbe027d076..e1972e407d 100644 --- a/src/frontends/qt4/QLMenubar.C +++ b/src/frontends/qt4/QLMenubar.C @@ -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