removed spellcheck, to be replaced by LL's version
parent
0d52c043d4
commit
0d4ca6478f
|
|
@ -1648,55 +1648,6 @@
|
|||
</map>
|
||||
</map>
|
||||
|
||||
<key>libhunspell</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
<string>MPL_LGPL</string>
|
||||
<key>license_file</key>
|
||||
<string>LICENSES/license.hunspell</string>
|
||||
<key>name</key>
|
||||
<string>libhunspell</string>
|
||||
<key>platforms</key>
|
||||
<map>
|
||||
<key>darwin</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>aeab54c3a956acdc0f004e28e4feffdb</string>
|
||||
<key>url</key>
|
||||
<string>http://phoenixviewer.com/app/packages/libhunspell-1.3.2-darwin-20110925.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>darwin</string>
|
||||
</map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>535036d910262c5f10da0215bdde38f1</string>
|
||||
<key>url</key>
|
||||
<string>http://phoenixviewer.com/app/packages/libhunspell-1.3.2-linux-20110919.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>linux</string>
|
||||
</map>
|
||||
<key>windows</key>
|
||||
<map>
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>52aabfc137a0091f35cda7089a95d7d2</string>
|
||||
<key>url</key>
|
||||
<string>http://phoenixviewer.com/app/packages/libhunspell-1.3.2-windows-20110919.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>windows</string>
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
|
||||
<key>nd_hacdConvexDecomposition</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ set(cmake_SOURCE_FILES
|
|||
GooglePerfTools.cmake
|
||||
Growl.cmake
|
||||
HACD.cmake
|
||||
Hunspell.cmake
|
||||
JPEG.cmake
|
||||
LLAddBuildTest.cmake
|
||||
LLAudio.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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <hunspell/hunspelldll.h>
|
||||
#pragma comment(lib, "libhunspell.lib")
|
||||
#else
|
||||
#include <hunspell/hunspell.hxx>
|
||||
#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<std::string>& 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<std::string>& 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<std::string>& 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<std::string> 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<std::string>::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);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
@ -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 <boost/signals2.hpp>
|
||||
|
||||
class Hunspell;
|
||||
|
||||
// ============================================================================
|
||||
|
||||
class LLHunspellWrapper : public LLSingleton<LLHunspellWrapper>
|
||||
{
|
||||
friend class LLSingleton<LLHunspellWrapper>;
|
||||
protected:
|
||||
LLHunspellWrapper();
|
||||
~LLHunspellWrapper();
|
||||
|
||||
public:
|
||||
bool checkSpelling(const std::string& strWord) const;
|
||||
S32 getSuggestions(const std::string& strWord, std::vector<std::string>& strSuggestionList) const;
|
||||
|
||||
/*
|
||||
* Dictionary related functions
|
||||
*/
|
||||
public:
|
||||
const std::string getCurrentDictionary() const { return m_strDictionaryName; }
|
||||
S32 getDictionaries(std::vector<std::string>& strDictionaryList) const;
|
||||
S32 getInstalledDictionaries(std::vector<std::string>& 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<void()> 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<std::string> m_IgnoreList;
|
||||
|
||||
static settings_change_signal_t s_SettingsChangeSignal;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
#endif // LL_HUNSPELL_H
|
||||
|
|
@ -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<std::pair<U32, U32> >::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<std::pair<U32, U32> >::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<std::pair<U32, U32> >::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<U32, U32>(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<std::pair<U32, U32> >::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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<bool> 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<std::pair<U32, U32> > mMisspellRanges;
|
||||
std::vector<std::string> mSuggestionList;
|
||||
// [/SL:KB]
|
||||
|
||||
LLFrameTimer mKeystrokeTimer;
|
||||
LLTimer mTripleClickTimer;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -682,20 +682,11 @@ public:
|
|||
BOOL appendContextSubMenu(LLContextMenu *menu);
|
||||
|
||||
LLHandle<LLContextMenu> getHandle() { return getDerivedHandle<LLContextMenu>(); }
|
||||
|
||||
// [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<LLView> hSpawningView) { mSpawningViewHandle = hSpawningView; }
|
||||
// [/SL:KB]
|
||||
|
||||
|
||||
protected:
|
||||
BOOL mHoveredAnyItem;
|
||||
LLMenuItemGL* mHoverItem;
|
||||
LLRootHandle<LLContextMenu> mHandle;
|
||||
// [SL:KB] - Patch: Misc-Spellcheck | Checked: 2010-12-19 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
|
||||
LLHandle<LLView> mSpawningViewHandle;
|
||||
// [/SL:KB]
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -43,17 +43,9 @@
|
|||
#include "llwindow.h"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
// [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<LLView>(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<U32, U32>(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<std::pair<U32, U32> >::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; }
|
||||
|
|
|
|||
|
|
@ -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<LLTextSegment> 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]
|
||||
|
||||
|
||||
//<FS:KC - expose ParseHTML setting>
|
||||
void setParseHTML(bool parse_html) { mParseHTML = parse_html; }
|
||||
//</FS:KC - expose ParseHTML setting>
|
||||
|
|
@ -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<std::pair<U32, U32> > mMisspellRanges;
|
||||
|
||||
// Constant
|
||||
static const F32 SPELLCHECK_DELAY;
|
||||
// [/SL:KB]
|
||||
|
||||
|
||||
// configuration
|
||||
S32 mHPad; // padding on left of text
|
||||
S32 mVPad; // padding above text
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@
|
|||
#include <queue>
|
||||
#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<std::pair<U32, U32> >::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<std::pair<U32, U32> >::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<std::pair<U32, U32> >::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
|
||||
|
|
|
|||
|
|
@ -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<std::string> mSuggestionList;
|
||||
// [/SL:KB]
|
||||
|
||||
|
||||
LLUUID mSourceID;
|
||||
|
||||
LLCoordGL mLastIMEPosition; // Last position of the IME editor
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -14736,28 +14736,6 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<real>10.0</real>
|
||||
</map>
|
||||
<key>SpellCheck</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable spellchecking on line and text editors</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>SpellCheckDictionary</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Current dictionary used for spell checking</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>String</string>
|
||||
<key>Value</key>
|
||||
<string>English (United States)</string>
|
||||
</map>
|
||||
<key>UseNewWalkRun</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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" // <FS:AW opensim search support>
|
||||
|
||||
const F32 MAX_USER_FAR_CLIP = 512.f;
|
||||
|
|
@ -2101,22 +2097,7 @@ BOOL LLPanelPreference::postBuild()
|
|||
getChild<LLRadioGroup>("use_external_browser")->setValue(gSavedSettings.getBOOL("UseExternalBrowser"));
|
||||
}
|
||||
// </FS:Ansariel> 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<std::string> dictList;
|
||||
if (LLHunspellWrapper::instance().getInstalledDictionaries(dictList))
|
||||
{
|
||||
LLComboBox* pMainDictionaryList = findChild<LLComboBox>("comboDictionaryMain");
|
||||
for (std::vector<std::string>::const_iterator itDict = dictList.begin(); itDict != dictList.end(); ++itDict)
|
||||
pMainDictionaryList->add(*itDict);
|
||||
pMainDictionaryList->setControlName("SpellCheckDictionary");
|
||||
}
|
||||
}
|
||||
// [/SL:KB]
|
||||
|
||||
|
||||
////////////////////// PanelAlerts ///////////////////
|
||||
if (hasChild("OnlineOfflinetoNearbyChat", TRUE))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
// <FS:Zi> Is done inside XUI now, using visibility_control
|
||||
|
|
|
|||
|
|
@ -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<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(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<LLMenuItemGL*>(pMenuItemCtrl);
|
||||
const LLContextMenu* pMenu = dynamic_cast<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(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<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(pMenu->getSpawningView()) : NULL;
|
||||
if ( (pSpellCheckHandler) && (pSpellCheckHandler->canAddToDictionary()) )
|
||||
pSpellCheckHandler->addToDictionary();
|
||||
}
|
||||
|
||||
bool spellCheck_EnableAddToDictionary(LLUICtrl* pMenuItemCtrl)
|
||||
{
|
||||
const LLContextMenu* pMenu = dynamic_cast<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(pMenu->getSpawningView()) : NULL;
|
||||
return (pSpellCheckHandler) && (pSpellCheckHandler->canAddToDictionary());
|
||||
}
|
||||
|
||||
void spellCheck_AddToIgnore(LLUICtrl* pMenuItemCtrl)
|
||||
{
|
||||
LLContextMenu* pMenu = dynamic_cast<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(pMenu->getSpawningView()) : NULL;
|
||||
if ( (pSpellCheckHandler) && (pSpellCheckHandler->canAddToIgnore()) )
|
||||
pSpellCheckHandler->addToIgnore();
|
||||
}
|
||||
|
||||
bool spellCheck_EnableAddToIgnore(LLUICtrl* pMenuItemCtrl)
|
||||
{
|
||||
const LLContextMenu* pMenu = dynamic_cast<LLContextMenu*>(pMenuItemCtrl->getParent());
|
||||
const LLSpellCheckMenuHandler* pSpellCheckHandler = (pMenu) ? dynamic_cast<LLSpellCheckMenuHandler*>(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");
|
||||
|
|
|
|||
|
|
@ -231,7 +231,6 @@
|
|||
top="4"
|
||||
right="-12"
|
||||
follows="left|right|bottom"
|
||||
spellcheck="true"
|
||||
visible="true" />
|
||||
|
||||
<icon image_name="ChatBarHandle"
|
||||
|
|
|
|||
|
|
@ -209,15 +209,6 @@
|
|||
|
||||
<!-- Chat: Text Input -->
|
||||
<panel label="Texteingabe" name="ChatTextInput">
|
||||
<check_box label="Rechtschreibprüfung aktivieren" name="checkSpellCheck" width="200"/>
|
||||
<text name="textDictionaryMain" width="105">
|
||||
Haupt-Wörterbuch:
|
||||
</text>
|
||||
<check_box label="Auto-Korrektur" name="lgg_ac_enable"
|
||||
tool_tip="Muss aktiviert sein um die Einstellungen für die Auto-Korrektur nutzen zu können"/>
|
||||
<button name="lgg_ac_showgui" label="Auto-Korrektur-Einstellungen"
|
||||
width="170">
|
||||
</button>
|
||||
</panel>
|
||||
|
||||
</tab_container>
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@
|
|||
label="To"
|
||||
layout="bottomleft"
|
||||
select_on_focus="true"
|
||||
spellcheck="true"
|
||||
name="chat_editor"
|
||||
tab_group="1"
|
||||
width="238">
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@
|
|||
font="SansSerifSmall"
|
||||
height="20"
|
||||
label="To nearby chat"
|
||||
spellcheck="true"
|
||||
name="chat_box"
|
||||
tab_group="3" />
|
||||
</layout_panel>
|
||||
|
|
|
|||
|
|
@ -138,14 +138,6 @@
|
|||
layout="topleft"
|
||||
help_topic="preferences_advanced1_tab"
|
||||
name="advanced1" />
|
||||
<!--
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_spellcheck.xml"
|
||||
label="Spell Check"
|
||||
layout="topleft"
|
||||
name="spell_check" />
|
||||
-->
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_UI.xml"
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@
|
|||
max_length="65536"
|
||||
name="Notecard Editor"
|
||||
parse_urls="false"
|
||||
spellcheck="true"
|
||||
tab_group="1"
|
||||
top="46"
|
||||
width="392"
|
||||
|
|
|
|||
|
|
@ -1,85 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<context_menu
|
||||
name="Text editor context menu">
|
||||
<menu_item_call
|
||||
label="(unknown)"
|
||||
layout="topleft"
|
||||
name="Suggestion 1">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.ReplaceWithSuggestion"
|
||||
parameter="0" />
|
||||
<menu_item_call.on_visible
|
||||
function="SpellCheck.VisibleSuggestion"
|
||||
parameter="0" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="(unknown)"
|
||||
layout="topleft"
|
||||
name="Suggestion 2">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.ReplaceWithSuggestion"
|
||||
parameter="1" />
|
||||
<menu_item_call.on_visible
|
||||
function="SpellCheck.VisibleSuggestion"
|
||||
parameter="1" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="(unknown)"
|
||||
layout="topleft"
|
||||
name="Suggestion 3">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.ReplaceWithSuggestion"
|
||||
parameter="2" />
|
||||
<menu_item_call.on_visible
|
||||
function="SpellCheck.VisibleSuggestion"
|
||||
parameter="2" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="(unknown)"
|
||||
layout="topleft"
|
||||
name="Suggestion 4">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.ReplaceWithSuggestion"
|
||||
parameter="3" />
|
||||
<menu_item_call.on_visible
|
||||
function="SpellCheck.VisibleSuggestion"
|
||||
parameter="3" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="(unknown)"
|
||||
layout="topleft"
|
||||
name="Suggestion 5">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.ReplaceWithSuggestion"
|
||||
parameter="4" />
|
||||
<menu_item_call.on_visible
|
||||
function="SpellCheck.VisibleSuggestion"
|
||||
parameter="4" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft"
|
||||
name="Suggestion Separator" />
|
||||
<menu_item_call
|
||||
label="Add to Dictionary"
|
||||
layout="topleft"
|
||||
name="Add to Dictionary">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.AddToDictionary" />
|
||||
<menu_item_call.on_enable
|
||||
function="SpellCheck.EnableAddToDictionary" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Add to Ignore"
|
||||
layout="topleft"
|
||||
name="Add to Ignore">
|
||||
<menu_item_call.on_click
|
||||
function="SpellCheck.AddToIgnore" />
|
||||
<menu_item_call.on_enable
|
||||
function="SpellCheck.EnableAddToIgnore" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft"
|
||||
name="Spellcheck Separator" />
|
||||
<menu_item_call
|
||||
label="Cut"
|
||||
layout="topleft"
|
||||
|
|
|
|||
|
|
@ -152,7 +152,6 @@ Maximum 200 per group daily
|
|||
max_length="63"
|
||||
name="create_subject"
|
||||
prevalidate_callback="ascii"
|
||||
spellcheck="true"
|
||||
width="371" />
|
||||
|
||||
<text
|
||||
|
|
@ -173,7 +172,6 @@ Maximum 200 per group daily
|
|||
left_pad="0"
|
||||
max_length="511"
|
||||
name="create_message"
|
||||
spellcheck="true"
|
||||
top_delta="0"
|
||||
width="369"
|
||||
word_wrap="true"
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
left_delta="3"
|
||||
left="0"
|
||||
max_length_bytes="3000"
|
||||
spellcheck="true"
|
||||
name="chat_box"
|
||||
text_pad_left="5"
|
||||
text_pad_right="25"
|
||||
|
|
|
|||
|
|
@ -1119,40 +1119,7 @@
|
|||
follows="all"
|
||||
label="Text Input"
|
||||
name="ChatTextInput" >
|
||||
|
||||
<check_box
|
||||
control_name="SpellCheck"
|
||||
enabled="true"
|
||||
follows="top|left"
|
||||
height="16"
|
||||
label="Enable spell checking"
|
||||
layout="topleft"
|
||||
left="30"
|
||||
name="checkSpellCheck"
|
||||
top="30"
|
||||
width="150" />
|
||||
<text
|
||||
enabled_control="SpellCheck"
|
||||
follows="top|left"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_pad="10"
|
||||
mouse_opaque="false"
|
||||
name="textDictionaryMain"
|
||||
top_pad="-16"
|
||||
type="string"
|
||||
width="90" >
|
||||
Main dictionary:
|
||||
</text>
|
||||
<combo_box
|
||||
enabled_control="SpellCheck"
|
||||
follows="top|left"
|
||||
height="23"
|
||||
layout="topleft"
|
||||
left_pad="10"
|
||||
name="comboDictionaryMain"
|
||||
top_pad="-15"
|
||||
width="175" />
|
||||
<!--Empty for 3.3.4 merge-->
|
||||
</panel>
|
||||
</tab_container>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@
|
|||
top="4"
|
||||
right="-12"
|
||||
follows="left|right|bottom"
|
||||
spellcheck="true"
|
||||
visible="true" />
|
||||
|
||||
<icon image_name="ChatBarHandle"
|
||||
|
|
|
|||
|
|
@ -175,13 +175,6 @@
|
|||
</text>
|
||||
</panel>
|
||||
<panel label="Entrada de texto" name="ChatTextInput">
|
||||
<check_box label="Activar corrección ortográfica" name="checkSpellCheck" left="20" width="190"/>
|
||||
<text name="textDictionaryMain" width="113" left_pad="10" top_pad="-17">
|
||||
Diccionario principal:
|
||||
</text>
|
||||
<combo_box left_pad="5" name="comboDictionaryMain"/>
|
||||
<check_box label="Activar autocorreción" name="lgg_ac_enable" tool_tip="Debes marcar esta casilla para usar cualquiera de estas configuraciones. La autocorreción buscará en tu escritura y sustituirá las entradas configuradas por su texto de reemplazo" left="20"/>
|
||||
<button name="lgg_ac_showgui" label="Configuración de autocorreción" width="200"/>
|
||||
</panel>
|
||||
</tab_container>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -174,12 +174,6 @@
|
|||
</panel>
|
||||
<!--Dizionari-->
|
||||
<panel label="Dizionari" name="ChatTextInput">
|
||||
<check_box label="Abilita controllo parole" name="checkSpellCheck"/>
|
||||
<text name="textDictionaryMain">
|
||||
Dizionari:
|
||||
</text>
|
||||
<check_box label="Abilita autocorrezione" name="lgg_ac_enable" tool_tip="Spuntando questa casella abiliterete l'autocorrezione, in automatico cercherà le parole corrette e le sostituirà alla parole digitate male, le parole verranno prese dal dizionario selezionato nel menu a tendina."/>
|
||||
<button name="lgg_ac_showgui" label="Impostazioni Autocorrezione" width="180" />
|
||||
</panel>
|
||||
</tab_container>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -168,12 +168,6 @@
|
|||
</text>
|
||||
</panel>
|
||||
<panel label="Wprowadzanie tekstu" name="ChatTextInput">
|
||||
<check_box label="Sprawdzanie pisowni" name="checkSpellCheck"/>
|
||||
<text name="textDictionaryMain">
|
||||
Główny słownik:
|
||||
</text>
|
||||
<check_box label="Włącz autokorektę" name="lgg_ac_enable" tool_tip="To pole musi być zaznaczone, jeśli chcesz korzystać z opcji autokorekty. Autokorekta będzie sprawdzać wszystko co napiszesz w poszukiwaniu słów zdefiniowanych na pierwszej liście i wstawiać na ich na miejsce zamienniki z drugiej listy."/>
|
||||
<button name="lgg_ac_showgui" label="Ustawienia autokorekty"/>
|
||||
</panel>
|
||||
</tab_container>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -189,15 +189,6 @@
|
|||
|
||||
<!-- Chat: Text Input -->
|
||||
<panel label="Ввод текста" name="ChatTextInput">
|
||||
<check_box label="Проверка орфографии" name="checkSpellCheck" width="200"/>
|
||||
Источник:
|
||||
<text name="textDictionaryMain" width="105">
|
||||
</text>
|
||||
<check_box label="Авто корректура" name="lgg_ac_enable"
|
||||
tool_tip=""/>
|
||||
<button name="lgg_ac_showgui" label="Настройки Авто-корректуры"
|
||||
width="170">
|
||||
</button>
|
||||
</panel>
|
||||
|
||||
</tab_container>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@
|
|||
font="SansSerifSmall"
|
||||
height="20"
|
||||
label="To nearby chat"
|
||||
spellcheck="true"
|
||||
name="chat_box"
|
||||
tab_group="3" />
|
||||
</layout_panel>
|
||||
|
|
|
|||
|
|
@ -233,7 +233,6 @@
|
|||
top="4"
|
||||
right="-12"
|
||||
follows="left|right|bottom"
|
||||
spellcheck="true"
|
||||
visible="true" />
|
||||
|
||||
<icon image_name="ChatBarHandle"
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ Maximum 200 per group daily
|
|||
max_length_bytes="63"
|
||||
name="create_subject"
|
||||
prevalidate_callback="ascii"
|
||||
spellcheck="true"
|
||||
width="218" />
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
@ -159,7 +158,6 @@ Maximum 200 per group daily
|
|||
left_pad="3"
|
||||
max_length="511"
|
||||
name="create_message"
|
||||
spellcheck="true"
|
||||
top_delta="0"
|
||||
width="218"
|
||||
word_wrap="true" />
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@
|
|||
top="4"
|
||||
right="-12"
|
||||
follows="left|right|bottom"
|
||||
spellcheck="true"
|
||||
visible="true" />
|
||||
|
||||
<icon image_name="ChatBarHandle"
|
||||
|
|
|
|||
|
|
@ -145,14 +145,6 @@
|
|||
layout="topleft"
|
||||
help_topic="preferences_advanced1_tab"
|
||||
name="advanced1" />
|
||||
<!--
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_spellcheck.xml"
|
||||
label="Spell Check"
|
||||
layout="topleft"
|
||||
name="spell_check" />
|
||||
-->
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_UI.xml"
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ Maximum 200 per group daily
|
|||
max_length_bytes="63"
|
||||
name="create_subject"
|
||||
prevalidate_callback="ascii"
|
||||
spellcheck="true"
|
||||
width="218" />
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
@ -159,7 +158,6 @@ Maximum 200 per group daily
|
|||
left_pad="3"
|
||||
max_length="511"
|
||||
name="create_message"
|
||||
spellcheck="true"
|
||||
top_delta="0"
|
||||
width="218"
|
||||
word_wrap="true" />
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@
|
|||
top="4"
|
||||
right="-12"
|
||||
follows="left|right|bottom"
|
||||
spellcheck="true"
|
||||
visible="true" />
|
||||
|
||||
<icon image_name="ChatBarHandle"
|
||||
|
|
|
|||
|
|
@ -139,14 +139,6 @@
|
|||
layout="topleft"
|
||||
help_topic="preferences_advanced1_tab"
|
||||
name="advanced1" />
|
||||
<!--
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_spellcheck.xml"
|
||||
label="Spell Check"
|
||||
layout="topleft"
|
||||
name="spell_check" />
|
||||
-->
|
||||
<panel
|
||||
class="panel_preference"
|
||||
filename="panel_preferences_UI.xml"
|
||||
|
|
|
|||
|
|
@ -221,14 +221,13 @@
|
|||
parameter="nearby_chat" />
|
||||
</button>
|
||||
|
||||
<nearby_chat_control layout="topleft"
|
||||
name="default_chat_bar"
|
||||
label="To nearby chat"
|
||||
left_pad="8"
|
||||
height="20"
|
||||
right="-4"
|
||||
follows="all"
|
||||
spellcheck="true" />
|
||||
<nearby_chat_control layout="topleft"
|
||||
name="default_chat_bar"
|
||||
label="To nearby chat"
|
||||
left_pad="8"
|
||||
height="20"
|
||||
right="-4"
|
||||
follows="all" />
|
||||
</layout_panel>
|
||||
<!-- Panel to house the chat bar in, will be set visible/invisible in code
|
||||
as parent of the chat control -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue