From: Angus Leeming Date: Tue, 16 Sep 2003 12:12:33 +0000 (+0000) Subject: Remove IsInsetChar and IsWordChar from textutils.h. X-Git-Tag: 1.6.10~16077 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e7e92ec6609a97554e36833d799da03802881bcf;p=features.git Remove IsInsetChar and IsWordChar from textutils.h. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7771 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 0846ab4e37..24d007561e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2003-09-16 Angus Leeming + + * 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 * main.C: diff --git a/src/buffer.C b/src/buffer.C index 19d4103fc8..9bf58d5507 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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" diff --git a/src/lyxfind.C b/src/lyxfind.C index 3e30e438a0..bea21a291a 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -18,6 +18,7 @@ #include "BufferView.h" #include "gettext.h" #include "lyxtext.h" +#include "paragraph.h" #include "frontends/Alert.h" diff --git a/src/paragraph.C b/src/paragraph.C index 730b7d0159..671e3af713 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1004,6 +1004,17 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf, } +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) const bool Paragraph::isWord(pos_type pos) const { - return IsWordChar(getChar(pos)) ; + unsigned char const c = getChar(pos); + return !(IsSeparatorChar(c) + || IsKommaChar(c) + || IsInsetChar(c)); } diff --git a/src/rowpainter.C b/src/rowpainter.C index 0410a79437..7acb3393b4 100644 --- a/src/rowpainter.C +++ b/src/rowpainter.C @@ -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 & vpos) char const c = pit_->getChar(pos); - if (IsInsetChar(c)) { + if (c == Paragraph::META_INSET) { paintInset(pos); ++vpos; paintForeignMark(orig_x, orig_font); diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 0e87d6f3ac..f1abf82299 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,8 @@ +2003-09-16 Angus Leeming + + * textutils.h: remove #include "paragraph.h". Remove functions IsInsetChar + and IsWordChar. + 2003-09-15 Angus Leeming * copied_ptr.h: re-jig to something that resembles Herb Sutter's HolderPtr --- diff --git a/src/support/textutils.h b/src/support/textutils.h index 99f2df85ff..7e9d9fc8e7 100644 --- a/src/support/textutils.h +++ b/src/support/textutils.h @@ -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) @@ -98,16 +88,6 @@ bool IsPrintableNonspace(unsigned char c) } -/// return true if the char forms part of a word -inline -bool IsWordChar(unsigned char c) -{ - return !(IsSeparatorChar(c) - || IsKommaChar(c) - || IsInsetChar(c)); -} - - /// completely pointless FIXME inline bool IsDigit(unsigned char ch) diff --git a/src/text.C b/src/text.C index cb29a4cd86..6088af6a85 100644 --- a/src/text.C +++ b/src/text.C @@ -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::TextCase action) continue; } unsigned char c = pit->getChar(pos); - if (!IsInsetChar(c)) { + if (c != Paragraph::META_INSET) { switch (action) { case text_lowercase: c = lowercase(c); diff --git a/src/text2.C b/src/text2.C index b1cc8f22b6..579367e735 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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"