diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-09-23 01:53:11 +0000 |
commit | afe61eb994377e25d60d0a0893510a693149c6be (patch) | |
tree | 80c6e33cd664e5c8b1c5f55c3b7b49c081dd590a /indra/llui | |
parent | 2945882258ad1befe8e8094c0a1a655e4ddbcd30 (diff) |
QAR-849 merge maint-viewer-10-merge 96838-97237 -> release
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lllineeditor.cpp | 25 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 1 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 4 |
3 files changed, 14 insertions, 16 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index a41b2af2b4..a8ed555a45 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -35,6 +35,7 @@ #include "lllineeditor.h" +#include "lltexteditor.h" #include "audioengine.h" #include "llmath.h" #include "llfontgl.h" @@ -450,19 +451,19 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL doSelectAll = TRUE; // Select the word we're on - if( isPartOfWord( wtext[mCursorPos] ) ) + if( LLTextEditor::isPartOfWord( wtext[mCursorPos] ) ) { S32 old_selection_start = mLastSelectionStart; S32 old_selection_end = mLastSelectionEnd; // Select word the cursor is over - while ((mCursorPos > 0) && isPartOfWord( wtext[mCursorPos-1] )) + while ((mCursorPos > 0) && LLTextEditor::isPartOfWord( wtext[mCursorPos-1] )) { // Find the start of the word mCursorPos--; } startSelection(); - while ((mCursorPos < (S32)wtext.length()) && isPartOfWord( wtext[mCursorPos] ) ) + while ((mCursorPos < (S32)wtext.length()) && LLTextEditor::isPartOfWord( wtext[mCursorPos] ) ) { // Find the end of the word mCursorPos++; } @@ -764,7 +765,7 @@ S32 LLLineEditor::prevWordPos(S32 cursorPos) const { cursorPos--; } - while( (cursorPos > 0) && isPartOfWord( wtext[cursorPos-1] ) ) + while( (cursorPos > 0) && LLTextEditor::isPartOfWord( wtext[cursorPos-1] ) ) { cursorPos--; } @@ -774,7 +775,7 @@ S32 LLLineEditor::prevWordPos(S32 cursorPos) const S32 LLLineEditor::nextWordPos(S32 cursorPos) const { const LLWString& wtext = mText.getWString(); - while( (cursorPos < getLength()) && isPartOfWord( wtext[cursorPos] ) ) + while( (cursorPos < getLength()) && LLTextEditor::isPartOfWord( wtext[cursorPos] ) ) { cursorPos++; } @@ -1817,9 +1818,6 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str) return success; } -//static -BOOL LLLineEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } - // static BOOL LLLineEditor::postvalidateFloat(const std::string &str) { @@ -1993,7 +1991,7 @@ BOOL LLLineEditor::prevalidateAlphaNum(const LLWString &str) if(len == 0) return rv; while(len--) { - if( !isalnum(str[len]) ) + if( !LLStringOps::isAlnum((char)str[len]) ) { rv = FALSE; break; @@ -2012,7 +2010,7 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str) if(len == 0) return rv; while(len--) { - if(!(isalnum(str[len]) || (' ' == str[len]))) + if(!(LLStringOps::isAlnum((char)str[len]) || (' ' == str[len]))) { rv = FALSE; break; @@ -2034,7 +2032,7 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str) rv = FALSE; break; } - if(!((' ' == str[len]) || isalnum(str[len]) || ispunct(str[len]))) + if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len]))) { rv = FALSE; break; @@ -2052,12 +2050,13 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str) if(len == 0) return rv; while(len--) { - if(iswspace(str[len])) + if(LLStringOps::isSpace(str[len])) { rv = FALSE; break; } - if( !(isalnum(str[len]) || ispunct(str[len]) ) ) + if( !(LLStringOps::isAlnum((char)str[len]) || + LLStringOps::isPunct((char)str[len]) ) ) { rv = FALSE; break; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 98242a493d..9e8212cfbb 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -194,7 +194,6 @@ public: void setMaxTextLength(S32 max_text_length); void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text. - static BOOL isPartOfWord(llwchar c); // Prevalidation controls which keystrokes can affect the editor void setPrevalidate( BOOL (*func)(const LLWString &) ); static BOOL prevalidateFloat(const LLWString &str ); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index ff93d087ea..af9908a540 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -249,6 +249,8 @@ public: const LLTextSegment* getPreviousSegment(); void getSelectedSegments(std::vector<const LLTextSegment*>& segments); + static bool isPartOfWord(llwchar c) { return (c == '_') || LLStringOps::isAlnum((char)c); } + protected: // // Methods @@ -266,8 +268,6 @@ protected: void assignEmbedded(const std::string &s); BOOL truncate(); // Returns true if truncation occurs - static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } - void removeCharOrTab(); void setCursorAtLocalPos(S32 x, S32 y, BOOL round); S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const; |