> The only comment I have is that during ordinary development time no 'two
> OKs' are formally needed.

The problem here is that I have less confidence in this patch. It
looks more like a temporary fix than a formal solution.

> has a tendency to shorten after committing lots of uncontroversial
> stuff and lenghten as soon controversial stuff went in without proper
> discussion.

This was what I have done. I split the patch and committed the obvious
part (and left with a uncompilable trunk).


> This is not to say that waiting for explicit nods is discouraged or even
> forbidden.

I will wait for another day.

> Just go on and try to solve the problems you encounter in a timely
> manner. And try to keep trunk compilable ;-)

Let me explain the problem again:

I need a good signal handling mechanism to update the embedding
dialog. Because addition/removal of embedding files only happens to
certain insets, it should be easier than the Toc dialog. This patch
emits the embeddingChanged signal along with structureChanged, and
does not update the dialog *accurately*. For example, if you remove a
figure from a paragraph, the embedding dialog is not updated because
there is no structure change.

I am not quite sure what to do: emit the signal with buffer edition,
or in the constructor/destructor of some insets. If there is no good
suggestion, I will submit the current patch and revisit this problem
later.

Attached is an updated patch.

Cheers,
Bo
Index: src/buffer_funcs.cpp
===================================================================
--- src/buffer_funcs.cpp	(revision 20029)
+++ src/buffer_funcs.cpp	(working copy)
@@ -621,6 +621,10 @@
 	cbuf.tocBackend().update();
 	if (!childonly)
 		cbuf.structureChanged();
+	// the embedding signal is emitted with structureChanged signal
+	// this is inaccurate so these two should be separated.
+	cbuf.embeddedFiles().update();
+	cbuf.embeddingChanged();
 }
 
 
Index: src/Buffer.h
===================================================================
--- src/Buffer.h	(revision 20029)
+++ src/Buffer.h	(working copy)
@@ -144,6 +144,8 @@
 	boost::signal<void()> changed;
 	/// This signal is emitted when the buffer structure is changed.
 	boost::signal<void()> structureChanged;
+	/// This signal is emitted when an embedded file is changed
+	boost::signal<void()> embeddingChanged;
 	/// This signal is emitted when some parsing error shows up.
 	boost::signal<void(std::string)> errors;
 	/// This signal is emitted when some message shows up.
Index: src/frontends/LyXView.h
===================================================================
--- src/frontends/LyXView.h	(revision 20029)
+++ src/frontends/LyXView.h	(working copy)
@@ -215,6 +215,8 @@
 
 	/// buffer structure changed signal connection
 	boost::signals::connection bufferStructureChangedConnection_;
+	/// embedded file change signal connection
+	boost::signals::connection bufferEmbeddingChangedConnection_;
 	/// buffer errors signal connection
 	boost::signals::connection errorsConnection_;
 	/// buffer messages signal connection
@@ -255,6 +257,8 @@
 protected:
 	///
 	void updateToc();
+	///
+	void updateEmbeddedFiles();
 
 private:
 	int id_;
Index: src/frontends/LyXView.cpp
===================================================================
--- src/frontends/LyXView.cpp	(revision 20029)
+++ src/frontends/LyXView.cpp	(working copy)
@@ -170,6 +170,10 @@
 		buf.getMasterBuffer()->structureChanged.connect(
 			boost::bind(&LyXView::updateToc, this));
 
+	bufferEmbeddingChangedConnection_ =
+		buf.embeddingChanged.connect(
+			boost::bind(&LyXView::updateEmbeddedFiles, this));
+
 	errorsConnection_ =
 		buf.errors.connect(
 			boost::bind(&LyXView::showErrorList, this, _1));
@@ -200,6 +204,7 @@
 {
 	errorsConnection_.disconnect();
 	bufferStructureChangedConnection_.disconnect();
+	bufferEmbeddingChangedConnection_.disconnect();
 	messageConnection_.disconnect();
 	busyConnection_.disconnect();
 	titleConnection_.disconnect();
@@ -291,6 +296,12 @@
 }
 
 
+void LyXView::updateEmbeddedFiles()
+{
+	updateDialog("embedding", "");
+}
+
+
 void LyXView::updateToolbars()
 {
 	WorkArea * wa = currentWorkArea();
Index: src/frontends/controllers/ControlEmbeddedFiles.cpp
===================================================================
--- src/frontends/controllers/ControlEmbeddedFiles.cpp	(revision 20029)
+++ src/frontends/controllers/ControlEmbeddedFiles.cpp	(working copy)
@@ -55,7 +55,7 @@
 {
 	// copy buffer embeddedFiles to a local copy
 	kernel().buffer().embeddedFiles().update();
-	//kernel().buffer().embeddingChanged();
+	kernel().buffer().embeddingChanged();
 }
 
 

Reply via email to