Georg Baum wrote:

> The problem is that the main window still has no focus when Dialog::hide
> is called. I tried to activate it with QMainWindow::setFocus() and
> QMainWindow::show(), but neither worked. I'll investigate further.

Here is the result. I split FuncRequest::UI in FuncRequest::MENU and
FuncRequest::TOOLBAR and unset the buffer only for FuncRequest::MENU in
LyXFunc::getStatus. The bug is now gone for me, but the question is whether
the menus are still disabled on the Mac. I think so, but am not sure :-)
Could one of our Mac users please test this patch?


Georg
Index: src/MenuBackend.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.107
diff -u -p -r1.107 MenuBackend.C
--- src/MenuBackend.C	28 Jul 2005 14:36:16 -0000	1.107
+++ src/MenuBackend.C	14 Sep 2005 07:24:31 -0000
@@ -106,7 +106,7 @@ MenuItem::MenuItem(Kind kind, string con
 		   FuncRequest const & func, bool optional)
 	: kind_(kind), label_(label), func_(func), optional_(optional)
 {
-	func_.origin = FuncRequest::UI;
+	func_.origin = FuncRequest::MENU;
 }
 
 
Index: src/ToolbarBackend.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ToolbarBackend.C,v
retrieving revision 1.26
diff -u -p -r1.26 ToolbarBackend.C
--- src/ToolbarBackend.C	8 Nov 2004 10:54:27 -0000	1.26
+++ src/ToolbarBackend.C	14 Sep 2005 07:24:31 -0000
@@ -207,7 +207,7 @@ void ToolbarBackend::add(Toolbar & tb,
 			 FuncRequest const & func, string const & tooltip)
 {
 	tb.items.push_back(make_pair(func, tooltip));
-	tb.items.back().first.origin = FuncRequest::UI;
+	tb.items.back().first.origin = FuncRequest::TOOLBAR;
 }
 
 
Index: src/funcrequest.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/funcrequest.h,v
retrieving revision 1.20
diff -u -p -r1.20 funcrequest.h
--- src/funcrequest.h	26 Nov 2004 14:52:52 -0000	1.20
+++ src/funcrequest.h	14 Sep 2005 07:24:31 -0000
@@ -28,8 +28,13 @@ public:
 	/// Where the request came from
 	enum Origin {
 		INTERNAL,
-		UI, // The menu or the toolbar
-		KEYBOARD, // a keyboard binding
+		/// the menu
+		MENU,
+		/// the toolbar
+		TOOLBAR,
+		/// a keyboard binding
+		KEYBOARD,
+		/// the minibuffer
 		COMMANDBUFFER
 	};
 
Index: src/lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.666
diff -u -p -r1.666 lyxfunc.C
--- src/lyxfunc.C	8 Sep 2005 12:06:49 -0000	1.666
+++ src/lyxfunc.C	14 Sep 2005 07:24:31 -0000
@@ -340,7 +341,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
 	   entries that are buffer-related.
 	*/
 	Buffer * buf;
-	if (cmd.origin == FuncRequest::UI && !owner->hasFocus())
+	if (cmd.origin == FuncRequest::MENU && !owner->hasFocus())
 		buf = 0;
 	else
 		buf = owner->buffer();
@@ -1578,8 +1598,9 @@ void LyXFunc::sendDispatchMessage(string
 	owner->updateMenubar();
 	owner->updateToolbars();
 
-	const bool verbose = (cmd.origin == FuncRequest::UI
-			      || cmd.origin == FuncRequest::COMMANDBUFFER);
+	const bool verbose = (cmd.origin == FuncRequest::MENU ||
+	                      cmd.origin == FuncRequest::TOOLBAR ||
+	                      cmd.origin == FuncRequest::COMMANDBUFFER);
 
 	if (cmd.action == LFUN_SELFINSERT || !verbose) {
 		lyxerr[Debug::ACTION] << "dispatch msg is " << msg << endl;
Index: src/frontends/Toolbars.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Toolbars.C,v
retrieving revision 1.3
diff -u -p -r1.3 Toolbars.C
--- src/frontends/Toolbars.C	26 Nov 2004 14:52:53 -0000	1.3
+++ src/frontends/Toolbars.C	14 Sep 2005 07:24:31 -0000
@@ -168,7 +168,7 @@ void layoutSelected(LyXView & lv, string
 		// Yes, the _() is correct
 		if (_(itname) == name) {
 			FuncRequest const func(LFUN_LAYOUT, itname,
-					       FuncRequest::UI);
+					       FuncRequest::TOOLBAR);
 			lv.getLyXFunc().dispatch(func);
 			return;
 		}

Reply via email to