Will this be applied?
Thanks, Ed.
---------- Forwarded Message ----------
Subject: Re: formparagraph
Date: Wed, 31 Jul 2002 17:51:56 +0200
From: Edwin Leuven <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
something like this?
-------------------------------------------------------
Index: Dialogs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Dialogs.C,v
retrieving revision 1.9
diff -u -p -r1.9 Dialogs.C
--- Dialogs.C 2 Jul 2002 19:23:08 -0000 1.9
+++ Dialogs.C 31 Jul 2002 15:41:28 -0000
@@ -187,13 +187,6 @@ void Dialogs::showParagraph()
gui_ShowParagraph(*dialogs_lyxview, *this);
}
-void Dialogs::updateParagraph()
-{
-#if 0
- gui_UpdateParagraph(*dialogs_lyxview, *this);
-#endif
-}
-
void Dialogs::showPreamble()
{
Index: Dialogs.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/Dialogs.h,v
retrieving revision 1.57
diff -u -p -r1.57 Dialogs.h
--- Dialogs.h 2 Jul 2002 19:23:08 -0000 1.57
+++ Dialogs.h 31 Jul 2002 15:41:28 -0000
@@ -143,7 +143,7 @@ public:
///
void showParagraph();
///
- void updateParagraph();
+ boost::signal0<void> updateParagraph;
///
void showPreamble();
///
Index: controllers/ControlParagraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlParagraph.C,v
retrieving revision 1.4
diff -u -p -r1.4 ControlParagraph.C
--- controllers/ControlParagraph.C 24 Jun 2002 20:28:06 -0000 1.4
+++ controllers/ControlParagraph.C 31 Jul 2002 15:41:28 -0000
@@ -14,6 +14,7 @@
#endif
#include "ControlParagraph.h"
+#include "ButtonControllerBase.h"
#include "ViewBase.h"
#include "ParagraphParameters.h"
#include "Liason.h"
@@ -23,13 +24,19 @@
#include "buffer.h"
#include "lyxtext.h"
#include "support/LAssert.h"
+#include "Dialogs.h"
+#include <boost/bind.hpp>
using Liason::setMinibuffer;
ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), pp_(0), ininset_(false)
-{}
+{
+ cp_ = d_.updateParagraph.connect(
+ boost::bind(&ControlParagraph::changedParagraph, this));
+
+}
ControlParagraph::~ControlParagraph()
@@ -111,4 +118,19 @@ void ControlParagraph::setParams()
/// is paragraph in inset
ininset_ = par_->inInset();
+}
+
+void ControlParagraph::changedParagraph()
+{
+ /// get paragraph
+ Paragraph const * p = lv_.view()->getLyXText()->cursor.par();
+
+ if (p == 0) // this is wrong as we don't set par_ here! /* || p == par_) */
+ return;
+
+ // For now, don't bother checking if the params are different.
+ // Will the underlying paragraph accept our changes?
+ Inset * const inset = p->inInset();
+ bool const accept = !(inset && inset->forceDefaultParagraphs(inset));
+ bc().valid(accept);
}
Index: controllers/ControlParagraph.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlParagraph.h,v
retrieving revision 1.3
diff -u -p -r1.3 ControlParagraph.h
--- controllers/ControlParagraph.h 18 Jun 2002 15:44:20 -0000 1.3
+++ controllers/ControlParagraph.h 31 Jul 2002 15:41:28 -0000
@@ -38,6 +38,8 @@ public:
bool inInset() const;
///
LyXAlignment alignPossible() const;
+ ///
+ void changedParagraph();
private:
/// Get changed parameters and Dispatch them to the kernel.
@@ -51,6 +53,8 @@ private:
bool ininset_;
///
LyXAlignment alignpos_;
+ /// Changed Paragraph connection.
+ boost::signals::connection cp_;
};
#endif // CONTROLPARAGRAPH_H