diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/llui/lltexteditor.h | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/llui/lltexteditor.h')
-rw-r--r-- | linden/indra/llui/lltexteditor.h | 57 |
1 files changed, 44 insertions, 13 deletions
diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h index 33ec1c6..4c92297 100644 --- a/linden/indra/llui/lltexteditor.h +++ b/linden/indra/llui/lltexteditor.h | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -43,6 +43,8 @@ | |||
43 | #include "lleditmenuhandler.h" | 43 | #include "lleditmenuhandler.h" |
44 | #include "lldarray.h" | 44 | #include "lldarray.h" |
45 | 45 | ||
46 | #include "llpreeditor.h" | ||
47 | |||
46 | class LLFontGL; | 48 | class LLFontGL; |
47 | class LLScrollbar; | 49 | class LLScrollbar; |
48 | class LLViewBorder; | 50 | class LLViewBorder; |
@@ -64,7 +66,7 @@ const S32 MAX_EMBEDDED_ITEMS = LAST_EMBEDDED_CHAR - FIRST_EMBEDDED_CHAR + 1; | |||
64 | class LLTextSegment; | 66 | class LLTextSegment; |
65 | class LLTextCmd; | 67 | class LLTextCmd; |
66 | 68 | ||
67 | class LLTextEditor : public LLUICtrl, LLEditMenuHandler | 69 | class LLTextEditor : public LLUICtrl, LLEditMenuHandler, protected LLPreeditor |
68 | { | 70 | { |
69 | friend class LLTextCmd; | 71 | friend class LLTextCmd; |
70 | public: | 72 | public: |
@@ -104,6 +106,7 @@ public: | |||
104 | // view overrides | 106 | // view overrides |
105 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent); | 107 | virtual void reshape(S32 width, S32 height, BOOL called_from_parent); |
106 | virtual void draw(); | 108 | virtual void draw(); |
109 | virtual void onFocusReceived(); | ||
107 | virtual void onFocusLost(); | 110 | virtual void onFocusLost(); |
108 | virtual void setEnabled(BOOL enabled); | 111 | virtual void setEnabled(BOOL enabled); |
109 | 112 | ||
@@ -184,6 +187,7 @@ public: | |||
184 | 187 | ||
185 | void setCursorColor(const LLColor4& c) { mCursorColor = c; } | 188 | void setCursorColor(const LLColor4& c) { mCursorColor = c; } |
186 | void setFgColor( const LLColor4& c ) { mFgColor = c; } | 189 | void setFgColor( const LLColor4& c ) { mFgColor = c; } |
190 | void setTextDefaultColor( const LLColor4& c ) { mDefaultColor = c; } | ||
187 | void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; } | 191 | void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; } |
188 | void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; } | 192 | void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; } |
189 | void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; } | 193 | void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; } |
@@ -203,13 +207,13 @@ public: | |||
203 | void setTabToNextField(BOOL b) { mTabToNextField = b; } | 207 | void setTabToNextField(BOOL b) { mTabToNextField = b; } |
204 | void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } | 208 | void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; } |
205 | 209 | ||
206 | // If takes focus, will take keyboard focus on click. | ||
207 | void setTakesFocus(BOOL b) { mTakesFocus = b; } | ||
208 | |||
209 | // Hack to handle Notecards | 210 | // Hack to handle Notecards |
210 | virtual BOOL importBuffer(const LLString& buffer ); | 211 | virtual BOOL importBuffer(const LLString& buffer ); |
211 | virtual BOOL exportBuffer(LLString& buffer ); | 212 | virtual BOOL exportBuffer(LLString& buffer ); |
212 | 213 | ||
214 | // If takes focus, will take keyboard focus on click. | ||
215 | void setTakesFocus(BOOL b) { mTakesFocus = b; } | ||
216 | |||
213 | void setSourceID(const LLUUID& id) { mSourceID = id; } | 217 | void setSourceID(const LLUUID& id) { mSourceID = id; } |
214 | void setAcceptCallingCardNames(BOOL enable) { mAcceptCallingCardNames = enable; } | 218 | void setAcceptCallingCardNames(BOOL enable) { mAcceptCallingCardNames = enable; } |
215 | 219 | ||
@@ -234,13 +238,17 @@ public: | |||
234 | void setText(const LLStringExplicit &utf8str); | 238 | void setText(const LLStringExplicit &utf8str); |
235 | void setWText(const LLWString &wtext); | 239 | void setWText(const LLWString &wtext); |
236 | 240 | ||
237 | S32 getMaxLength() const { return mMaxTextLength; } | 241 | // Returns byte length limit |
242 | S32 getMaxLength() const { return mMaxTextByteLength; } | ||
238 | 243 | ||
239 | // Change cursor | 244 | // Change cursor |
240 | void startOfLine(); | 245 | void startOfLine(); |
241 | void endOfLine(); | 246 | void endOfLine(); |
242 | void endOfDoc(); | 247 | void endOfDoc(); |
243 | 248 | ||
249 | BOOL isScrolledToTop(); | ||
250 | BOOL isScrolledToBottom(); | ||
251 | |||
244 | // Getters | 252 | // Getters |
245 | const LLWString& getWText() const; | 253 | const LLWString& getWText() const; |
246 | llwchar getWChar(S32 pos); | 254 | llwchar getWChar(S32 pos); |
@@ -259,6 +267,7 @@ protected: | |||
259 | void drawCursor(); | 267 | void drawCursor(); |
260 | void drawText(); | 268 | void drawText(); |
261 | void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x); | 269 | void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyle& color, F32* right_x); |
270 | void drawPreeditMarker(); | ||
262 | 271 | ||
263 | void updateLineStartList(S32 startpos = 0); | 272 | void updateLineStartList(S32 startpos = 0); |
264 | void updateScrollFromCursor(); | 273 | void updateScrollFromCursor(); |
@@ -267,7 +276,7 @@ protected: | |||
267 | void pruneSegments(); | 276 | void pruneSegments(); |
268 | 277 | ||
269 | void assignEmbedded(const LLString &s); | 278 | void assignEmbedded(const LLString &s); |
270 | void truncate(); | 279 | BOOL truncate(); // Returns true if truncation occurs |
271 | 280 | ||
272 | static BOOL isPartOfWord(llwchar c); | 281 | static BOOL isPartOfWord(llwchar c); |
273 | 282 | ||
@@ -291,7 +300,7 @@ protected: | |||
291 | BOOL handleControlKey(const KEY key, const MASK mask); | 300 | BOOL handleControlKey(const KEY key, const MASK mask); |
292 | BOOL handleEditKey(const KEY key, const MASK mask); | 301 | BOOL handleEditKey(const KEY key, const MASK mask); |
293 | 302 | ||
294 | BOOL hasSelection() { return (mSelectionStart !=mSelectionEnd); } | 303 | BOOL hasSelection() const { return (mSelectionStart !=mSelectionEnd); } |
295 | BOOL selectionContainsLineBreaks(); | 304 | BOOL selectionContainsLineBreaks(); |
296 | void startSelection(); | 305 | void startSelection(); |
297 | void endSelection(); | 306 | void endSelection(); |
@@ -300,8 +309,8 @@ protected: | |||
300 | S32 prevWordPos(S32 cursorPos) const; | 309 | S32 prevWordPos(S32 cursorPos) const; |
301 | S32 nextWordPos(S32 cursorPos) const; | 310 | S32 nextWordPos(S32 cursorPos) const; |
302 | 311 | ||
303 | S32 getLineCount(); | 312 | S32 getLineCount() const; |
304 | S32 getLineStart( S32 line ); | 313 | S32 getLineStart( S32 line ) const; |
305 | void getLineAndOffset(S32 pos, S32* linep, S32* offsetp); | 314 | void getLineAndOffset(S32 pos, S32* linep, S32* offsetp); |
306 | S32 getPos(S32 line, S32 offset); | 315 | S32 getPos(S32 line, S32 offset); |
307 | 316 | ||
@@ -338,6 +347,20 @@ protected: | |||
338 | S32 removeStringNoUndo(S32 pos, S32 length); | 347 | S32 removeStringNoUndo(S32 pos, S32 length); |
339 | S32 overwriteCharNoUndo(S32 pos, llwchar wc); | 348 | S32 overwriteCharNoUndo(S32 pos, llwchar wc); |
340 | 349 | ||
350 | protected: | ||
351 | void updateAllowingLanguageInput(); | ||
352 | BOOL hasPreeditString() const; | ||
353 | |||
354 | // Overrides LLPreeditor | ||
355 | virtual void resetPreedit(); | ||
356 | virtual void updatePreedit(const LLWString &preedit_string, | ||
357 | const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position); | ||
358 | virtual void markAsPreedit(S32 position, S32 length); | ||
359 | virtual void getPreeditRange(S32 *position, S32 *length) const; | ||
360 | virtual void getSelectionRange(S32 *position, S32 *length) const; | ||
361 | virtual BOOL getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; | ||
362 | virtual S32 getPreeditFontSize() const; | ||
363 | |||
341 | public: | 364 | public: |
342 | LLKeywords mKeywords; | 365 | LLKeywords mKeywords; |
343 | static LLColor4 mLinkColor; | 366 | static LLColor4 mLinkColor; |
@@ -349,7 +372,7 @@ protected: | |||
349 | mutable LLString mUTF8Text; | 372 | mutable LLString mUTF8Text; |
350 | mutable BOOL mTextIsUpToDate; | 373 | mutable BOOL mTextIsUpToDate; |
351 | 374 | ||
352 | S32 mMaxTextLength; // Maximum length mText is allowed to be | 375 | S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes |
353 | 376 | ||
354 | const LLFontGL* mGLFont; | 377 | const LLFontGL* mGLFont; |
355 | 378 | ||
@@ -407,6 +430,7 @@ protected: | |||
407 | LLColor4 mCursorColor; | 430 | LLColor4 mCursorColor; |
408 | 431 | ||
409 | LLColor4 mFgColor; | 432 | LLColor4 mFgColor; |
433 | LLColor4 mDefaultColor; | ||
410 | LLColor4 mReadOnlyFgColor; | 434 | LLColor4 mReadOnlyFgColor; |
411 | LLColor4 mWriteableBgColor; | 435 | LLColor4 mWriteableBgColor; |
412 | LLColor4 mReadOnlyBgColor; | 436 | LLColor4 mReadOnlyBgColor; |
@@ -420,6 +444,8 @@ protected: | |||
420 | BOOL mTakesFocus; | 444 | BOOL mTakesFocus; |
421 | BOOL mHideScrollbarForShortDocs; | 445 | BOOL mHideScrollbarForShortDocs; |
422 | BOOL mTakesNonScrollClicks; | 446 | BOOL mTakesNonScrollClicks; |
447 | BOOL mTrackBottom; // if true, keeps scroll position at bottom during resize | ||
448 | BOOL mScrolledToBottom; | ||
423 | 449 | ||
424 | BOOL mAllowEmbeddedItems; | 450 | BOOL mAllowEmbeddedItems; |
425 | 451 | ||
@@ -439,6 +465,11 @@ protected: | |||
439 | 465 | ||
440 | BOOL mParseHTML; | 466 | BOOL mParseHTML; |
441 | LLString mHTML; | 467 | LLString mHTML; |
468 | |||
469 | LLWString mPreeditWString; | ||
470 | LLWString mPreeditOverwrittenWString; | ||
471 | std::vector<S32> mPreeditPositions; | ||
472 | std::vector<BOOL> mPreeditStandouts; | ||
442 | }; | 473 | }; |
443 | 474 | ||
444 | class LLTextSegment | 475 | class LLTextSegment |