]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
the spellcheck cleanup
[lyx.git] / src / BufferView.C
index f4b655850bdd125b1b8dcc2e9cfd1f63c6b70c80..32245364337c42be2b8609abd5416b020fdb3566 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Alfredo Braustein
+ * \author Alfredo Braunstein
  * \author Lars Gullik Bjønnes
  * \author John Levon
  * \author André Pönitz
@@ -56,7 +56,8 @@ extern BufferList bufferlist;
 
 BufferView::BufferView(LyXView * owner, int xpos, int ypos,
                       int width, int height)
-       : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height))
+       : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height)),
+         x_target_(0)
 {
        text = 0;
 }
@@ -280,15 +281,15 @@ bool BufferView::insertLyXFile(string const & filen)
 void BufferView::showErrorList(string const & action) const
 {
        if (getErrorList().size()) {
-               string const title = bformat(_("LyX: %1$s errors (%2$s)"), action, buffer()->fileName());
+               string const title = bformat(_("LyX: %1$s errors (%2$s)"),
+                       action, buffer()->fileName());
                owner()->getDialogs().show("errorlist", title);
                pimpl_->errorlist_.clear();
        }
 }
 
 
-ErrorList const &
-BufferView::getErrorList() const
+ErrorList const & BufferView::getErrorList() const
 {
        return pimpl_->errorlist_;
 }
@@ -361,55 +362,19 @@ 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())
                return;
 
-       LyXText * tt = getLyXText();
+       LyXText * text = getLyXText();
 
-       tt->replaceSelectionWithString(replacestring);
-       tt->setSelectionRange(replacestring.length());
+       text->replaceSelectionWithString(replacestring);
+       text->setSelectionRange(replacestring.length());
 
        // Go back so that replacement string is also spellchecked
        for (string::size_type i = 0; i < replacestring.length() + 1; ++i)
-               tt->cursorLeft(this);
+               text->cursorLeft(this);
 
        // FIXME: should be done through LFUN
        buffer()->markDirty();
@@ -580,3 +545,15 @@ int BufferView::workHeight() const
 {
        return pimpl_->workarea().workHeight();
 }
+
+
+void BufferView::x_target(int x)
+{
+       x_target_ = x;
+}
+
+
+int BufferView::x_target() const
+{
+       return x_target_;
+}