aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lltexteditor.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/lltexteditor.h')
-rw-r--r--linden/indra/llui/lltexteditor.h57
1 files changed, 30 insertions, 27 deletions
diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h
index d5a68ca..3cff91d 100644
--- a/linden/indra/llui/lltexteditor.h
+++ b/linden/indra/llui/lltexteditor.h
@@ -62,10 +62,10 @@ public:
62 static const llwchar LAST_EMBEDDED_CHAR = 0x10ffff; 62 static const llwchar LAST_EMBEDDED_CHAR = 0x10ffff;
63 static const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1; 63 static const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1;
64 64
65 LLTextEditor(const LLString& name, 65 LLTextEditor(const std::string& name,
66 const LLRect& rect, 66 const LLRect& rect,
67 S32 max_length, 67 S32 max_length,
68 const LLString &default_text, 68 const std::string &default_text,
69 const LLFontGL* glfont = NULL, 69 const LLFontGL* glfont = NULL,
70 BOOL allow_embedded_items = FALSE); 70 BOOL allow_embedded_items = FALSE);
71 71
@@ -85,10 +85,10 @@ public:
85 virtual BOOL handleKeyHere(KEY key, MASK mask ); 85 virtual BOOL handleKeyHere(KEY key, MASK mask );
86 virtual BOOL handleUnicodeCharHere(llwchar uni_char); 86 virtual BOOL handleUnicodeCharHere(llwchar uni_char);
87 87
88 virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect); 88 virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect);
89 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, 89 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
90 EDragAndDropType cargo_type, void *cargo_data, 90 EDragAndDropType cargo_type, void *cargo_data,
91 EAcceptance *accept, LLString& tooltip_msg); 91 EAcceptance *accept, std::string& tooltip_msg);
92 virtual void onMouseCaptureLost(); 92 virtual void onMouseCaptureLost();
93 93
94 // view overrides 94 // view overrides
@@ -123,9 +123,9 @@ public:
123 virtual void deselect(); 123 virtual void deselect();
124 virtual BOOL canDeselect() const; 124 virtual BOOL canDeselect() const;
125 125
126 void selectNext(const LLString& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE); 126 void selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
127 BOOL replaceText(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); 127 BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
128 void replaceTextAll(const LLString& search_text, const LLString& replace_text, BOOL case_insensitive); 128 void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive);
129 129
130 // Undo/redo stack 130 // Undo/redo stack
131 void blockUndo(); 131 void blockUndo();
@@ -136,17 +136,17 @@ public:
136 BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; } 136 BOOL allowsEmbeddedItems() const { return mAllowEmbeddedItems; }
137 137
138 // inserts text at cursor 138 // inserts text at cursor
139 void insertText(const LLString &text); 139 void insertText(const std::string &text);
140 // appends text at end 140 // appends text at end
141 void appendText(const LLString &wtext, bool allow_undo, bool prepend_newline, 141 void appendText(const std::string &wtext, bool allow_undo, bool prepend_newline,
142 const LLStyleSP *stylep = NULL); 142 const LLStyleSP *stylep = NULL);
143 143
144 void appendColoredText(const LLString &wtext, bool allow_undo, 144 void appendColoredText(const std::string &wtext, bool allow_undo,
145 bool prepend_newline, 145 bool prepend_newline,
146 const LLColor4 &color, 146 const LLColor4 &color,
147 const LLString& font_name = LLString::null); 147 const std::string& font_name = LLStringUtil::null);
148 // if styled text starts a line, you need to prepend a newline. 148 // if styled text starts a line, you need to prepend a newline.
149 void appendStyledText(const LLString &new_text, bool allow_undo, 149 void appendStyledText(const std::string &new_text, bool allow_undo,
150 bool prepend_newline, 150 bool prepend_newline,
151 const LLStyleSP *stylep = NULL); 151 const LLStyleSP *stylep = NULL);
152 152
@@ -160,12 +160,14 @@ public:
160 void setCursorPos(S32 offset); 160 void setCursorPos(S32 offset);
161 void setCursorAndScrollToEnd(); 161 void setCursorAndScrollToEnd();
162 162
163 void getLineAndColumnForPosition( S32 position, S32* line, S32* col, BOOL include_wordwrap );
163 void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap ); 164 void getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wordwrap );
165 S32 getLineForPosition(S32 position);
166 S32 getCurrentLine();
164 167
165 // Keywords support 168 void loadKeywords(const std::string& filename,
166 void loadKeywords(const LLString& filename, 169 const std::vector<std::string>& funcs,
167 const LLDynamicArray<const char*>& funcs, 170 const std::vector<std::string>& tooltips,
168 const LLDynamicArray<const char*>& tooltips,
169 const LLColor3& func_color); 171 const LLColor3& func_color);
170 LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); } 172 LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
171 LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); } 173 LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
@@ -195,8 +197,8 @@ public:
195 void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } 197 void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; }
196 198
197 // Hack to handle Notecards 199 // Hack to handle Notecards
198 virtual BOOL importBuffer(const LLString& buffer ); 200 virtual BOOL importBuffer(const char* buffer, S32 length );
199 virtual BOOL exportBuffer(LLString& buffer ); 201 virtual BOOL exportBuffer(std::string& buffer );
200 202
201 // If takes focus, will take keyboard focus on click. 203 // If takes focus, will take keyboard focus on click.
202 void setTakesFocus(BOOL b) { mTakesFocus = b; } 204 void setTakesFocus(BOOL b) { mTakesFocus = b; }
@@ -210,7 +212,7 @@ public:
210 212
211 // Callbacks 213 // Callbacks
212 static void setLinkColor(LLColor4 color) { mLinkColor = color; } 214 static void setLinkColor(LLColor4 color) { mLinkColor = color; }
213 static void setURLCallbacks(void (*callback1) (const char* url), 215 static void setURLCallbacks(void (*callback1) (const std::string& url),
214 bool (*callback2) (const std::string& url), 216 bool (*callback2) (const std::string& url),
215 bool (*callback3) (const std::string& url) ) 217 bool (*callback3) (const std::string& url) )
216 { mURLcallback = callback1; mSecondlifeURLcallback = callback2; mSecondlifeURLcallbackRightClick = callback3;} 218 { mURLcallback = callback1; mSecondlifeURLcallback = callback2; mSecondlifeURLcallbackRightClick = callback3;}
@@ -221,7 +223,7 @@ public:
221 void setValue(const LLSD& value); 223 void setValue(const LLSD& value);
222 LLSD getValue() const; 224 LLSD getValue() const;
223 225
224 const LLString& getText() const; 226 const std::string& getText() const;
225 227
226 // Non-undoable 228 // Non-undoable
227 void setText(const LLStringExplicit &utf8str); 229 void setText(const LLStringExplicit &utf8str);
@@ -261,7 +263,7 @@ protected:
261 void updateTextRect(); 263 void updateTextRect();
262 const LLRect& getTextRect() const { return mTextRect; } 264 const LLRect& getTextRect() const { return mTextRect; }
263 265
264 void assignEmbedded(const LLString &s); 266 void assignEmbedded(const std::string &s);
265 BOOL truncate(); // Returns true if truncation occurs 267 BOOL truncate(); // Returns true if truncation occurs
266 268
267 static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); } 269 static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
@@ -313,8 +315,8 @@ protected:
313 virtual void bindEmbeddedChars(LLFontGL* font) const {} 315 virtual void bindEmbeddedChars(LLFontGL* font) const {}
314 virtual void unbindEmbeddedChars(LLFontGL* font) const {} 316 virtual void unbindEmbeddedChars(LLFontGL* font) const {}
315 317
316 S32 findHTMLToken(const LLString &line, S32 pos, BOOL reverse) const; 318 S32 findHTMLToken(const std::string &line, S32 pos, BOOL reverse) const;
317 BOOL findHTML(const LLString &line, S32 *begin, S32 *end) const; 319 BOOL findHTML(const std::string &line, S32 *begin, S32 *end) const;
318 320
319 // Abstract inner base class representing an undoable editor command. 321 // Abstract inner base class representing an undoable editor command.
320 // Concrete sub-classes can be defined for operations such as insert, remove, etc. 322 // Concrete sub-classes can be defined for operations such as insert, remove, etc.
@@ -399,7 +401,7 @@ protected:
399 S32 mLastSelectionY; 401 S32 mLastSelectionY;
400 402
401 BOOL mParseHTML; 403 BOOL mParseHTML;
402 LLString mHTML; 404 std::string mHTML;
403 405
404 typedef std::vector<LLTextSegment *> segment_list_t; 406 typedef std::vector<LLTextSegment *> segment_list_t;
405 segment_list_t mSegments; 407 segment_list_t mSegments;
@@ -436,7 +438,7 @@ private:
436 // 438 //
437 LLKeywords mKeywords; 439 LLKeywords mKeywords;
438 static LLColor4 mLinkColor; 440 static LLColor4 mLinkColor;
439 static void (*mURLcallback) (const char* url); 441 static void (*mURLcallback) (const std::string& url);
440 static bool (*mSecondlifeURLcallback) (const std::string& url); 442 static bool (*mSecondlifeURLcallback) (const std::string& url);
441 static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url); 443 static bool (*mSecondlifeURLcallbackRightClick) (const std::string& url);
442 444
@@ -447,7 +449,7 @@ private:
447 class LLTextCmdRemove; 449 class LLTextCmdRemove;
448 450
449 LLWString mWText; 451 LLWString mWText;
450 mutable LLString mUTF8Text; 452 mutable std::string mUTF8Text;
451 mutable BOOL mTextIsUpToDate; 453 mutable BOOL mTextIsUpToDate;
452 454
453 S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes 455 S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
@@ -501,6 +503,7 @@ private:
501 503
502 BOOL mReadOnly; 504 BOOL mReadOnly;
503 BOOL mWordWrap; 505 BOOL mWordWrap;
506 BOOL mShowLineNumbers;
504 507
505 BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces 508 BOOL mTabsToNextField; // if true, tab moves focus to next field, else inserts spaces
506 BOOL mCommitOnFocusLost; 509 BOOL mCommitOnFocusLost;
@@ -544,7 +547,7 @@ public:
544 BOOL getIsDefault() const { return mIsDefault; } 547 BOOL getIsDefault() const { return mIsDefault; }
545 void setToken( LLKeywordToken* token ) { mToken = token; } 548 void setToken( LLKeywordToken* token ) { mToken = token; }
546 LLKeywordToken* getToken() const { return mToken; } 549 LLKeywordToken* getToken() const { return mToken; }
547 BOOL getToolTip( LLString& msg ) const; 550 BOOL getToolTip( std::string& msg ) const;
548 551
549 void dump() const; 552 void dump() const;
550 553