]> git.lyx.org Git - features.git/commitdiff
fix bug 1950: Spellchecker runs twice
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 28 Jul 2005 10:26:33 +0000 (10:26 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 28 Jul 2005 10:26:33 +0000 (10:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10367 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/ControlSpellchecker.h
src/frontends/controllers/Dialog.h
src/frontends/gtk/ChangeLog
src/frontends/gtk/GViewBase.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QDialogView.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDialogView.C

index 9461c9c9b78c4d87fd52b1c8394af778a6d27d00..c9f19d8d170d49ffb9badb8df30138f5edb45dfb 100644 (file)
@@ -1,3 +1,15 @@
+2005-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       bug 1950.
+       
+       * Dialog.h (exitEarly): virtual function, returns false as a
+       default. 
+
+       * ControlSpellchecker.h (exitEarly): return exitEarly_
+
+       * ControlSpellchecker.C (check): set exitEarly_ to true when
+       spell-checking is finished, false otherwise.
+
 2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * ControlBibtex.C: sort bst files (bug 1936)
index 161fba9d271a7936cbda711e2ff5d0f5fc08ca1d..e08c7df62010fcb31608f244c9c648a757a1cd31 100644 (file)
@@ -54,7 +54,7 @@ namespace frontend {
 
 
 ControlSpellchecker::ControlSpellchecker(Dialog & parent)
-       : Dialog::Controller(parent),
+       : Dialog::Controller(parent), exitEarly_(false),
          oldval_(0), newvalue_(0), count_(0)
 {}
 
@@ -202,6 +202,7 @@ void ControlSpellchecker::check()
                ++start;
 
        BufferParams & bufferparams = kernel().buffer().params();
+       exitEarly_ = false;
 
        while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) {
                word_ = nextWord(cur, start, bufferparams);
@@ -209,6 +210,7 @@ void ControlSpellchecker::check()
                // end of document
                if (getWord().empty()) {
                        showSummary();
+                       exitEarly_ = true;
                        return;
                }
 
index e04435bd75d43c389b3e324428b4b06b47f87fc7..c187bc5d98e53c076b536d1ddada04564f29278e 100644 (file)
@@ -40,6 +40,8 @@ public:
        virtual void dispatchParams() {}
        ///
        virtual bool isBufferDependent() const { return true; }
+       ///
+       virtual bool exitEarly() const { return exitEarly_; }
 
        /// replace word with replacement
        void replace(std::string const &);
@@ -76,6 +78,10 @@ private:
        /// show count of checked words at normal exit
        void showSummary();
 
+private:
+       /// set to true when spellchecking is finished
+       bool exitEarly_;
+
        /// current word being checked and lang code
        WordLangTuple word_;
 
index 9408ab3166e4cebd0bcb83801d4ae8fb40942f88..e0219eeb4ec16018dce8d034686dc2514e6f7748 100644 (file)
@@ -186,6 +186,12 @@ public:
         *  return true.
         */
        virtual bool disconnectOnApply() const { return false; }
+
+       /** \return true if Dialog::View::show() should not display the dialog
+        *   after running update. Currently, only ControlSpellchecker 
+        *   makes use of that.
+       */
+       virtual bool exitEarly() const { return false; }
        //@}
 
 protected:
index 73b26950d7eb2c3d4c7f06a42e0a204b056100a0..c0189e6fa6dcc6468b16f85e3005ff0c6d8ef0d9 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * GViewBase.C (show): exit after update if Controller::exitEarly()
+       is true. (bug 1950)
+
 2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * GTexInfo.C: Load and display full-path and no-path
index dbee44c9df7685bad2f19a0dd69a823503fa3dd2..bb45a5fc3e0b9951a27fd1b0db829bdd6f58e6a7 100644 (file)
@@ -62,6 +62,9 @@ void GViewBase::show()
                build();
        }
        update();
+       if (dialog().controller().exitEarly())
+               return;
+
        window()->show();
 }
 
index 58b1a7bcc99bafcfca7e3a786955f8070eb2585b..477a8eada1b26b541e6cb389e041cdc5b7cc5c8c 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * QDialogView.C (show): exit after update if Controller::exitEarly()
+       is true. (bug 1950)
+
 2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * QBibTeX.C: Do not insert empty items to bst combo.
index 087a7de99ef7b67a6a6a3c69591448c666ac9c3a..6251a689ad01bcbe3494c217a0966e4408a10e77 100644 (file)
@@ -51,6 +51,8 @@ void QDialogView::show()
        form()->setMinimumSize(form()->sizeHint());
 
        update();  // make sure its up-to-date
+       if (dialog().controller().exitEarly())
+               return;
 
        form()->setCaption(toqstr("LyX: " + getTitle()));
 
index 6619a1bc4437c53977099d9a1b28442a9640dea4..4dff0cadafc04aa4113a274806fdf47ef8b9b57d 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-28  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * FormDialogView.C (show): exit after update if Controller::exitEarly()
+       is true. (bug 1950)
+
 2005-07-27  Jürgen Spitzmüller  <j.spitzmueller@gmx.de>
 
        * FormTexInfo.C: Load and display full-path and no-path
index 5e742bdaa5e770460797518d3d09d52fe8fb35fd..13b0822adef9966e31faeba134c08e2717e23b07 100644 (file)
@@ -145,6 +145,8 @@ void FormDialogView::show()
        fl_freeze_form(form());
        update();
        fl_unfreeze_form(form());
+       if (dialog().controller().exitEarly())
+               return;
 
        if (form()->visible) {
                fl_raise_form(form());