diff options
Diffstat (limited to 'linden/indra/llui/lllineeditor.h')
-rw-r--r-- | linden/indra/llui/lllineeditor.h | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index fc1b75f..6de57ec 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h | |||
@@ -78,6 +78,7 @@ public: | |||
78 | LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, | 78 | LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE, |
79 | S32 border_thickness = 1); | 79 | S32 border_thickness = 1); |
80 | 80 | ||
81 | |||
81 | virtual ~LLLineEditor(); | 82 | virtual ~LLLineEditor(); |
82 | 83 | ||
83 | virtual LLXMLNodePtr getXML(bool save_children = true) const; | 84 | virtual LLXMLNodePtr getXML(bool save_children = true) const; |
@@ -91,15 +92,30 @@ public: | |||
91 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); | 92 | /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); |
92 | /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); | 93 | /*virtual*/ BOOL handleDoubleClick(S32 x,S32 y,MASK mask); |
93 | /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); | 94 | /*virtual*/ BOOL handleMiddleMouseDown(S32 x,S32 y,MASK mask); |
95 | /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); | ||
94 | /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); | 96 | /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); |
95 | /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); | 97 | /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); |
96 | /*virtual*/ void onMouseCaptureLost(); | 98 | /*virtual*/ void onMouseCaptureLost(); |
97 | 99 | ||
100 | struct SpellMenuBind | ||
101 | { | ||
102 | LLLineEditor* origin; | ||
103 | void * menuItem; | ||
104 | std::string word; | ||
105 | S32 wordPositionStart; | ||
106 | S32 wordPositionEnd; | ||
107 | }; | ||
108 | |||
109 | virtual void spellReplace(SpellMenuBind* spellData); | ||
110 | virtual void insert(std::string what,S32 wher); | ||
111 | |||
98 | // LLEditMenuHandler overrides | 112 | // LLEditMenuHandler overrides |
99 | virtual void cut(); | 113 | virtual void cut(); |
100 | virtual BOOL canCut() const; | 114 | virtual BOOL canCut() const; |
115 | |||
101 | virtual void copy(); | 116 | virtual void copy(); |
102 | virtual BOOL canCopy() const; | 117 | virtual BOOL canCopy() const; |
118 | |||
103 | virtual void paste(); | 119 | virtual void paste(); |
104 | virtual BOOL canPaste() const; | 120 | virtual BOOL canPaste() const; |
105 | 121 | ||
@@ -117,8 +133,20 @@ public: | |||
117 | virtual void deselect(); | 133 | virtual void deselect(); |
118 | virtual BOOL canDeselect() const; | 134 | virtual BOOL canDeselect() const; |
119 | 135 | ||
136 | static void context_cut(void* data); | ||
137 | static void context_copy(void* data); | ||
138 | static void spell_correct(void* data); | ||
139 | static void spell_show(void* data); | ||
140 | static void translateText(void * data); | ||
141 | static void spell_add(void* data); | ||
142 | static void context_paste(void* data); | ||
143 | static void context_delete(void* data); | ||
144 | static void context_selectall(void* data); | ||
145 | std::vector<S32> getMisspelledWordsPositions(); | ||
120 | // view overrides | 146 | // view overrides |
121 | virtual void draw(); | 147 | virtual void draw(); |
148 | void autoCorrectText(); | ||
149 | void drawMisspelled(LLRect background); | ||
122 | virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE); | 150 | virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE); |
123 | virtual void onFocusReceived(); | 151 | virtual void onFocusReceived(); |
124 | virtual void onFocusLost(); | 152 | virtual void onFocusLost(); |
@@ -133,6 +161,8 @@ public: | |||
133 | virtual void onCommit(); | 161 | virtual void onCommit(); |
134 | virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all | 162 | virtual BOOL isDirty() const { return mText.getString() != mPrevText; } // Returns TRUE if user changed value at all |
135 | virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state | 163 | virtual void resetDirty() { mPrevText = mText.getString(); } // Clear dirty state |
164 | virtual BOOL isSpellDirty() const { return mText.getString() != mPrevSpelledText; } // Returns TRUE if user changed value at all | ||
165 | virtual void resetSpellDirty() { mPrevSpelledText = mText.getString(); } // Clear dirty state | ||
136 | 166 | ||
137 | // assumes UTF8 text | 167 | // assumes UTF8 text |
138 | virtual void setValue(const LLSD& value ) { setText(value.asString()); } | 168 | virtual void setValue(const LLSD& value ) { setText(value.asString()); } |
@@ -168,6 +198,7 @@ public: | |||
168 | void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; } | 198 | void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; } |
169 | void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; } | 199 | void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; } |
170 | void setFocusBgColor(const LLColor4& c) { mFocusBgColor = c; } | 200 | void setFocusBgColor(const LLColor4& c) { mFocusBgColor = c; } |
201 | void setOverRideAndShowMisspellings(BOOL b) { mOverRideAndShowMisspellings =b;} | ||
171 | 202 | ||
172 | const LLColor4& getFgColor() const { return mFgColor; } | 203 | const LLColor4& getFgColor() const { return mFgColor; } |
173 | const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor; } | 204 | const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor; } |
@@ -213,7 +244,7 @@ public: | |||
213 | static BOOL prevalidateASCII(const LLWString &str); | 244 | static BOOL prevalidateASCII(const LLWString &str); |
214 | 245 | ||
215 | static BOOL postvalidateFloat(const std::string &str); | 246 | static BOOL postvalidateFloat(const std::string &str); |
216 | 247 | ||
217 | BOOL evaluateFloat(); | 248 | BOOL evaluateFloat(); |
218 | 249 | ||
219 | // line history support: | 250 | // line history support: |
@@ -225,11 +256,12 @@ public: | |||
225 | private: | 256 | private: |
226 | // private helper methods | 257 | // private helper methods |
227 | 258 | ||
228 | void pasteHelper(bool is_primary); | 259 | void pasteHelper(bool is_primary); |
229 | 260 | ||
230 | void removeChar(); | 261 | void removeChar(); |
231 | void addChar(const llwchar c); | 262 | void addChar(const llwchar c); |
232 | void setCursorAtLocalPos(S32 local_mouse_x); | 263 | void setCursorAtLocalPos(S32 local_mouse_x); |
264 | S32 calculateCursorFromMouse(S32 local_mouse_x); | ||
233 | S32 findPixelNearestPos(S32 cursor_offset = 0) const; | 265 | S32 findPixelNearestPos(S32 cursor_offset = 0) const; |
234 | void reportBadKeystroke(); | 266 | void reportBadKeystroke(); |
235 | BOOL handleSpecialKey(KEY key, MASK mask); | 267 | BOOL handleSpecialKey(KEY key, MASK mask); |
@@ -253,9 +285,18 @@ private: | |||
253 | virtual S32 getPreeditFontSize() const; | 285 | virtual S32 getPreeditFontSize() const; |
254 | 286 | ||
255 | protected: | 287 | protected: |
288 | LLHandle<LLView> mPopupMenuHandle; | ||
256 | LLUIString mText; // The string being edited. | 289 | LLUIString mText; // The string being edited. |
257 | std::string mPrevText; // Saved string for 'ESC' revert | 290 | std::string mPrevText; // Saved string for 'ESC' revert |
258 | LLUIString mLabel; // text label that is visible when no user text provided | 291 | LLUIString mLabel; // text label that is visible when no user text provided |
292 | std::string mPrevSpelledText; // saved string so we know whether to respell or not | ||
293 | std::vector<S32> misspellLocations; // where all the mispelled words are | ||
294 | S32 mStartSpellHere; // the position of the first char on the screen, stored so we know when to update | ||
295 | S32 mEndSpellHere; // the location of the last char on the screen | ||
296 | BOOL mOverRideAndShowMisspellings; | ||
297 | LLFrameTimer mSpellTimer; | ||
298 | //to keep track of what we have to remove before showing menu | ||
299 | std::vector<SpellMenuBind* > suggestionMenuItems; | ||
259 | 300 | ||
260 | // line history support: | 301 | // line history support: |
261 | BOOL mHaveHistory; // flag for enabled line history | 302 | BOOL mHaveHistory; // flag for enabled line history |
@@ -364,6 +405,8 @@ private: | |||
364 | BOOL mIsSelecting; | 405 | BOOL mIsSelecting; |
365 | S32 mSelectionStart; | 406 | S32 mSelectionStart; |
366 | S32 mSelectionEnd; | 407 | S32 mSelectionEnd; |
408 | |||
409 | |||
367 | }; // end class LLLineEditorRollback | 410 | }; // end class LLLineEditorRollback |
368 | 411 | ||
369 | }; // end class LLLineEditor | 412 | }; // end class LLLineEditor |