diff options
17 files changed, 194 insertions, 205 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1f7843b79d..0f328aa065 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -152,7 +152,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mPreeditBgColor(p.preedit_bg_color()), mGLFont(p.font), mContextMenuHandle(), - mAutocorrectCallback() + mAutoreplaceCallback() { llassert( mMaxLengthBytes > 0 ); @@ -866,10 +866,10 @@ void LLLineEditor::addChar(const llwchar uni_char) LLUI::reportBadKeystroke(); } - if (!mReadOnly && mAutocorrectCallback != NULL) + if (!mReadOnly && mAutoreplaceCallback != NULL) { // call callback - mAutocorrectCallback(mText, mCursorPos); + mAutoreplaceCallback(mText, mCursorPos); } getWindow()->hideCursorUntilMouseMove(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 53af9ac996..cd4be17f37 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -169,9 +169,9 @@ public: virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - typedef boost::function<void(LLUIString&, S32&)> autocorrect_callback_t; - autocorrect_callback_t mAutocorrectCallback; - void setAutocorrectCallback(autocorrect_callback_t cb) { mAutocorrectCallback = cb; } + typedef boost::function<void(LLUIString&, S32&)> autoreplace_callback_t; + autoreplace_callback_t mAutoreplaceCallback; + void setAutoreplaceCallback(autoreplace_callback_t cb) { mAutoreplaceCallback = cb; } void setLabel(const LLStringExplicit &new_label) { mLabel = new_label; } const std::string& getLabel() { return mLabel.getString(); } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index efad75ec59..90468ccbef 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -98,8 +98,8 @@ set(viewer_SOURCE_FILES llassetuploadresponders.cpp llattachmentsmgr.cpp llaudiosourcevo.cpp - llautocorrect.cpp - llautocorrectfloater.cpp + llautoreplace.cpp + llautoreplacefloater.cpp llavataractions.cpp llavatariconctrl.cpp llavatarlist.cpp @@ -656,8 +656,8 @@ set(viewer_HEADER_FILES llassetuploadresponders.h llattachmentsmgr.h llaudiosourcevo.h - llautocorrect.h - llautocorrectfloater.h + llautoreplace.h + llautoreplacefloater.h llavataractions.h llavatariconctrl.h llavatarlist.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4adf93e7aa..bc5c293625 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -346,10 +346,10 @@ <key>Value</key> <integer>0</integer> </map> - <key>AutoCorrect</key> + <key>AutoReplace</key> <map> <key>Comment</key> - <string>Replaces common spelling mistakes with correct word</string> + <string>Replaces keywords with a configured word or phrase</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -1650,17 +1650,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>CmdLineAutocorrect</key> - <map> - <key>Comment</key> - <string>Command for adding new entries to autocorrect</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>String</string> - <key>Value</key> - <string>/addac</string> - </map> <key>CmdLineDisableVoice</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/settings_autocorrect.xml b/indra/newview/app_settings/settings_autoreplace.xml index 4669ba5822..4669ba5822 100644 --- a/indra/newview/app_settings/settings_autocorrect.xml +++ b/indra/newview/app_settings/settings_autoreplace.xml diff --git a/indra/newview/llautocorrect.cpp b/indra/newview/llautoreplace.cpp index acbb790dff..a5683e4190 100644 --- a/indra/newview/llautocorrect.cpp +++ b/indra/newview/llautoreplace.cpp @@ -1,6 +1,6 @@ /** - * @file llautocorrect.cpp - * @brief Auto Correct Manager + * @file llautoreplace.cpp + * @brief Auto Replace Manager * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code @@ -23,30 +23,30 @@ */ #include "llviewerprecompiledheaders.h" -#include "llautocorrect.h" +#include "llautoreplace.h" #include "llsdserialize.h" #include "llboost.h" #include "llcontrol.h" #include "llviewercontrol.h" #include "llnotificationsutil.h" -AutoCorrect* AutoCorrect::sInstance; +AutoReplace* AutoReplace::sInstance; -AutoCorrect::AutoCorrect() +AutoReplace::AutoReplace() { sInstance = this; sInstance->loadFromDisk(); } -AutoCorrect::~AutoCorrect() +AutoReplace::~AutoReplace() { sInstance = NULL; } -void AutoCorrect::autocorrectCallback(LLUIString& inputText, S32& cursorPos) +void AutoReplace::autoreplaceCallback(LLUIString& inputText, S32& cursorPos) { - static LLCachedControl<bool> perform_autocorrect(gSavedSettings, "AutoCorrect"); - if(perform_autocorrect) + static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace"); + if(perform_autoreplace) { S32 wordStart = 0; S32 wordEnd = cursorPos-1; @@ -80,11 +80,11 @@ void AutoCorrect::autocorrectCallback(LLUIString& inputText, S32& cursorPos) std::string strLastWord = std::string(text.begin(), text.end()); std::string lastTypedWord = strLastWord.substr(wordStart, wordEnd-wordStart); - std::string correctedWord(replaceWord(lastTypedWord)); + std::string replaceedWord(replaceWord(lastTypedWord)); - if(correctedWord != lastTypedWord) + if(replaceedWord != lastTypedWord) { - LLWString strNew = utf8str_to_wstring(correctedWord); + LLWString strNew = utf8str_to_wstring(replaceedWord); LLWString strOld = utf8str_to_wstring(lastTypedWord); int nDiff = strNew.size() - strOld.size(); @@ -97,58 +97,58 @@ void AutoCorrect::autocorrectCallback(LLUIString& inputText, S32& cursorPos) } } -AutoCorrect* AutoCorrect::getInstance() +AutoReplace* AutoReplace::getInstance() { if(sInstance)return sInstance; else { - sInstance = new AutoCorrect(); + sInstance = new AutoReplace(); return sInstance; } } -void AutoCorrect::save() +void AutoReplace::save() { - saveToDisk(mAutoCorrects); + saveToDisk(mAutoReplaces); } -std::string AutoCorrect::getFileName() +std::string AutoReplace::getFileName() { std::string path=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""); if (!path.empty()) { - path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "settings_autocorrect.xml"); + path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "settings_autoreplace.xml"); } return path; } -std::string AutoCorrect::getDefaultFileName() +std::string AutoReplace::getDefaultFileName() { std::string path=gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, ""); if (!path.empty()) { - path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_autocorrect.xml"); + path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_autoreplace.xml"); } return path; } -LLSD AutoCorrect::exportList(std::string listName) +LLSD AutoReplace::exportList(std::string listName) { LLSD toReturn; - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { toReturn["listName"]=listName; - toReturn["data"]=mAutoCorrects[listName]["data"]; - toReturn["author"]=mAutoCorrects[listName]["author"]; - toReturn["wordStyle"]=mAutoCorrects[listName]["wordStyle"]; - toReturn["priority"]=mAutoCorrects[listName]["priority"]; + toReturn["data"]=mAutoReplaces[listName]["data"]; + toReturn["author"]=mAutoReplaces[listName]["author"]; + toReturn["wordStyle"]=mAutoReplaces[listName]["wordStyle"]; + toReturn["priority"]=mAutoReplaces[listName]["priority"]; } return toReturn; } -BOOL AutoCorrect::addCorrectionList(LLSD newList) +BOOL AutoReplace::addReplacementList(LLSD newList) { if(newList.has("listName")) { std::string name = newList["listName"]; - //if(!mAutoCorrects.has(name)){ + //if(!mAutoReplaces.has(name)){ LLSD newPart; newPart["data"]=newList["data"]; newPart["enabled"]=TRUE; @@ -157,67 +157,67 @@ BOOL AutoCorrect::addCorrectionList(LLSD newList) newPart["wordStyle"]=newList["wordStyle"]; newPart["priority"]=newList["priority"].asInteger(); llinfos << "adding new list with settings priority "<<newPart["priority"].asInteger() <<llendl; - mAutoCorrects[name]=newPart; + mAutoReplaces[name]=newPart; return TRUE; } return FALSE; } -BOOL AutoCorrect::removeCorrectionList(std::string listName) +BOOL AutoReplace::removeReplacementList(std::string listName) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects.erase(listName); + mAutoReplaces.erase(listName); return TRUE; } return FALSE; } -BOOL AutoCorrect::setListEnabled(std::string listName, BOOL enabled) +BOOL AutoReplace::setListEnabled(std::string listName, BOOL enabled) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects[listName]["enabled"]=enabled; + mAutoReplaces[listName]["enabled"]=enabled; return TRUE; } return FALSE; } -BOOL AutoCorrect::setListAnnounceeState(std::string listName, BOOL announce) +BOOL AutoReplace::setListAnnounceeState(std::string listName, BOOL announce) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects[listName]["announce"]=announce; + mAutoReplaces[listName]["announce"]=announce; return TRUE; } return FALSE; } -BOOL AutoCorrect::setListStyle(std::string listName, BOOL announce) +BOOL AutoReplace::setListStyle(std::string listName, BOOL announce) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects[listName]["wordStyle"]=announce; + mAutoReplaces[listName]["wordStyle"]=announce; return TRUE; } return FALSE; } -BOOL AutoCorrect::setListPriority(std::string listName, int priority) +BOOL AutoReplace::setListPriority(std::string listName, int priority) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects[listName]["priority"]=priority; + mAutoReplaces[listName]["priority"]=priority; return TRUE; } return FALSE; } -LLSD AutoCorrect::getAutoCorrects() +LLSD AutoReplace::getAutoReplaces() { //loadFromDisk(); - return mAutoCorrects; + return mAutoReplaces; } -void AutoCorrect::loadFromDisk() +void AutoReplace::loadFromDisk() { std::string filename=getFileName(); if (filename.empty()) @@ -249,21 +249,21 @@ void AutoCorrect::loadFromDisk() file.open(filename.c_str()); if (file.is_open()) { - LLSDSerialize::fromXML(mAutoCorrects, file); + LLSDSerialize::fromXML(mAutoReplaces, file); } file.close(); } } -void AutoCorrect::saveToDisk(LLSD newSettings) +void AutoReplace::saveToDisk(LLSD newSettings) { - mAutoCorrects=newSettings; + mAutoReplaces=newSettings; std::string filename=getFileName(); llofstream file; file.open(filename.c_str()); - LLSDSerialize::toPrettyXML(mAutoCorrects, file); + LLSDSerialize::toPrettyXML(mAutoReplaces, file); file.close(); } -void AutoCorrect::runTest() +void AutoReplace::runTest() { std::string startS("He just abandonned all his abilties"); std::string endS = replaceWords(startS); @@ -271,9 +271,9 @@ void AutoCorrect::runTest() } -BOOL AutoCorrect::saveListToDisk(std::string listName, std::string fileName) +BOOL AutoReplace::saveListToDisk(std::string listName, std::string fileName) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { llofstream file; file.open(fileName.c_str()); @@ -283,24 +283,24 @@ BOOL AutoCorrect::saveListToDisk(std::string listName, std::string fileName) } return FALSE; } -LLSD AutoCorrect::getAutoCorrectEntries(std::string listName) +LLSD AutoReplace::getAutoReplaceEntries(std::string listName) { LLSD toReturn; - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - toReturn=mAutoCorrects[listName]; + toReturn=mAutoReplaces[listName]; } return toReturn; } -std::string AutoCorrect::replaceWord(std::string currentWord) +std::string AutoReplace::replaceWord(std::string currentWord) { - static LLCachedControl<bool> perform_autocorrect(gSavedSettings, "AutoCorrect"); - if(!(perform_autocorrect))return currentWord; + static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace"); + if(!(perform_autoreplace))return currentWord; //loop through priorities for(int currentPriority = 10;currentPriority>=0;currentPriority--) { - LLSD::map_const_iterator loc_it = mAutoCorrects.beginMap(); - LLSD::map_const_iterator loc_end = mAutoCorrects.endMap(); + LLSD::map_const_iterator loc_it = mAutoReplaces.beginMap(); + LLSD::map_const_iterator loc_end = mAutoReplaces.endMap(); for (; loc_it != loc_end; ++loc_it) { const std::string& location = (*loc_it).first; @@ -349,10 +349,10 @@ std::string AutoCorrect::replaceWord(std::string currentWord) } return currentWord; } -std::string AutoCorrect::replaceWords(std::string words) +std::string AutoReplace::replaceWords(std::string words) { - static LLCachedControl<bool> perform_autocorrect(gSavedSettings, "AutoCorrect"); - if(!(perform_autocorrect))return words; + static LLCachedControl<bool> perform_autoreplace(gSavedSettings, "AutoReplace"); + if(!(perform_autoreplace))return words; //*TODO update this function to use the "wordStyle" thing, //but so far this function is never used, so later @@ -360,8 +360,8 @@ std::string AutoCorrect::replaceWords(std::string words) for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { std::string currentWord(*token_iter); - LLSD::map_const_iterator loc_it = mAutoCorrects.beginMap(); - LLSD::map_const_iterator loc_end = mAutoCorrects.endMap(); + LLSD::map_const_iterator loc_it = mAutoReplaces.beginMap(); + LLSD::map_const_iterator loc_end = mAutoReplaces.endMap(); for (; loc_it != loc_end; ++loc_it) { const std::string& location = (*loc_it).first; @@ -388,42 +388,42 @@ std::string AutoCorrect::replaceWords(std::string words) } return words; } -BOOL AutoCorrect::addEntryToList(std::string wrong, std::string right, std::string listName) +BOOL AutoReplace::addEntryToList(std::string wrong, std::string right, std::string listName) { // *HACK: Make sure the "Custom" list exists, because the design of this // system prevents us from updating it by changing the original file... - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - mAutoCorrects[listName]["data"][wrong]=right; + mAutoReplaces[listName]["data"][wrong]=right; return TRUE; } else if(listName == "Custom") { - mAutoCorrects[listName]["announce"] = 0; - mAutoCorrects[listName]["author"] = "You"; - mAutoCorrects[listName]["data"][wrong] = right; - mAutoCorrects[listName]["enabled"] = 1; - mAutoCorrects[listName]["priority"] = 10; - mAutoCorrects[listName]["wordStyle"] = 1; + mAutoReplaces[listName]["announce"] = 0; + mAutoReplaces[listName]["author"] = "You"; + mAutoReplaces[listName]["data"][wrong] = right; + mAutoReplaces[listName]["enabled"] = 1; + mAutoReplaces[listName]["priority"] = 10; + mAutoReplaces[listName]["wordStyle"] = 1; return TRUE; } return FALSE; } -BOOL AutoCorrect::removeEntryFromList(std::string wrong, std::string listName) +BOOL AutoReplace::removeEntryFromList(std::string wrong, std::string listName) { - if(mAutoCorrects.has(listName)) + if(mAutoReplaces.has(listName)) { - if(mAutoCorrects[listName]["data"].has(wrong)) + if(mAutoReplaces[listName]["data"].has(wrong)) { - mAutoCorrects[listName]["data"].erase(wrong); + mAutoReplaces[listName]["data"].erase(wrong); return TRUE; } } return FALSE; } -LLSD AutoCorrect::getExampleLLSD() +LLSD AutoReplace::getExampleLLSD() { LLSD toReturn; diff --git a/indra/newview/llautocorrect.h b/indra/newview/llautoreplace.h index 82cf75f3cf..b11c124a62 100644 --- a/indra/newview/llautocorrect.h +++ b/indra/newview/llautoreplace.h @@ -1,6 +1,6 @@ /** - * @file llautocorrect.h - * @brief Auto Correct Manager + * @file llautoreplace.h + * @brief Auto Replace Manager * @copyright Copyright (c) 2011 LordGregGreg Back * * This library is free software; you can redistribute it and/or @@ -17,21 +17,21 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AUTO_CORRECT -#define AUTO_CORRECT +#ifndef AUTO_REPLACE +#define AUTO_REPLACE #include "lllineeditor.h" -class AutoCorrect : public LLSingleton<AutoCorrect> +class AutoReplace : public LLSingleton<AutoReplace> { - AutoCorrect(); - ~AutoCorrect(); - static AutoCorrect* sInstance; + AutoReplace(); + ~AutoReplace(); + static AutoReplace* sInstance; public: - void autocorrectCallback(LLUIString& inputText, S32& cursorPos); - static AutoCorrect* getInstance(); - BOOL addCorrectionList(LLSD newList); - BOOL removeCorrectionList(std::string listName); + void autoreplaceCallback(LLUIString& inputText, S32& cursorPos); + static AutoReplace* getInstance(); + BOOL addReplacementList(LLSD newList); + BOOL removeReplacementList(std::string listName); BOOL setListEnabled(std::string listName, BOOL enabled); BOOL setListAnnounceeState(std::string listName, BOOL announce); BOOL setListPriority(std::string listName, int priority); @@ -43,20 +43,20 @@ public: BOOL saveListToDisk(std::string listName, std::string fileName); LLSD exportList(std::string listName); void runTest(); - LLSD getAutoCorrects(); - LLSD getAutoCorrectEntries(std::string listName); + LLSD getAutoReplaces(); + LLSD getAutoReplaceEntries(std::string listName); void save(); void loadFromDisk(); private: - friend class LLSingleton<AutoCorrect>; + friend class LLSingleton<AutoReplace>; void saveToDisk(LLSD newSettings); LLSD getExampleLLSD(); std::string getFileName(); std::string getDefaultFileName(); - LLSD mAutoCorrects; + LLSD mAutoReplaces; }; diff --git a/indra/newview/llautocorrectfloater.cpp b/indra/newview/llautoreplacefloater.cpp index 10bc30c0b4..01950adb37 100644 --- a/indra/newview/llautocorrectfloater.cpp +++ b/indra/newview/llautoreplacefloater.cpp @@ -1,6 +1,6 @@ /** - * @file llautocorrectfloater.cpp - * @brief Auto Correct List floater + * @file llautoreplacefloater.cpp + * @brief Auto Replace List floater * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ * Second Life Viewer Source Code @@ -24,7 +24,7 @@ #include "llviewerprecompiledheaders.h" -#include "llautocorrectfloater.h" +#include "llautoreplacefloater.h" #include "llagentdata.h" #include "llcommandhandler.h" @@ -44,7 +44,7 @@ #include "llui.h" #include "llcontrol.h" #include "llscrollingpanellist.h" -#include "llautocorrect.h" +#include "llautoreplace.h" #include "llfilepicker.h" #include "llfile.h" #include "llsdserialize.h" @@ -64,16 +64,16 @@ #include "llnotificationmanager.h" -AutoCorrectFloater::AutoCorrectFloater(const LLSD& key) : +AutoReplaceFloater::AutoReplaceFloater(const LLSD& key) : LLFloater(key) { } -void AutoCorrectFloater::onClose(bool app_quitting) +void AutoReplaceFloater::onClose(bool app_quitting) { destroy(); } -BOOL AutoCorrectFloater::postBuild(void) +BOOL AutoReplaceFloater::postBuild(void) { namesList = getChild<LLScrollListCtrl>("ac_list_name"); @@ -106,17 +106,17 @@ BOOL AutoCorrectFloater::postBuild(void) return true; } -void AutoCorrectFloater::onSelectName(LLUICtrl* ctrl, void* user_data) +void AutoReplaceFloater::onSelectName(LLUICtrl* ctrl, void* user_data) { if ( user_data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )user_data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )user_data; if ( self ) self->updateItemsList(); } } -void AutoCorrectFloater::updateItemsList() +void AutoReplaceFloater::updateItemsList() { entryList->deleteAllItems(); if((namesList->getAllSelected().size())<=0) @@ -129,7 +129,7 @@ void AutoCorrectFloater::updateItemsList() updateListControlsEnabled(TRUE); std::string listName= namesList->getFirstSelected()->getColumn(0)->getValue().asString(); - LLSD listData = AutoCorrect::getInstance()->getAutoCorrectEntries(listName); + LLSD listData = AutoReplace::getInstance()->getAutoReplaceEntries(listName); childSetValue("ac_list_enabled",listData["enabled"].asBoolean()); childSetValue("ac_list_style",listData["wordStyle"].asBoolean()); childSetValue("ac_list_show",listData["announce"].asBoolean()); @@ -137,9 +137,9 @@ void AutoCorrectFloater::updateItemsList() childSetValue("ac_text_author",listData["author"]); childSetValue("ac_priority",listData["priority"]); - LLSD autoCorrects = listData["data"]; - LLSD::map_const_iterator loc_it = autoCorrects.beginMap(); - LLSD::map_const_iterator loc_end = autoCorrects.endMap(); + LLSD autoReplaces = listData["data"]; + LLSD::map_const_iterator loc_it = autoReplaces.beginMap(); + LLSD::map_const_iterator loc_end = autoReplaces.endMap(); for ( ; loc_it != loc_end; ++loc_it) { const std::string& wrong = (*loc_it).first; @@ -162,17 +162,17 @@ void AutoCorrectFloater::updateItemsList() } } -void AutoCorrectFloater::updateNamesList() +void AutoReplaceFloater::updateNamesList() { namesList->deleteAllItems(); - if(!gSavedSettings.getBOOL("AutoCorrect")) + if(!gSavedSettings.getBOOL("AutoReplace")) { updateItemsList(); return; } - LLSD autoCorrects = AutoCorrect::getInstance()->getAutoCorrects(); - LLSD::map_const_iterator loc_it = autoCorrects.beginMap(); - LLSD::map_const_iterator loc_end = autoCorrects.endMap(); + LLSD autoReplaces = AutoReplace::getInstance()->getAutoReplaces(); + LLSD::map_const_iterator loc_it = autoReplaces.beginMap(); + LLSD::map_const_iterator loc_end = autoReplaces.endMap(); for ( ; loc_it != loc_end; ++loc_it) { const std::string& listName = (*loc_it).first; @@ -195,7 +195,7 @@ void AutoCorrectFloater::updateNamesList() } updateItemsList(); } -void AutoCorrectFloater::updateListControlsEnabled(BOOL selected) +void AutoReplaceFloater::updateListControlsEnabled(BOOL selected) { childSetEnabled("ac_text1",selected); @@ -212,10 +212,10 @@ void AutoCorrectFloater::updateListControlsEnabled(BOOL selected) childSetEnabled("ac_priority",selected); } -void AutoCorrectFloater::updateEnabledStuff() +void AutoReplaceFloater::updateEnabledStuff() { - BOOL autocorrect = gSavedSettings.getBOOL("AutoCorrect"); - if(autocorrect) + BOOL autoreplace = gSavedSettings.getBOOL("AutoReplace"); + if(autoreplace) { LLCheckBoxCtrl *enBox = getChild<LLCheckBoxCtrl>("ac_enable"); enBox->setDisabledColor(LLColor4::red); @@ -226,51 +226,51 @@ void AutoCorrectFloater::updateEnabledStuff() LLUIColorTable::instance().getColor( "LabelTextColor" )); } - childSetEnabled("ac_list_name", autocorrect); - childSetEnabled("ac_list_entry", autocorrect); - updateListControlsEnabled(autocorrect); + childSetEnabled("ac_list_name", autoreplace); + childSetEnabled("ac_list_entry", autoreplace); + updateListControlsEnabled(autoreplace); updateNamesList(); - AutoCorrect::getInstance()->save(); + AutoReplace::getInstance()->save(); } -void AutoCorrectFloater::setData(void * data) +void AutoReplaceFloater::setData(void * data) { } -void AutoCorrectFloater::onBoxCommitEnabled(LLUICtrl* caller, void* user_data) +void AutoReplaceFloater::onBoxCommitEnabled(LLUICtrl* caller, void* user_data) { if ( user_data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )user_data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )user_data; if ( self ) { self->updateEnabledStuff(); } } } -void AutoCorrectFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data) +void AutoReplaceFloater::onEntrySettingChange(LLUICtrl* caller, void* user_data) { if ( user_data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )user_data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )user_data; if ( self ) { std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString(); - AutoCorrect::getInstance()->setListEnabled(listName,self->childGetValue("ac_list_enabled").asBoolean()); - AutoCorrect::getInstance()->setListAnnounceeState(listName,self->childGetValue("ac_list_show").asBoolean()); - AutoCorrect::getInstance()->setListStyle(listName,self->childGetValue("ac_list_style").asBoolean()); - AutoCorrect::getInstance()->setListPriority(listName,self->childGetValue("ac_priority").asInteger()); + AutoReplace::getInstance()->setListEnabled(listName,self->childGetValue("ac_list_enabled").asBoolean()); + AutoReplace::getInstance()->setListAnnounceeState(listName,self->childGetValue("ac_list_show").asBoolean()); + AutoReplace::getInstance()->setListStyle(listName,self->childGetValue("ac_list_style").asBoolean()); + AutoReplace::getInstance()->setListPriority(listName,self->childGetValue("ac_priority").asInteger()); //sInstance->updateEnabledStuff(); self->updateItemsList(); - AutoCorrect::getInstance()->save(); + AutoReplace::getInstance()->save(); } } } -void AutoCorrectFloater::deleteEntry(void* data) +void AutoReplaceFloater::deleteEntry(void* data) { if ( data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )data; if ( self ) { @@ -279,14 +279,14 @@ void AutoCorrectFloater::deleteEntry(void* data) if((self->entryList->getAllSelected().size())>0) { std::string wrong= self->entryList->getFirstSelected()->getColumn(0)->getValue().asString(); - AutoCorrect::getInstance()->removeEntryFromList(wrong,listName); + AutoReplace::getInstance()->removeEntryFromList(wrong,listName); self->updateItemsList(); - AutoCorrect::getInstance()->save(); + AutoReplace::getInstance()->save(); } } } } -void AutoCorrectFloater::loadList(void* data) +void AutoReplaceFloater::loadList(void* data) { LLFilePicker& picker = LLFilePicker::instance(); @@ -301,34 +301,34 @@ void AutoCorrectFloater::loadList(void* data) LLSDSerialize::fromXMLDocument(blankllsd, file); } file.close(); - gSavedSettings.setBOOL("AutoCorrect",true); - AutoCorrect::getInstance()->addCorrectionList(blankllsd); + gSavedSettings.setBOOL("AutoReplace",true); + AutoReplace::getInstance()->addReplacementList(blankllsd); if ( data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )data; if ( self ) self->updateEnabledStuff(); } } -void AutoCorrectFloater::removeList(void* data) +void AutoReplaceFloater::removeList(void* data) { if ( data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )data; if ( self ) { std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString(); - AutoCorrect::getInstance()->removeCorrectionList(listName); + AutoReplace::getInstance()->removeReplacementList(listName); self->updateEnabledStuff(); } } } -void AutoCorrectFloater::exportList(void *data) +void AutoReplaceFloater::exportList(void *data) { if ( data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )data; if ( self ) { std::string listName=self->namesList->getFirstSelected()->getColumn(0)->getValue().asString(); @@ -340,17 +340,17 @@ void AutoCorrectFloater::exportList(void *data) } llofstream file; file.open(picker.getFirstFile().c_str()); - LLSDSerialize::toPrettyXML(AutoCorrect::getInstance()->exportList(listName), file); + LLSDSerialize::toPrettyXML(AutoReplace::getInstance()->exportList(listName), file); file.close(); } } } -void AutoCorrectFloater::addEntry(void* data) +void AutoReplaceFloater::addEntry(void* data) { if ( data ) { - AutoCorrectFloater* self = ( AutoCorrectFloater* )data; + AutoReplaceFloater* self = ( AutoReplaceFloater* )data; if ( self ) { std::string listName= self->namesList->getFirstSelected()->getColumn(0)->getValue().asString(); @@ -358,16 +358,16 @@ void AutoCorrectFloater::addEntry(void* data) std::string right = self->mNewText->getText(); if(wrong != "" && right != "") { - AutoCorrect::getInstance()->addEntryToList(wrong, right, listName); + AutoReplace::getInstance()->addEntryToList(wrong, right, listName); self->updateItemsList(); - AutoCorrect::getInstance()->save(); + AutoReplace::getInstance()->save(); } } } } -AutoCorrectFloater* AutoCorrectFloater::showFloater() +AutoReplaceFloater* AutoReplaceFloater::showFloater() { - AutoCorrectFloater *floater = dynamic_cast<AutoCorrectFloater*>(LLFloaterReg::getInstance("autocorrect")); + AutoReplaceFloater *floater = dynamic_cast<AutoReplaceFloater*>(LLFloaterReg::getInstance("autoreplace")); if(floater) { floater->setVisible(true); @@ -377,7 +377,7 @@ AutoCorrectFloater* AutoCorrectFloater::showFloater() } else { - LL_WARNS("AutoCorrect") << "Can't find floater!" << LL_ENDL; + LL_WARNS("AutoReplace") << "Can't find floater!" << LL_ENDL; return NULL; } } diff --git a/indra/newview/llautocorrectfloater.h b/indra/newview/llautoreplacefloater.h index 2a02f6cc82..213cf93a30 100644 --- a/indra/newview/llautocorrectfloater.h +++ b/indra/newview/llautoreplacefloater.h @@ -1,6 +1,6 @@ /** - * @file llautocorrectfloater.h - * @brief Auto Correct List floater + * @file llautoreplacefloater.h + * @brief Auto Replace List floater * @copyright Copyright (c) 2011 LordGregGreg Back * * $LicenseInfo:firstyear=2012&license=viewerlgpl$ @@ -23,8 +23,8 @@ * $/LicenseInfo$ */ -#ifndef AUTOCORRECTFLOATER_H -#define AUTOCORRECTFLOATER_H +#ifndef AUTOREPLACEFLOATER_H +#define AUTOREPLACEFLOATER_H #include "llfloater.h" #include "llmediactrl.h" @@ -34,16 +34,16 @@ #include "llviewerinventory.h" #include <boost/bind.hpp> -class AutoCorrectFloater : +class AutoReplaceFloater : public LLFloater { public: - AutoCorrectFloater(const LLSD& key); + AutoReplaceFloater(const LLSD& key); /*virtual*/ BOOL postBuild(); /*virtual*/ void onClose(bool app_quitting); - static AutoCorrectFloater* showFloater(); + static AutoReplaceFloater* showFloater(); void setData(void * data); void updateEnabledStuff(); @@ -72,4 +72,4 @@ private: static void loadList(void* data); }; -#endif // AUTOCORRECTFLOATER_H +#endif // AUTOREPLACEFLOATER_H diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9954878ae4..362904f0f8 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -35,7 +35,7 @@ #include "llfloaterpreference.h" #include "message.h" -#include "llautocorrectfloater.h" +#include "llautoreplacefloater.h" #include "llagent.h" #include "llavatarconstants.h" #include "llcheckboxctrl.h" @@ -355,7 +355,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2)); gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged, _2)); - mCommitCallbackRegistrar.add("Pref.ShowAC", boost::bind(&AutoCorrectFloater::showFloater)); + mCommitCallbackRegistrar.add("Pref.ShowAC", boost::bind(&AutoReplaceFloater::showFloater)); LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this ); } diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index e300f6f32d..670db3773e 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" +#include "llautoreplace.h" LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), @@ -255,8 +255,8 @@ BOOL LLIMFloater::postBuild() 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)); + // *TODO Establish LineEditor with autoreplace callback + mInputEditor->setAutoreplaceCallback(boost::bind(&AutoReplace::autoreplaceCallback, AutoReplace::getInstance(), _1, _2)); LLFontGL* font = LLViewerChat::getChatFont(); mInputEditor->setFont(font); diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 07516d4b4f..a3aeadbfb8 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -51,7 +51,7 @@ #include "lltranslate.h" #include "llresizehandle.h" -#include "llautocorrect.h" +#include "llautoreplace.h" S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; @@ -88,7 +88,7 @@ BOOL LLNearbyChatBar::postBuild() { mChatBox = getChild<LLLineEditor>("chat_box"); - mChatBox->setAutocorrectCallback(boost::bind(&AutoCorrect::autocorrectCallback, AutoCorrect::getInstance(), _1, _2)); + mChatBox->setAutoreplaceCallback(boost::bind(&AutoReplace::autoreplaceCallback, AutoReplace::getInstance(), _1, _2)); mChatBox->setCommitCallback(boost::bind(&LLNearbyChatBar::onChatBoxCommit, this)); mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); mChatBox->setFocusLostCallback(boost::bind(&onChatBoxFocusLost, _1, this)); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 20face6d89..b2480a1805 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -30,7 +30,7 @@ #include "llfloaterreg.h" #include "llviewerfloaterreg.h" -#include "llautocorrectfloater.h" +#include "llautoreplacefloater.h" #include "llcompilequeue.h" #include "llcallfloater.h" #include "llfasttimerview.h" @@ -170,7 +170,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); - LLFloaterReg::add("settings_autocorrect", "floater_autocorrect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<AutoCorrectFloater>); + LLFloaterReg::add("settings_autoreplace", "floater_autoreplace.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<AutoReplaceFloater>); LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatar>); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0aafb6ea73..af3189f1b7 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1982,11 +1982,11 @@ class LLAdvancedCompressImage : public view_listener_t }; -class LLAdvancedShowAutocorrectSettings : public view_listener_t +class LLAdvancedShowAutoreplaceSettings : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLFloaterReg::showInstance("settings_autocorrect", userdata); + LLFloaterReg::showInstance("settings_autoreplace", userdata); return true; } }; @@ -8291,7 +8291,7 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedToggleShowObjectUpdates(), "Advanced.ToggleShowObjectUpdates"); view_listener_t::addMenu(new LLAdvancedCheckShowObjectUpdates(), "Advanced.CheckShowObjectUpdates"); view_listener_t::addMenu(new LLAdvancedCompressImage(), "Advanced.CompressImage"); - view_listener_t::addMenu(new LLAdvancedShowAutocorrectSettings(), "Advanced.ShowAutocorrectSettings"); + view_listener_t::addMenu(new LLAdvancedShowAutoreplaceSettings(), "Advanced.ShowAutoreplaceSettings"); view_listener_t::addMenu(new LLAdvancedShowDebugSettings(), "Advanced.ShowDebugSettings"); view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions"); view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions"); diff --git a/indra/newview/skins/default/xui/en/floater_autocorrect.xml b/indra/newview/skins/default/xui/en/floater_autoreplace.xml index ab6e65c847..5f53e61fa2 100644 --- a/indra/newview/skins/default/xui/en/floater_autocorrect.xml +++ b/indra/newview/skins/default/xui/en/floater_autoreplace.xml @@ -9,7 +9,7 @@ height="500" width="400" name="ac_floater" - title="Autocorrect Settings"> + title="Autoreplace Settings"> <check_box bottom_delta="50" left_delta="5" @@ -20,8 +20,8 @@ font="SansSerifSmall" mouse_opaque="true" radio_style="false" - label="Enable Autocorrect" - control_name="AutoCorrect" + label="Enable Autoreplace" + control_name="AutoReplace" name="ac_enable" tool_tip="You must have this check box enabled to use any of these settings, it will search your writable text entry, and replace any of the search entries with their replacement"/> <button @@ -312,4 +312,4 @@ top_delta="-5" right="-15" select_on_focus="true" /> -</floater>
\ No newline at end of file +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index ebba8ba35f..26abc754db 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1836,9 +1836,9 @@ <menu_item_separator/> <menu_item_call - label="Show Autocorrect Settings"> + label="Show Autoreplace Settings"> <menu_item_call.on_click - function="Advanced.ShowAutocorrectSettings" /> + function="Advanced.ShowAutoreplaceSettings" /> </menu_item_call> <menu_item_call label="Show Debug Settings" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index f4f3c8f4d0..12bf6c5296 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -224,7 +224,7 @@ left_pad="5" name="ac_showgui" commit_callback.function="Pref.ShowAC" - label="AutoCorrect Settings" + label="AutoReplace Settings" width="150"> </button> </panel> |