* 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
This commit is contained in:
Jean-Marc Lasgouttes 2007-01-03 11:59:10 +00:00
parent b7f2544bc3
commit 94da7f7c83
4 changed files with 29 additions and 34 deletions

View 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

View 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);
}
}

View 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_;
};
///

View 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