]> git.lyx.org Git - features.git/commitdiff
Sync doc CT settings with dialog-external change of status (#12703)
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 21 Mar 2023 09:24:34 +0000 (10:24 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Tue, 21 Mar 2023 09:24:34 +0000 (10:24 +0100)
src/frontends/qt/GuiDocument.cpp
src/frontends/qt/GuiDocument.h
src/frontends/qt/GuiView.cpp
src/frontends/qt/GuiView.h

index f92c129c27d2505e53aa7c54c09f2624de7d7e0a..b72d17bffccbd1bb0aacc18c59984cf6302f5015 100644 (file)
@@ -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_;
index 248e5844a145305805f7293be1d698e9d1cd0fcf..dbdf34f47e633c6370407fc03c3f55b56e7d7443 100644 (file)
@@ -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();
index 9a353117a364e55f14b2b906a019771ae6d81e3f..6518216c27ddc6b49803fc0b3d602e14b197a538 100644 (file)
@@ -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;
index 29687c387bf8badc9e9f224a94d0effb4acd5bdf..8453c47c22084c339273bc6d90fe1a91cfb273d6 100644 (file)
@@ -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:
        ///