]> git.lyx.org Git - features.git/commitdiff
remove dead spellcheck code
authorAlfredo Braunstein <abraunst@lyx.org>
Tue, 4 Nov 2003 11:36:28 +0000 (11:36 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Tue, 4 Nov 2003 11:36:28 +0000 (11:36 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8032 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
src/BufferView.C
src/BufferView.h
src/ChangeLog
src/insets/ChangeLog
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/insets/updatableinset.C
src/insets/updatableinset.h
src/lyxtext.h
src/text.C

index 1cdbf0c75e9dd9a40e84ef28694497eac714ce27..32245364337c42be2b8609abd5416b020fdb3566 100644 (file)
@@ -362,42 +362,6 @@ void BufferView::redo()
 }
 
 
-// these functions are for the spellchecker
-WordLangTuple const BufferView::nextWord(float & value)
-{
-       if (!available()) {
-               value = 1;
-               return WordLangTuple();
-       }
-
-       return text->selectNextWordToSpellcheck(value);
-}
-
-
-void BufferView::selectLastWord()
-{
-       if (!available())
-               return;
-
-       LyXCursor cur = text->selection.cursor;
-       beforeChange(text);
-       text->selection.cursor = cur;
-       text->selectSelectedWord();
-       update();
-}
-
-
-void BufferView::endOfSpellCheck()
-{
-       if (!available()) return;
-
-       beforeChange(text);
-       text->selectSelectedWord();
-       text->clearSelection();
-       update();
-}
-
-
 void BufferView::replaceWord(string const & replacestring)
 {
        if (!available())
index f05a62fd6828adb1138a50ac732ba3704855ca33..34b9b25cba5609e2a2b5ea1a212719e96cb98b0b 100644 (file)
@@ -33,7 +33,6 @@ class LyXView;
 class Painter;
 class TeXErrors;
 class UpdatableInset;
-class WordLangTuple;
 
 /**
  * A buffer view encapsulates a view onto a particular
@@ -135,14 +134,8 @@ public:
        /// return the parent language of the given inset
        Language const * getParentLanguage(InsetOld * inset) const;
 
-       /// Select the "current" word
-       void selectLastWord();
        /// replace the currently selected word
        void replaceWord(std::string const & replacestring);
-       /// Update after spellcheck finishes
-       void endOfSpellCheck();
-       /// return the next word
-       WordLangTuple const nextWord(float & value);
 
        /// move cursor to the named label
        void gotoLabel(std::string const & label);
index 382ce9c62b0c5ac481a53b37935ac8ea5d2e227f..e879aa8c1ec12b1c1c53d08c88c009d576481881 100644 (file)
@@ -1,3 +1,10 @@
+
+2003-11-04  Alfredo Braunstein  <abraunst@libero.it>
+
+       * BufferView.[Ch]:
+       * lyxtext.h:
+       * text.C: remove dead spellcheck code
+       
 2003-11-04  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * dispatchresult.h: add a val setter
index da46b017e9786c65a00a9b77c34da4c5bd88cc68..907802f4271f696ee2f6271f60cb9bf96c79169d 100644 (file)
@@ -1,3 +1,13 @@
+
+2003-11-04  Alfredo Braunstein  <abraunst@libero.it>
+
+       * inset.h:
+       * insetcollapsable.[Ch]:
+       * insetert.[Ch]:
+       * insettabular.[Ch]:
+       * insettext.[Ch]:
+       * updatableinset.[Ch]: remove dead spellcheck code
+
 2003-11-04  Alfredo Braunstein  <abraunst@libero.it>
 
        * insettabular.C (lockInsetInInset): small fix
index 50616a2b9a27d6f380abdb315b1ae259c7179ead..45cde09eee80969e29579d7aabb42fc86054c5f4 100644 (file)
@@ -31,7 +31,6 @@ class LyXText;
 class Painter;
 class Paragraph;
 class UpdatableInset;
-class WordLangTuple;
 
 namespace lyx {
 namespace graphics {
@@ -257,10 +256,6 @@ public:
        /// we need this here because collapsed insets are only EDITABLE
        virtual void setFont(BufferView *, LyXFont const &,
                         bool toggleall = false, bool selectall = false);
-       ///
-       // needed for spellchecking text
-       ///
-       virtual bool allowSpellcheck() const { return false; }
 
        // should this inset be handled like a normal charater
        virtual bool isChar() const { return false; }
index c5587cb3e0e028f6221a31a52ecfd30311c91fe8..e3a889d80fc81a6f18247cbe0b989341d46d2e73 100644 (file)
@@ -23,7 +23,6 @@
 #include "funcrequest.h"
 #include "metricsinfo.h"
 #include "paragraph.h"
-#include "WordLangTuple.h"
 
 #include "frontends/font_metrics.h"
 #include "frontends/Painter.h"
@@ -564,17 +563,6 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
 }
 
 
-WordLangTuple const
-InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, float & value) const
-{
-       WordLangTuple word = inset.selectNextWordToSpellcheck(bv, value);
-       if (first_after_edit && word.word().empty())
-               close(bv);
-       first_after_edit = false;
-       return word;
-}
-
-
 void InsetCollapsable::addPreview(PreviewLoader & loader) const
 {
        inset.addPreview(loader);
index da1723bda00753487f7de2fe7ff16f865b3e87de..9a85975d8398c6dc14533b55a5bcc40a4bfc029c 100644 (file)
@@ -130,13 +130,6 @@ public:
        void open(BufferView *);
        ///
        void close(BufferView *) const;
-       ///
-       bool allowSpellcheck() const;
-       ///
-       WordLangTuple const
-       selectNextWordToSpellcheck(BufferView *, float &) const;
-       ///
-       void selectSelectedWord(BufferView *);
 
        void markErased();
 
@@ -259,20 +252,6 @@ bool InsetCollapsable::isOpen() const
 }
 
 
-inline
-bool InsetCollapsable::allowSpellcheck() const
-{
-       return inset.allowSpellcheck();
-}
-
-
-inline
-void InsetCollapsable::selectSelectedWord(BufferView * bv)
-{
-       inset.selectSelectedWord(bv);
-}
-
-
 inline
 Box const & InsetCollapsable::buttonDim() const
 {
index 77814f47e987a20253112e7c02ffeed444440e51..0dfa14f46d8fd5e965ebb21dbc5560261330e98f 100644 (file)
@@ -24,7 +24,6 @@
 #include "lyxlex.h"
 #include "metricsinfo.h"
 #include "paragraph.h"
-#include "WordLangTuple.h"
 
 #include "frontends/Alert.h"
 #include "frontends/LyXView.h"
@@ -644,14 +643,6 @@ void InsetERT::close(BufferView * bv) const
 }
 
 
-WordLangTuple const
-InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const
-{
-       bv->unlockInset(const_cast<InsetERT *>(this));
-       return WordLangTuple();
-}
-
-
 void InsetERT::getDrawFont(LyXFont & font) const
 {
        LyXFont f(LyXFont::ALL_INHERIT, latex_language);
index 5617d6839c33f09afa2e61fac664fb240c891ab4..2999f73397821da201a7e00fd8036fbd671bc31f 100644 (file)
@@ -92,11 +92,6 @@ public:
        ///
        void close(BufferView *) const;
        ///
-       bool allowSpellcheck() const { return false; }
-
-       WordLangTuple const
-       selectNextWordToSpellcheck(BufferView *, float &) const;
-       ///
        void metrics(MetricsInfo &, Dimension &) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
index 974e7091456401c91bce8f9e56de71aba531d24a..38f0eb82966da70d2da964d38951909c0b3f01af 100644 (file)
@@ -30,7 +30,6 @@
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "undo.h"
-#include "WordLangTuple.h"
 
 #include "frontends/Alert.h"
 #include "frontends/font_metrics.h"
@@ -2419,60 +2418,6 @@ LyXCursor const & InsetTabular::cursor(BufferView * bv) const
 }
 
 
-WordLangTuple const
-InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
-{
-       if (the_locking_inset) {
-               WordLangTuple word =
-                       the_locking_inset->selectNextWordToSpellcheck(bv, value);
-               if (!word.word().empty())
-                       return word;
-               if (tabular.isLastCell(actcell)) {
-                       bv->unlockInset(const_cast<InsetTabular *>(this));
-                       return WordLangTuple();
-               }
-               ++actcell;
-       }
-       // otherwise we have to lock the next inset and ask for it's selecttion
-       tabular.getCellInset(actcell)
-               .dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
-       WordLangTuple word = selectNextWordInt(bv, value);
-       if (!word.word().empty())
-               resetPos(bv);
-       return word;
-}
-
-
-WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
-{
-       // when entering this function the inset should be ALWAYS locked!
-       BOOST_ASSERT(the_locking_inset);
-
-       WordLangTuple word =
-               the_locking_inset->selectNextWordToSpellcheck(bv, value);
-       if (!word.word().empty())
-               return word;
-
-       if (tabular.isLastCell(actcell)) {
-               bv->unlockInset(const_cast<InsetTabular *>(this));
-               return WordLangTuple();
-       }
-
-       // otherwise we have to lock the next inset and ask for it's selecttion
-       ++actcell;
-       tabular.getCellInset(actcell)
-               .dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
-       return selectNextWordInt(bv, value);
-}
-
-
-void InsetTabular::selectSelectedWord(BufferView * bv)
-{
-       if (the_locking_inset)
-               the_locking_inset->selectSelectedWord(bv);
-}
-
-
 void InsetTabular::markErased()
 {
        for (int cell = 0; cell < tabular.getNumberOfCells(); ++cell)
index 52186a4ebf0bca0044b31d0617fe6315b208e2a8..145bd1ee646966e9adaef31baa029ab73c90d146 100644 (file)
@@ -165,14 +165,8 @@ public:
        LyXText * getText(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
-       ///
-       bool allowSpellcheck() const { return true; }
-       ///
-       WordLangTuple const
-       selectNextWordToSpellcheck(BufferView *, float & value) const;
-       ///
-       void selectSelectedWord(BufferView *);
 
+       ///
        void markErased();
 
        /// find next change
@@ -285,8 +279,6 @@ private:
        void getSelection(int & scol, int & ecol,
                          int & srow, int & erow) const;
        ///
-       WordLangTuple selectNextWordInt(BufferView *, float & value) const;
-       ///
        bool insertAsciiString(BufferView *, std::string const & buf, bool usePaste);
 
        //
index ad28fc028c420d0387b1074a4cd554cbb0d579b2..150193edc1a647da6ae3ccb684e3fd0d23c488ca 100644 (file)
@@ -35,7 +35,6 @@
 #include "sgml.h"
 #include "texrow.h"
 #include "undo.h"
-#include "WordLangTuple.h"
 
 #include "frontends/Alert.h"
 #include "frontends/font_metrics.h"
@@ -1456,39 +1455,6 @@ LyXCursor const & InsetText::cursor(BufferView * bv) const
 }
 
 
-WordLangTuple const
-InsetText::selectNextWordToSpellcheck(BufferView * bv, float & value) const
-{
-       WordLangTuple word;
-       if (the_locking_inset) {
-               word = the_locking_inset->selectNextWordToSpellcheck(bv, value);
-               if (!word.word().empty()) {
-                       value += cy();
-                       return word;
-               }
-               // we have to go on checking so move cursor to the next char
-               text_.cursor.pos(text_.cursor.pos() + 1);
-       }
-       word = text_.selectNextWordToSpellcheck(value);
-       if (word.word().empty())
-               bv->unlockInset(const_cast<InsetText *>(this));
-       else
-               value = cy();
-       return word;
-}
-
-
-void InsetText::selectSelectedWord(BufferView * bv)
-{
-       if (the_locking_inset) {
-               the_locking_inset->selectSelectedWord(bv);
-               return;
-       }
-       getLyXText(bv)->selectSelectedWord();
-       updateLocal(bv, false);
-}
-
-
 bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
 {
        if (the_locking_inset) {
index bb5d1b980b9b98a15f75fa465682be1c5a9d553c..b9de092828b21cce0366807cfca6abe885ba32b0 100644 (file)
@@ -157,13 +157,6 @@ public:
        LyXText * getText(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
-       ///
-       bool allowSpellcheck() const { return true; }
-       ///
-       WordLangTuple const
-       selectNextWordToSpellcheck(BufferView *, float & value) const;
-       ///
-       void selectSelectedWord(BufferView *);
 
        /// mark as erased for change tracking
        void markErased() { clear(true); };
index 6e1e7254057660d47d48894522acbe7cdf55f1d3..a62fbc0be7c112af2a1856dfc6c543b4645290ad 100644 (file)
@@ -20,7 +20,6 @@
 #include "dispatchresult.h"
 #include "funcrequest.h"
 #include "lyxtext.h"
-#include "WordLangTuple.h"
 
 #include "support/lstrings.h"
 
@@ -139,16 +138,6 @@ LyXCursor const & InsetOld::cursor(BufferView * bv) const
 }
 
 
-WordLangTuple const
-UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const
-{
-       // we have to unlock ourself in this function by default!
-       bv->unlockInset(const_cast<UpdatableInset *>(this));
-       value = 0;
-       return WordLangTuple();
-}
-
-
 bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &)
 {
        // we have to unlock ourself in this function by default!
index d791ecfdaa45a3b3b32c4d07cc2e71b827be96a8..bdb503bced32cde9b6c756d53575cc126b464c37 100644 (file)
@@ -87,15 +87,6 @@ public:
        ///
        virtual bool showInsetDialog(BufferView *) const { return false; }
        ///
-       // needed for spellchecking text
-       ///
-       virtual bool allowSpellcheck() const { return false; }
-       ///
-       virtual WordLangTuple const
-       selectNextWordToSpellcheck(BufferView *, float & value) const;
-       ///
-       virtual void selectSelectedWord(BufferView *) {}
-       ///
        virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {}
 
        /// find the next change in the inset
index 5ed7f5f72a73871df836057a89f0c0d7ac66f9e1..c19d8b440c2927bd8398af7927389c335cd0d898 100644 (file)
@@ -37,7 +37,6 @@ class Row;
 class Spacing;
 class UpdatableInset;
 class VSpace;
-class WordLangTuple;
 
 
 /**
@@ -204,14 +203,6 @@ public:
        /// reject selected change
        void rejectChange();
 
-       /** 'selects" the next word, where the cursor is not in
-        and returns this word as string. THe cursor will be moved
-        to the beginning of this word.
-        With SelectSelectedWord can this be highlighted really
-        */
-       WordLangTuple const selectNextWordToSpellcheck(float & value);
-       ///
-       void selectSelectedWord();
        /// re-computes the cached coordinates in the cursor
        void redoCursor();
        ///
index c2e51021cf424efae0c1c7fbe67566d40a08e868..3c2bb6e871dac845e4a9e0fa7e50a0b795b7ec9c 100644 (file)
@@ -1242,128 +1242,6 @@ void LyXText::rejectChange()
 }
 
 
-// This function is only used by the spellchecker for NextWord().
-// It doesn't handle LYX_ACCENTs and probably never will.
-WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
-{
-       if (the_locking_inset) {
-               WordLangTuple word =
-                       the_locking_inset->selectNextWordToSpellcheck(bv(), value);
-               if (!word.word().empty()) {
-                       value += float(cursor.y());
-                       value /= float(height);
-                       return word;
-               }
-               // we have to go on checking so move cursor to the next char
-               if (cursor.pos() == cursorPar()->size()) {
-                       if (cursor.par() + 1 == int(ownerParagraphs().size()))
-                               return word;
-                       cursor.par(cursor.par() + 1);
-                       cursor.pos(0);
-               } else {
-                       cursor.pos(cursor.pos() + 1);
-               }
-       }
-       int const tmppar = cursor.par();
-
-       // If this is not the very first word, skip rest of
-       // current word because we are probably in the middle
-       // of a word if there is text here.
-       if (cursor.pos() || cursor.par() != 0) {
-               while (cursor.pos() < cursorPar()->size()
-                      && cursorPar()->isLetter(cursor.pos()))
-                       cursor.pos(cursor.pos() + 1);
-       }
-
-       // Now, skip until we have real text (will jump paragraphs)
-       while (true) {
-               ParagraphList::iterator cpit = cursorPar();
-               pos_type const cpos = cursor.pos();
-
-               if (cpos == cpit->size()) {
-                       if (cursor.par() + 1 != int(ownerParagraphs().size())) {
-                               cursor.par(cursor.par() + 1);
-                               cursor.pos(0);
-                               continue;
-                       }
-                       break;
-               }
-
-               bool const is_good_inset = cpit->isInset(cpos)
-                       && cpit->getInset(cpos)->allowSpellcheck();
-
-               if (!isDeletedText(*cpit, cpos)
-                   && (is_good_inset || cpit->isLetter(cpos)))
-                       break;
-
-               cursor.pos(cpos + 1);
-       }
-
-       // now check if we hit an inset so it has to be a inset containing text!
-       if (cursor.pos() < cursorPar()->size() &&
-           cursorPar()->isInset(cursor.pos())) {
-               // lock the inset!
-               FuncRequest cmd(bv(), LFUN_INSET_EDIT, "left");
-               cursorPar()->getInset(cursor.pos())->dispatch(cmd);
-               // now call us again to do the above trick
-               // but obviously we have to start from down below ;)
-               return bv()->text->selectNextWordToSpellcheck(value);
-       }
-
-       // Update the value if we changed paragraphs
-       if (cursor.par() != tmppar) {
-               setCursor(cursor.par(), cursor.pos());
-               value = float(cursor.y())/float(height);
-       }
-
-       // Start the selection from here
-       selection.cursor = cursor;
-
-       string lang_code = getFont(cursorPar(), cursor.pos()).language()->code();
-       // and find the end of the word (insets like optional hyphens
-       // and ligature break are part of a word)
-       while (cursor.pos() < cursorPar()->size()
-              && cursorPar()->isLetter(cursor.pos())
-              && !isDeletedText(*cursorPar(), cursor.pos()))
-               cursor.pos(cursor.pos() + 1);
-
-       // Finally, we copy the word to a string and return it
-       string str;
-       if (selection.cursor.pos() < cursor.pos()) {
-               for (pos_type i = selection.cursor.pos(); i < cursor.pos(); ++i) {
-                       if (!cursorPar()->isInset(i))
-                               str += cursorPar()->getChar(i);
-               }
-       }
-       return WordLangTuple(str, lang_code);
-}
-
-
-// This one is also only for the spellchecker
-void LyXText::selectSelectedWord()
-{
-       if (the_locking_inset) {
-               the_locking_inset->selectSelectedWord(bv());
-               return;
-       }
-       // move cursor to the beginning
-       setCursor(selection.cursor.par(), selection.cursor.pos());
-
-       // set the sel cursor
-       selection.cursor = cursor;
-
-       // now find the end of the word
-       while (cursor.pos() < cursorPar()->size()
-              && cursorPar()->isLetter(cursor.pos()))
-               cursor.pos(cursor.pos() + 1);
-
-       setCursor(cursorPar(), cursor.pos());
-
-       // finally set the selection
-       setSelection();
-}
-
-
 // Delete from cursor up to the end of the current or next word.
 void LyXText::deleteWordForward()
 {