[LyX/master] Adv F&R: indicate search direction

Juergen Spitzmueller spitz at lyx.org
Wed Feb 17 08:47:55 UTC 2021


commit a2a5656d07d097f25b5abd06a54e3b904979d92e
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Feb 17 09:50:18 2021 +0100

    Adv F&R: indicate search direction
---
 src/frontends/qt/FindAndReplace.cpp |   23 +++++++++++++++++++++++
 src/frontends/qt/FindAndReplace.h   |    2 ++
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt/FindAndReplace.cpp b/src/frontends/qt/FindAndReplace.cpp
index b378f46..9cfdfcf 100644
--- a/src/frontends/qt/FindAndReplace.cpp
+++ b/src/frontends/qt/FindAndReplace.cpp
@@ -530,6 +530,12 @@ void FindAndReplaceWidget::on_replaceallPB_clicked()
 }
 
 
+void FindAndReplaceWidget::on_searchbackCB_clicked()
+{
+	updateButtons();
+}
+
+
 // 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();
@@ -577,6 +583,7 @@ bool FindAndReplaceWidget::initialiseParams(std::string const & /*params*/)
 void FindAndReplace::updateView()
 {
 	widget_->updateGUI();
+	widget_->updateButtons();
 }
 
 
@@ -633,6 +640,22 @@ void FindAndReplaceWidget::updateGUI()
 }
 
 
+void FindAndReplaceWidget::updateButtons()
+{
+	if (searchbackCB->isChecked()) {
+		findNextPB->setText(qt_("&< Find"));
+		findNextPB->setToolTip(qt_("Find previous occurrence (Shift+Enter, forwards: Enter)"));
+		replacePB->setText(qt_("< Rep&lace"));
+		replacePB->setToolTip(qt_("Replace and find previous occurrence (Shift+Enter, forwards: Enter)"));
+	} else {
+		findNextPB->setText(qt_("Find &>"));
+		findNextPB->setToolTip(qt_("Find next occurrence (Enter, backwards: Shift+Enter)"));
+		replacePB->setText(qt_("Rep&lace >"));
+		replacePB->setToolTip(qt_("Replace and find next occurrence (Enter, backwards: Shift+Enter)"));
+	}
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
diff --git a/src/frontends/qt/FindAndReplace.h b/src/frontends/qt/FindAndReplace.h
index 565db5a..0ffc39d 100644
--- a/src/frontends/qt/FindAndReplace.h
+++ b/src/frontends/qt/FindAndReplace.h
@@ -33,6 +33,7 @@ public:
 	FindAndReplaceWidget(GuiView & view);
 	bool initialiseParams(std::string const & params);
 	void updateGUI();
+	void updateButtons();
 
 public Q_SLOTS:
 	///
@@ -69,6 +70,7 @@ protected Q_SLOTS:
 	void on_findNextPB_clicked();
 	void on_replacePB_clicked();
 	void on_replaceallPB_clicked();
+	void on_searchbackCB_clicked();
 };
 
 


More information about the lyx-cvs mailing list