diff options
author | thickbrick | 2010-09-28 18:06:43 +0200 |
---|---|---|
committer | thickbrick | 2010-09-28 18:06:43 +0200 |
commit | 13b1fd24af265af8eb14585121958bf1e4bc89fd (patch) | |
tree | c3165ceda466531fb27dc6ae3169deb4fba65e81 /linden | |
parent | Fixed typo causing menu seperator to not hide. (diff) | |
download | meta-impy-13b1fd24af265af8eb14585121958bf1e4bc89fd.zip meta-impy-13b1fd24af265af8eb14585121958bf1e4bc89fd.tar.gz meta-impy-13b1fd24af265af8eb14585121958bf1e4bc89fd.tar.bz2 meta-impy-13b1fd24af265af8eb14585121958bf1e4bc89fd.tar.xz |
Context menu translator:
- Don't hide the translate menu, instead only enable the options
that make sense in the context (translate languages,
copy/paste/etc.)
- Made highlighting misspellings a global option, with immediate
effect.
- Convert newview/lgghunspell_wrapper.cpp to UTF-8.
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 127 | ||||
-rw-r--r-- | linden/indra/llui/lllineeditor.h | 19 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 125 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.h | 12 | ||||
-rw-r--r-- | linden/indra/newview/lgghunspell_wrapper.cpp | 18 | ||||
-rw-r--r-- | linden/indra/newview/lgghunspell_wrapper.h | 4 |
6 files changed, 189 insertions, 116 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 8d88ce9..49fe3be 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -175,7 +175,6 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, | |||
175 | mImage( sImage ), | 175 | mImage( sImage ), |
176 | mReplaceNewlinesWithSpaces( TRUE ), | 176 | mReplaceNewlinesWithSpaces( TRUE ), |
177 | mSpellCheckable( FALSE ), | 177 | mSpellCheckable( FALSE ), |
178 | mShowMisspellings(FALSE), | ||
179 | mAllowTranslate(TRUE) | 178 | mAllowTranslate(TRUE) |
180 | { | 179 | { |
181 | llassert( max_length_bytes > 0 ); | 180 | llassert( max_length_bytes > 0 ); |
@@ -215,12 +214,6 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, | |||
215 | } | 214 | } |
216 | mImage = sImage; | 215 | mImage = sImage; |
217 | 216 | ||
218 | // in other words, highlighting requires a restart | ||
219 | if (glggHunSpell->getSpellCheckHighlight()) | ||
220 | { | ||
221 | mShowMisspellings = TRUE; | ||
222 | } | ||
223 | |||
224 | // make the popup menu available | 217 | // make the popup menu available |
225 | //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); | 218 | //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); |
226 | LLMenuGL* menu = new LLMenuGL("wot"); | 219 | LLMenuGL* menu = new LLMenuGL("wot"); |
@@ -228,46 +221,49 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect, | |||
228 | { | 221 | { |
229 | menu = new LLMenuGL(LLStringUtil::null); | 222 | menu = new LLMenuGL(LLStringUtil::null); |
230 | }*/ | 223 | }*/ |
231 | menu->append(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); | 224 | |
232 | menu->append(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); | 225 | menu->append(new LLMenuItemCallGL("Cut", context_cut, context_enable_cut, this)); |
233 | menu->append(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); | 226 | menu->append(new LLMenuItemCallGL("Copy", context_copy, context_enable_copy, this)); |
234 | menu->append(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); | 227 | menu->append(new LLMenuItemCallGL("Paste", context_paste, context_enable_paste, this)); |
235 | menu->append(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); | 228 | menu->append(new LLMenuItemCallGL("Delete", context_delete, context_enable_delete, this)); |
229 | menu->append(new LLMenuItemCallGL("Select All", context_selectall, context_enable_selectall, this)); | ||
230 | |||
236 | menu->appendSeparator("Transep"); | 231 | menu->appendSeparator("Transep"); |
237 | LLMenuGL* translatemenu = new LLMenuGL("Translate To"); | 232 | LLMenuGL* translatemenu = new LLMenuGL("Translate To"); |
238 | translatemenu->setCanTearOff(FALSE); | 233 | translatemenu->setCanTearOff(FALSE); |
239 | SpellMenuBind* t=new SpellMenuBind;t->origin=this;t->word="en"; | 234 | SpellMenuBind* t=new SpellMenuBind;t->origin=this;t->word="en"; |
240 | translatemenu->append(new LLMenuItemCallGL("English",translateText, NULL, t)); | 235 | translatemenu->append(new LLMenuItemCallGL("English", context_translate, context_enable_translate, t)); |
241 | t=new SpellMenuBind;t->origin=this;t->word="da"; | 236 | t=new SpellMenuBind;t->origin=this;t->word="da"; |
242 | translatemenu->append(new LLMenuItemCallGL("Danish",translateText, NULL, t)); | 237 | translatemenu->append(new LLMenuItemCallGL("Danish", context_translate, context_enable_translate, t)); |
243 | t=new SpellMenuBind;t->origin=this;t->word="de"; | 238 | t=new SpellMenuBind;t->origin=this;t->word="de"; |
244 | translatemenu->append(new LLMenuItemCallGL("Deutsch(German)",translateText, NULL, t)); | 239 | translatemenu->append(new LLMenuItemCallGL("Deutsch(German)", context_translate, context_enable_translate, t)); |
245 | t=new SpellMenuBind;t->origin=this;t->word="es"; | 240 | t=new SpellMenuBind;t->origin=this;t->word="es"; |
246 | translatemenu->append(new LLMenuItemCallGL("Spanish",translateText, NULL, t)); | 241 | translatemenu->append(new LLMenuItemCallGL("Spanish", context_translate, context_enable_translate, t)); |
247 | t=new SpellMenuBind;t->origin=this;t->word="fr"; | 242 | t=new SpellMenuBind;t->origin=this;t->word="fr"; |
248 | translatemenu->append(new LLMenuItemCallGL("French",translateText, NULL, t)); | 243 | translatemenu->append(new LLMenuItemCallGL("French", context_translate, context_enable_translate, t)); |
249 | t=new SpellMenuBind;t->origin=this;t->word="it"; | 244 | t=new SpellMenuBind;t->origin=this;t->word="it"; |
250 | translatemenu->append(new LLMenuItemCallGL("Italian",translateText, NULL, t)); | 245 | translatemenu->append(new LLMenuItemCallGL("Italian", context_translate, context_enable_translate, t)); |
251 | t=new SpellMenuBind;t->origin=this;t->word="hu"; | 246 | t=new SpellMenuBind;t->origin=this;t->word="hu"; |
252 | translatemenu->append(new LLMenuItemCallGL("Hungarian",translateText, NULL, t)); | 247 | translatemenu->append(new LLMenuItemCallGL("Hungarian", context_translate, context_enable_translate, t)); |
253 | t=new SpellMenuBind;t->origin=this;t->word="nl"; | 248 | t=new SpellMenuBind;t->origin=this;t->word="nl"; |
254 | translatemenu->append(new LLMenuItemCallGL("Dutch",translateText, NULL, t)); | 249 | translatemenu->append(new LLMenuItemCallGL("Dutch", context_translate, context_enable_translate, t)); |
255 | t=new SpellMenuBind;t->origin=this;t->word="pl"; | 250 | t=new SpellMenuBind;t->origin=this;t->word="pl"; |
256 | translatemenu->append(new LLMenuItemCallGL("Polish",translateText, NULL, t)); | 251 | translatemenu->append(new LLMenuItemCallGL("Polish", context_translate, context_enable_translate, t)); |
257 | t=new SpellMenuBind;t->origin=this;t->word="pt"; | 252 | t=new SpellMenuBind;t->origin=this;t->word="pt"; |
258 | translatemenu->append(new LLMenuItemCallGL("Portugese",translateText, NULL, t)); | 253 | translatemenu->append(new LLMenuItemCallGL("Portugese", context_translate, context_enable_translate, t)); |
259 | t=new SpellMenuBind;t->origin=this;t->word="ru"; | 254 | t=new SpellMenuBind;t->origin=this;t->word="ru"; |
260 | translatemenu->append(new LLMenuItemCallGL("Russian",translateText, NULL, t)); | 255 | translatemenu->append(new LLMenuItemCallGL("Russian", context_translate, context_enable_translate, t)); |
261 | t=new SpellMenuBind;t->origin=this;t->word="tr"; | 256 | t=new SpellMenuBind;t->origin=this;t->word="tr"; |
262 | translatemenu->append(new LLMenuItemCallGL("Turkish",translateText, NULL, t)); | 257 | translatemenu->append(new LLMenuItemCallGL("Turkish", context_translate, context_enable_translate, t)); |
263 | t=new SpellMenuBind;t->origin=this;t->word="uk"; | 258 | t=new SpellMenuBind;t->origin=this;t->word="uk"; |
264 | translatemenu->append(new LLMenuItemCallGL("Ukrainian",translateText, NULL, t)); | 259 | translatemenu->append(new LLMenuItemCallGL("Ukrainian", context_translate, context_enable_translate, t)); |
265 | t=new SpellMenuBind;t->origin=this;t->word="zh"; | 260 | t=new SpellMenuBind;t->origin=this;t->word="zh"; |
266 | translatemenu->append(new LLMenuItemCallGL("Chinese",translateText, NULL, t)); | 261 | translatemenu->append(new LLMenuItemCallGL("Chinese", context_translate, context_enable_translate, t)); |
267 | t=new SpellMenuBind;t->origin=this;t->word="ja"; | 262 | t=new SpellMenuBind;t->origin=this;t->word="ja"; |
268 | translatemenu->append(new LLMenuItemCallGL("Japanese",translateText, NULL, t)); | 263 | translatemenu->append(new LLMenuItemCallGL("Japanese", context_translate, context_enable_translate, t)); |
269 | t=new SpellMenuBind;t->origin=this;t->word="ko"; | 264 | t=new SpellMenuBind;t->origin=this;t->word="ko"; |
270 | translatemenu->append(new LLMenuItemCallGL("Korean",translateText, NULL, t)); | 265 | translatemenu->append(new LLMenuItemCallGL("Korean", context_translate, context_enable_translate, t)); |
266 | |||
271 | menu->appendMenu(translatemenu); | 267 | menu->appendMenu(translatemenu); |
272 | menu->appendSeparator("Spelsep"); | 268 | menu->appendSeparator("Spelsep"); |
273 | //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); | 269 | //menu->setBackgroundColor(gColors.getColor("MenuPopupBgColor")); |
@@ -443,7 +439,7 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) | |||
443 | 439 | ||
444 | 440 | ||
445 | // Picks a new cursor position based on the actual screen size of text being drawn. | 441 | // Picks a new cursor position based on the actual screen size of text being drawn. |
446 | S32 LLLineEditor::calculateCursorFromMouse( S32 local_mouse_x ) | 442 | S32 LLLineEditor::calculateCursorFromMouse( S32 local_mouse_x ) const |
447 | { | 443 | { |
448 | const llwchar* wtext = mText.getWString().c_str(); | 444 | const llwchar* wtext = mText.getWString().c_str(); |
449 | LLWString asterix_text; | 445 | LLWString asterix_text; |
@@ -521,17 +517,30 @@ void LLLineEditor::deselect() | |||
521 | mIsSelecting = FALSE; | 517 | mIsSelecting = FALSE; |
522 | } | 518 | } |
523 | 519 | ||
520 | BOOL LLLineEditor::context_enable_cut(void* data) | ||
521 | { | ||
522 | LLLineEditor* line = (LLLineEditor*)data; | ||
523 | return (line && line->canCut()); | ||
524 | } | ||
524 | 525 | ||
525 | void LLLineEditor::context_cut(void* data) | 526 | void LLLineEditor::context_cut(void* data) |
526 | { | 527 | { |
527 | LLLineEditor* line = (LLLineEditor*)data; | 528 | LLLineEditor* line = (LLLineEditor*)data; |
528 | if(line)line->cut(); | 529 | if(line)line->cut(); |
529 | } | 530 | } |
531 | |||
532 | BOOL LLLineEditor::context_enable_copy(void* data) | ||
533 | { | ||
534 | LLLineEditor* line = (LLLineEditor*)data; | ||
535 | return (line &&line->canCopy()); | ||
536 | } | ||
537 | |||
530 | void LLLineEditor::context_copy(void* data) | 538 | void LLLineEditor::context_copy(void* data) |
531 | { | 539 | { |
532 | LLLineEditor* line = (LLLineEditor*)data; | 540 | LLLineEditor* line = (LLLineEditor*)data; |
533 | if(line)line->copy(); | 541 | if(line)line->copy(); |
534 | } | 542 | } |
543 | |||
535 | void LLLineEditor::spell_correct(void* data) | 544 | void LLLineEditor::spell_correct(void* data) |
536 | { | 545 | { |
537 | SpellMenuBind* tempBind = (SpellMenuBind*)data; | 546 | SpellMenuBind* tempBind = (SpellMenuBind*)data; |
@@ -544,7 +553,13 @@ void LLLineEditor::spell_correct(void* data) | |||
544 | } | 553 | } |
545 | } | 554 | } |
546 | 555 | ||
547 | void LLLineEditor::translateText(void * data) | 556 | BOOL LLLineEditor::context_enable_translate(void* data) |
557 | { | ||
558 | SpellMenuBind* t = (SpellMenuBind*)data; | ||
559 | return (t && t->origin && t->origin->canTranslate()); | ||
560 | } | ||
561 | |||
562 | void LLLineEditor::context_translate(void * data) | ||
548 | { | 563 | { |
549 | SpellMenuBind* t = (SpellMenuBind*)data; | 564 | SpellMenuBind* t = (SpellMenuBind*)data; |
550 | LLLineEditor* line = t->origin; | 565 | LLLineEditor* line = t->origin; |
@@ -579,16 +594,10 @@ void LLLineEditor::spell_show(void * data) | |||
579 | SpellMenuBind* tempBind = (SpellMenuBind*)data; | 594 | SpellMenuBind* tempBind = (SpellMenuBind*)data; |
580 | LLLineEditor* line = tempBind->origin; | 595 | LLLineEditor* line = tempBind->origin; |
581 | 596 | ||
582 | if( tempBind && line) | 597 | if (tempBind && line) |
583 | { | 598 | { |
584 | if (tempBind->word == "Show Misspellings") | 599 | BOOL show = (tempBind->word == "Show Misspellings"); |
585 | { | 600 | glggHunSpell->setSpellCheckHighlight(show); |
586 | line->mShowMisspellings = TRUE; | ||
587 | } | ||
588 | else | ||
589 | { | ||
590 | line->mShowMisspellings = FALSE; | ||
591 | } | ||
592 | } | 601 | } |
593 | } | 602 | } |
594 | 603 | ||
@@ -648,18 +657,36 @@ void LLLineEditor::spell_add(void* data) | |||
648 | } | 657 | } |
649 | } | 658 | } |
650 | 659 | ||
660 | BOOL LLLineEditor::context_enable_paste(void* data) | ||
661 | { | ||
662 | LLLineEditor* line = (LLLineEditor*)data; | ||
663 | return (line && line->canPaste()); | ||
664 | } | ||
665 | |||
651 | void LLLineEditor::context_paste(void* data) | 666 | void LLLineEditor::context_paste(void* data) |
652 | { | 667 | { |
653 | LLLineEditor* line = (LLLineEditor*)data; | 668 | LLLineEditor* line = (LLLineEditor*)data; |
654 | if(line)line->paste(); | 669 | if(line)line->paste(); |
655 | } | 670 | } |
656 | 671 | ||
672 | BOOL LLLineEditor::context_enable_delete(void* data) | ||
673 | { | ||
674 | LLLineEditor* line = (LLLineEditor*)data; | ||
675 | return (line && line->canDoDelete()); | ||
676 | } | ||
677 | |||
657 | void LLLineEditor::context_delete(void* data) | 678 | void LLLineEditor::context_delete(void* data) |
658 | { | 679 | { |
659 | LLLineEditor* line = (LLLineEditor*)data; | 680 | LLLineEditor* line = (LLLineEditor*)data; |
660 | if(line)line->doDelete(); | 681 | if(line)line->doDelete(); |
661 | } | 682 | } |
662 | 683 | ||
684 | BOOL LLLineEditor::context_enable_selectall(void* data) | ||
685 | { | ||
686 | LLLineEditor* line = (LLLineEditor*)data; | ||
687 | return (line && line->canSelectAll()); | ||
688 | } | ||
689 | |||
663 | void LLLineEditor::context_selectall(void* data) | 690 | void LLLineEditor::context_selectall(void* data) |
664 | { | 691 | { |
665 | LLLineEditor* line = (LLLineEditor*)data; | 692 | LLLineEditor* line = (LLLineEditor*)data; |
@@ -787,16 +814,12 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
787 | } | 814 | } |
788 | suggestionMenuItems.clear(); | 815 | suggestionMenuItems.clear(); |
789 | 816 | ||
790 | bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordEnd); | ||
791 | // allow_translate="true" in xui | ||
792 | bool can_translate = mAllowTranslate && !mReadOnly && (is_word_part || hasSelection()); | ||
793 | menu->setItemVisible("Translate To", can_translate); | ||
794 | menu->setItemVisible("Transep", can_translate); | ||
795 | |||
796 | // spell_check="true" in xui | 817 | // spell_check="true" in xui |
818 | menu->setItemVisible("Spelsep", !mReadOnly && mSpellCheckable); | ||
797 | if (!mReadOnly && mSpellCheckable) | 819 | if (!mReadOnly && mSpellCheckable) |
798 | { | 820 | { |
799 | // search for word matches | 821 | // search for word matches |
822 | bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordEnd); | ||
800 | if (is_word_part) | 823 | if (is_word_part) |
801 | { | 824 | { |
802 | const LLWString& text = mText.getWString(); | 825 | const LLWString& text = mText.getWString(); |
@@ -806,7 +829,6 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
806 | { | 829 | { |
807 | //misspelled word here, and you have just right clicked on it! | 830 | //misspelled word here, and you have just right clicked on it! |
808 | std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord); | 831 | std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord); |
809 | //menu->setItemVisible("Transep",(suggs.size()>0)); | ||
810 | 832 | ||
811 | for (int i = 0; i<(int)suggs.size() ;i++) | 833 | for (int i = 0; i<(int)suggs.size() ;i++) |
812 | { | 834 | { |
@@ -837,7 +859,7 @@ BOOL LLLineEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
837 | 859 | ||
838 | SpellMenuBind * tempStruct = new SpellMenuBind; | 860 | SpellMenuBind * tempStruct = new SpellMenuBind; |
839 | tempStruct->origin = this; | 861 | tempStruct->origin = this; |
840 | if (mShowMisspellings) | 862 | if (glggHunSpell->getSpellCheckHighlight()) |
841 | { | 863 | { |
842 | tempStruct->word = "Hide Misspellings"; | 864 | tempStruct->word = "Hide Misspellings"; |
843 | } | 865 | } |
@@ -1370,6 +1392,15 @@ void LLLineEditor::translationReplace(const std::string &translation, const S32 | |||
1370 | setCursor(pos + text_wlen); | 1392 | setCursor(pos + text_wlen); |
1371 | } | 1393 | } |
1372 | 1394 | ||
1395 | BOOL LLLineEditor::canTranslate() const | ||
1396 | { | ||
1397 | // if allow_translate="true" in xui, and if other factors permit, we allow it | ||
1398 | S32 pos = calculateCursorFromMouse(mLastContextMenuX); | ||
1399 | const LLWString& wtext = getWText(); | ||
1400 | bool is_word_part = (pos > -1) && LLTextEditor::isPartOfWord(wtext[pos]); | ||
1401 | return (mAllowTranslate && !mReadOnly && (is_word_part || hasSelection())); | ||
1402 | } | ||
1403 | |||
1373 | void LLLineEditor::insert(std::string what, S32 wher) | 1404 | void LLLineEditor::insert(std::string what, S32 wher) |
1374 | { | 1405 | { |
1375 | LLLineEditorRollback rollback(this); | 1406 | LLLineEditorRollback rollback(this); |
@@ -1980,7 +2011,7 @@ void LLLineEditor::drawMisspelled(LLRect background) | |||
1980 | } | 2011 | } |
1981 | } | 2012 | } |
1982 | 2013 | ||
1983 | if (mShowMisspellings) | 2014 | if (glggHunSpell->getSpellCheckHighlight()) |
1984 | { | 2015 | { |
1985 | for (int i =0; i<(int)misspellLocations.size(); i++) | 2016 | for (int i =0; i<(int)misspellLocations.size(); i++) |
1986 | { | 2017 | { |
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h index 0ad415a..f9e0621 100644 --- a/linden/indra/llui/lllineeditor.h +++ b/linden/indra/llui/lllineeditor.h | |||
@@ -108,6 +108,7 @@ public: | |||
108 | 108 | ||
109 | virtual void spellReplace(SpellMenuBind* spellData); | 109 | virtual void spellReplace(SpellMenuBind* spellData); |
110 | virtual void translationReplace(const std::string &translation, const S32 orig_start, const S32 orig_length); | 110 | virtual void translationReplace(const std::string &translation, const S32 orig_start, const S32 orig_length); |
111 | virtual BOOL canTranslate() const; | ||
111 | virtual void insert(std::string what,S32 wher); | 112 | virtual void insert(std::string what,S32 wher); |
112 | 113 | ||
113 | // LLEditMenuHandler overrides | 114 | // LLEditMenuHandler overrides |
@@ -134,15 +135,22 @@ public: | |||
134 | virtual void deselect(); | 135 | virtual void deselect(); |
135 | virtual BOOL canDeselect() const; | 136 | virtual BOOL canDeselect() const; |
136 | 137 | ||
138 | static BOOL context_enable_cut(void* data); | ||
137 | static void context_cut(void* data); | 139 | static void context_cut(void* data); |
140 | static BOOL context_enable_copy(void* data); | ||
138 | static void context_copy(void* data); | 141 | static void context_copy(void* data); |
139 | static void spell_correct(void* data); | 142 | static BOOL context_enable_paste(void* data); |
140 | static void spell_show(void* data); | ||
141 | static void translateText(void * data); | ||
142 | static void spell_add(void* data); | ||
143 | static void context_paste(void* data); | 143 | static void context_paste(void* data); |
144 | static BOOL context_enable_delete(void* data); | ||
144 | static void context_delete(void* data); | 145 | static void context_delete(void* data); |
146 | static BOOL context_enable_selectall(void* data); | ||
145 | static void context_selectall(void* data); | 147 | static void context_selectall(void* data); |
148 | static BOOL context_enable_translate(void * data); | ||
149 | static void context_translate(void * data); | ||
150 | static void spell_correct(void* data); | ||
151 | static void spell_show(void* data); | ||
152 | static void spell_add(void* data); | ||
153 | |||
146 | std::vector<S32> getMisspelledWordsPositions(); | 154 | std::vector<S32> getMisspelledWordsPositions(); |
147 | // view overrides | 155 | // view overrides |
148 | virtual void draw(); | 156 | virtual void draw(); |
@@ -264,7 +272,7 @@ private: | |||
264 | void removeChar(); | 272 | void removeChar(); |
265 | void addChar(const llwchar c); | 273 | void addChar(const llwchar c); |
266 | void setCursorAtLocalPos(S32 local_mouse_x); | 274 | void setCursorAtLocalPos(S32 local_mouse_x); |
267 | S32 calculateCursorFromMouse(S32 local_mouse_x); | 275 | S32 calculateCursorFromMouse(S32 local_mouse_x) const; |
268 | S32 findPixelNearestPos(S32 cursor_offset = 0) const; | 276 | S32 findPixelNearestPos(S32 cursor_offset = 0) const; |
269 | void reportBadKeystroke(); | 277 | void reportBadKeystroke(); |
270 | BOOL handleSpecialKey(KEY key, MASK mask); | 278 | BOOL handleSpecialKey(KEY key, MASK mask); |
@@ -297,7 +305,6 @@ protected: | |||
297 | S32 mStartSpellHere; // the position of the first char on the screen, stored so we know when to update | 305 | S32 mStartSpellHere; // the position of the first char on the screen, stored so we know when to update |
298 | S32 mEndSpellHere; // the location of the last char on the screen | 306 | S32 mEndSpellHere; // the location of the last char on the screen |
299 | BOOL mSpellCheckable; // set in xui as "spell_check". Default value for a field | 307 | BOOL mSpellCheckable; // set in xui as "spell_check". Default value for a field |
300 | BOOL mShowMisspellings; // show misspellings as highlighted (initialized in the ctor) | ||
301 | LLFrameTimer mSpellTimer; | 308 | LLFrameTimer mSpellTimer; |
302 | //to keep track of what we have to remove before showing menu | 309 | //to keep track of what we have to remove before showing menu |
303 | std::vector<SpellMenuBind* > suggestionMenuItems; | 310 | std::vector<SpellMenuBind* > suggestionMenuItems; |
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index e2335c9..8dcb014 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp | |||
@@ -330,7 +330,6 @@ LLTextEditor::LLTextEditor( | |||
330 | mReflowNeeded(FALSE), | 330 | mReflowNeeded(FALSE), |
331 | mScrollNeeded(FALSE), | 331 | mScrollNeeded(FALSE), |
332 | mSpellCheckable(FALSE), | 332 | mSpellCheckable(FALSE), |
333 | mShowMisspellings(FALSE), | ||
334 | mAllowTranslate(TRUE) | 333 | mAllowTranslate(TRUE) |
335 | { | 334 | { |
336 | mSourceID.generate(); | 335 | mSourceID.generate(); |
@@ -384,12 +383,6 @@ LLTextEditor::LLTextEditor( | |||
384 | mParseHTML=FALSE; | 383 | mParseHTML=FALSE; |
385 | mHTML.clear(); | 384 | mHTML.clear(); |
386 | 385 | ||
387 | // in other words, highlighting requires a restart | ||
388 | if (glggHunSpell->getSpellCheckHighlight()) | ||
389 | { | ||
390 | mShowMisspellings = TRUE; | ||
391 | } | ||
392 | |||
393 | // make the popup menu available | 386 | // make the popup menu available |
394 | //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); | 387 | //LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_texteditor.xml", parent_view); |
395 | LLMenuGL* menu = new LLMenuGL("wot"); | 388 | LLMenuGL* menu = new LLMenuGL("wot"); |
@@ -397,46 +390,46 @@ LLTextEditor::LLTextEditor( | |||
397 | { | 390 | { |
398 | menu = new LLMenuGL(LLStringUtil::null); | 391 | menu = new LLMenuGL(LLStringUtil::null); |
399 | }*/ | 392 | }*/ |
400 | menu->append(new LLMenuItemCallGL("Cut", context_cut, NULL, this)); | 393 | menu->append(new LLMenuItemCallGL("Cut", context_cut, context_enable_cut, this)); |
401 | menu->append(new LLMenuItemCallGL("Copy", context_copy, NULL, this)); | 394 | menu->append(new LLMenuItemCallGL("Copy", context_copy, context_enable_copy, this)); |
402 | menu->append(new LLMenuItemCallGL("Paste", context_paste, NULL, this)); | 395 | menu->append(new LLMenuItemCallGL("Paste", context_paste, context_enable_paste, this)); |
403 | menu->append(new LLMenuItemCallGL("Delete", context_delete, NULL, this)); | 396 | menu->append(new LLMenuItemCallGL("Delete", context_delete, context_enable_delete, this)); |
404 | menu->append(new LLMenuItemCallGL("Select All", context_selectall, NULL, this)); | 397 | menu->append(new LLMenuItemCallGL("Select All", context_selectall, context_enable_selectall, this)); |
405 | menu->appendSeparator("Transep"); | 398 | menu->appendSeparator("Transep"); |
406 | LLMenuGL* translatemenu = new LLMenuGL("Translate To"); | 399 | LLMenuGL* translatemenu = new LLMenuGL("Translate To"); |
407 | translatemenu->setCanTearOff(FALSE); | 400 | translatemenu->setCanTearOff(FALSE); |
408 | SpellMenuBind* t=new SpellMenuBind;t->origin=this;t->word="en"; | 401 | SpellMenuBind* t=new SpellMenuBind;t->origin=this;t->word="en"; |
409 | translatemenu->append(new LLMenuItemCallGL("English",translateText, NULL, t)); | 402 | translatemenu->append(new LLMenuItemCallGL("English", context_translate, context_enable_translate, t)); |
410 | t=new SpellMenuBind;t->origin=this;t->word="da"; | 403 | t=new SpellMenuBind;t->origin=this;t->word="da"; |
411 | translatemenu->append(new LLMenuItemCallGL("Danish",translateText, NULL, t)); | 404 | translatemenu->append(new LLMenuItemCallGL("Danish", context_translate, context_enable_translate, t)); |
412 | t=new SpellMenuBind;t->origin=this;t->word="de"; | 405 | t=new SpellMenuBind;t->origin=this;t->word="de"; |
413 | translatemenu->append(new LLMenuItemCallGL("Deutsch(German)",translateText, NULL, t)); | 406 | translatemenu->append(new LLMenuItemCallGL("Deutsch(German)", context_translate, context_enable_translate, t)); |
414 | t=new SpellMenuBind;t->origin=this;t->word="es"; | 407 | t=new SpellMenuBind;t->origin=this;t->word="es"; |
415 | translatemenu->append(new LLMenuItemCallGL("Spanish",translateText, NULL, t)); | 408 | translatemenu->append(new LLMenuItemCallGL("Spanish", context_translate, context_enable_translate, t)); |
416 | t=new SpellMenuBind;t->origin=this;t->word="fr"; | 409 | t=new SpellMenuBind;t->origin=this;t->word="fr"; |
417 | translatemenu->append(new LLMenuItemCallGL("French",translateText, NULL, t)); | 410 | translatemenu->append(new LLMenuItemCallGL("French", context_translate, context_enable_translate, t)); |
418 | t=new SpellMenuBind;t->origin=this;t->word="it"; | 411 | t=new SpellMenuBind;t->origin=this;t->word="it"; |
419 | translatemenu->append(new LLMenuItemCallGL("Italian",translateText, NULL, t)); | 412 | translatemenu->append(new LLMenuItemCallGL("Italian", context_translate, context_enable_translate, t)); |
420 | t=new SpellMenuBind;t->origin=this;t->word="hu"; | 413 | t=new SpellMenuBind;t->origin=this;t->word="hu"; |
421 | translatemenu->append(new LLMenuItemCallGL("Hungarian",translateText, NULL, t)); | 414 | translatemenu->append(new LLMenuItemCallGL("Hungarian", context_translate, context_enable_translate, t)); |
422 | t=new SpellMenuBind;t->origin=this;t->word="nl"; | 415 | t=new SpellMenuBind;t->origin=this;t->word="nl"; |
423 | translatemenu->append(new LLMenuItemCallGL("Dutch",translateText, NULL, t)); | 416 | translatemenu->append(new LLMenuItemCallGL("Dutch", context_translate, context_enable_translate, t)); |
424 | t=new SpellMenuBind;t->origin=this;t->word="pl"; | 417 | t=new SpellMenuBind;t->origin=this;t->word="pl"; |
425 | translatemenu->append(new LLMenuItemCallGL("Polish",translateText, NULL, t)); | 418 | translatemenu->append(new LLMenuItemCallGL("Polish", context_translate, context_enable_translate, t)); |
426 | t=new SpellMenuBind;t->origin=this;t->word="pt"; | 419 | t=new SpellMenuBind;t->origin=this;t->word="pt"; |
427 | translatemenu->append(new LLMenuItemCallGL("Portugese",translateText, NULL, t)); | 420 | translatemenu->append(new LLMenuItemCallGL("Portugese", context_translate, context_enable_translate, t)); |
428 | t=new SpellMenuBind;t->origin=this;t->word="ru"; | 421 | t=new SpellMenuBind;t->origin=this;t->word="ru"; |
429 | translatemenu->append(new LLMenuItemCallGL("Russian",translateText, NULL, t)); | 422 | translatemenu->append(new LLMenuItemCallGL("Russian", context_translate, context_enable_translate, t)); |
430 | t=new SpellMenuBind;t->origin=this;t->word="tr"; | 423 | t=new SpellMenuBind;t->origin=this;t->word="tr"; |
431 | translatemenu->append(new LLMenuItemCallGL("Turkish",translateText, NULL, t)); | 424 | translatemenu->append(new LLMenuItemCallGL("Turkish", context_translate, context_enable_translate, t)); |
432 | t=new SpellMenuBind;t->origin=this;t->word="uk"; | 425 | t=new SpellMenuBind;t->origin=this;t->word="uk"; |
433 | translatemenu->append(new LLMenuItemCallGL("Ukrainian",translateText, NULL, t)); | 426 | translatemenu->append(new LLMenuItemCallGL("Ukrainian", context_translate, context_enable_translate, t)); |
434 | t=new SpellMenuBind;t->origin=this;t->word="zh"; | 427 | t=new SpellMenuBind;t->origin=this;t->word="zh"; |
435 | translatemenu->append(new LLMenuItemCallGL("Chinese",translateText, NULL, t)); | 428 | translatemenu->append(new LLMenuItemCallGL("Chinese", context_translate, context_enable_translate, t)); |
436 | t=new SpellMenuBind;t->origin=this;t->word="ja"; | 429 | t=new SpellMenuBind;t->origin=this;t->word="ja"; |
437 | translatemenu->append(new LLMenuItemCallGL("Japanese",translateText, NULL, t)); | 430 | translatemenu->append(new LLMenuItemCallGL("Japanese", context_translate, context_enable_translate, t)); |
438 | t=new SpellMenuBind;t->origin=this;t->word="ko"; | 431 | t=new SpellMenuBind;t->origin=this;t->word="ko"; |
439 | translatemenu->append(new LLMenuItemCallGL("Korean",translateText, NULL, t)); | 432 | translatemenu->append(new LLMenuItemCallGL("Korean", context_translate, context_enable_translate, t)); |
440 | 433 | ||
441 | menu->appendMenu(translatemenu); | 434 | menu->appendMenu(translatemenu); |
442 | menu->appendSeparator("Spelsep"); | 435 | menu->appendSeparator("Spelsep"); |
@@ -446,7 +439,6 @@ LLTextEditor::LLTextEditor( | |||
446 | mPopupMenuHandle = menu->getHandle(); | 439 | mPopupMenuHandle = menu->getHandle(); |
447 | } | 440 | } |
448 | 441 | ||
449 | |||
450 | LLTextEditor::~LLTextEditor() | 442 | LLTextEditor::~LLTextEditor() |
451 | { | 443 | { |
452 | gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() | 444 | gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() |
@@ -464,18 +456,38 @@ LLTextEditor::~LLTextEditor() | |||
464 | std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); | 456 | std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer()); |
465 | LLView::deleteViewByHandle(mPopupMenuHandle); | 457 | LLView::deleteViewByHandle(mPopupMenuHandle); |
466 | } | 458 | } |
459 | |||
460 | BOOL LLTextEditor::context_enable_cut(void* data) | ||
461 | { | ||
462 | LLTextEditor* line = (LLTextEditor*)data; | ||
463 | return (line && line->canCut()); | ||
464 | } | ||
465 | |||
467 | void LLTextEditor::context_cut(void* data) | 466 | void LLTextEditor::context_cut(void* data) |
468 | { | 467 | { |
469 | LLTextEditor* line = (LLTextEditor*)data; | 468 | LLTextEditor* line = (LLTextEditor*)data; |
470 | if(line)line->cut(); | 469 | if(line)line->cut(); |
471 | } | 470 | } |
471 | |||
472 | BOOL LLTextEditor::context_enable_copy(void* data) | ||
473 | { | ||
474 | LLTextEditor* line = (LLTextEditor*)data; | ||
475 | return (line && line->canCopy()); | ||
476 | } | ||
477 | |||
472 | void LLTextEditor::context_copy(void* data) | 478 | void LLTextEditor::context_copy(void* data) |
473 | { | 479 | { |
474 | LLTextEditor* line = (LLTextEditor*)data; | 480 | LLTextEditor* line = (LLTextEditor*)data; |
475 | if(line)line->copy(); | 481 | if(line)line->copy(); |
476 | } | 482 | } |
477 | 483 | ||
478 | void LLTextEditor::translateText(void * data) | 484 | BOOL LLTextEditor::context_enable_translate(void * data) |
485 | { | ||
486 | SpellMenuBind* t = (SpellMenuBind*)data; | ||
487 | return (t && t->origin && t->origin->canTranslate()); | ||
488 | } | ||
489 | |||
490 | void LLTextEditor::context_translate(void * data) | ||
479 | { | 491 | { |
480 | SpellMenuBind* t = (SpellMenuBind*)data; | 492 | SpellMenuBind* t = (SpellMenuBind*)data; |
481 | LLTextEditor* line = t->origin; | 493 | LLTextEditor* line = t->origin; |
@@ -523,14 +535,8 @@ void LLTextEditor::spell_show(void * data) | |||
523 | 535 | ||
524 | if (tempBind && line) | 536 | if (tempBind && line) |
525 | { | 537 | { |
526 | if (tempBind->word == "Show Misspellings") | 538 | BOOL show = (tempBind->word == "Show Misspellings"); |
527 | { | 539 | glggHunSpell->setSpellCheckHighlight(show); |
528 | glggHunSpell->setSpellCheckHighlight(TRUE); | ||
529 | } | ||
530 | else | ||
531 | { | ||
532 | glggHunSpell->setSpellCheckHighlight(FALSE); | ||
533 | } | ||
534 | } | 540 | } |
535 | } | 541 | } |
536 | 542 | ||
@@ -582,16 +588,37 @@ void LLTextEditor::spell_add(void* data) | |||
582 | tempBind->origin->mPrevSpelledText.erase();//make it update | 588 | tempBind->origin->mPrevSpelledText.erase();//make it update |
583 | } | 589 | } |
584 | } | 590 | } |
591 | |||
592 | BOOL LLTextEditor::context_enable_paste(void* data) | ||
593 | { | ||
594 | LLTextEditor* line = (LLTextEditor*)data; | ||
595 | return(line && line->canPaste()); | ||
596 | } | ||
597 | |||
585 | void LLTextEditor::context_paste(void* data) | 598 | void LLTextEditor::context_paste(void* data) |
586 | { | 599 | { |
587 | LLTextEditor* line = (LLTextEditor*)data; | 600 | LLTextEditor* line = (LLTextEditor*)data; |
588 | if(line)line->paste(); | 601 | if(line)line->paste(); |
589 | } | 602 | } |
603 | |||
604 | BOOL LLTextEditor::context_enable_delete(void* data) | ||
605 | { | ||
606 | LLTextEditor* line = (LLTextEditor*)data; | ||
607 | return (line && line->canDoDelete()); | ||
608 | } | ||
609 | |||
590 | void LLTextEditor::context_delete(void* data) | 610 | void LLTextEditor::context_delete(void* data) |
591 | { | 611 | { |
592 | LLTextEditor* line = (LLTextEditor*)data; | 612 | LLTextEditor* line = (LLTextEditor*)data; |
593 | if(line)line->doDelete(); | 613 | if(line)line->doDelete(); |
594 | } | 614 | } |
615 | |||
616 | BOOL LLTextEditor::context_enable_selectall(void* data) | ||
617 | { | ||
618 | LLTextEditor* line = (LLTextEditor*)data; | ||
619 | return (line && line->canSelectAll()); | ||
620 | } | ||
621 | |||
595 | void LLTextEditor::context_selectall(void* data) | 622 | void LLTextEditor::context_selectall(void* data) |
596 | { | 623 | { |
597 | LLTextEditor* line = (LLTextEditor*)data; | 624 | LLTextEditor* line = (LLTextEditor*)data; |
@@ -1506,16 +1533,11 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
1506 | } | 1533 | } |
1507 | suggestionMenuItems.clear(); | 1534 | suggestionMenuItems.clear(); |
1508 | 1535 | ||
1509 | bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordEnd); | ||
1510 | |||
1511 | // allow_translate="true" in xui | ||
1512 | bool can_translate = mAllowTranslate && !mReadOnly && (is_word_part || hasSelection()); | ||
1513 | menu->setItemVisible("Translate To", can_translate); | ||
1514 | menu->setItemVisible("Transep", can_translate); | ||
1515 | |||
1516 | // spell_check="true" in xui | 1536 | // spell_check="true" in xui |
1537 | menu->setItemVisible("Spelsep", !mReadOnly && mSpellCheckable); | ||
1517 | if (!mReadOnly && mSpellCheckable) | 1538 | if (!mReadOnly && mSpellCheckable) |
1518 | { | 1539 | { |
1540 | bool is_word_part = getWordBoundriesAt(pos, &wordStart, &wordEnd); | ||
1519 | if (is_word_part) | 1541 | if (is_word_part) |
1520 | { | 1542 | { |
1521 | const LLWString &text = mWText; | 1543 | const LLWString &text = mWText; |
@@ -1526,7 +1548,6 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
1526 | //misspelled word here, and you have just right clicked on it! | 1548 | //misspelled word here, and you have just right clicked on it! |
1527 | std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord); | 1549 | std::vector<std::string> suggs = glggHunSpell->getSuggestionList(selectedWord); |
1528 | 1550 | ||
1529 | //menu->setItemVisible("Transep",(suggs.size()>0)); | ||
1530 | for (int i = 0; i<(int)suggs.size(); i++) | 1551 | for (int i = 0; i<(int)suggs.size(); i++) |
1531 | { | 1552 | { |
1532 | SpellMenuBind * tempStruct = new SpellMenuBind; | 1553 | SpellMenuBind * tempStruct = new SpellMenuBind; |
@@ -1557,7 +1578,7 @@ BOOL LLTextEditor::handleRightMouseDown( S32 x, S32 y, MASK mask ) | |||
1557 | 1578 | ||
1558 | SpellMenuBind * tempStruct = new SpellMenuBind; | 1579 | SpellMenuBind * tempStruct = new SpellMenuBind; |
1559 | tempStruct->origin = this; | 1580 | tempStruct->origin = this; |
1560 | if (mShowMisspellings) | 1581 | if (glggHunSpell->getSpellCheckHighlight()) |
1561 | { | 1582 | { |
1562 | tempStruct->word = "Hide Misspellings"; | 1583 | tempStruct->word = "Hide Misspellings"; |
1563 | } | 1584 | } |
@@ -2301,6 +2322,14 @@ void LLTextEditor::translationReplace(const std::string &translation, const S32 | |||
2301 | needsReflow(); | 2322 | needsReflow(); |
2302 | } | 2323 | } |
2303 | 2324 | ||
2325 | BOOL LLTextEditor::canTranslate() const | ||
2326 | { | ||
2327 | // if allow_translate="true" in xui, and if other factors permit, we allow it | ||
2328 | S32 pos = getCursorPosFromLocalCoord(mLastContextMenuX, mLastContextMenuY, TRUE); | ||
2329 | bool is_word_part = (pos > -1) && isPartOfWord(mWText[pos]); | ||
2330 | return (mAllowTranslate && !mReadOnly && (is_word_part || hasSelection())); | ||
2331 | } | ||
2332 | |||
2304 | // paste from clipboard | 2333 | // paste from clipboard |
2305 | void LLTextEditor::paste() | 2334 | void LLTextEditor::paste() |
2306 | { | 2335 | { |
@@ -3225,7 +3254,7 @@ void LLTextEditor::drawMisspelled() | |||
3225 | } | 3254 | } |
3226 | } | 3255 | } |
3227 | //draw | 3256 | //draw |
3228 | if (mShowMisspellings) | 3257 | if (glggHunSpell->getSpellCheckHighlight()) |
3229 | { | 3258 | { |
3230 | for (int i = 0; i<(int)misspellLocations.size() ;i++) | 3259 | for (int i = 0; i<(int)misspellLocations.size() ;i++) |
3231 | { | 3260 | { |
diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h index 3269e17..f2a831b 100644 --- a/linden/indra/llui/lltexteditor.h +++ b/linden/indra/llui/lltexteditor.h | |||
@@ -137,6 +137,7 @@ public: | |||
137 | 137 | ||
138 | virtual void spellReplace(SpellMenuBind* spellData); | 138 | virtual void spellReplace(SpellMenuBind* spellData); |
139 | virtual void translationReplace(const std::string &translation, const S32 orig_start, const S32 orig_length); | 139 | virtual void translationReplace(const std::string &translation, const S32 orig_start, const S32 orig_length); |
140 | virtual BOOL canTranslate() const; | ||
140 | 141 | ||
141 | virtual void updatePrimary(); | 142 | virtual void updatePrimary(); |
142 | virtual void copyPrimary(); | 143 | virtual void copyPrimary(); |
@@ -149,13 +150,19 @@ public: | |||
149 | virtual BOOL canSelectAll() const; | 150 | virtual BOOL canSelectAll() const; |
150 | virtual void deselect(); | 151 | virtual void deselect(); |
151 | virtual BOOL canDeselect() const; | 152 | virtual BOOL canDeselect() const; |
152 | static void context_cut(void* data); | ||
153 | 153 | ||
154 | static BOOL context_enable_cut(void* data); | ||
155 | static void context_cut(void* data); | ||
156 | static BOOL context_enable_copy(void* data); | ||
154 | static void context_copy(void* data); | 157 | static void context_copy(void* data); |
158 | static BOOL context_enable_paste(void* data); | ||
155 | static void context_paste(void* data); | 159 | static void context_paste(void* data); |
160 | static BOOL context_enable_delete(void* data); | ||
156 | static void context_delete(void* data); | 161 | static void context_delete(void* data); |
162 | static BOOL context_enable_selectall(void* data); | ||
157 | static void context_selectall(void* data); | 163 | static void context_selectall(void* data); |
158 | static void translateText(void * data); | 164 | static BOOL context_enable_translate(void * data); |
165 | static void context_translate(void * data); | ||
159 | static void spell_correct(void* data); | 166 | static void spell_correct(void* data); |
160 | static void spell_add(void* data); | 167 | static void spell_add(void* data); |
161 | static void spell_show(void* data); | 168 | static void spell_show(void* data); |
@@ -529,7 +536,6 @@ private: | |||
529 | S32 spellEnd; | 536 | S32 spellEnd; |
530 | std::vector<S32> misspellLocations; // where all the mispelled words are | 537 | std::vector<S32> misspellLocations; // where all the mispelled words are |
531 | BOOL mSpellCheckable; // set in xui as "spell_check". Default value for a field | 538 | BOOL mSpellCheckable; // set in xui as "spell_check". Default value for a field |
532 | BOOL mShowMisspellings; // show misspellings as highlighted (initialized in the ctor) | ||
533 | BOOL mAllowTranslate; // set in xui as "allow_translate". | 539 | BOOL mAllowTranslate; // set in xui as "allow_translate". |
534 | 540 | ||
535 | S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes | 541 | S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes |
diff --git a/linden/indra/newview/lgghunspell_wrapper.cpp b/linden/indra/newview/lgghunspell_wrapper.cpp index f800043..aa4507c 100644 --- a/linden/indra/newview/lgghunspell_wrapper.cpp +++ b/linden/indra/newview/lgghunspell_wrapper.cpp | |||
@@ -72,7 +72,7 @@ static char * countryCodesraw[] = { | |||
72 | (char*)"CF",(char*)"Central African Republic", | 72 | (char*)"CF",(char*)"Central African Republic", |
73 | (char*)"CG",(char*)"Congo", | 73 | (char*)"CG",(char*)"Congo", |
74 | (char*)"CH",(char*)"Switzerland", | 74 | (char*)"CH",(char*)"Switzerland", |
75 | (char*)"CI",(char*)"Côte D'ivoire (Ivory Coast)", | 75 | (char*)"CI",(char*)"Côte D'ivoire (Ivory Coast)", |
76 | (char*)"CK",(char*)"Cook Iislands", | 76 | (char*)"CK",(char*)"Cook Iislands", |
77 | (char*)"CL",(char*)"Chile", | 77 | (char*)"CL",(char*)"Chile", |
78 | (char*)"CM",(char*)"Cameroon", | 78 | (char*)"CM",(char*)"Cameroon", |
@@ -212,7 +212,7 @@ static char * countryCodesraw[] = { | |||
212 | (char*)"PW",(char*)"Palau", | 212 | (char*)"PW",(char*)"Palau", |
213 | (char*)"PY",(char*)"Paraguay", | 213 | (char*)"PY",(char*)"Paraguay", |
214 | (char*)"QA",(char*)"Qatar", | 214 | (char*)"QA",(char*)"Qatar", |
215 | (char*)"RE",(char*)"Réunion", | 215 | (char*)"RE",(char*)"Réunion", |
216 | (char*)"RO",(char*)"Romania", | 216 | (char*)"RO",(char*)"Romania", |
217 | (char*)"RU",(char*)"Russian Federation", | 217 | (char*)"RU",(char*)"Russian Federation", |
218 | (char*)"RW",(char*)"Rwanda", | 218 | (char*)"RW",(char*)"Rwanda", |
@@ -333,7 +333,7 @@ static char * languageCodesraw[]={ | |||
333 | (char*)"ga",(char*)"Irish", | 333 | (char*)"ga",(char*)"Irish", |
334 | (char*)"gd",(char*)"Gaelic", | 334 | (char*)"gd",(char*)"Gaelic", |
335 | (char*)"gl",(char*)"Galician", | 335 | (char*)"gl",(char*)"Galician", |
336 | (char*)"gn",(char*)"Guaraní", | 336 | (char*)"gn",(char*)"GuaranÃ", |
337 | (char*)"gu",(char*)"Gujarati", | 337 | (char*)"gu",(char*)"Gujarati", |
338 | (char*)"gv",(char*)"Manx", | 338 | (char*)"gv",(char*)"Manx", |
339 | (char*)"ha",(char*)"Hausa", | 339 | (char*)"ha",(char*)"Hausa", |
@@ -456,7 +456,7 @@ static char * languageCodesraw[]={ | |||
456 | (char*)"uz",(char*)"Uzbek", | 456 | (char*)"uz",(char*)"Uzbek", |
457 | (char*)"ve",(char*)"Venda", | 457 | (char*)"ve",(char*)"Venda", |
458 | (char*)"vi",(char*)"Vietnamese", | 458 | (char*)"vi",(char*)"Vietnamese", |
459 | (char*)"vo",(char*)"Volapük", | 459 | (char*)"vo",(char*)"Volapük", |
460 | (char*)"wa",(char*)"Walloon", | 460 | (char*)"wa",(char*)"Walloon", |
461 | (char*)"wo",(char*)"Wolof", | 461 | (char*)"wo",(char*)"Wolof", |
462 | (char*)"xh",(char*)"Xhosa", | 462 | (char*)"xh",(char*)"Xhosa", |
@@ -470,10 +470,9 @@ static char * languageCodesraw[]={ | |||
470 | #define LANGUAGE_CODES_RAW_SIZE 368 | 470 | #define LANGUAGE_CODES_RAW_SIZE 368 |
471 | 471 | ||
472 | lggHunSpell_Wrapper::lggHunSpell_Wrapper() | 472 | lggHunSpell_Wrapper::lggHunSpell_Wrapper() |
473 | : | ||
474 | mSpellCheckHighlight(false) | ||
475 | { | 473 | { |
476 | //languageCodes(begin(languageCodesraw), end(languageCodesraw)); | 474 | //languageCodes(begin(languageCodesraw), end(languageCodesraw)); |
475 | mSpellCheckHighlight = rebind_llcontrol<BOOL>("EmeraldSpellDisplay", &gSavedSettings, false); | ||
477 | } | 476 | } |
478 | 477 | ||
479 | lggHunSpell_Wrapper::~lggHunSpell_Wrapper() | 478 | lggHunSpell_Wrapper::~lggHunSpell_Wrapper() |
@@ -638,8 +637,6 @@ void lggHunSpell_Wrapper::processSettings() | |||
638 | //expects everything to already be in saved settings | 637 | //expects everything to already be in saved settings |
639 | //this will also reload and read the installed dicts | 638 | //this will also reload and read the installed dicts |
640 | setNewDictionary(gSavedSettings.getString("EmeraldSpellBase")); | 639 | setNewDictionary(gSavedSettings.getString("EmeraldSpellBase")); |
641 | mSpellCheckHighlight = gSavedSettings.getBOOL("EmeraldSpellDisplay"); | ||
642 | |||
643 | } | 640 | } |
644 | 641 | ||
645 | void lggHunSpell_Wrapper::addDictionary(std::string additionalDictionary) | 642 | void lggHunSpell_Wrapper::addDictionary(std::string additionalDictionary) |
@@ -966,5 +963,8 @@ void lggHunSpell_Wrapper::editCustomButton() | |||
966 | 963 | ||
967 | void lggHunSpell_Wrapper::setSpellCheckHighlight(BOOL highlight) | 964 | void lggHunSpell_Wrapper::setSpellCheckHighlight(BOOL highlight) |
968 | { | 965 | { |
969 | mSpellCheckHighlight = highlight; | 966 | if (mSpellCheckHighlight) |
967 | { | ||
968 | *mSpellCheckHighlight = highlight; | ||
969 | } | ||
970 | } | 970 | } |
diff --git a/linden/indra/newview/lgghunspell_wrapper.h b/linden/indra/newview/lgghunspell_wrapper.h index b5f3ddb..71b2f14 100644 --- a/linden/indra/newview/lgghunspell_wrapper.h +++ b/linden/indra/newview/lgghunspell_wrapper.h | |||
@@ -55,7 +55,7 @@ public: | |||
55 | std::string VEC2CSV(std::vector<std::string> vec); | 55 | std::string VEC2CSV(std::vector<std::string> vec); |
56 | 56 | ||
57 | void setSpellCheckHighlight(BOOL highlight); | 57 | void setSpellCheckHighlight(BOOL highlight); |
58 | BOOL getSpellCheckHighlight() { return mSpellCheckHighlight; } | 58 | BOOL getSpellCheckHighlight() { return mSpellCheckHighlight && *mSpellCheckHighlight; } |
59 | 59 | ||
60 | private: | 60 | private: |
61 | void createCustomDic(); | 61 | void createCustomDic(); |
@@ -67,7 +67,7 @@ private: | |||
67 | std::string currentBaseDic; | 67 | std::string currentBaseDic; |
68 | //std::vector<std::string> languageCodes; | 68 | //std::vector<std::string> languageCodes; |
69 | //std::vector<std::string> countryCodes; | 69 | //std::vector<std::string> countryCodes; |
70 | BOOL mSpellCheckHighlight; | 70 | BOOL* mSpellCheckHighlight; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | extern lggHunSpell_Wrapper* glggHunSpell; // the singleton hunspell wrapper | 73 | extern lggHunSpell_Wrapper* glggHunSpell; // the singleton hunspell wrapper |