diff options
author | Jonathan Yap <none@none> | 2012-02-10 17:40:58 -0500 |
---|---|---|
committer | Jonathan Yap <none@none> | 2012-02-10 17:40:58 -0500 |
commit | 22f26725b902cb2e942048d059710169666e4a45 (patch) | |
tree | 0886bf3a25fb9e4198bd4fdb7823d230d6de0599 /indra | |
parent | 39ffad760b7abd09c8a7af6871fcabbf2da9c1e6 (diff) |
STORM-1738 Autocorrect working for nearby chat and IM input boxes
warn-on-failure:open-license
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/lllineeditor.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 3 | ||||
-rw-r--r-- | indra/newview/llautocorrect.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 3 |
5 files changed, 7 insertions, 9 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index de951d3b56..4d0b972bf1 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -866,11 +866,10 @@ void LLLineEditor::addChar(const llwchar uni_char) LLUI::reportBadKeystroke(); } -// *TODO implement callback routine if (!mReadOnly && mAutocorrectCallback != NULL) { // call callback - // mAutotocorrectCallback(mText&, mCursorPos&); + mAutocorrectCallback(mText, mCursorPos); } getWindow()->hideCursorUntilMouseMove(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 9394700e8c..53af9ac996 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -169,8 +169,7 @@ public: virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - // *TODO Make this work - typedef boost::function<void()> autocorrect_callback_t; + typedef boost::function<void(LLUIString&, S32&)> autocorrect_callback_t; autocorrect_callback_t mAutocorrectCallback; void setAutocorrectCallback(autocorrect_callback_t cb) { mAutocorrectCallback = cb; } void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; } diff --git a/indra/newview/llautocorrect.cpp b/indra/newview/llautocorrect.cpp index 9162b35f45..791d34df0c 100644 --- a/indra/newview/llautocorrect.cpp +++ b/indra/newview/llautocorrect.cpp @@ -349,7 +349,7 @@ std::string AutoCorrect::replaceWords(std::string words) { static LLCachedControl<bool> perform_autocorrect(gSavedSettings, "AutoCorrect"); if(!(perform_autocorrect))return words; - //TODO update this function to use the "wordStyle" thing, + //*TODO update this function to use the "wordStyle" thing, //but so far this function is never used, so later boost_tokenizer tokens(words, boost::char_separator<char>(" ")); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8354243bd3..e300f6f32d 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -56,7 +56,7 @@ #include "llrootview.h" #include "llspeakers.h" #include "llviewerchat.h" - +#include "llautocorrect.h" LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), @@ -251,11 +251,12 @@ BOOL LLIMFloater::postBuild() slide_right->setVisible(!mControlPanel->getParent()->getVisible()); slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - // *TODO Establish LineEditor with autocorrect callback mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setMaxTextLength(1023); // enable line history support for instant message bar mInputEditor->setEnableLineHistory(TRUE); + // *TODO Establish LineEditor with autocorrect callback + mInputEditor->setAutocorrectCallback(boost::bind(&AutoCorrect::autocorrectCallback, AutoCorrect::getInstance(), _1, _2)); LLFontGL* font = LLViewerChat::getChatFont(); mInputEditor->setFont(font); diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 86244cbaa6..72fb95aca5 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -88,8 +88,7 @@ BOOL LLNearbyChatBar::postBuild() { mChatBox = getChild<LLLineEditor>("chat_box"); - // *TODO Establish LineEditor with autocorrect callback -// mChatBox->setAutocorrectCallback(boost::bind(&AutoCorrect::autocorrectCallback, _1, _2)); + mChatBox->setAutocorrectCallback(boost::bind(&AutoCorrect::autocorrectCallback, AutoCorrect::getInstance(), _1, _2)); mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this)); mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this)); |