BufferView.C              |   36 -------------
 BufferView.h              |    7 --
 insets/inset.h            |    5 -
 insets/insetcollapsable.C |   12 ----
 insets/insetcollapsable.h |   21 -------
 insets/insetert.C         |    9 ---
 insets/insetert.h         |    5 -
 insets/insettabular.C     |   55 --------------------
 insets/insettabular.h     |   10 ---
 insets/insettext.C        |   34 ------------
 insets/insettext.h        |    7 --
 insets/updatableinset.C   |   11 ----
 insets/updatableinset.h   |    9 ---
 lyxtext.h                 |    9 ---
 text.C                    |  122
----------------------------------------------
 15 files changed, 1 insertion(+), 351 deletions(-)

Sorry about the insertion (it's an empty comment line).

Alfredo

PS: it would be nice if someone tests the new code [already active], just in
case ;-)
? PosIterator.C-save
? PosIterator.h-save
? all.diff
? bfs.cpp
? files
? save
? frontends/screen.C-save
Index: BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.204
diff -u -p -u -r1.204 BufferView.C
--- BufferView.C	4 Nov 2003 07:42:59 -0000	1.204
+++ BufferView.C	4 Nov 2003 09:00:43 -0000
@@ -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: BufferView.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v
retrieving revision 1.148
diff -u -p -u -r1.148 BufferView.h
--- BufferView.h	4 Nov 2003 07:42:59 -0000	1.148
+++ BufferView.h	4 Nov 2003 09:00:44 -0000
@@ -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: lyxtext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v
retrieving revision 1.250
diff -u -p -u -r1.250 lyxtext.h
--- lyxtext.h	29 Oct 2003 10:47:13 -0000	1.250
+++ lyxtext.h	4 Nov 2003 09:00:45 -0000
@@ -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: text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.492
diff -u -p -u -r1.492 text.C
--- text.C	4 Nov 2003 07:33:48 -0000	1.492
+++ text.C	4 Nov 2003 09:00:47 -0000
@@ -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()
 {
Index: insets/inset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/inset.h,v
retrieving revision 1.132
diff -u -p -u -r1.132 inset.h
--- insets/inset.h	3 Nov 2003 16:46:42 -0000	1.132
+++ insets/inset.h	4 Nov 2003 09:00:50 -0000
@@ -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: insets/insetcollapsable.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.C,v
retrieving revision 1.192
diff -u -p -u -r1.192 insetcollapsable.C
--- insets/insetcollapsable.C	3 Nov 2003 19:52:43 -0000	1.192
+++ insets/insetcollapsable.C	4 Nov 2003 09:00:51 -0000
@@ -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"
@@ -561,17 +560,6 @@ bool InsetCollapsable::searchBackward(Bu
 	else if (!found)
 		first_after_edit = false;
 	return found;
-}
-
-
-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;
 }
 
 
Index: insets/insetcollapsable.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetcollapsable.h,v
retrieving revision 1.138
diff -u -p -u -r1.138 insetcollapsable.h
--- insets/insetcollapsable.h	3 Nov 2003 16:46:42 -0000	1.138
+++ insets/insetcollapsable.h	4 Nov 2003 09:00:51 -0000
@@ -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();
 
@@ -256,20 +249,6 @@ inline
 bool InsetCollapsable::isOpen() const
 {
 	return !collapsed_;
-}
-
-
-inline
-bool InsetCollapsable::allowSpellcheck() const
-{
-	return inset.allowSpellcheck();
-}
-
-
-inline
-void InsetCollapsable::selectSelectedWord(BufferView * bv)
-{
-	inset.selectSelectedWord(bv);
 }
 
 
Index: insets/insetert.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.C,v
retrieving revision 1.167
diff -u -p -u -r1.167 insetert.C
--- insets/insetert.C	3 Nov 2003 19:52:44 -0000	1.167
+++ insets/insetert.C	4 Nov 2003 09:00:52 -0000
@@ -24,7 +24,6 @@
 #include "lyxlex.h"
 #include "metricsinfo.h"
 #include "paragraph.h"
-#include "WordLangTuple.h"
 
 #include "frontends/Alert.h"
 #include "frontends/LyXView.h"
@@ -641,14 +640,6 @@ void InsetERT::close(BufferView * bv) co
 		return;
 
 	status(bv, Collapsed);
-}
-
-
-WordLangTuple const
-InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const
-{
-	bv->unlockInset(const_cast<InsetERT *>(this));
-	return WordLangTuple();
 }
 
 
Index: insets/insetert.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetert.h,v
retrieving revision 1.89
diff -u -p -u -r1.89 insetert.h
--- insets/insetert.h	31 Oct 2003 18:45:38 -0000	1.89
+++ insets/insetert.h	4 Nov 2003 09:00:52 -0000
@@ -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: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.364
diff -u -p -u -r1.364 insettabular.C
--- insets/insettabular.C	3 Nov 2003 19:52:45 -0000	1.364
+++ insets/insettabular.C	4 Nov 2003 09:00:56 -0000
@@ -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"
@@ -2411,60 +2410,6 @@ LyXCursor const & InsetTabular::cursor(B
 	if (the_locking_inset)
 		return the_locking_inset->cursor(bv);
 	return InsetOld::cursor(bv);
-}
-
-
-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);
 }
 
 
Index: insets/insettabular.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v
retrieving revision 1.158
diff -u -p -u -r1.158 insettabular.h
--- insets/insettabular.h	3 Nov 2003 16:46:43 -0000	1.158
+++ insets/insettabular.h	4 Nov 2003 09:00:57 -0000
@@ -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
@@ -284,8 +278,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: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.526
diff -u -p -u -r1.526 insettext.C
--- insets/insettext.C	4 Nov 2003 08:33:23 -0000	1.526
+++ insets/insettext.C	4 Nov 2003 09:00:59 -0000
@@ -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"
@@ -1453,39 +1452,6 @@ LyXCursor const & InsetText::cursor(Buff
 	if (the_locking_inset)
 		return the_locking_inset->cursor(bv);
 	return getLyXText(bv)->cursor;
-}
-
-
-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);
 }
 
 
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.220
diff -u -p -u -r1.220 insettext.h
--- insets/insettext.h	3 Nov 2003 16:46:44 -0000	1.220
+++ insets/insettext.h	4 Nov 2003 09:00:59 -0000
@@ -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: insets/updatableinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/updatableinset.C,v
retrieving revision 1.32
diff -u -p -u -r1.32 updatableinset.C
--- insets/updatableinset.C	3 Nov 2003 19:52:46 -0000	1.32
+++ insets/updatableinset.C	4 Nov 2003 09:00:59 -0000
@@ -20,7 +20,6 @@
 #include "dispatchresult.h"
 #include "funcrequest.h"
 #include "lyxtext.h"
-#include "WordLangTuple.h"
 
 #include "support/lstrings.h"
 
@@ -136,16 +135,6 @@ LyXCursor const & InsetOld::cursor(Buffe
 	if (owner())
 		return owner()->getLyXText(bv, false)->cursor;
 	return bv->text->cursor;
-}
-
-
-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();
 }
 
 
Index: insets/updatableinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/updatableinset.h,v
retrieving revision 1.20
diff -u -p -u -r1.20 updatableinset.h
--- insets/updatableinset.h	29 Oct 2003 10:47:19 -0000	1.20
+++ insets/updatableinset.h	4 Nov 2003 09:00:59 -0000
@@ -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

Reply via email to