From 3611b0ff3380fd0b18bdc35dd07e7c41423dc19a Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 4 Sep 2007 14:34:42 +0000 Subject: [PATCH] Embedding patch 4: interaction between buffer and the embedding dialog. Emit embeddingChanged signal to update the embedding dialog. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20038 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.h | 2 ++ src/buffer_funcs.cpp | 5 +++++ src/frontends/LyXView.cpp | 11 +++++++++++ src/frontends/LyXView.h | 4 ++++ src/frontends/controllers/ControlEmbeddedFiles.cpp | 2 +- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Buffer.h b/src/Buffer.h index 9d7d266bf6..6e5ba14546 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -144,6 +144,8 @@ public: boost::signal changed; /// This signal is emitted when the buffer structure is changed. boost::signal structureChanged; + /// This signal is emitted when an embedded file is changed + boost::signal embeddingChanged; /// This signal is emitted when some parsing error shows up. boost::signal errors; /// This signal is emitted when some message shows up. diff --git a/src/buffer_funcs.cpp b/src/buffer_funcs.cpp index 857bbe6a60..ee2a68a379 100644 --- a/src/buffer_funcs.cpp +++ b/src/buffer_funcs.cpp @@ -621,6 +621,11 @@ void updateLabels(Buffer const & buf, bool childonly) cbuf.tocBackend().update(); if (!childonly) cbuf.structureChanged(); + // FIXME + // the embedding signal is emitted with structureChanged signal + // this is inaccurate so these two will be separated later. + cbuf.embeddedFiles().update(); + cbuf.embeddingChanged(); } diff --git a/src/frontends/LyXView.cpp b/src/frontends/LyXView.cpp index f36cc12b71..926ceaa59c 100644 --- a/src/frontends/LyXView.cpp +++ b/src/frontends/LyXView.cpp @@ -170,6 +170,10 @@ void LyXView::connectBuffer(Buffer & buf) 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 @@ void LyXView::disconnectBuffer() { errorsConnection_.disconnect(); bufferStructureChangedConnection_.disconnect(); + bufferEmbeddingChangedConnection_.disconnect(); messageConnection_.disconnect(); busyConnection_.disconnect(); titleConnection_.disconnect(); @@ -291,6 +296,12 @@ void LyXView::updateToc() } +void LyXView::updateEmbeddedFiles() +{ + updateDialog("embedding", ""); +} + + void LyXView::updateToolbars() { WorkArea * wa = currentWorkArea(); diff --git a/src/frontends/LyXView.h b/src/frontends/LyXView.h index a864f23ab8..e7100d6f17 100644 --- a/src/frontends/LyXView.h +++ b/src/frontends/LyXView.h @@ -215,6 +215,8 @@ private: /// 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 @@ private: protected: /// void updateToc(); + /// + void updateEmbeddedFiles(); private: int id_; diff --git a/src/frontends/controllers/ControlEmbeddedFiles.cpp b/src/frontends/controllers/ControlEmbeddedFiles.cpp index 4887541266..674568020b 100644 --- a/src/frontends/controllers/ControlEmbeddedFiles.cpp +++ b/src/frontends/controllers/ControlEmbeddedFiles.cpp @@ -55,7 +55,7 @@ void ControlEmbeddedFiles::updateEmbeddedFiles() { // copy buffer embeddedFiles to a local copy kernel().buffer().embeddedFiles().update(); - //kernel().buffer().embeddingChanged(); + kernel().buffer().embeddingChanged(); } -- 2.39.5