summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/lllineeditor.cpp1
-rw-r--r--indra/llui/llspellcheck.cpp12
-rw-r--r--indra/llui/llspellcheck.h29
-rw-r--r--indra/llui/lltextbase.cpp1
-rwxr-xr-xindra/newview/llfloaterpreference.cpp95
-rw-r--r--indra/newview/llfloaterpreference.h2
-rw-r--r--indra/newview/skins/default/textures/textures.xml2
-rw-r--r--indra/newview/skins/default/textures/widgets/Arrow_Left.pngbin0 -> 311 bytes
-rw-r--r--indra/newview/skins/default/textures/widgets/Arrow_Right.pngbin0 -> 313 bytes
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences.xml6
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_spellcheck.xml132
11 files changed, 261 insertions, 19 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index e67753292e..42cfc4cae9 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -617,6 +617,7 @@ bool LLLineEditor::isMisspelledWord(U32 pos) const
void LLLineEditor::onSpellCheckSettingsChange()
{
// Recheck the spelling on every change
+ mMisspellRanges.clear();
mSpellCheckStart = mSpellCheckEnd = -1;
}
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 433ca02852..65207144f8 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -186,7 +186,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri
}
}
-void LLSpellChecker::setSecondaryDictionaries(std::list<std::string> dict_list)
+void LLSpellChecker::setSecondaryDictionaries(dict_list_t dict_list)
{
if (!getUseSpellCheck())
{
@@ -194,11 +194,11 @@ void LLSpellChecker::setSecondaryDictionaries(std::list<std::string> dict_list)
}
// Check if we're only adding secondary dictionaries, or removing them
- std::list<std::string> dict_add(llmax(dict_list.size(), mDictSecondary.size())), dict_rem(llmax(dict_list.size(), mDictSecondary.size()));
+ dict_list_t dict_add(llmax(dict_list.size(), mDictSecondary.size())), dict_rem(llmax(dict_list.size(), mDictSecondary.size()));
dict_list.sort();
mDictSecondary.sort();
- std::list<std::string>::iterator end_added = std::set_difference(dict_list.begin(), dict_list.end(), mDictSecondary.begin(), mDictSecondary.end(), dict_add.begin());
- std::list<std::string>::iterator end_removed = std::set_difference(mDictSecondary.begin(), mDictSecondary.end(), dict_list.begin(), dict_list.end(), dict_rem.begin());
+ dict_list_t::iterator end_added = std::set_difference(dict_list.begin(), dict_list.end(), mDictSecondary.begin(), mDictSecondary.end(), dict_add.begin());
+ dict_list_t::iterator end_removed = std::set_difference(mDictSecondary.begin(), mDictSecondary.end(), dict_list.begin(), dict_list.end(), dict_rem.begin());
if (end_removed != dict_rem.begin()) // We can't remove secondary dictionaries so we need to recreate the Hunspell instance
{
@@ -211,7 +211,7 @@ void LLSpellChecker::setSecondaryDictionaries(std::list<std::string> dict_list)
{
const std::string app_path = getDictionaryAppPath();
const std::string user_path = getDictionaryUserPath();
- for (std::list<std::string>::const_iterator it_added = dict_add.begin(); it_added != end_added; ++it_added)
+ for (dict_list_t::const_iterator it_added = dict_add.begin(); it_added != end_added; ++it_added)
{
const LLSD dict_entry = getDictionaryData(*it_added);
if ( (!dict_entry.isDefined()) || (!dict_entry["installed"].asBoolean()) )
@@ -287,7 +287,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_name)
}
}
- for (std::list<std::string>::const_iterator it = mDictSecondary.begin(); it != mDictSecondary.end(); ++it)
+ for (dict_list_t::const_iterator it = mDictSecondary.begin(); it != mDictSecondary.end(); ++it)
{
const LLSD dict_entry = getDictionaryData(*it);
if ( (!dict_entry.isDefined()) || (!dict_entry["installed"].asBoolean()) )
diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h
index affdac2907..8351655b49 100644
--- a/indra/llui/llspellcheck.h
+++ b/indra/llui/llspellcheck.h
@@ -44,17 +44,20 @@ public:
void addToIgnoreList(const std::string& word);
bool checkSpelling(const std::string& word) const;
S32 getSuggestions(const std::string& word, std::vector<std::string>& suggestions) const;
-
-public:
- const LLSD getDictionaryData(const std::string& dict_name) const;
- const LLSD& getDictionaryMap() const { return mDictMap; }
- void refreshDictionaryMap();
- void setSecondaryDictionaries(std::list<std::string> dictList);
protected:
- void addToDictFile(const std::string& dict_path, const std::string& word);
- void initHunspell(const std::string& dict_name);
+ void addToDictFile(const std::string& dict_path, const std::string& word);
+ void initHunspell(const std::string& dict_name);
public:
+ typedef std::list<std::string> dict_list_t;
+
+ const std::string& getActiveDictionary() const { return mDictName; }
+ const LLSD getDictionaryData(const std::string& dict_name) const;
+ const LLSD& getDictionaryMap() const { return mDictMap; }
+ const dict_list_t& getSecondaryDictionaries() const { return mDictSecondary; }
+ void refreshDictionaryMap();
+ void setSecondaryDictionaries(dict_list_t dict_list);
+
static const std::string getDictionaryAppPath();
static const std::string getDictionaryUserPath();
static bool getUseSpellCheck();
@@ -64,11 +67,11 @@ public:
static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb);
protected:
- Hunspell* mHunspell;
- std::string mDictName;
- std::string mDictFile;
- LLSD mDictMap;
- std::list<std::string> mDictSecondary;
+ Hunspell* mHunspell;
+ std::string mDictName;
+ std::string mDictFile;
+ LLSD mDictMap;
+ dict_list_t mDictSecondary;
std::vector<std::string> mIgnoreList;
static settings_change_signal_t sSettingsChangeSignal;
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 7eee1d39c4..2231d9b983 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1308,6 +1308,7 @@ bool LLTextBase::isMisspelledWord(U32 pos) const
void LLTextBase::onSpellCheckSettingsChange()
{
// Recheck the spelling on every change
+ mMisspellRanges.clear();
mSpellCheckStart = mSpellCheckEnd = -1;
}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a333989e7e..29b07d2479 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -66,6 +66,7 @@
#include "llsky.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
+#include "llspellcheck.h"
#include "llsliderctrl.h"
#include "lltabcontainer.h"
#include "lltrans.h"
@@ -110,6 +111,8 @@
#include "lllogininstance.h" // to check if logged in yet
#include "llsdserialize.h"
+#include <boost/algorithm/string.hpp>
+
const F32 MAX_USER_FAR_CLIP = 512.f;
const F32 MIN_USER_FAR_CLIP = 64.f;
const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f;
@@ -445,6 +448,9 @@ BOOL LLFloaterPreference::postBuild()
getChild<LLComboBox>("language_combobox")->setCommitCallback(boost::bind(&LLFloaterPreference::onLanguageChange, this));
+ getChild<LLUICtrl>("btn_spellcheck_moveleft")->setCommitCallback(boost::bind(&LLFloaterPreference::onClickDictMove, this, "list_spellcheck_active", "list_spellcheck_available"));
+ getChild<LLUICtrl>("btn_spellcheck_moveright")->setCommitCallback(boost::bind(&LLFloaterPreference::onClickDictMove, this, "list_spellcheck_available", "list_spellcheck_active"));
+
// if floater is opened before login set default localized busy message
if (LLStartUp::getStartupState() < STATE_STARTED)
{
@@ -577,6 +583,19 @@ void LLFloaterPreference::apply()
}
}
+ if (hasChild("check_spellcheck"), TRUE)
+ {
+ LLScrollListCtrl* list_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_active");
+ std::vector<LLScrollListItem*> list_items = list_ctrl->getAllData();
+
+ std::list<std::string> list_dict;
+ list_dict.push_back(LLSpellChecker::instance().getActiveDictionary());
+ for (std::vector<LLScrollListItem*>::const_iterator item_it = list_items.begin(); item_it != list_items.end(); ++item_it)
+ list_dict.push_back((*item_it)->getColumn(0)->getValue().asString());
+
+ gSavedSettings.setString("SpellCheckDictionary", boost::join(list_dict, ","));
+ }
+
saveAvatarProperties();
if (mClickActionDirty)
@@ -687,6 +706,8 @@ void LLFloaterPreference::onOpen(const LLSD& key)
// Load (double-)click to walk/teleport settings.
updateClickActionControls();
+ buildDictLists();
+
// Enabled/disabled popups, might have been changed by user actions
// while preferences floater was closed.
buildPopupLists();
@@ -865,6 +886,25 @@ void LLFloaterPreference::onNameTagOpacityChange(const LLSD& newvalue)
}
}
+void LLFloaterPreference::onClickDictMove(const std::string& from, const std::string& to)
+{
+ LLScrollListCtrl* from_ctrl = findChild<LLScrollListCtrl>(from);
+ LLScrollListCtrl* to_ctrl = findChild<LLScrollListCtrl>(to);
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
+ row["columns"][0]["font"]["style"] = "NORMAL";
+
+ std::vector<LLScrollListItem*> sel_items = from_ctrl->getAllSelected();
+ for (std::vector<LLScrollListItem*>::const_iterator sel_it = sel_items.begin(); sel_it != sel_items.end(); ++sel_it)
+ {
+ row["columns"][0]["value"] = (*sel_it)->getColumn(0)->getValue();
+ to_ctrl->addElement(row);
+ }
+ from_ctrl->deleteSelectedItems();
+}
+
void LLFloaterPreference::onClickSetCache()
{
std::string cur_name(gSavedSettings.getString("CacheLocation"));
@@ -930,6 +970,61 @@ void LLFloaterPreference::refreshSkin(void* data)
self->getChild<LLRadioGroup>("skin_selection", true)->setValue(sSkin);
}
+void LLFloaterPreference::buildDictLists()
+{
+ LLComboBox* dict_combo = findChild<LLComboBox>("combo_spellcheck_dict");
+ dict_combo->clearRows();
+
+ LLScrollListCtrl* active_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_active");
+ active_ctrl->clearRows();
+
+ LLScrollListCtrl* avail_ctrl = findChild<LLScrollListCtrl>("list_spellcheck_available");
+ avail_ctrl->clearRows();
+
+ if (LLSpellChecker::getUseSpellCheck())
+ {
+ // Populate the main dictionary combobox
+ const LLSD& dict_map = LLSpellChecker::instance().getDictionaryMap();
+ if (dict_map.size())
+ {
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ if ( (dict["installed"].asBoolean()) && (dict.has("language")) )
+ dict_combo->add(dict["language"].asString());
+ }
+ dict_combo->selectByValue(LLSpellChecker::instance().getActiveDictionary());
+ }
+
+ LLSD row;
+ row["columns"][0]["column"] = "name";
+ row["columns"][0]["font"]["name"] = "SANSSERIF_SMALL";
+ row["columns"][0]["font"]["style"] = "NORMAL";
+
+ // Populate the active dictionary list
+ LLSpellChecker::dict_list_t active_list = LLSpellChecker::instance().getSecondaryDictionaries();
+ active_ctrl->sortByColumnIndex(0, true);
+ for (LLSpellChecker::dict_list_t::const_iterator it = active_list.begin(); it != active_list.end(); ++it)
+ {
+ row["columns"][0]["value"] = *it;
+ active_ctrl->addElement(row);
+ }
+ active_list.push_back(LLSpellChecker::instance().getActiveDictionary());
+
+ // Populate the available dictionary list
+ avail_ctrl->sortByColumnIndex(0, true);
+ for (LLSD::array_const_iterator dict_it = dict_map.beginArray(); dict_it != dict_map.endArray(); ++dict_it)
+ {
+ const LLSD& dict = *dict_it;
+ if ( (dict["installed"].asBoolean()) && (dict.has("language")) &&
+ (active_list.end() == std::find(active_list.begin(), active_list.end(), dict["language"].asString())) )
+ {
+ row["columns"][0]["value"] = dict["language"].asString();
+ avail_ctrl->addElement(row);
+ }
+ }
+ }
+}
void LLFloaterPreference::buildPopupLists()
{
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 7ee3294478..cd258b5614 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -121,6 +121,7 @@ public:
void setCacheLocation(const LLStringExplicit& location);
+ void onClickDictMove(const std::string& from, const std::string& to);
void onClickSetCache();
void onClickResetCache();
void onClickSkin(LLUICtrl* ctrl,const LLSD& userdata);
@@ -160,6 +161,7 @@ public:
void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
void getUIColor(LLUICtrl* ctrl, const LLSD& param);
+ void buildDictLists();
void buildPopupLists();
static void refreshSkin(void* data);
private:
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 8702ebde2a..bc0363014a 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -54,6 +54,8 @@ with the same filename but different name
<texture name="Arrow_Down" file_name="widgets/Arrow_Down.png" preload="true" />
<texture name="Arrow_Up" file_name="widgets/Arrow_Up.png" preload="true" />
+ <texture name="Arrow_Left" file_name="widgets/Arrow_Left.png" preload="true" />
+ <texture name="Arrow_Right" file_name="widgets/Arrow_Right.png" preload="true" />
<texture name="AudioMute_Off" file_name="icons/AudioMute_Off.png" preload="false" />
<texture name="AudioMute_Over" file_name="icons/AudioMute_Over.png" preload="false" />
diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Left.png b/indra/newview/skins/default/textures/widgets/Arrow_Left.png
new file mode 100644
index 0000000000..a424282839
--- /dev/null
+++ b/indra/newview/skins/default/textures/widgets/Arrow_Left.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Right.png b/indra/newview/skins/default/textures/widgets/Arrow_Right.png
new file mode 100644
index 0000000000..e32bee8f34
--- /dev/null
+++ b/indra/newview/skins/default/textures/widgets/Arrow_Right.png
Binary files differ
diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml
index 402868bb97..eebc3a9cca 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences.xml
@@ -120,6 +120,12 @@
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" />
</tab_container>
</floater>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_spellcheck.xml b/indra/newview/skins/default/xui/en/panel_preferences_spellcheck.xml
new file mode 100644
index 0000000000..9b5d429846
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_preferences_spellcheck.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ border="true"
+ follows="left|top|right|bottom"
+ height="408"
+ label="Spell Check"
+ layout="topleft"
+ left="102"
+ name="spellcheck"
+ top="1"
+ width="517">
+ <check_box
+ control_name="SpellCheck"
+ enabled="true"
+ follows="top|left"
+ height="16"
+ label="Enable spell checking"
+ layout="topleft"
+ left="30"
+ name="check_spellcheck"
+ top="30"
+ width="250"
+ />
+ <text
+ enabled_control="SpellCheck"
+ follows="top|left"
+ height="10"
+ label="Logs:"
+ layout="topleft"
+ left="55"
+ mouse_opaque="false"
+ name="text_spellcheck_dict"
+ top_pad="15"
+ type="string"
+ width="90"
+ >
+ Main dictionary :
+ </text>
+ <combo_box
+ enabled_control="SpellCheck"
+ follows="top|left"
+ height="23"
+ layout="topleft"
+ left_pad="10"
+ name="combo_spellcheck_dict"
+ top_pad="-15"
+ width="175"
+ />
+
+ <text
+ enabled_control="SpellCheck"
+ follows="top|left"
+ height="10"
+ label="Logs:"
+ layout="topleft"
+ left="55"
+ mouse_opaque="false"
+ name="text_spellcheck_additional"
+ top_pad="15"
+ type="string"
+ width="190"
+ >
+ Additional dictionaries :
+ </text>
+ <text
+ follows="top|left"
+ height="12"
+ layout="topleft"
+ left="80"
+ length="1"
+ name="text_spellcheck_available"
+ top_pad="10"
+ type="string"
+ width="175">
+ Available
+ </text>
+ <text
+ follows="top|left"
+ height="12"
+ type="string"
+ left_pad="45"
+ length="1"
+ layout="topleft"
+ name="text_spellcheck_active"
+ width="175">
+ Active
+ </text>
+ <scroll_list
+ follows="top|left"
+ height="155"
+ layout="topleft"
+ left="80"
+ multi_select="true"
+ name="list_spellcheck_available"
+ sort_column="0"
+ sort_ascending="true"
+ width="175" />
+ <button
+ follows="top|left"
+ height="26"
+ image_overlay="Arrow_Right"
+ hover_glow_amount="0.15"
+ layout="topleft"
+ left_pad="10"
+ name="btn_spellcheck_moveright"
+ top_delta="50"
+ width="25">
+ </button>
+ <button
+ follows="top|left"
+ height="26"
+ image_overlay="Arrow_Left"
+ hover_glow_amount="0.15"
+ layout="topleft"
+ name="btn_spellcheck_moveleft"
+ top_delta="30"
+ width="25">
+ </button>
+ <scroll_list
+ follows="top|left"
+ height="155"
+ layout="topleft"
+ left_pad="10"
+ multi_select="true"
+ name="list_spellcheck_active"
+ sort_column="0"
+ sort_ascending="true"
+ top_pad="-105"
+ width="175"
+ />
+
+</panel>