From: Juergen Spitzmueller Date: Tue, 21 Mar 2023 09:24:34 +0000 (+0100) Subject: Sync doc CT settings with dialog-external change of status (#12703) X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=3a02e477a00077e5442d8e34e92690d26a7ed4ae;p=features.git Sync doc CT settings with dialog-external change of status (#12703) --- diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index f92c129c27..b72d17bffc 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -19,6 +19,7 @@ #include "GuiApplication.h" #include "GuiBranches.h" #include "GuiIndices.h" +#include "GuiView.h" #include "GuiSelectionManager.h" #include "LaTeXHighlighter.h" #include "Validator.h" @@ -1380,6 +1381,8 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(outputChangesToggled(bool))); connect(changesModule->changeBarsCB, SIGNAL(clicked()), this, SLOT(change_adaptor())); + connect(&lv, SIGNAL(changeTrackingToggled(bool)), + this, SLOT(changeTrackingChanged(bool))); // numbering @@ -1904,6 +1907,14 @@ void GuiDocument::bookmarksopenChanged(bool state) } +void GuiDocument::changeTrackingChanged(bool state) +{ + // This is triggered if the CT state is toggled outside + // the document dialog (e.g., menu). + changesModule->trackChangesCB->setChecked(state); +} + + void GuiDocument::slotApply() { bool only_shellescape_changed = !nonModuleChanged_ && !modulesChanged_; diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h index 248e5844a1..dbdf34f47e 100644 --- a/src/frontends/qt/GuiDocument.h +++ b/src/frontends/qt/GuiDocument.h @@ -168,6 +168,7 @@ private Q_SLOTS: void outputChangesToggled(bool); void setOutputSync(bool); void bookmarksopenChanged(bool); + void changeTrackingChanged(bool); private: /// validate listings parameters and return an error message, if any QString validateListingsParameters(); diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp index 9a353117a3..6518216c27 100644 --- a/src/frontends/qt/GuiView.cpp +++ b/src/frontends/qt/GuiView.cpp @@ -2446,6 +2446,14 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) break; } + case LFUN_CHANGES_TRACK: { + if (!doc_buffer) { + enable = false; + break; + } + return doc_buffer->getStatus(cmd, flag); + } + case LFUN_VIEW_SPLIT: if (cmd.getArg(0) == "vertical") enable = doc_buffer && (d.splitter_->count() == 1 || @@ -4528,6 +4536,15 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) doc_buffer->runChktex(); break; + case LFUN_CHANGES_TRACK: { + // the actual dispatch is done in Buffer + dispatchToBufferView(cmd, dr); + // but we inform the GUI (document settings) if this is toggled + LASSERT(doc_buffer, break); + Q_EMIT changeTrackingToggled(doc_buffer->params().track_changes); + break; + } + case LFUN_COMMAND_EXECUTE: { command_execute_ = true; minibuffer_focus_ = true; diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h index 29687c387b..8453c47c22 100644 --- a/src/frontends/qt/GuiView.h +++ b/src/frontends/qt/GuiView.h @@ -230,6 +230,8 @@ Q_SIGNALS: void currentZoomChanged(int); /// emitted when script is killed (e.g., user cancels export) void scriptKilled(); + /// emitted when track changes status toggled + void changeTrackingToggled(bool); public Q_SLOTS: ///