diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterpreference.cpp | 95 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/textures.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/textures/widgets/Arrow_Left.png | bin | 0 -> 311 bytes | |||
-rw-r--r-- | indra/newview/skins/default/textures/widgets/Arrow_Right.png | bin | 0 -> 313 bytes | |||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences.xml | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_spellcheck.xml | 132 |
7 files changed, 237 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000000..a424282839 --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/Arrow_Left.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Right.png b/indra/newview/skins/default/textures/widgets/Arrow_Right.png Binary files differnew file mode 100644 index 0000000000..e32bee8f34 --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/Arrow_Right.png 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> |