It was mentioned last week that it would be a good idea to move IsInsetChar 
out of textutils.h. This patch does that.

-- 
Angus
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.1581
diff -u -p -r1.1581 ChangeLog
--- src/ChangeLog	16 Sep 2003 11:03:15 -0000	1.1581
+++ src/ChangeLog	16 Sep 2003 12:03:15 -0000
@@ -1,3 +1,18 @@
+2003-09-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* paragraph.C (IsInsetChar): new function in namespace anon, moved out of
+	support/textutils.h.
+	(isWord): move the contents of support/textutils.h's IsWordChar here.
+
+	* buffer.C:
+	* lyxfind.C:
+	* rowpainter.C:
+	* text.C:
+	* text2.C: add #include "paragraph.h".
+
+	* rowpainter.C:
+	* text.C: replace IsInsetChar(c) with a direct test of Paragraph::META_INSET.
+
 2003-09-16  Lars Gullik Bjønnes  <[EMAIL PROTECTED]>
 
 	* main.C: 
Index: src/buffer.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/buffer.C,v
retrieving revision 1.526
diff -u -p -r1.526 buffer.C
--- src/buffer.C	16 Sep 2003 11:03:16 -0000	1.526
+++ src/buffer.C	16 Sep 2003 12:03:17 -0000
@@ -32,6 +32,7 @@
 #include "lyxrc.h"
 #include "lyxvc.h"
 #include "messages.h"
+#include "paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "sgml.h"
Index: src/lyxfind.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfind.C,v
retrieving revision 1.51
diff -u -p -r1.51 lyxfind.C
--- src/lyxfind.C	9 Sep 2003 22:13:25 -0000	1.51
+++ src/lyxfind.C	16 Sep 2003 12:03:18 -0000
@@ -18,6 +18,7 @@
 #include "BufferView.h"
 #include "gettext.h"
 #include "lyxtext.h"
+#include "paragraph.h"
 
 #include "frontends/Alert.h"
 
Index: src/paragraph.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/paragraph.C,v
retrieving revision 1.319
diff -u -p -r1.319 paragraph.C
--- src/paragraph.C	15 Sep 2003 10:59:52 -0000	1.319
+++ src/paragraph.C	16 Sep 2003 12:03:19 -0000
@@ -1004,6 +1004,17 @@ bool Paragraph::simpleTeXOnePar(Buffer c
 }
 
 
+namespace {
+
+/// return true if the char is a meta-character for an inset
+inline
+bool IsInsetChar(char c)
+{
+	return (c == Paragraph::META_INSET);
+}
+
+} // namespace anon
+
 
 
 bool Paragraph::isHfill(pos_type pos) const
@@ -1063,7 +1074,10 @@ bool Paragraph::isLetter(pos_type pos) c
 
 bool Paragraph::isWord(pos_type pos) const
 {
-	return IsWordChar(getChar(pos)) ;
+	unsigned char const c = getChar(pos);
+	return !(IsSeparatorChar(c)
+		  || IsKommaChar(c)
+		  || IsInsetChar(c));
 }
 
 
Index: src/rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.74
diff -u -p -r1.74 rowpainter.C
--- src/rowpainter.C	16 Sep 2003 10:30:55 -0000	1.74
+++ src/rowpainter.C	16 Sep 2003 12:03:20 -0000
@@ -24,6 +24,7 @@
 #include "lyxrow.h"
 #include "lyxrow_funcs.h"
 #include "metricsinfo.h"
+#include "paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "vspace.h"
@@ -336,7 +337,7 @@ void RowPainter::paintFromPos(pos_type &
 
 	char const c = pit_->getChar(pos);
 
-	if (IsInsetChar(c)) {
+	if (c == Paragraph::META_INSET) {
 		paintInset(pos);
 		++vpos;
 		paintForeignMark(orig_x, orig_font);
Index: src/text.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text.C,v
retrieving revision 1.450
diff -u -p -r1.450 text.C
--- src/text.C	16 Sep 2003 10:30:55 -0000	1.450
+++ src/text.C	16 Sep 2003 12:03:22 -0000
@@ -31,6 +31,7 @@
 #include "lyxrc.h"
 #include "lyxrow.h"
 #include "lyxrow_funcs.h"
+#include "paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "rowpainter.h"
@@ -1809,7 +1810,7 @@ void LyXText::changeCase(LyXText::TextCa
 			continue;
 		}
 		unsigned char c = pit->getChar(pos);
-		if (!IsInsetChar(c)) {
+		if (c != Paragraph::META_INSET) {
 			switch (action) {
 			case text_lowercase:
 				c = lowercase(c);
Index: src/text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.468
diff -u -p -r1.468 text2.C
--- src/text2.C	12 Sep 2003 17:13:22 -0000	1.468
+++ src/text2.C	16 Sep 2003 12:03:24 -0000
@@ -39,6 +39,7 @@
 #include "lyxrow.h"
 #include "lyxrow_funcs.h"
 #include "metricsinfo.h"
+#include "paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "undo_funcs.h"
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.213
diff -u -p -r1.213 ChangeLog
--- src/support/ChangeLog	15 Sep 2003 20:51:47 -0000	1.213
+++ src/support/ChangeLog	16 Sep 2003 12:03:27 -0000
@@ -1,3 +1,8 @@
+2003-09-16  Angus Leeming  <[EMAIL PROTECTED]>
+
+	* textutils.h: remove #include "paragraph.h". Remove functions IsInsetChar
+	and IsWordChar.
+
 2003-09-15  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* copied_ptr.h: re-jig to something that resembles Herb Sutter's HolderPtr ---
Index: src/support/textutils.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/textutils.h,v
retrieving revision 1.24
diff -u -p -r1.24 textutils.h
--- src/support/textutils.h	5 Sep 2003 15:34:37 -0000	1.24
+++ src/support/textutils.h	16 Sep 2003 12:03:27 -0000
@@ -15,8 +15,6 @@
 #ifndef TEXTUTILS_H
 #define TEXTUTILS_H
 
-#include "paragraph.h"
-
 /// return true if the char is a word separator
 inline
 bool IsSeparatorChar(char c)
@@ -33,14 +31,6 @@ bool IsLineSeparatorChar(char c)
 }
 
 
-/// return true if the char is a meta-character for an inset
-inline
-bool IsInsetChar(char c)
-{
-	return (c == Paragraph::META_INSET);
-}
-
-
 /// return true if the char is "punctuation"
 inline
 bool IsKommaChar(char c)
@@ -95,16 +85,6 @@ inline
 bool IsPrintableNonspace(unsigned char c)
 {
 	return IsPrintable(c) && (c != ' ');
-}
-
-
-/// return true if the char forms part of a word
-inline
-bool IsWordChar(unsigned char c)
-{
-	return !(IsSeparatorChar(c)
-		  || IsKommaChar(c)
-		  || IsInsetChar(c));
 }
 
 

Reply via email to