fix bug 1950: Spellchecker runs twice

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10367 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-07-28 10:26:33 +00:00
parent a5e061ce42
commit a4fc781dcc
10 changed files with 49 additions and 1 deletions

View 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> 2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* ControlBibtex.C: sort bst files (bug 1936) * ControlBibtex.C: sort bst files (bug 1936)

View File

@ -54,7 +54,7 @@ namespace frontend {
ControlSpellchecker::ControlSpellchecker(Dialog & parent) ControlSpellchecker::ControlSpellchecker(Dialog & parent)
: Dialog::Controller(parent), : Dialog::Controller(parent), exitEarly_(false),
oldval_(0), newvalue_(0), count_(0) oldval_(0), newvalue_(0), count_(0)
{} {}
@ -202,6 +202,7 @@ void ControlSpellchecker::check()
++start; ++start;
BufferParams & bufferparams = kernel().buffer().params(); BufferParams & bufferparams = kernel().buffer().params();
exitEarly_ = false;
while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) { while (res == SpellBase::OK || res == SpellBase::IGNORED_WORD) {
word_ = nextWord(cur, start, bufferparams); word_ = nextWord(cur, start, bufferparams);
@ -209,6 +210,7 @@ void ControlSpellchecker::check()
// end of document // end of document
if (getWord().empty()) { if (getWord().empty()) {
showSummary(); showSummary();
exitEarly_ = true;
return; return;
} }

View File

@ -40,6 +40,8 @@ public:
virtual void dispatchParams() {} virtual void dispatchParams() {}
/// ///
virtual bool isBufferDependent() const { return true; } virtual bool isBufferDependent() const { return true; }
///
virtual bool exitEarly() const { return exitEarly_; }
/// replace word with replacement /// replace word with replacement
void replace(std::string const &); void replace(std::string const &);
@ -76,6 +78,10 @@ private:
/// show count of checked words at normal exit /// show count of checked words at normal exit
void showSummary(); void showSummary();
private:
/// set to true when spellchecking is finished
bool exitEarly_;
/// current word being checked and lang code /// current word being checked and lang code
WordLangTuple word_; WordLangTuple word_;

View File

@ -186,6 +186,12 @@ public:
* return true. * return true.
*/ */
virtual bool disconnectOnApply() const { return false; } 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: protected:

View 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> 2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* GTexInfo.C: Load and display full-path and no-path * GTexInfo.C: Load and display full-path and no-path

View File

@ -62,6 +62,9 @@ void GViewBase::show()
build(); build();
} }
update(); update();
if (dialog().controller().exitEarly())
return;
window()->show(); window()->show();
} }

View 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> 2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* QBibTeX.C: Do not insert empty items to bst combo. * QBibTeX.C: Do not insert empty items to bst combo.

View File

@ -51,6 +51,8 @@ void QDialogView::show()
form()->setMinimumSize(form()->sizeHint()); form()->setMinimumSize(form()->sizeHint());
update(); // make sure its up-to-date update(); // make sure its up-to-date
if (dialog().controller().exitEarly())
return;
form()->setCaption(toqstr("LyX: " + getTitle())); form()->setCaption(toqstr("LyX: " + getTitle()));

View 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> 2005-07-27 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormTexInfo.C: Load and display full-path and no-path * FormTexInfo.C: Load and display full-path and no-path

View File

@ -145,6 +145,8 @@ void FormDialogView::show()
fl_freeze_form(form()); fl_freeze_form(form());
update(); update();
fl_unfreeze_form(form()); fl_unfreeze_form(form());
if (dialog().controller().exitEarly())
return;
if (form()->visible) { if (form()->visible) {
fl_raise_form(form()); fl_raise_form(form());