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

Bennett> I can confirm that the patch works, though it of course
Bennett> defeats one of our aims in getting dialogs both not to remove
Bennett> menus and prevent the user from selecting inappropriate menu
Bennett> items (which then affect the main window) when the dialog is
Bennett> frontmost.

I think that attached patch (which is also attached to bug 1693) fixes
the problem properly.

Andreas, Bennett, could you test it?

JMarc

Index: src/frontends/qt2//ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.713
diff -u -p -r1.713 ChangeLog
--- src/frontends/qt2//ChangeLog	14 Sep 2004 10:20:38 -0000	1.713
+++ src/frontends/qt2//ChangeLog	1 Oct 2004 13:35:47 -0000
@@ -1,3 +1,11 @@
+2004-10-01  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* QLPopupMenu.C (populate): move the code below to here, so that
+	it only has an effect on the menu entries
+
+	* lyx_gui.C (getStatus): remove special Qt/Mac code, which broke
+	most dialogs (bug 1693)
+
 2004-09-09  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* qfont_loader.C (addFontPath): quote the name of the font dir in
Index: src/frontends/qt2//QLPopupMenu.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/QLPopupMenu.C,v
retrieving revision 1.34
diff -u -p -r1.34 QLPopupMenu.C
--- src/frontends/qt2//QLPopupMenu.C	14 Aug 2004 18:06:10 -0000	1.34
+++ src/frontends/qt2//QLPopupMenu.C	1 Oct 2004 13:35:49 -0000
@@ -24,6 +24,7 @@
 
 #ifdef Q_WS_MACX
 #include "kbmap.h"
+#include "LyXAction.h"
 #include "QLyXKeySym.h"
 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
 #endif
@@ -113,7 +114,7 @@ void QLPopupMenu::populate(Menu * menu)
 			setItemEnabled(res.first, m->status().enabled());
 			res.second->populate(m->submenu());
 		} else { // we have a MenuItem::Command
-			FuncStatus const status = m->status();
+			FuncStatus status = m->status();
 
 			Funcs::iterator fit =
 				funcs_.insert(funcs_.end(), m->func());
@@ -121,6 +122,17 @@ void QLPopupMenu::populate(Menu * menu)
 
 			QString label = toqstr(getLabel(*m));
 #ifdef Q_WS_MACX
+			/* In LyX/Mac, when a dialog is open, the
+			 menus of the application can still be
+			 accessed without giving focus to the main
+			 window. In this case, we want to disable the
+			 menu entries that are buffer-related.
+			*/
+			if (qApp->activeWindow() != qApp->mainWidget()
+			    && !lyxaction.funcHasFlag(m->func().action, 
+						      LyXAction::NoBuffer))
+				status.enabled(false);
+
 			/* There are two constraints on Qt/Mac: (1)
 			   the bindings require a unicode string to be
 			   represented meaningfully and std::string
Index: src/frontends/qt2//lyx_gui.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.72
diff -u -p -r1.72 lyx_gui.C
--- src/frontends/qt2//lyx_gui.C	26 Sep 2004 14:19:46 -0000	1.72
+++ src/frontends/qt2//lyx_gui.C	1 Oct 2004 13:35:49 -0000
@@ -283,17 +283,6 @@ FuncStatus getStatus(FuncRequest const &
 		break;
 	}
 
-#ifdef Q_WS_MACX
-	// In LyX/Mac, when a dialog is open, the menus of the
-	// application can still be accessed without giving focus to
-	// the main window. In this case, we want to disable the menu
-	// entries that are buffer-related.
-	if (use_gui
-	    && qApp->activeWindow() != qApp->mainWidget()
-	    && !lyxaction.funcHasFlag(ev.action, LyXAction::NoBuffer))
-		flag.enabled(false);
-#endif
-
 	return flag;
 }
 

Reply via email to