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

Bennett> Well, it compiles now, but LyX on startup. Here's the
Bennett> backtrace:

Try this one instead.

JMarc

Index: src/frontends/qt4/qt_helpers.h
===================================================================
--- src/frontends/qt4/qt_helpers.h	(revision 16123)
+++ src/frontends/qt4/qt_helpers.h	(working copy)
@@ -89,7 +89,7 @@ inline void ucs4_to_qstring(char_type co
 {
 	int i = static_cast<int>(ls);
 	s.resize(i);
-	for (i ; --i >= 0; )
+	for ( ; --i >= 0; )
 		s[i] = ucs4_to_qchar(str[i]);
 }
 
Index: src/frontends/qt4/QLMenubar.C
===================================================================
--- src/frontends/qt4/QLMenubar.C	(revision 16123)
+++ src/frontends/qt4/QLMenubar.C	(working copy)
@@ -45,8 +45,6 @@ namespace frontend {
 QLMenubar::QLMenubar(LyXView * view, MenuBackend & mbe)
 	: owner_(static_cast<GuiView*>(view)), menubackend_(mbe)
 {
-	macxMenuBarInit();
-
 	lyxerr[Debug::GUI] << "populating menu bar" << lyx::to_utf8(menubackend_.getMenubar().name()) << endl;
 
 	if (menubackend_.getMenubar().size() == 0) {
@@ -97,6 +95,8 @@ QLMenubar::QLMenubar(LyXView * view, Men
 */
 	}
 	//QObject::connect(owner_->menuBar(), SIGNAL(triggered()), this, SLOT(update()));
+
+	macxMenuBarInit();
 }
 
 void QLMenubar::openByName(docstring const & name)
@@ -161,12 +161,17 @@ void QLMenubar::macxMenuBarInit()
 #ifdef Q_WS_MACX
 	mac_menubar_.reset(new QMenuBar);
 
+# ifdef MERGE_MAC_MENUS
 	// this is the name of the menu that contains our special entries
 	menubackend_.specialMenu(lyx::from_ascii("LyX"));
 	// make sure that the special entries are added to the first
 	// menu even before this menu has been opened.
-	//name_map_[menubackend_.getMenubar().begin()->submenuname()]->update();
-#endif
+	docstring menuname = menubackend_.getMenubar().begin()->submenuname();
+	name_map_[menuname]->update();
+# else
+	qt_mac_set_menubar_merge(false);
+# endif // MERGE_MAC_MENUS
+#endif // Q_WS_MACX
 }
 
 } // namespace frontend
Index: src/frontends/qt4/GuiApplication.C
===================================================================
--- src/frontends/qt4/GuiApplication.C	(revision 16123)
+++ src/frontends/qt4/GuiApplication.C	(working copy)
@@ -58,7 +58,7 @@ using std::endl;
 extern void initEncodings();
 
 ///////////////////////////////////////////////////////////////
-// You can find other X11 and MACX specific stuff
+// You can find other X11 specific stuff
 // at the end of this file...
 ///////////////////////////////////////////////////////////////
 
@@ -121,23 +121,6 @@ GuiApplication::GuiApplication(int & arg
 			<< "Could not find  Qt translations for locale "
 			<< fromqstr(language_name) << std::endl;
 
-/*#ifdef Q_WS_MACX
-	// These translations are meant to break Qt/Mac menu merging
-	// algorithm on some entries. It lists the menu names that
-	// should not be moved to the LyX menu
-	QTranslator aqua_trans(0);
-	aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setting", 0,
-					     "do_not_merge_me"));
-	aqua_trans.insert(QTranslatorMessage("QMenuBar", "Config", 0,
-					     "do_not_merge_me"));
-	aqua_trans.insert(QTranslatorMessage("QMenuBar", "Options", 0,
-					     "do_not_merge_me"));
-	aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setup", 0,
-					     "do_not_merge_me"));
-
-	qApp->installTranslator(&aqua_trans);
-#endif
-*/
 	using namespace lyx::graphics;
 
 	Image::newImage = boost::bind(&QLImage::newImage);
Index: src/frontends/qt4/QLPopupMenu.C
===================================================================
--- src/frontends/qt4/QLPopupMenu.C	(revision 16123)
+++ src/frontends/qt4/QLPopupMenu.C	(working copy)
@@ -78,9 +78,8 @@ void QLPopupMenu::update()
 	if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
 		lyxerr[Debug::GUI] << "\tWARNING: menu seems empty" << lyx::to_utf8(topLevelMenu_.name()) << endl;
 	}
+	specialMacXmenuHack(this);
 	populate(this, &topLevelMenu_);
-
-	specialMacXmenuHack();
 }
 
 void QLPopupMenu::populate(QMenu* qMenu, Menu * menu)
@@ -171,9 +170,9 @@ void QLPopupMenu::addBinding(docstring &
 }
 
 /// \todo Fix Mac specific menu hack
-void QLPopupMenu::specialMacXmenuHack()
+void QLPopupMenu::specialMacXmenuHack(QMenu * qMenu)
 {
-#ifdef Q_WS_MACX
+#ifdef MERGE_MAC_MENUS
 	/* 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
@@ -181,17 +180,19 @@ void QLPopupMenu::specialMacXmenuHack()
 	   always available. Since we build menus on demand,
 	   we add some dummy contents to one of the menus (JMarc)
 	*/
-/*
+
 	static QLPopupMenu * themenu = this;
-	if (themenu == this && owner_->backend().hasMenu("LyX")) {
-		Menu special = owner_->backend().getMenu("LyX");
+	if (themenu == this && owner_->backend().hasMenu(from_ascii("LyX"))) {
+		Menu special = owner_->backend().getMenu(from_ascii("LyX"));
 		Menu::const_iterator end = special.end();
 		Menu::size_type i = 0;
 		for (Menu::const_iterator cit = special.begin();
-		     cit != end ; ++cit, ++i)
-			insertItem(toqstr(cit->label()), indexOffset + i);
+		     cit != end ; ++cit, ++i) {
+			Action * action = new Action(*(owner_->view()),
+						     cit->label(), cit->func());
+			qMenu->addAction(action);
+		}
 	}
-*/
 #endif
 }
 
Index: src/frontends/qt4/GuiApplication.h
===================================================================
--- src/frontends/qt4/GuiApplication.h	(revision 16123)
+++ src/frontends/qt4/GuiApplication.h	(working copy)
@@ -23,14 +23,6 @@
 
 #include <QApplication>
 
-///////////////////////////////////////////////////////////////
-// Specific stuff
-
-#ifdef Q_WS_MACX
-#include <Carbon/Carbon.h>
-#endif
-///////////////////////////////////////////////////////////////
-
 namespace lyx {
 
 class BufferView;
Index: src/frontends/qt4/QLPopupMenu.h
===================================================================
--- src/frontends/qt4/QLPopupMenu.h	(revision 16123)
+++ src/frontends/qt4/QLPopupMenu.h	(working copy)
@@ -17,6 +17,13 @@
 #include "funcrequest.h"
 #include "MenuBackend.h"
 
+#ifdef Q_WS_MAC
+# define MERGE_MAC_MENUS
+# ifndef MERGE_MAC_MENUS
+extern void qt_mac_set_menubar_merge(bool b);
+# endif
+#endif
+
 namespace lyx {
 namespace frontend {
 
@@ -58,7 +65,7 @@ private:
 
 	/// Mac specific menu hack
 	/// \todo Fix it
-	void specialMacXmenuHack();
+	void specialMacXmenuHack(QMenu * qMenu);
 };
 
 } // namespace frontend

Reply via email to