>>>>> "Bennett" == Bennett Helm <[EMAIL PROTECTED]> writes:

Jean-Marc> Try this one instead. It should additionally show correctly
Jean-Marc> the menus when a dialog has focus.

Bennett> In both English and French, I get only a LyX menu and nothing
Bennett> else. In that menu, Preferences is grayed out, and there's no
Bennett> About LyX item. (In both English and French, menus appear in
Bennett> English, though in French dialogs appear in French ... where
Bennett> translated.)

Try the previous version (attached again here) then.

JMarc

Index: src/frontends/qt4/QLMenubar.C
===================================================================
--- src/frontends/qt4/QLMenubar.C	(revision 16378)
+++ src/frontends/qt4/QLMenubar.C	(working copy)
@@ -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
Index: src/MenuBackend.C
===================================================================
--- src/MenuBackend.C	(revision 16378)
+++ src/MenuBackend.C	(working copy)
@@ -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 & fr
 			break;
 
 		case MenuItem::Command:
-			if (!specialmenu_
-			    || !specialmenu_->hasFunc(cit->func()))
+			if (!specialmenu_.hasFunc(cit->func()))
 				tomenu.addWithStatusCheck(*cit);
 		}
 	}
Index: src/MenuBackend.h
===================================================================
--- src/MenuBackend.h	(revision 16378)
+++ src/MenuBackend.h	(working copy)
@@ -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: lib/ui/stdmenus.ui
===================================================================
--- lib/ui/stdmenus.ui	(revision 16378)
+++ lib/ui/stdmenus.ui	(working copy)
@@ -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

Reply via email to