commit c26c7602e4b5139ad8a98e77d97cf47ba67588d2
Author: Richard Kimberly Heck <[email protected]>
Date: Fri May 4 12:37:52 2018 -0400
Copy modules into the Advanced F&R pane as well.
(cherry picked from commit 5064c09e9f57a7ffb6082a7f8ec06c03ee9a0cef)
Update the Advanced F&R document class when switching buffers.
(cherry picked from commit 944b0ae55dd89e48bf8845c6d5e08a73bd1c4917)
---
src/BufferParams.cpp | 12 ++++++++++++
src/BufferParams.h | 5 ++++-
src/frontends/qt4/FindAndReplace.cpp | 23 +++++++++++++++--------
src/frontends/qt4/FindAndReplace.h | 2 ++
status.23x | 1 +
5 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index fc436e1..acf9520 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3566,4 +3566,16 @@ void BufferParams::invalidateConverterCache() const
pimpl_->isViewCacheValid = false;
}
+
+// We shouldn't need to reset the params here, since anything
+// we need will be recopied.
+void BufferParams::copyForAdvFR(const BufferParams & bp)
+{
+ string const & lang = bp.language->lang();
+ setLanguage(lang);
+ layout_modules_ = bp.layout_modules_;
+ string const & doc_class = bp.documentClass().name();
+ setBaseClass(doc_class);
+}
+
} // namespace lyx
diff --git a/src/BufferParams.h b/src/BufferParams.h
index 9236d5b..23cd435 100644
--- a/src/BufferParams.h
+++ b/src/BufferParams.h
@@ -553,6 +553,10 @@ public:
bool setLanguage(std::string const & lang);
///
void invalidateConverterCache() const;
+ /// Copies over some of the settings from \param bp,
+ /// namely the ones need by Advanced F&R. We don't want
+ /// to copy them all, e.g., not the default master.
+ void copyForAdvFR(BufferParams const & bp);
private:
///
@@ -616,7 +620,6 @@ private:
static void destroy(Impl *);
};
support::copied_ptr<Impl, MemoryTraits> pimpl_;
-
};
} // namespace lyx
diff --git a/src/frontends/qt4/FindAndReplace.cpp
b/src/frontends/qt4/FindAndReplace.cpp
index 607f165..96fcd58 100644
--- a/src/frontends/qt4/FindAndReplace.cpp
+++ b/src/frontends/qt4/FindAndReplace.cpp
@@ -67,6 +67,8 @@ FindAndReplaceWidget::FindAndReplaceWidget(GuiView & view)
// We don't want two cursors blinking.
find_work_area_->stopBlinkingCaret();
replace_work_area_->stopBlinkingCaret();
+ old_buffer_ = view_.documentBufferView() ?
+ &(view_.documentBufferView()->buffer()) : 0;
}
@@ -526,16 +528,12 @@ void FindAndReplaceWidget::on_replaceallPB_clicked()
}
-/** Copy selected elements from bv's BufferParams to the dest_bv's one
- ** We don't want to copy'em all, e.g., not the default master **/
+// Copy selected elements from bv's BufferParams to the dest_bv's
static void copy_params(BufferView const & bv, BufferView & dest_bv) {
Buffer const & doc_buf = bv.buffer();
BufferParams const & doc_bp = doc_buf.params();
- string const & lang = doc_bp.language->lang();
- string const & doc_class = doc_bp.documentClass().name();
Buffer & dest_buf = dest_bv.buffer();
- dest_buf.params().setLanguage(lang);
- dest_buf.params().setBaseClass(doc_class);
+ dest_buf.params().copyForAdvFR(doc_bp);
dest_bv.makeDocumentClass();
dest_bv.cursor().current_font.setLanguage(doc_bp.language);
}
@@ -609,8 +607,17 @@ bool FindAndReplace::initialiseParams(std::string const &
params)
void FindAndReplaceWidget::updateGUI()
{
- bool replace_enabled = view_.documentBufferView()
- && !view_.documentBufferView()->buffer().isReadonly();
+ BufferView * bv = view_.documentBufferView();
+ if (bv) {
+ if (old_buffer_ != &bv->buffer()) {
+ copy_params(*bv, find_work_area_->bufferView());
+ copy_params(*bv,
replace_work_area_->bufferView());
+ old_buffer_ = &bv->buffer();
+ }
+ } else
+ old_buffer_ = 0;
+
+ bool const replace_enabled = bv && !bv->buffer().isReadonly();
replace_work_area_->setEnabled(replace_enabled);
replacePB->setEnabled(replace_enabled);
replaceallPB->setEnabled(replace_enabled);
diff --git a/src/frontends/qt4/FindAndReplace.h
b/src/frontends/qt4/FindAndReplace.h
index 93af535..da854da 100644
--- a/src/frontends/qt4/FindAndReplace.h
+++ b/src/frontends/qt4/FindAndReplace.h
@@ -40,6 +40,8 @@ public Q_SLOTS:
private:
///
GuiView & view_;
+ ///
+ Buffer * old_buffer_;
/// add a string to the combo if needed
void remember(std::string const & find, QComboBox & combo);
diff --git a/status.23x b/status.23x
index 36335ab..8f0ea4a 100644
--- a/status.23x
+++ b/status.23x
@@ -74,6 +74,7 @@ What's new
* ADVANCED FIND AND REPLACE
+- Pay attention to layout modules in Advanced F&R (bug 11138).
* BUILD/INSTALLATION