From 0d4ca6478fcb0eaf20b1fe3fbd0a090c55f2713e Mon Sep 17 00:00:00 2001 From: Tank_Master Date: Tue, 10 Jul 2012 23:57:05 -0700 Subject: [PATCH] removed spellcheck, to be replaced by LL's version --- autobuild.xml | 49 --- indra/cmake/CMakeLists.txt | 1 - indra/cmake/Copy3rdPartyLibs.cmake | 3 - indra/cmake/Hunspell.cmake | 21 -- indra/cmake/ViewerMiscLibs.cmake | 1 - indra/llcommon/llstring.h | 5 - indra/llui/CMakeLists.txt | 3 - indra/llui/llhunspell.cpp | 292 ------------------ indra/llui/llhunspell.h | 83 ----- indra/llui/lllineeditor.cpp | 253 +-------------- indra/llui/lllineeditor.h | 41 +-- indra/llui/llmenugl.cpp | 6 - indra/llui/llmenugl.h | 11 +- indra/llui/llspellcheckmenuhandler.h | 40 --- indra/llui/lltextbase.cpp | 132 +------- indra/llui/lltextbase.h | 40 +-- indra/llui/lltexteditor.cpp | 123 -------- indra/llui/lltexteditor.h | 23 +- indra/newview/CMakeLists.txt | 6 - indra/newview/app_settings/settings.xml | 22 -- indra/newview/llappviewer.cpp | 10 +- indra/newview/llfloaterpreference.cpp | 21 +- indra/newview/llviewercontrol.cpp | 23 -- indra/newview/llviewermenu.cpp | 77 ----- .../ansastorm/xui/en/panel_toolbar_view.xml | 1 - .../default/xui/de/panel_preferences_chat.xml | 9 - .../default/xui/en/floater_im_session.xml | 1 - .../default/xui/en/floater_nearby_chat.xml | 1 - .../default/xui/en/floater_preferences.xml | 8 - .../xui/en/floater_preview_notecard.xml | 1 - .../skins/default/xui/en/menu_text_editor.xml | 79 ----- .../default/xui/en/panel_group_notices.xml | 2 - .../default/xui/en/panel_nearby_chat_bar.xml | 1 - .../default/xui/en/panel_preferences_chat.xml | 35 +-- .../default/xui/en/panel_toolbar_view.xml | 1 - .../default/xui/es/panel_preferences_chat.xml | 7 - .../default/xui/it/panel_preferences_chat.xml | 6 - .../default/xui/pl/panel_preferences_chat.xml | 6 - .../default/xui/ru/panel_preferences_chat.xml | 9 - .../metaharper/xui/en/floater_nearby_chat.xml | 1 - .../metaharper/xui/en/panel_toolbar_view.xml | 1 - .../starlight/xui/en/panel_group_notices.xml | 2 - .../starlight/xui/en/panel_toolbar_view.xml | 1 - .../xui/en/floater_preferences.xml | 8 - .../xui/en/panel_group_notices.xml | 2 - .../xui/en/panel_toolbar_view.xml | 1 - .../vintage/xui/en/floater_preferences.xml | 8 - .../vintage/xui/en/panel_toolbar_view.xml | 15 +- 48 files changed, 19 insertions(+), 1473 deletions(-) delete mode 100644 indra/cmake/Hunspell.cmake delete mode 100644 indra/llui/llhunspell.cpp delete mode 100644 indra/llui/llhunspell.h delete mode 100644 indra/llui/llspellcheckmenuhandler.h diff --git a/autobuild.xml b/autobuild.xml index b31b71fefd..3a4c44a84a 100755 --- a/autobuild.xml +++ b/autobuild.xml @@ -1648,55 +1648,6 @@ - libhunspell - - license - MPL_LGPL - license_file - LICENSES/license.hunspell - name - libhunspell - platforms - - darwin - - archive - - hash - aeab54c3a956acdc0f004e28e4feffdb - url - http://phoenixviewer.com/app/packages/libhunspell-1.3.2-darwin-20110925.tar.bz2 - - name - darwin - - linux - - archive - - hash - 535036d910262c5f10da0215bdde38f1 - url - http://phoenixviewer.com/app/packages/libhunspell-1.3.2-linux-20110919.tar.bz2 - - name - linux - - windows - - archive - - hash - 52aabfc137a0091f35cda7089a95d7d2 - url - http://phoenixviewer.com/app/packages/libhunspell-1.3.2-windows-20110919.tar.bz2 - - name - windows - - - - nd_hacdConvexDecomposition license diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 8bab456c72..665d8d4165 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -39,7 +39,6 @@ set(cmake_SOURCE_FILES GooglePerfTools.cmake Growl.cmake HACD.cmake - Hunspell.cmake JPEG.cmake LLAddBuildTest.cmake LLAudio.cmake diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 871500f17c..31fc4d3442 100755 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -45,7 +45,6 @@ if(WINDOWS) libeay32.dll libcollada14dom22-d.dll glod.dll - libhunspell.dll ) set(release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}") @@ -60,7 +59,6 @@ if(WINDOWS) libeay32.dll libcollada14dom22.dll glod.dll - libhunspell.dll ) if(USE_GOOGLE_PERFTOOLS) @@ -220,7 +218,6 @@ elseif(DARWIN) libllqtwebkit.dylib libminizip.a libndofdev.dylib - libhunspell-1.3.dylib libexception_handler.dylib libcollada14dom.dylib #libgrowl.dylib # *TODO - test/fix/get mac growl working diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake deleted file mode 100644 index def2198c93..0000000000 --- a/indra/cmake/Hunspell.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# -*- cmake -*- -include(Prebuilt) - -set(HUNSPELL_FIND_QUIETLY ON) -set(HUNSPELL_FIND_REQUIRED ON) - -if (STANDALONE) - include(FindHUNSPELL) -else (STANDALONE) - use_prebuilt_binary(libhunspell) - if (WINDOWS) - set(HUNSPELL_LIBRARY libhunspell) - set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell) - elseif(DARWIN) - set(HUNSPELL_LIBRARY hunspell-1.3) - set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell) - else() - set(HUNSPELL_LIBRARY hunspell-1.3) - set(HUNSPELL_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/hunspell) - endif() -endif (STANDALONE) diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake index a2018ed554..665348a2a4 100644 --- a/indra/cmake/ViewerMiscLibs.cmake +++ b/indra/cmake/ViewerMiscLibs.cmake @@ -2,7 +2,6 @@ include(Prebuilt) if (NOT STANDALONE) - use_prebuilt_binary(libhunspell) use_prebuilt_binary(nd_hacdConvexDecomposition) use_prebuilt_binary(libuuid) use_prebuilt_binary(slvoice) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 701e27cd42..09733e8e2a 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -183,11 +183,6 @@ public: static bool isPunct(char a) { return ispunct((unsigned char)a) != 0; } static bool isPunct(llwchar a) { return iswpunct(a) != 0; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-18 (Catznip-2.8.0c) | Added: Catznip-2.8.0c - static bool isAlpha(char a) { return isalpha((unsigned char)a) != 0; } - static bool isAlpha(llwchar a) { return iswalpha(a) != 0; } -// [/SL:KB] - static bool isAlnum(char a) { return isalnum((unsigned char)a) != 0; } static bool isAlnum(llwchar a) { return iswalnum(a) != 0; } diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index b1810adf39..2a8e52d3da 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -54,7 +54,6 @@ set(llui_SOURCE_FILES llflyoutbutton.cpp llfocusmgr.cpp llfunctorregistry.cpp - llhunspell.cpp lliconctrl.cpp llkeywords.cpp lllayoutstack.cpp @@ -158,7 +157,6 @@ set(llui_HEADER_FILES llfunctorregistry.h llhandle.h llhelp.h - llhunspell.h lliconctrl.h llkeywords.h lllayoutstack.h @@ -195,7 +193,6 @@ set(llui_HEADER_FILES llscrolllistitem.h llsliderctrl.h llslider.h - llspellcheckmenuhandler.h llspinctrl.h llstatbar.h llstatgraph.h diff --git a/indra/llui/llhunspell.cpp b/indra/llui/llhunspell.cpp deleted file mode 100644 index cd419003d7..0000000000 --- a/indra/llui/llhunspell.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/** - * - * Copyright (c) 2010, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the - * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt - * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt - * - * By copying, modifying or distributing this software, you acknowledge that - * you have read and understood your obligations described above, and agree to - * abide by those obligations. - * - */ - -#include "linden_common.h" - -#include "lldir.h" -#include "llsdserialize.h" - -#include "llhunspell.h" - -#if LL_WINDOWS - #include - #pragma comment(lib, "libhunspell.lib") -#else - #include -#endif - -// ============================================================================ -// Static variables -// - -static const std::string c_strDictCustomSuffix = "_custom"; -static const std::string c_strDictIgnoreSuffix = "_ignore"; - -// ============================================================================ - -LLHunspellWrapper::LLHunspellWrapper() - : m_pHunspell(NULL) -{ - m_strDictionaryAppPath = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "dictionaries", ""); - m_strDictionaryUserPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "dictionaries", ""); - if (!gDirUtilp->fileExists(m_strDictionaryUserPath)) - LLFile::mkdir(m_strDictionaryUserPath); - - // Load dictionary information (file name, friendly name, ...) - llifstream fileDictMap(m_strDictionaryAppPath + "dictionaries.xml", std::ios::binary); - if (fileDictMap.is_open()) - LLSDSerialize::fromXMLDocument(m_sdDictionaryMap, fileDictMap); - - // Look for installed dictionaries - std::string strTempAppPath, strTempUserPath; - for (LLSD::array_iterator itDictInfo = m_sdDictionaryMap.beginArray(), endDictInfo = m_sdDictionaryMap.endArray(); - itDictInfo != endDictInfo; ++itDictInfo) - { - LLSD& sdDict = *itDictInfo; - strTempAppPath = (sdDict.has("name")) ? m_strDictionaryAppPath + sdDict["name"].asString() : LLStringUtil::null; - strTempUserPath = (sdDict.has("name")) ? m_strDictionaryUserPath + sdDict["name"].asString() : LLStringUtil::null; - sdDict["installed"] = - (!strTempAppPath.empty()) && (gDirUtilp->fileExists(strTempAppPath + ".aff")) && (gDirUtilp->fileExists(strTempAppPath + ".dic")); - sdDict["has_custom"] = (!strTempUserPath.empty()) && (gDirUtilp->fileExists(strTempUserPath + c_strDictCustomSuffix + ".dic")); - sdDict["has_ignore"] = (!strTempUserPath.empty()) && (gDirUtilp->fileExists(strTempUserPath + c_strDictIgnoreSuffix + ".dic")); - } -} - -LLHunspellWrapper::~LLHunspellWrapper() -{ - delete m_pHunspell; -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -bool LLHunspellWrapper::checkSpelling(const std::string& strWord) const -{ - if ( (!m_pHunspell) || (strWord.length() < 3) || (0 != m_pHunspell->spell(strWord.c_str())) ) - { - return true; - } - if (m_IgnoreList.size() > 0) - { - std::string strWordLower(strWord); - LLStringUtil::toLower(strWordLower); - return (std::find(m_IgnoreList.begin(), m_IgnoreList.end(), strWordLower) != m_IgnoreList.end()); - } - return false; -} - -S32 LLHunspellWrapper::getSuggestions(const std::string& strWord, std::vector& strSuggestionList) const -{ - if ( (!m_pHunspell) || (strWord.length() < 3) ) - return 0; - - strSuggestionList.clear(); - - char** ppstrSuggestionList; int cntSuggestion = 0; - if ( (cntSuggestion = m_pHunspell->suggest(&ppstrSuggestionList, strWord.c_str())) != 0 ) - { - for (int idxSuggestion = 0; idxSuggestion < cntSuggestion; idxSuggestion++) - strSuggestionList.push_back(ppstrSuggestionList[idxSuggestion]); - m_pHunspell->free_list(&ppstrSuggestionList, cntSuggestion); - } - return strSuggestionList.size(); -} - -// ============================================================================ -// Dictionary related functions -// - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -S32 LLHunspellWrapper::getDictionaries(std::vector& strDictionaryList) const -{ - strDictionaryList.clear(); - for (LLSD::array_const_iterator itDictInfo = m_sdDictionaryMap.beginArray(), endDictInfo = m_sdDictionaryMap.endArray(); - itDictInfo != endDictInfo; ++itDictInfo) - { - const LLSD& sdDict = *itDictInfo; - strDictionaryList.push_back(sdDict["language"].asString()); - } - return strDictionaryList.size(); -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -S32 LLHunspellWrapper::getInstalledDictionaries(std::vector& strDictionaryList) const -{ - strDictionaryList.clear(); - for (LLSD::array_const_iterator itDictInfo = m_sdDictionaryMap.beginArray(), endDictInfo = m_sdDictionaryMap.endArray(); - itDictInfo != endDictInfo; ++itDictInfo) - { - const LLSD& sdDict = *itDictInfo; - if (sdDict["installed"].asBoolean()) - strDictionaryList.push_back(sdDict["language"].asString()); - } - return strDictionaryList.size(); -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -bool LLHunspellWrapper::setCurrentDictionary(const std::string& strDictionary) -{ - if (strDictionary == m_strDictionaryName) - return false; - s_SettingsChangeSignal(); - - if (m_pHunspell) - { - delete m_pHunspell; - m_pHunspell = NULL; - m_strDictionaryName = m_strDictionaryFile = ""; - m_IgnoreList.clear(); - } - - if (strDictionary.empty()) - return false; - - LLSD sdDictInfo; - for (LLSD::array_const_iterator itDictInfo = m_sdDictionaryMap.beginArray(), endDictInfo = m_sdDictionaryMap.endArray(); - itDictInfo != endDictInfo; ++itDictInfo) - { - const LLSD& sdDict = *itDictInfo; - if ( (sdDict["installed"].asBoolean()) && (strDictionary == sdDict["language"].asString()) ) - sdDictInfo = sdDict; - } - - if (sdDictInfo.has("name")) - { - std::string strPathAff = m_strDictionaryAppPath + sdDictInfo["name"].asString() + ".aff"; - std::string strPathDic = m_strDictionaryAppPath + sdDictInfo["name"].asString() + ".dic"; - m_pHunspell = new Hunspell(strPathAff.c_str(), strPathDic.c_str()); - if (!m_pHunspell) - return false; - - m_strDictionaryName = strDictionary; - m_strDictionaryFile = sdDictInfo["name"].asString(); - - // Add the custom dictionary (if there is one) - if (sdDictInfo["has_custom"].asBoolean()) - { - std::string strPathCustomDic = m_strDictionaryUserPath + m_strDictionaryFile + c_strDictCustomSuffix + ".dic"; - m_pHunspell->add_dic(strPathCustomDic.c_str()); - } - - // Load the ignore list (if there is one) - if (sdDictInfo["has_ignore"].asBoolean()) - { - llifstream fileDictIgnore(m_strDictionaryUserPath + m_strDictionaryFile + c_strDictIgnoreSuffix + ".dic", std::ios::in); - if (fileDictIgnore.is_open()) - { - std::string strWord; int idxLine = 0; - while (getline(fileDictIgnore, strWord)) - { - // Skip over the first line since that's just a line count - if (0 != idxLine) - { - LLStringUtil::toLower(strWord); - m_IgnoreList.push_back(strWord); - } - idxLine++; - } - } - } - } - - return (NULL != m_pHunspell); -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLHunspellWrapper::addToCustomDictionary(const std::string& strWord) -{ - if (m_pHunspell) - m_pHunspell->add(strWord.c_str()); - addToDictFile(m_strDictionaryUserPath + m_strDictionaryFile + c_strDictCustomSuffix + ".dic", strWord); - s_SettingsChangeSignal(); -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLHunspellWrapper::addToIgnoreList(const std::string& strWord) -{ - std::string strWordLower(strWord); - LLStringUtil::toLower(strWordLower); - if (std::find(m_IgnoreList.begin(), m_IgnoreList.end(), strWordLower) == m_IgnoreList.end()) - { - m_IgnoreList.push_back(strWordLower); - addToDictFile(m_strDictionaryUserPath + m_strDictionaryFile + c_strDictIgnoreSuffix + ".dic", strWordLower); - s_SettingsChangeSignal(); - } -} - -// Checked: 2010-12-23 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLHunspellWrapper::addToDictFile(const std::string& strDictPath, const std::string& strWord) -{ - // TODO-Catznip: has to be a better way to add one word to the end and increment the line count? - std::vector wordList; - - // Read any existing words - if (gDirUtilp->fileExists(strDictPath)) - { - llifstream fileDictIn(strDictPath, std::ios::in); - if (fileDictIn.is_open()) - { - std::string strWord; int idxLine = 0; - while (getline(fileDictIn, strWord)) - { - // Skip over the first line since that's just a line count - if (0 != idxLine) - wordList.push_back(strWord); - idxLine++; - } - } - else - { - // TODO-Catznip: show error message? - return; - } - } - - // Add the new word to the end - wordList.push_back(strWord); - - // Recreate the file with the new line count and new word added - llofstream fileDictOut(strDictPath, std::ios::out | std::ios::trunc); - if (fileDictOut.is_open()) - { - fileDictOut << wordList.size() << std::endl; - for (std::vector::const_iterator itWord = wordList.begin(); itWord != wordList.end(); ++itWord) - fileDictOut << *itWord << std::endl; - fileDictOut.close(); - } -} - -// ============================================================================ -// Static member functions -// - -LLHunspellWrapper::settings_change_signal_t LLHunspellWrapper::s_SettingsChangeSignal; - -boost::signals2::connection LLHunspellWrapper::setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb) -{ - return s_SettingsChangeSignal.connect(cb); -} - -bool LLHunspellWrapper::useSpellCheck() -{ - return (LLHunspellWrapper::instanceExists()) || (LLHunspellWrapper::instance().m_pHunspell); -} - -void LLHunspellWrapper::setUseSpellCheck(const std::string& strDictionary) -{ - if ( ((strDictionary.empty()) && (useSpellCheck())) || (!strDictionary.empty()) ) - LLHunspellWrapper::instance().setCurrentDictionary(strDictionary); -} - -// ============================================================================ diff --git a/indra/llui/llhunspell.h b/indra/llui/llhunspell.h deleted file mode 100644 index 0b7de5ebae..0000000000 --- a/indra/llui/llhunspell.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * - * Copyright (c) 2010, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the - * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt - * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt - * - * By copying, modifying or distributing this software, you acknowledge that - * you have read and understood your obligations described above, and agree to - * abide by those obligations. - * - */ - -#ifndef LL_HUNSPELL_H -#define LL_HUNSPELL_H - -#include "llsingleton.h" -#include - -class Hunspell; - -// ============================================================================ - -class LLHunspellWrapper : public LLSingleton -{ - friend class LLSingleton; -protected: - LLHunspellWrapper(); - ~LLHunspellWrapper(); - -public: - bool checkSpelling(const std::string& strWord) const; - S32 getSuggestions(const std::string& strWord, std::vector& strSuggestionList) const; - - /* - * Dictionary related functions - */ -public: - const std::string getCurrentDictionary() const { return m_strDictionaryName; } - S32 getDictionaries(std::vector& strDictionaryList) const; - S32 getInstalledDictionaries(std::vector& strDictionaryList) const; - - void addToCustomDictionary(const std::string& strWord); - void addToIgnoreList(const std::string& strWord); -protected: - void addToDictFile(const std::string& strDictPath, const std::string& strWord); - bool setCurrentDictionary(const std::string& strDictionary); - - /* - * Event callbacks - */ -public: - typedef boost::signals2::signal settings_change_signal_t; - static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb); - - /* - * Static member functions - */ -public: - static bool useSpellCheck(); - static void setUseSpellCheck(const std::string& strDictionary); - - /* - * Member variables - */ -protected: - Hunspell* m_pHunspell; - std::string m_strDictionaryName; - std::string m_strDictionaryFile; - std::string m_strDictionaryAppPath; - std::string m_strDictionaryUserPath; - LLSD m_sdDictionaryMap; - std::vector m_IgnoreList; - - static settings_change_signal_t s_SettingsChangeSignal; -}; - -// ============================================================================ - -#endif // LL_HUNSPELL_H diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 45eea360cc..3a1f14bc3d 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -52,9 +52,6 @@ #include "llclipboard.h" #include "llmenugl.h" #include "../newview/llviewercontrol.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) -#include "llhunspell.h" -// [/SL:KB] // // Imported globals @@ -69,9 +66,6 @@ const S32 SCROLL_INCREMENT_ADD = 0; // make space for typing const S32 SCROLL_INCREMENT_DEL = 4; // make space for baskspacing const F32 AUTO_SCROLL_TIME = 0.05f; const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click. *TODO: make this equal to the double click interval? -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-24 (Catznip-2.7.0a) | Added: Catznip-2.5.0a -const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and showing spell checking feedback for the word the cursor is on -// [/SL:KB] const std::string PASSWORD_ASTERISK( "\xE2\x80\xA2" ); // U+2022 BULLET @@ -95,9 +89,6 @@ LLLineEditor::Params::Params() background_image_focused("background_image_focused"), select_on_focus("select_on_focus", false), revert_on_esc("revert_on_esc", true), -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - spellcheck("spellcheck", false), -// [/SL:KB] commit_on_focus_lost("commit_on_focus_lost", true), ignore_tab("ignore_tab", true), is_password("is_password", false), @@ -144,10 +135,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mIgnoreArrowKeys( FALSE ), mIgnoreTab( p.ignore_tab ), mDrawAsterixes( p.is_password ), -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - mSpellCheck( p.spellcheck ), - mNeedsSpellCheck( FALSE ), -// [/SL:KB] mSelectAllonFocusReceived( p.select_on_focus ), mSelectAllonCommit( TRUE ), mPassDelete(FALSE), @@ -171,11 +158,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mScrollTimer.reset(); mTripleClickTimer.reset(); -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Modified: Catznip-2.8.0a - if (mSpellCheck) - LLHunspellWrapper::setSettingsChangeCallback(boost::bind(&LLLineEditor::onSpellCheckSettingsChange, this)); - mSpellCheckTimer.reset(); -// [/SL:KB] setText(p.default_text()); // Initialize current history line iterator @@ -538,110 +520,6 @@ void LLLineEditor::selectAll() //updatePrimary(); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - -// Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a -bool LLLineEditor::useSpellCheck() const -{ - return (LLHunspellWrapper::useSpellCheck()) && (!mReadOnly) && (mSpellCheck); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -std::string LLLineEditor::getSuggestion(U32 idxSuggestion) const -{ - return (idxSuggestion < mSuggestionList.size()) ? mSuggestionList[idxSuggestion] : LLStringUtil::null; -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -U32 LLLineEditor::getSuggestionCount() const -{ - return mSuggestionList.size(); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLLineEditor::replaceWithSuggestion(U32 idxSuggestion) -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= (U32)mCursorPos) && (itMisspell->second >= (U32)mCursorPos) ) - { - deselect(); - - // Delete the misspelled word - mText.erase(itMisspell->first, itMisspell->second - itMisspell->first); - setCursor(itMisspell->first); - - // Insert the suggestion in its place - LLWString wstrSuggestion = utf8str_to_wstring(mSuggestionList[idxSuggestion]); - mText.insert(getCursor(), wstrSuggestion); - - setCursor(mCursorPos + (S32)wstrSuggestion.length()); - - break; - } - } - mNeedsSpellCheck = TRUE; -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLLineEditor::addToDictionary() -{ - if (canAddToDictionary()) - LLHunspellWrapper::instance().addToCustomDictionary(getMisspelledWord(mCursorPos)); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -bool LLLineEditor::canAddToDictionary() const -{ - return (useSpellCheck()) && (isMisspelledWord(mCursorPos)); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void LLLineEditor::addToIgnore() -{ - if (canAddToIgnore()) - LLHunspellWrapper::instance().addToIgnoreList(getMisspelledWord(mCursorPos)); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -bool LLLineEditor::canAddToIgnore() const -{ - return (useSpellCheck()) && (isMisspelledWord(mCursorPos)); -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -std::string LLLineEditor::getMisspelledWord(U32 posCursor) const -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= posCursor) && (itMisspell->second >= posCursor) ) - return wstring_to_utf8str(mText.getWString().substr(itMisspell->first, itMisspell->second - itMisspell->first)); - } - return LLStringUtil::null; -} - -// Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -bool LLLineEditor::isMisspelledWord(U32 posCursor) const -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= posCursor) && (itMisspell->second >= posCursor) ) - return true; - } - return false; -} - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -void LLLineEditor::onSpellCheckSettingsChange() -{ - // Recheck the spelling on every change - mNeedsSpellCheck = TRUE; -} -// [/SL:KB] - BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { setFocus( TRUE ); @@ -1572,13 +1450,6 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) { mKeystrokeCallback(this); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-24 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - // We're only interested in the backspace key - if ( (!selection_modified) && (KEY_BACKSPACE == key) ) - { - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); - } -// [/SL:KB] } } } @@ -1636,9 +1507,6 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) // We'll have to do something about this if something ever changes! - Doug mKeystrokeCallback( this ); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-24 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); -// [/SL:KB] } } return handled; @@ -1689,9 +1557,6 @@ void LLLineEditor::doDelete() { mKeystrokeCallback( this ); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-24 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); -// [/SL:KB] } } } @@ -1888,10 +1753,7 @@ void LLLineEditor::draw() if( (rendered_pixels_right < (F32)mTextRightEdge) && (rendered_text < text_len) ) { // unselected, right side -// mGLFont->render( -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - rendered_text += mGLFont->render( -// [/SL:KB] + mGLFont->render( mText, mScrollHPos + rendered_text, rendered_pixels_right, text_bottom, text_color, @@ -1905,10 +1767,7 @@ void LLLineEditor::draw() } else { -// mGLFont->render( -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - rendered_text = mGLFont->render( -// [/SL:KB] + mGLFont->render( mText, mScrollHPos, rendered_pixels_right, text_bottom, text_color, @@ -1923,85 +1782,6 @@ void LLLineEditor::draw() mBorder->setVisible(FALSE); // no more programmatic art. #endif -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - if ( (useSpellCheck()) && (mText.length() > 2) ) - { - // Calculate start and end (character) indices for the first and last visible word - U32 idxStart = prevWordPos(mScrollHPos); static U32 idxPrevStart = -1; - U32 idxEnd = nextWordPos(mScrollHPos + rendered_text); static U32 idxPrevEnd = -1; - - // Perform spell check if needed - if ( (mNeedsSpellCheck) || (idxStart != idxPrevStart) || (idxEnd != idxPrevEnd) ) - { - const LLWString& wstrText = mText.getWString().substr(idxStart, idxEnd); - - // Find the start of the first word - U32 idxWordStart = 0, idxWordEnd = 0; - while ( (idxWordStart < wstrText.length()) && (!LLStringOps::isAlpha(wstrText[idxWordStart])) ) - idxWordStart++; - // Iterate over all words in the text block and check them one by one - mMisspellRanges.clear(); - while (idxWordStart < wstrText.length()) - { - // Find the end of the current word (special case handling for "'" when it's used as a contraction) - idxWordEnd = idxWordStart + 1; - while ( (idxWordEnd < wstrText.length()) && - ((LLWStringUtil::isPartOfWord(wstrText[idxWordEnd])) || - ((L'\'' == wstrText[idxWordEnd]) && - (LLStringOps::isAlnum(wstrText[idxWordEnd - 1])) && (LLStringOps::isAlnum(wstrText[idxWordEnd + 1])))) ) - { - idxWordEnd++; - } - if (idxWordEnd > wstrText.length()) - break; - - // Don't process words shorter than 3 characters - std::string strWord = wstring_to_utf8str(wstrText.substr(idxWordStart, idxWordEnd - idxWordStart)); - if ( (strWord.length() >= 3) && (!LLHunspellWrapper::instance().checkSpelling(strWord)) ) - mMisspellRanges.push_back(std::pair(idxStart + idxWordStart, idxStart + idxWordEnd)); - - // Find the start of the next word - idxWordStart = idxWordEnd + 1; - while ( (idxWordStart < wstrText.length()) && (!LLWStringUtil::isPartOfWord(wstrText[idxWordStart])) ) - idxWordStart++; - } - - idxPrevStart = idxStart; - idxPrevEnd = idxEnd; - mNeedsSpellCheck = FALSE; - } - - // Draw squiggly lines under any (visible) misspelled words - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - // Skip over words that aren't (partially) visible - if ( ((itMisspell->first < idxStart) && (itMisspell->second < idxStart)) || (itMisspell->first > idxEnd) ) - continue; - - // Skip the current word if the user is still busy editing it - if ( (!mSpellCheckTimer.hasExpired()) && (itMisspell->first <= (U32)mCursorPos) && (itMisspell->second >= (U32)mCursorPos) ) - continue; - - S32 pxWidth = getRect().getWidth(); - S32 pxStart = findPixelNearestPos(itMisspell->first - getCursor()); - if (pxStart > pxWidth) - continue; - S32 pxEnd = findPixelNearestPos(itMisspell->second - getCursor()); - if (pxEnd > pxWidth) - pxEnd = pxWidth; - - gGL.color4ub(255, 0, 0, 200); - while (pxStart < pxEnd) - { - gl_line_2d(pxStart, text_bottom - 2, pxStart + 3, text_bottom + 1); - gl_line_2d(pxStart + 3, text_bottom + 1, pxStart + 6, text_bottom - 2); - pxStart += 6; - } - } - } -// [/SL:KB] - // If we're editing... if( hasFocus()) { @@ -2459,9 +2239,6 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, { mKeystrokeCallback( this ); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-24 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); -// [/SL:KB] } BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const @@ -2613,32 +2390,6 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) S32 screen_x, screen_y; localPointToScreen(x, y, &screen_x, &screen_y); -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-21 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - // Move the cursor to where the user right-clicked (clear the current selection if the user right-clicked outside of it) - setCursorAtLocalPos(x); - if ( (mCursorPos < llmin(mSelectionStart, mSelectionEnd)) || (mCursorPos > llmax(mSelectionStart, mSelectionEnd)) ) - deselect(); - else - setCursor(llmax(mSelectionStart, mSelectionEnd)); - - bool fUseSpellCheck = useSpellCheck(), fMisspelledWord = false; - if (fUseSpellCheck) - { - mSuggestionList.clear(); - - // If the cursor is on a misspelled word, retrieve suggestions for it - std::string strMisspelledWord = getMisspelledWord(mCursorPos); - if ((fMisspelledWord = !strMisspelledWord.empty()) == true) - LLHunspellWrapper::instance().getSuggestions(strMisspelledWord, mSuggestionList); - } - - // Show/hide spell checking related menu items - menu->setItemVisible("Suggestion Separator", (fUseSpellCheck) && (!mSuggestionList.empty())); - menu->setItemVisible("Add to Dictionary", (fUseSpellCheck) && (fMisspelledWord)); - menu->setItemVisible("Add to Ignore", (fUseSpellCheck) && (fMisspelledWord)); - menu->setItemVisible("Spellcheck Separator", (fUseSpellCheck) && (fMisspelledWord)); - menu->setSpawningView(getHandle()); -// [/SL:KB] menu->show(screen_x, screen_y); } } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 9c48c44c68..124ae20582 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -40,9 +40,6 @@ #include "llframetimer.h" #include "lleditmenuhandler.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) -#include "llspellcheckmenuhandler.h" -// [/SL:KB] #include "lluictrl.h" #include "lluiimage.h" #include "lluistring.h" @@ -58,9 +55,6 @@ class LLContextMenu; class LLLineEditor : public LLUICtrl, public LLEditMenuHandler, protected LLPreeditor -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -, public LLSpellCheckMenuHandler -// [/SL:KB] { public: @@ -92,9 +86,6 @@ public: Optional select_on_focus, revert_on_esc, -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a - spellcheck, -// [/SL:KB] commit_on_focus_lost, ignore_tab, is_password; @@ -155,25 +146,6 @@ public: virtual void deselect(); virtual BOOL canDeselect() const; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - // LLSpellCheckMenuHandler overrides - /*virtual*/ bool useSpellCheck() const; - - /*virtual*/ std::string getSuggestion(U32 idxSuggestion) const; - /*virtual*/ U32 getSuggestionCount() const; - /*virtual*/ void replaceWithSuggestion(U32 idxSuggestion); - - /*virtual*/ void addToDictionary(); - /*virtual*/ bool canAddToDictionary() const; - - /*virtual*/ void addToIgnore(); - /*virtual*/ bool canAddToIgnore() const; - - // Spell checking helper functions - std::string getMisspelledWord(U32 posCursor) const; - bool isMisspelledWord(U32 posCursor) const; -// [/SL:KB] - // view overrides virtual void draw(); virtual void reshape(S32 width,S32 height,BOOL called_from_parent=TRUE); @@ -298,11 +270,7 @@ private: // Draw the background image depending on enabled/focused state. void drawBackground(); - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - void onSpellCheckSettingsChange(); -// [/SL:KB] - + // // private data members // @@ -356,13 +324,6 @@ protected: LLTextValidate::validate_func_t mPrevalidateFunc; LLTextValidate::validate_func_t mPrevalidateInputFunc; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - BOOL mSpellCheck; - BOOL mNeedsSpellCheck; - LLTimer mSpellCheckTimer; - std::list > mMisspellRanges; - std::vector mSuggestionList; -// [/SL:KB] LLFrameTimer mKeystrokeTimer; LLTimer mTripleClickTimer; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c5a1fed9d4..ff6928ffda 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3922,12 +3922,6 @@ void LLContextMenu::hide() mHoverItem->setHighlight( FALSE ); } mHoverItem = NULL; -// ND_MERGE is this still needed? There are no such lines in mSpawningViewHandle.markDead(); in V/dev. Just a comment for a todo? Then it should be done, or this lines deleted. -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - // NOTE: this should be done *somewhere* but a menu item's onCommit() calls "hideMenus" before it fires the "onCommit" signal -// mSpawningViewHandle.markDead(); -// [/SL:KB] -// /ND_MERGE } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index bd565f8907..30e8e6669e 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -682,20 +682,11 @@ public: BOOL appendContextSubMenu(LLContextMenu *menu); LLHandle getHandle() { return getDerivedHandle(); } - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - // NOTE: this is currently only used for spell checking so don't presume this will return something meaningful elsewhere - LLView* getSpawningView() const { return mSpawningViewHandle.get(); } - void setSpawningView(LLHandle hSpawningView) { mSpawningViewHandle = hSpawningView; } -// [/SL:KB] - + protected: BOOL mHoveredAnyItem; LLMenuItemGL* mHoverItem; LLRootHandle mHandle; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - LLHandle mSpawningViewHandle; -// [/SL:KB] }; diff --git a/indra/llui/llspellcheckmenuhandler.h b/indra/llui/llspellcheckmenuhandler.h deleted file mode 100644 index 5465a478d5..0000000000 --- a/indra/llui/llspellcheckmenuhandler.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - * Copyright (c) 2010, Kitty Barnett - * - * The source code in this file is provided to you under the terms of the - * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt - * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt - * - * By copying, modifying or distributing this software, you acknowledge that - * you have read and understood your obligations described above, and agree to - * abide by those obligations. - * - */ - -#ifndef LLSPELLCHECKMENUHANDLER_H -#define LLSPELLCHECKMENUHANDLER_H - -// ============================================================================ - -class LLSpellCheckMenuHandler -{ -public: - virtual bool useSpellCheck() const { return false; } - - virtual std::string getSuggestion(U32 idxSuggestion) const { return ""; } - virtual U32 getSuggestionCount() const { return 0; } - virtual void replaceWithSuggestion(U32 idxSuggestion) {} - - virtual void addToDictionary() {} - virtual bool canAddToDictionary() const { return false; } - - virtual void addToIgnore() {} - virtual bool canAddToIgnore() const { return false; } -}; - -// ============================================================================ - -#endif diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 79dc2730f8..72e62dad07 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -43,17 +43,9 @@ #include "llwindow.h" #include -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -#include "llhunspell.h" -// [/SL:KB] - const F32 CURSOR_FLASH_DELAY = 1.0f; // in seconds const S32 CURSOR_THICKNESS = 2; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-08 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -const F32 LLTextBase::SPELLCHECK_DELAY = 0.5f; // Delay between the last keypress and showing spell checking feedback for the word the cursor is on -// [/SL:KB] - LLTextBase::line_info::line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num) : mDocIndexStart(index_start), mDocIndexEnd(index_end), @@ -166,9 +158,6 @@ LLTextBase::Params::Params() plain_text("plain_text",false), track_end("track_end", false), read_only("read_only", false), -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - spellcheck("spellcheck", false), -// [/SL:KB] v_pad("v_pad", 0), h_pad("h_pad", 0), clip("clip", true), @@ -195,10 +184,6 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mFontShadow(p.font_shadow), mPopupMenu(NULL), mReadOnly(p.read_only), -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - mSpellCheck(p.spellcheck), - mNeedsSpellCheck( FALSE ), -// [/SL:KB] mCursorColor(p.cursor_color), mFgColor(p.text_color), mBorderVisible( p.border_visible ), @@ -260,12 +245,6 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) view_params.rect = LLRect(0, 500, 500, 0); view_params.mouse_opaque = false; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - if (mSpellCheck) - LLHunspellWrapper::setSettingsChangeCallback(boost::bind(&LLTextBase::onSpellCheckSettingsChange, this)); - mSpellCheckTimer.reset(); -// [/SL:KB] - mDocumentView = LLUICtrlFactory::create(view_params); if (mScroller) { @@ -567,79 +546,9 @@ void LLTextBase::drawText() { return; } - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - // Perform spell check if needed - if ( (useSpellCheck()) && (getWText().length() > 2) ) - { - S32 idxStart = getLineStart(llmax(first_line - 1, 0)); static S32 idxPrevStart = -1; - S32 idxEnd = getLineEnd(llmin(last_line + 1, (S32)mLineInfoList.size() - 1)); static S32 idxPrevEnd = -1; - - if ( (mNeedsSpellCheck) || (idxStart != idxPrevStart) || (idxEnd != idxPrevEnd) ) - { - const LLWString& wstrText = getWText(); - mMisspellRanges.clear(); - - segment_set_t::iterator itSegment = getSegIterContaining(idxStart); LLTextSegmentPtr pSegment; - while ( (mSegments.end() != itSegment) && (pSegment = *itSegment) && (pSegment->getStart() < idxEnd) ) - { - if (!pSegment->canSpellCheck()) - { - ++itSegment; - continue; - } - - // Combine adjoining text segments into one (newly typed text will be one letter per text segment) - U32 idxSegmentStart = pSegment->getStart(), idxSegmentEnd = llmin(pSegment->getEnd(), idxEnd); - while ( (mSegments.end() != ++itSegment) && - (pSegment = *itSegment) && (pSegment->canSpellCheck()) && (pSegment->getStart() < idxEnd) ) - { - idxSegmentEnd = llmin(pSegment->getEnd(), idxEnd); - } - - // Find the start of the first word - U32 idxWordStart = idxSegmentStart, idxWordEnd = -1; - while ( (idxWordStart < wstrText.length()) && (!LLStringOps::isAlpha(wstrText[idxWordStart])) ) - idxWordStart++; - // Iterate over all words in the text block and check them one by one - while (idxWordStart < idxSegmentEnd && idxWordStart < wstrText.length() ) - { - // Find the end of the current word (special case handling for "'" when it's used as a contraction) - idxWordEnd = idxWordStart + 1; - while ( (idxWordEnd < idxSegmentEnd) && (idxWordEnd < wstrText.length()) && - ((LLWStringUtil::isPartOfWord(wstrText[idxWordEnd])) || - ((L'\'' == wstrText[idxWordEnd]) && - (LLStringOps::isAlnum(wstrText[idxWordEnd - 1])) && (LLStringOps::isAlnum(wstrText[idxWordEnd + 1])))) ) - { - idxWordEnd++; - } - if (idxWordEnd > idxSegmentEnd || idxWordEnd >= wstrText.length()) - break; - - // Don't process words shorter than 3 characters - std::string strWord = wstring_to_utf8str(wstrText.substr(idxWordStart, idxWordEnd - idxWordStart)); - if ( (strWord.length() >= 3) && (!LLHunspellWrapper::instance().checkSpelling(strWord)) ) - mMisspellRanges.push_back(std::pair(idxWordStart, idxWordEnd)); - - // Find the start of the next word - idxWordStart = idxWordEnd + 1; - while ( (idxWordStart < idxSegmentEnd) && (!LLWStringUtil::isPartOfWord(wstrText[idxWordStart])) ) - idxWordStart++; - } - } - - idxPrevStart = idxStart; - idxPrevEnd = idxEnd; - mNeedsSpellCheck = FALSE; - } - } -// [/SL:KB] - + LLTextSegmentPtr cur_segment = *seg_iter; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - std::list >::const_iterator itMisspell = mMisspellRanges.begin(); -// [/SL:KB] for (S32 cur_line = first_line; cur_line < last_line; cur_line++) { S32 next_line = cur_line + 1; @@ -686,29 +595,6 @@ void LLTextBase::drawText() text_rect.mRight -= 2; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - // Draw squiggly lines under any (visible) misspelled words - for (; (itMisspell != mMisspellRanges.end()) && ((itMisspell->first < line_end) && (itMisspell->second > line_start)); ++itMisspell) - { - // Skip the current word if the user is still busy editing it - if ( (!mSpellCheckTimer.hasExpired()) && (itMisspell->first <= (U32)mCursorPos) && (itMisspell->second >= (U32)mCursorPos) ) - continue; - - S32 pxStart, pxEnd, pxTemp; - cur_segment->getDimensions(seg_start - cur_segment->getStart(), itMisspell->first - seg_start + 1, pxStart, pxTemp); - cur_segment->getDimensions(itMisspell->first - seg_start + 1, itMisspell->second - itMisspell->first, pxEnd, pxTemp); - pxEnd += pxStart; - - gGL.color4ub(255, 0, 0, 200); - while (pxStart < pxEnd) - { - gl_line_2d(pxStart, text_rect.mBottom - 2, pxStart + 3, text_rect.mBottom + 1); - gl_line_2d(pxStart + 3, text_rect.mBottom + 1, pxStart + 6, text_rect.mBottom - 2); - pxStart += 6; - } - } -// [/SL:KB] - text_rect.mLeft = (S32)(cur_segment->draw(seg_start - cur_segment->getStart(), clipped_end, selection_left, selection_right, text_rect)); seg_start = clipped_end + cur_segment->getStart(); @@ -1234,19 +1120,6 @@ void LLTextBase::deselect() mIsSelecting = FALSE; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -bool LLTextBase::useSpellCheck() const -{ - return (LLHunspellWrapper::useSpellCheck()) && (!mReadOnly) && (mSpellCheck); -} - -void LLTextBase::onSpellCheckSettingsChange() -{ - // Recheck the spelling on every change - mNeedsSpellCheck = TRUE; -} -// [/SL:KB] - // Sets the scrollbar from the cursor position void LLTextBase::updateScrollFromCursor() { @@ -2810,9 +2683,6 @@ S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offs void LLTextSegment::updateLayout(const LLTextBase& editor) {} F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect) { return draw_rect.mLeft; } bool LLTextSegment::canEdit() const { return false; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -bool LLTextSegment::canSpellCheck() const { return false; } -// [/SL:KB] void LLTextSegment::unlinkFromDocument(LLTextBase*) {} void LLTextSegment::linkToDocument(LLTextBase*) {} const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 932bc42566..46be80bb4e 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -30,9 +30,6 @@ #include "v4color.h" #include "lleditmenuhandler.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -#include "llspellcheckmenuhandler.h" -// [/SL:KB] #include "llstyle.h" #include "llkeywords.h" #include "llpanel.h" @@ -64,9 +61,6 @@ public: virtual void updateLayout(const class LLTextBase& editor); virtual F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); virtual bool canEdit() const; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - virtual bool canSpellCheck() const; -// [/SL:KB] virtual void unlinkFromDocument(class LLTextBase* editor); virtual void linkToDocument(class LLTextBase* editor); @@ -118,9 +112,6 @@ public: /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect); /*virtual*/ bool canEdit() const { return true; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - /*virtual*/ bool canSpellCheck() const { return true; } -// [/SL:KB] /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } /*virtual*/ LLStyleConstSP getStyle() const { return mStyle; } // /*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; } @@ -246,9 +237,6 @@ typedef LLPointer LLTextSegmentPtr; class LLTextBase : public LLUICtrl, protected LLEditMenuHandler -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -, public LLSpellCheckMenuHandler -// [/SL:KB] { public: friend class LLTextSegment; @@ -280,9 +268,6 @@ public: border_visible, track_end, read_only, -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - spellcheck, -// [/SL:KB] allow_scroll, plain_text, wrap, @@ -334,12 +319,7 @@ public: // LLEditMenuHandler interface /*virtual*/ BOOL canDeselect() const; /*virtual*/ void deselect(); - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - // LLSpellCheckMenuHandler overrides - /*virtual*/ bool useSpellCheck() const; -// [/SL:KB] - + // void setParseHTML(bool parse_html) { mParseHTML = parse_html; } // @@ -539,11 +519,7 @@ protected: // misc void updateRects(); void needsScroll() { mScrollNeeded = TRUE; } - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - void onSpellCheckSettingsChange(); -// [/SL:KB] - + struct URLLabelCallback; // Replace a URL with a new icon and label, for example, when // avatar names are looked up. @@ -589,17 +565,7 @@ protected: S32 mSelectionEnd; BOOL mIsSelecting; // Are we in the middle of a drag-select? - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-07 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - BOOL mSpellCheck; - BOOL mNeedsSpellCheck; - LLTimer mSpellCheckTimer; - std::list > mMisspellRanges; - - // Constant - static const F32 SPELLCHECK_DELAY; -// [/SL:KB] - + // configuration S32 mHPad; // padding on left of text S32 mVPad; // padding above text diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3a3e31a5e9..43591f2a1b 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -62,10 +62,6 @@ #include #include "llcombobox.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -#include "llhunspell.h" -// [/SL:KB] - // // Globals // @@ -703,95 +699,6 @@ void LLTextEditor::selectAll() //updatePrimary(); } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -std::string LLTextEditor::getSuggestion(U32 idxSuggestion) const -{ - return (idxSuggestion < mSuggestionList.size()) ? mSuggestionList[idxSuggestion] : LLStringUtil::null; -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -U32 LLTextEditor::getSuggestionCount() const -{ - return mSuggestionList.size(); -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -void LLTextEditor::replaceWithSuggestion(U32 idxSuggestion) -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= (U32)mCursorPos) && (itMisspell->second >= (U32)mCursorPos) ) - { - deselect(); - - // Delete the misspelled word - remove(itMisspell->first, itMisspell->second - itMisspell->first, TRUE); - setCursorPos(itMisspell->first); - - // Insert the suggestion in its place - S32 cntCh = insert(mCursorPos, utf8str_to_wstring(mSuggestionList[idxSuggestion]), FALSE, LLTextSegmentPtr()); - setCursorPos(mCursorPos + cntCh); - - break; - } - } - mNeedsSpellCheck = TRUE; -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -void LLTextEditor::addToDictionary() -{ - if (canAddToDictionary()) - LLHunspellWrapper::instance().addToCustomDictionary(getMisspelledWord(mCursorPos)); -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -bool LLTextEditor::canAddToDictionary() const -{ - return (useSpellCheck()) && (isMisspelledWord(mCursorPos)); -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -void LLTextEditor::addToIgnore() -{ - if (canAddToIgnore()) - LLHunspellWrapper::instance().addToIgnoreList(getMisspelledWord(mCursorPos)); -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -bool LLTextEditor::canAddToIgnore() const -{ - return (useSpellCheck()) && (isMisspelledWord(mCursorPos)); -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -std::string LLTextEditor::getMisspelledWord(U32 posCursor) const -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= posCursor) && (itMisspell->second >= posCursor) ) - return wstring_to_utf8str(getWText().substr(itMisspell->first, itMisspell->second - itMisspell->first)); - } - return LLStringUtil::null; -} - -// Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -bool LLTextEditor::isMisspelledWord(U32 posCursor) const -{ - for (std::list >::const_iterator itMisspell = mMisspellRanges.begin(); - itMisspell != mMisspellRanges.end(); ++itMisspell) - { - if ( (itMisspell->first <= posCursor) && (itMisspell->second >= posCursor) ) - return true; - } - return false; -} -// [/SL:KB] - BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -2117,32 +2024,6 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) S32 screen_x, screen_y; localPointToScreen(x, y, &screen_x, &screen_y); -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - // Move the cursor to where the user right-clicked (clear the current selection if the user right-clicked outside of it) - setCursorAtLocalPos(x, y, false); - if ( (mCursorPos < llmin(mSelectionStart, mSelectionEnd)) || (mCursorPos > llmax(mSelectionStart, mSelectionEnd)) ) - deselect(); - else - setCursorPos(llmax(mSelectionStart, mSelectionEnd)); - - bool fUseSpellCheck = useSpellCheck(), fMisspelledWord = false; - if (fUseSpellCheck) - { - mSuggestionList.clear(); - - // If the cursor is on a misspelled word, retrieve suggestions for it - std::string strMisspelledWord = getMisspelledWord(mCursorPos); - if ((fMisspelledWord = !strMisspelledWord.empty()) == true) - LLHunspellWrapper::instance().getSuggestions(strMisspelledWord, mSuggestionList); - } - - // Show/hide spell checking related menu items - mContextMenu->setItemVisible("Suggestion Separator", (fUseSpellCheck) && (!mSuggestionList.empty())); - mContextMenu->setItemVisible("Add to Dictionary", (fUseSpellCheck) && (fMisspelledWord)); - mContextMenu->setItemVisible("Add to Ignore", (fUseSpellCheck) && (fMisspelledWord)); - mContextMenu->setItemVisible("Spellcheck Separator", (fUseSpellCheck) && (fMisspelledWord)); - mContextMenu->setSpawningView(getHandle()); -// [/SL:KB] mContextMenu->show(screen_x, screen_y); } @@ -3041,10 +2922,6 @@ void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& cal void LLTextEditor::onKeyStroke() { mKeystrokeSignal(this); -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-08 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - mNeedsSpellCheck = TRUE; - mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); -// [/SL:KB] } //virtual diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index b802d181c1..5125bbadc2 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -154,23 +154,6 @@ public: // [/SL:KB] // BOOL replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE); -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - // LLSpellCheckMenuHandler overrides - /*virtual*/ std::string getSuggestion(U32 idxSuggestion) const; - /*virtual*/ U32 getSuggestionCount() const; - /*virtual*/ void replaceWithSuggestion(U32 idxSuggestion); - - /*virtual*/ void addToDictionary(); - /*virtual*/ bool canAddToDictionary() const; - - /*virtual*/ void addToIgnore(); - /*virtual*/ bool canAddToIgnore() const; - - // Spell checking helper functions - std::string getMisspelledWord(U32 posCursor) const; - bool isMisspelledWord(U32 posCursor) const; -// [/SL:KB] - void replaceTextAll(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive); // Undo/redo stack @@ -355,11 +338,7 @@ private: BOOL mAllowEmbeddedItems; bool mShowContextMenu; bool mParseOnTheFly; - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-09 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - std::vector mSuggestionList; -// [/SL:KB] - + LLUUID mSourceID; LLCoordGL mLastIMEPosition; // Last position of the IME editor diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 528a9963d6..8e79e78f55 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -13,7 +13,6 @@ include(EXPAT) include(FMOD) include(OPENAL) include(FindOpenGL) -include(Hunspell) include(JsonCpp) include(LLAudio) include(LLCharacter) @@ -71,7 +70,6 @@ include_directories( ${LSCRIPT_INCLUDE_DIRS} ${LSCRIPT_INCLUDE_DIRS}/lscript_compile ${LLLOGIN_INCLUDE_DIRS} - ${LIBS_PREBUILD_DIR}/include/hunspell ${LIBS_PREBUILT_DIR}/include/collada ${UPDATER_INCLUDE_DIRS} ${OPENAL_LIB_INCLUDE_DIRS} @@ -1751,9 +1749,6 @@ if (WINDOWS) ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/msvcp100.dll ${SHARED_LIB_STAGING_DIR}/Debug/msvcr100d.dll ${SHARED_LIB_STAGING_DIR}/Debug/msvcp100d.dll - ${SHARED_LIB_STAGING_DIR}/Release/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libhunspell.dll - ${SHARED_LIB_STAGING_DIR}/Debug/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/SLVoice.exe ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/alut.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/wrap_oal.dll @@ -1936,7 +1931,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLMATH_LIBRARIES} ${LLCOMMON_LIBRARIES} ${NDOF_LIBRARY} - ${HUNSPELL_LIBRARY} ${viewer_LIBRARIES} ${BOOST_PROGRAM_OPTIONS_LIBRARY} ${BOOST_REGEX_LIBRARY} diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2cdc05a5b6..fa125d5da2 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14736,28 +14736,6 @@ Change of this parameter will affect the layout of buttons in notification toast Value 10.0 - SpellCheck - - Comment - Enable spellchecking on line and text editors - Persist - 1 - Type - Boolean - Value - 1 - - SpellCheckDictionary - - Comment - Current dictionary used for spell checking - Persist - 1 - Type - String - Value - English (United States) - UseNewWalkRun Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 03cf435499..986a7c1784 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -111,9 +111,6 @@ #include "llvfsthread.h" #include "llvolumemgr.h" #include "llxfermanager.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.7.0a) | Added: Catznip-2.5.0a -#include "llhunspell.h" -// [/SL:KB] #include "llnotificationmanager.h" #include "llnotifications.h" @@ -2791,12 +2788,7 @@ bool LLAppViewer::initConfiguration() if ( (themefolder) && (LLStringUtil::null != skinfolder->getValue().asString()) ) gDirUtilp->setSkinThemeFolder(themefolder->getValue().asString()); } - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Modified: Catznip-2.8.0a - if (gSavedSettings.getBOOL("SpellCheck")) - LLHunspellWrapper::setUseSpellCheck(gSavedSettings.getString("SpellCheckDictionary")); -// [/SL:KB] - + mYieldTime = gSavedSettings.getS32("YieldTime"); // Read skin/branding settings if specified. diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 24577fd640..b3fb513902 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -123,10 +123,6 @@ //-TT #include "NACLantispam.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Added: Catznip-2.8.0a -#include "llhunspell.h" -// [/SL:KB] - #include "llviewernetwork.h" // const F32 MAX_USER_FAR_CLIP = 512.f; @@ -2101,22 +2097,7 @@ BOOL LLPanelPreference::postBuild() getChild("use_external_browser")->setValue(gSavedSettings.getBOOL("UseExternalBrowser")); } // Fix for visually broken browser choice radiobuttons - -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Added: Catznip-2.8.0a - //////////////////////PanelSpellCheck////////////////////// - if (hasChild("checkSpellCheck", TRUE)) - { - std::vector dictList; - if (LLHunspellWrapper::instance().getInstalledDictionaries(dictList)) - { - LLComboBox* pMainDictionaryList = findChild("comboDictionaryMain"); - for (std::vector::const_iterator itDict = dictList.begin(); itDict != dictList.end(); ++itDict) - pMainDictionaryList->add(*itDict); - pMainDictionaryList->setControlName("SpellCheckDictionary"); - } - } -// [/SL:KB] - + ////////////////////// PanelAlerts /////////////////// if (hasChild("OnlineOfflinetoNearbyChat", TRUE)) { diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index fafb02f36f..e91995b6a9 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -76,10 +76,6 @@ #include "llupdaterservice.h" #include "llnotificationsutil.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-07-02 (Catznip-2.7.0a) | Added: Catznip-2.7.0a -#include "llhunspell.h" -// [/SL:KB] - // NaCl - Antispam Registry #include "NACLantispam.h" // NaCl End @@ -573,21 +569,6 @@ bool handleForceShowGrid(const LLSD& newvalue) return true; } -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2011-09-06 (Catznip-2.8.0a) | Modified: Catznip-2.8.0a -bool handleSpellCheckChanged(const LLSD& sdValue) -{ - LLHunspellWrapper::setUseSpellCheck((sdValue.asBoolean()) ? gSavedSettings.getString("SpellCheckDictionary") : LLStringUtil::null); - return true; -} - -bool handleSpellCheckDictChanged(const LLSD& sdValue) -{ - if (gSavedSettings.getBOOL("SpellCheck")) - LLHunspellWrapper::setUseSpellCheck(sdValue.asString()); - return true; -} -// [/SL:KB] - bool toggle_agent_pause(const LLSD& newvalue) { if ( newvalue.asBoolean() ) @@ -861,10 +842,6 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderTransparentWater")->getSignal()->connect(boost::bind(&handleRenderTransparentWaterChanged, _2)); // [SL:KB] - Patch: UI-DndButtonCommit | Checked: 2011-06-19 (Catznip-2.6.0c) | Added: Catznip-2.6.0c gSavedSettings.getControl("DragAndDropCommitDelay")->getSignal()->connect(boost::bind(&handleSettingF32Change, _2, &DELAY_DRAG_HOVER_COMMIT)); -// [/SL:KB] - gSavedSettings.getControl("SpellCheck")->getSignal()->connect(boost::bind(&handleSpellCheckChanged, _2)); - gSavedSettings.getControl("SpellCheckDictionary")->getSignal()->connect(boost::bind(&handleSpellCheckDictChanged, _2)); -// [/SL:KB] gSavedSettings.getControl("AvatarZOffset")->getSignal()->connect(boost::bind(&handleAvatarZOffsetChanged, _2)); // ## Zi: Moved Avatar Z offset from RLVa to here gSavedSettings.getControl("FSUseV1Menus")->getSignal()->connect(boost::bind(&show_v1_menus)); // V1 menu system -WoLf // Is done inside XUI now, using visibility_control diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4f8bad3ef7..8585cd6928 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -40,9 +40,6 @@ #include "llinventorypanel.h" #include "llnotifications.h" #include "llnotificationsutil.h" -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) -#include "llspellcheckmenuhandler.h" -// [/SL:KB] // newview includes #include "llagent.h" @@ -5892,68 +5889,6 @@ class LLViewEnableLastChatter : public view_listener_t } }; -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a -void spellCheck_ReplaceWithSuggestion(LLUICtrl* pMenuItemCtrl, const LLSD& sdParam) -{ - LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - if ( (!pSpellCheckHandler) || (!pSpellCheckHandler->useSpellCheck()) ) - return; - - U32 idxSuggestion = 0; - if ( (!LLStringUtil::convertToU32(sdParam.asString(), idxSuggestion)) || (idxSuggestion >= pSpellCheckHandler->getSuggestionCount()) ) - return; - - pSpellCheckHandler->replaceWithSuggestion(idxSuggestion); -} - -bool spellCheck_VisibleSuggestion(LLUICtrl* pMenuItemCtrl, const LLSD& sdParam) -{ - LLMenuItemGL* pMenuItem = dynamic_cast(pMenuItemCtrl); - const LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - if ( (!pSpellCheckHandler) || (!pSpellCheckHandler->useSpellCheck()) ) - return false; - - U32 idxSuggestion = 0; - if ( (!LLStringUtil::convertToU32(sdParam.asString(), idxSuggestion)) || (idxSuggestion >= pSpellCheckHandler->getSuggestionCount()) ) - return false; - - pMenuItem->setLabel(pSpellCheckHandler->getSuggestion(idxSuggestion)); - return true; -} - -void spellCheck_AddToDictionary(LLUICtrl* pMenuItemCtrl) -{ - LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - if ( (pSpellCheckHandler) && (pSpellCheckHandler->canAddToDictionary()) ) - pSpellCheckHandler->addToDictionary(); -} - -bool spellCheck_EnableAddToDictionary(LLUICtrl* pMenuItemCtrl) -{ - const LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - return (pSpellCheckHandler) && (pSpellCheckHandler->canAddToDictionary()); -} - -void spellCheck_AddToIgnore(LLUICtrl* pMenuItemCtrl) -{ - LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - if ( (pSpellCheckHandler) && (pSpellCheckHandler->canAddToIgnore()) ) - pSpellCheckHandler->addToIgnore(); -} - -bool spellCheck_EnableAddToIgnore(LLUICtrl* pMenuItemCtrl) -{ - const LLContextMenu* pMenu = dynamic_cast(pMenuItemCtrl->getParent()); - const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast(pMenu->getSpawningView()) : NULL; - return (pSpellCheckHandler) && (pSpellCheckHandler->canAddToIgnore()); -} -// [/SL:KB] - class LLEditEnableDeselect : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9443,18 +9378,6 @@ void toggleTeleportHistory() // pick up the menu properly. void initialize_edit_menu() { -// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a - LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); - LLUICtrl::EnableCallbackRegistry::Registrar& enable = LLUICtrl::EnableCallbackRegistry::currentRegistrar(); - - commit.add("SpellCheck.ReplaceWithSuggestion", boost::bind(&spellCheck_ReplaceWithSuggestion, _1, _2)); - enable.add("SpellCheck.VisibleSuggestion", boost::bind(&spellCheck_VisibleSuggestion, _1, _2)); - commit.add("SpellCheck.AddToDictionary", boost::bind(&spellCheck_AddToDictionary, _1)); - enable.add("SpellCheck.EnableAddToDictionary", boost::bind(&spellCheck_EnableAddToDictionary, _1)); - commit.add("SpellCheck.AddToIgnore", boost::bind(&spellCheck_AddToIgnore, _1)); - enable.add("SpellCheck.EnableAddToIgnore", boost::bind(&spellCheck_EnableAddToIgnore, _1)); -// [/SL:KB] - view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo"); view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo"); view_listener_t::addMenu(new LLEditCut(), "Edit.Cut"); diff --git a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml index c1116742d7..7945326328 100644 --- a/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/ansastorm/xui/en/panel_toolbar_view.xml @@ -231,7 +231,6 @@ top="4" right="-12" follows="left|right|bottom" - spellcheck="true" visible="true" /> - - - Haupt-Wörterbuch: - - - diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 2048835a1b..20ee7c946d 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -397,7 +397,6 @@ label="To" layout="bottomleft" select_on_focus="true" - spellcheck="true" name="chat_editor" tab_group="1" width="238"> diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml index 1a65babaa2..e131b4d792 100644 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml @@ -138,7 +138,6 @@ font="SansSerifSmall" height="20" label="To nearby chat" - spellcheck="true" name="chat_box" tab_group="3" /> diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 337176d7fc..14ed2e96ab 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -138,14 +138,6 @@ layout="topleft" help_topic="preferences_advanced1_tab" name="advanced1" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Main dictionary: - - + diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 10c29e7c16..1cb94cf608 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -229,7 +229,6 @@ top="4" right="-12" follows="left|right|bottom" - spellcheck="true" visible="true" /> - - - Diccionario principal: - - - - diff --git a/indra/newview/skins/metaharper/xui/en/floater_nearby_chat.xml b/indra/newview/skins/metaharper/xui/en/floater_nearby_chat.xml index 39e47fc8b9..d1de80ca2f 100644 --- a/indra/newview/skins/metaharper/xui/en/floater_nearby_chat.xml +++ b/indra/newview/skins/metaharper/xui/en/floater_nearby_chat.xml @@ -141,7 +141,6 @@ font="SansSerifSmall" height="20" label="To nearby chat" - spellcheck="true" name="chat_box" tab_group="3" /> diff --git a/indra/newview/skins/metaharper/xui/en/panel_toolbar_view.xml b/indra/newview/skins/metaharper/xui/en/panel_toolbar_view.xml index ebcdaa417a..4590a8d5c4 100644 --- a/indra/newview/skins/metaharper/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/metaharper/xui/en/panel_toolbar_view.xml @@ -233,7 +233,6 @@ top="4" right="-12" follows="left|right|bottom" - spellcheck="true" visible="true" /> diff --git a/indra/newview/skins/starlight/xui/en/panel_toolbar_view.xml b/indra/newview/skins/starlight/xui/en/panel_toolbar_view.xml index ce1805a3a2..b7ff7e8cdf 100644 --- a/indra/newview/skins/starlight/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/starlight/xui/en/panel_toolbar_view.xml @@ -229,7 +229,6 @@ top="4" right="-12" follows="left|right|bottom" - spellcheck="true" visible="true" /> - diff --git a/indra/newview/skins/starlightcui/xui/en/panel_toolbar_view.xml b/indra/newview/skins/starlightcui/xui/en/panel_toolbar_view.xml index 37405cab14..a75457e786 100644 --- a/indra/newview/skins/starlightcui/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/starlightcui/xui/en/panel_toolbar_view.xml @@ -229,7 +229,6 @@ top="4" right="-12" follows="left|right|bottom" - spellcheck="true" visible="true" /> - - +