It came out that the problem is caused by refreshReadOnly(), called 
(indirectly) by Dialog::checkStatus(). refreshReadOnly disables all widgets 
(that are addReadOnly()'ed) in read only mode and enables all these widgets 
in non-read-only mode. The latter, which is necessary to switch modes, 
overrides the intiial disabling of certain widgets by the dialogs.

The attached patch just calls the dialog's update() after all widgets have 
been enabled by refreshReadOnly, so that the widgets that should be disabled 
actually get disabled.

I have tested all scenarios I could think of (non-read-only, read-only and 
switches between those two modes) and saw no problems.

Comments?

Jürgen
Index: Dialog.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/Dialog.C,v
retrieving revision 1.18
diff -p -u -r1.18 Dialog.C
--- Dialog.C	26 Apr 2005 09:37:52 -0000	1.18
+++ Dialog.C	3 Oct 2005 09:57:09 -0000
@@ -186,11 +186,17 @@ void Dialog::checkStatus()
 		return;
 	}
 
+	bool const readonly = kernel().isBufferReadonly();
 	// check whether this dialog may be active
 	if (controller().canApply())
-		bc().readOnly(kernel().isBufferReadonly());
+		bc().readOnly(readonly);
 	else
 		bc().readOnly(true);
+
+	// refreshReadOnly() is too generous in _enabling_ widgets
+	// update dialog to disable disabled widgets again
+	if (!readonly)
+		view().update();
 }
 
 

Reply via email to