"Paragraph form doesn't check if it can apply to current para"

I _think_ that the attached patch will fix this, although we probably need to 
emit an updateParagraph(true) signal on leaving the insettext as well as 
emitting updateParagraph(false) on entering it so that the contents of the 
paragraph dialog can be applied again. (Of  course, if we enter a new 
insettext, then the dialog is automatically disabled again.)

Could those who know what I'm talking about have a look please. (John, 
Jürgen, Lars, etc, etc, etc)

Regards,
Angus
Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.218
diff -u -p -r1.218 BufferView_pimpl.C
--- src/BufferView_pimpl.C	21 Mar 2002 17:25:06 -0000	1.218
+++ src/BufferView_pimpl.C	22 Mar 2002 11:53:24 -0000
@@ -280,7 +266,7 @@ bool BufferView::Pimpl::fitCursor()
 		ret = screen_->fitCursor(bv_->text, bv_);
 	}
 
-	bv_->owner()->getDialogs()->updateParagraph();
+	bv_->owner()->getDialogs()->updateParagraph(true);
 	if (ret)
 	    updateScrollbar();
 	return ret;
Index: src/frontends/Dialogs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Dialogs.h,v
retrieving revision 1.52
diff -u -p -r1.52 Dialogs.h
--- src/frontends/Dialogs.h	21 Mar 2002 21:13:35 -0000	1.52
+++ src/frontends/Dialogs.h	22 Mar 2002 11:53:25 -0000
@@ -143,8 +143,12 @@ public:
 	SigC::Signal1<void, InsetFloat *> showFloat;
 	///
 	SigC::Signal0<void> showParagraph;
-	///
-	SigC::Signal0<void> updateParagraph;
+	/** Tell the paragraph dialog that the cusror has moved to a different
+	 *  paragraph. The bool indicates whether this paragraph will accept
+	 *  input from the dialog. "Regular" paragraphs pass \c true to the
+	 *  signal. InsetTexts pass \c false.
+	 */
+	SigC::Signal1<void, bool> updateParagraph;
 	///
 	SigC::Signal0<void> showPreamble;
 	///
Index: src/frontends/xforms/FormParagraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormParagraph.C,v
retrieving revision 1.62
diff -u -p -r1.62 FormParagraph.C
--- src/frontends/xforms/FormParagraph.C	21 Mar 2002 21:18:03 -0000	1.62
+++ src/frontends/xforms/FormParagraph.C	22 Mar 2002 11:53:27 -0000
@@ -73,22 +73,20 @@ Paragraph const * FormParagraph::getCurr
 }
 
 
-void FormParagraph::changedParagraph()
+void FormParagraph::changedParagraph(bool accept_input)
 {
 	/// Record the paragraph
 	Paragraph const * const p = getCurrentParagraph();
 	if (p == 0 || p == par_)
 		return;
 
-	// OBS FIX LOOK HERE
+	// For now, don't bother checking if the params are different,
 
-	// shouldn't we chage the par_ pointer too?
-	// anyway for me the below function does just nothing!
-	// (Jug 20020108)
-
-	// For now don't bother checking if the params are different,
-	// just activate the Apply button
-	bc().valid();
+	// The underlying paragraph will accept our changes
+	if (accept_input)
+		bc().valid();
+	else
+		bc().invalid();
 }
 
 
Index: src/frontends/xforms/FormParagraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormParagraph.h,v
retrieving revision 1.20
diff -u -p -r1.20 FormParagraph.h
--- src/frontends/xforms/FormParagraph.h	21 Mar 2002 21:18:03 -0000	1.20
+++ src/frontends/xforms/FormParagraph.h	22 Mar 2002 11:53:27 -0000
@@ -45,8 +45,8 @@ private:
 	virtual void connect();
 	/// Disconnect signals
 	virtual void disconnect();
-	///
-	void changedParagraph();
+	/// See comment to Dialogs::updateParagraph for bool.
+	void changedParagraph(bool accept_input);
 	///
 	Paragraph const * getCurrentParagraph() const;
 	///
Index: src/insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.275
diff -u -p -r1.275 insettext.C
--- src/insets/insettext.C	21 Mar 2002 17:09:52 -0000	1.275
+++ src/insets/insettext.C	22 Mar 2002 11:53:34 -0000
@@ -43,6 +43,7 @@
 #include "lyxfind.h"
 
 #include "frontends/Alert.h"
+#include "frontends/Dialogs.h"
 
 #include "support/textutils.h"
 #include "support/LAssert.h"
@@ -684,6 +685,10 @@ void InsetText::edit(BufferView * bv, in
 	if (drawFrame_ == LOCKED)
 		code = CURSOR|DRAW_FRAME;
 	updateLocal(bv, code, false);
+
+	// Tell the paragraph dialog (if it's open) that this inset won't
+	// accept input from it.
+	bv->owner()->getDialogs()->updateParagraph(false);
 }
 
 

Reply via email to