summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterpreference.cpp81
-rw-r--r--indra/newview/llfloaterpreference.h11
-rw-r--r--indra/newview/llviewermenu.cpp10
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml20
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_move.xml9
5 files changed, 97 insertions, 34 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index c105f023c7..ac940f4f77 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -282,7 +282,8 @@ std::string LLFloaterPreference::sSkin = "";
LLFloaterPreference::LLFloaterPreference(const LLSD& key)
: LLFloater(key),
mGotPersonalInfo(false),
- mOriginalIMViaEmail(false)
+ mOriginalIMViaEmail(false),
+ mDoubleClickActionDirty(false)
{
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
@@ -320,6 +321,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
mCommitCallbackRegistrar.add("Pref.MaturitySettings", boost::bind(&LLFloaterPreference::onChangeMaturity, this));
mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
+ mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox", boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1));
+ mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick", boost::bind(&LLFloaterPreference::onDoubleClickRadio, this));
sSkin = gSavedSettings.getString("SkinCurrent");
@@ -342,6 +345,8 @@ BOOL LLFloaterPreference::postBuild()
if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
tabcontainer->selectFirstTab();
+ updateDoubleClickControls();
+
getChild<LLUICtrl>("cache_location")->setEnabled(FALSE); // make it read-only but selectable (STORM-227)
std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
setCacheLocation(cache_location);
@@ -475,6 +480,12 @@ void LLFloaterPreference::apply()
gAgent.sendAgentUpdateUserInfo(new_im_via_email,mDirectoryVisibility);
}
}
+
+ if (mDoubleClickActionDirty)
+ {
+ updateDoubleClickSettings();
+ mDoubleClickActionDirty = false;
+ }
}
void LLFloaterPreference::cancel()
@@ -501,6 +512,12 @@ void LLFloaterPreference::cancel()
// reverts any changes to current skin
gSavedSettings.setString("SkinCurrent", sSkin);
+
+ if (mDoubleClickActionDirty)
+ {
+ updateDoubleClickControls();
+ mDoubleClickActionDirty = false;
+ }
}
void LLFloaterPreference::onOpen(const LLSD& key)
@@ -1318,6 +1335,68 @@ void LLFloaterPreference::onClickBlockList()
}
}
+void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl)
+{
+ if (!ctrl) return;
+ mDoubleClickActionDirty = true;
+ LLRadioGroup* radio_double_click_action = getChild<LLRadioGroup>("double_click_action");
+ if (!radio_double_click_action) return;
+ // select default value("teleport") in radio-group.
+ radio_double_click_action->setSelectedIndex(0);
+ // set radio-group enabled depending on state of checkbox
+ radio_double_click_action->setEnabled(ctrl->getValue());
+}
+
+void LLFloaterPreference::onDoubleClickRadio()
+{
+ mDoubleClickActionDirty = true;
+}
+
+void LLFloaterPreference::updateDoubleClickSettings()
+{
+ LLCheckBoxCtrl* double_click_action_cb = getChild<LLCheckBoxCtrl>("double_click_chkbox");
+ if (!double_click_action_cb) return;
+ bool enable = double_click_action_cb->getValue().asBoolean();
+
+ LLRadioGroup* radio_double_click_action = getChild<LLRadioGroup>("double_click_action");
+ if (!radio_double_click_action) return;
+
+ // enable double click radio-group depending on state of checkbox
+ radio_double_click_action->setEnabled(enable);
+
+ if (!enable)
+ {
+ // set double click action settings values to false if checkbox was unchecked
+ gSavedSettings.setBOOL("DoubleClickAutoPilot", false);
+ gSavedSettings.setBOOL("DoubleClickTeleport", false);
+ }
+ else
+ {
+ std::string selected = radio_double_click_action->getValue().asString();
+ bool teleport_selected = selected == "radio_teleport";
+ // set double click action settings values depending on chosen radio-button
+ gSavedSettings.setBOOL( "DoubleClickTeleport", teleport_selected );
+ gSavedSettings.setBOOL( "DoubleClickAutoPilot", !teleport_selected );
+ }
+}
+
+void LLFloaterPreference::updateDoubleClickControls()
+{
+ // check is one of double-click actions settings enabled
+ bool double_click_action_enabled = gSavedSettings.getBOOL("DoubleClickAutoPilot") || gSavedSettings.getBOOL("DoubleClickTeleport");
+ LLCheckBoxCtrl* double_click_action_cb = getChild<LLCheckBoxCtrl>("double_click_chkbox");
+ if (double_click_action_cb)
+ {
+ // check checkbox if one of double-click actions settings enabled, uncheck otherwise
+ double_click_action_cb->setValue(double_click_action_enabled);
+ }
+ LLRadioGroup* double_click_action_radio = getChild<LLRadioGroup>("double_click_action");
+ if (!double_click_action_radio) return;
+ // set radio-group enabled if one of double-click actions settings enabled
+ double_click_action_radio->setEnabled(double_click_action_enabled);
+ // select button in radio-group depending on setting
+ double_click_action_radio->setSelectedIndex(gSavedSettings.getBOOL("DoubleClickAutoPilot"));
+}
void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
{
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index e99731b92e..46f50d9a4d 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -95,6 +95,14 @@ protected:
void setHardwareDefaults();
// callback for when client turns on shaders
void onVertexShaderEnable();
+ // callback for changing double click action checkbox
+ void onDoubleClickCheckBox(LLUICtrl* ctrl);
+ // callback for selecting double click action radio-button
+ void onDoubleClickRadio();
+ // updates double-click action settings depending on controls from preferences
+ void updateDoubleClickSettings();
+ // updates double-click action controls depending on values from settings.xml
+ void updateDoubleClickControls();
// This function squirrels away the current values of the controls so that
// cancel() can restore them.
@@ -145,6 +153,9 @@ public:
static void refreshSkin(void* data);
private:
static std::string sSkin;
+ // set true if state of double-click action checkbox or radio-group was changed by user
+ // (reset back to false on apply or cancel)
+ bool mDoubleClickActionDirty;
bool mGotPersonalInfo;
bool mOriginalIMViaEmail;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 2874a6ec79..54fe34e738 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6500,16 +6500,6 @@ class LLToggleControl : public view_listener_t
std::string control_name = userdata.asString();
BOOL checked = gSavedSettings.getBOOL( control_name );
gSavedSettings.setBOOL( control_name, !checked );
-
- // Doubleclick actions - there can be only one
- if ((control_name == "DoubleClickAutoPilot") && !checked)
- {
- gSavedSettings.setBOOL( "DoubleClickTeleport", FALSE );
- }
- else if ((control_name == "DoubleClickTeleport") && !checked)
- {
- gSavedSettings.setBOOL( "DoubleClickAutoPilot", FALSE );
- }
return true;
}
};
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 9fcf952bf0..f74b6ba7b5 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2661,26 +2661,6 @@
function="Advanced.PrintTextureMemoryStats" />
</menu_item_call>
<menu_item_check
- label="Double-ClickAuto-Pilot"
- name="Double-ClickAuto-Pilot">
- <menu_item_check.on_check
- function="CheckControl"
- parameter="DoubleClickAutoPilot" />
- <menu_item_check.on_click
- function="ToggleControl"
- parameter="DoubleClickAutoPilot" />
- </menu_item_check>
- <menu_item_check
- label="Double-Click Teleport"
- name="DoubleClick Teleport">
- <menu_item_check.on_check
- function="CheckControl"
- parameter="DoubleClickTeleport" />
- <menu_item_check.on_click
- function="ToggleControl"
- parameter="DoubleClickTeleport" />
- </menu_item_check>
- <menu_item_check
label="Region Debug Console"
name="Region Debug Console"
shortcut="control|shift|`"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml
index c893a92e7c..d2fc6ea09a 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml
@@ -177,7 +177,10 @@
left_delta="0"
name="double_click_chkbox"
width="237"
- top_pad="0"/>
+ top_pad="0">
+ <check_box.commit_callback
+ function="Pref.CommitDoubleClickChekbox"/>
+ </check_box>
<radio_group
height="20"
layout="topleft"
@@ -191,7 +194,6 @@
left="0"
name="radio_teleport"
top_delta="20"
- value="0"
width="100" />
<radio_item
height="16"
@@ -200,8 +202,9 @@
layout="topleft"
name="radio_autopilot"
top_delta="0"
- value="1"
width="75" />
+ <radio_group.commit_callback
+ function="Pref.CommitRadioDoubleClick"/>
</radio_group>
<button
height="23"