This patch (against 1.4) should 

1/ reimplement the OSX feature that greys-out unavailable actions when
a dialog is active

2/ fix the bug that save is not reactivated when changing document
settings.

Please test both behaviours, and in general weird toolbar things.

JMarc

Index: src/lyxfunc.C
===================================================================
--- src/lyxfunc.C	(revision 15327)
+++ src/lyxfunc.C	(working copy)
@@ -345,7 +345,7 @@ FuncStatus LyXFunc::getStatus(FuncReques
 	   http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
 	*/
 	Buffer * buf;
-	if (cmd.origin == FuncRequest::UI && !owner->hasFocus())
+	if (cmd.origin == FuncRequest::MENU && !owner->hasFocus())
 		buf = 0;
 	else
 		buf = owner->buffer();
@@ -1609,23 +1609,16 @@ void LyXFunc::dispatch(FuncRequest const
 			view()->owner()->updateLayoutChoice();
 		}
 	}
+	owner->updateMenubar();
+	owner->updateToolbars();
 	sendDispatchMessage(_(getMessage()), cmd);
 }
 
 
 void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & cmd)
 {
-	/* When an action did not originate from the UI/kbd, it makes
-	 * sense to avoid updating the GUI. It turns out that this
-	 * fixes bug 1941, for reasons that are described here:
-	 * http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4 
-	 */
-	if (cmd.origin != FuncRequest::INTERNAL) {
-		owner->updateMenubar();
-		owner->updateToolbars();
-	}
-
-	const bool verbose = (cmd.origin == FuncRequest::UI
+	const bool verbose = (cmd.origin == FuncRequest::MENU
+			      || cmd.origin == FuncRequest::TOOLBAR
 			      || cmd.origin == FuncRequest::COMMANDBUFFER);
 
 	if (cmd.action == LFUN_SELFINSERT || !verbose) {
Index: src/frontends/Toolbars.C
===================================================================
--- src/frontends/Toolbars.C	(revision 15327)
+++ src/frontends/Toolbars.C	(working copy)
@@ -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;
 		}
Index: src/funcrequest.h
===================================================================
--- src/funcrequest.h	(revision 15327)
+++ src/funcrequest.h	(working copy)
@@ -28,7 +28,8 @@ public:
 	/// Where the request came from
 	enum Origin {
 		INTERNAL,
-		UI, // The menu or the toolbar
+		MENU, // A menu entry
+		TOOLBAR, // A toolbar icon
 		KEYBOARD, // a keyboard binding
 		COMMANDBUFFER
 	};
Index: src/MenuBackend.C
===================================================================
--- src/MenuBackend.C	(revision 15327)
+++ src/MenuBackend.C	(working copy)
@@ -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
===================================================================
--- src/ToolbarBackend.C	(revision 15327)
+++ src/ToolbarBackend.C	(working copy)
@@ -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/frontends/qt2/QtView.C
===================================================================
--- src/frontends/qt2/QtView.C	(revision 15327)
+++ src/frontends/qt2/QtView.C	(working copy)
@@ -149,11 +149,7 @@ void QtView::activated(FuncRequest const
 
 bool QtView::hasFocus() const
 {
-#if 0
 	return qApp->activeWindow() == this;
-#else
-	return true;
-#endif
 }
 
 

Reply via email to