Commits

Scott Lawrence committed eeb5824 Merge

merge changes for storm-1612

  • Participants
  • Parent commits 16ec3bd, 99b9161

Comments (0)

Files changed (6)

indra/newview/app_settings/settings.xml

       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>ShowOfferedInventory</key>
     <map>

indra/newview/llfloaterpreference.cpp

 	mOriginalIMViaEmail(false),
 	mLanguageChanged(false),
 	mAvatarDataInitialized(false),
-	mDoubleClickActionDirty(false)
+	mClickActionDirty(false)
 {
 	
 	//Build Floater is now Called from 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
 	
 	sSkin = gSavedSettings.getString("SkinCurrent");
 
-	mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox",	boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1));
-	mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick",	boost::bind(&LLFloaterPreference::onDoubleClickRadio, this));
+	mCommitCallbackRegistrar.add("Pref.ClickActionChange",				boost::bind(&LLFloaterPreference::onClickActionChange, this));
 
 	gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	
 	gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	
 	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);
 
 	saveAvatarProperties();
 
-	if (mDoubleClickActionDirty)
+	if (mClickActionDirty)
 	{
-		updateDoubleClickSettings();
-		mDoubleClickActionDirty = false;
+		updateClickActionSettings();
+		mClickActionDirty = false;
 	}
 }
 
 	// reverts any changes to current skin
 	gSavedSettings.setString("SkinCurrent", sSkin);
 
-	if (mDoubleClickActionDirty)
+	if (mClickActionDirty)
 	{
-		updateDoubleClickControls();
-		mDoubleClickActionDirty = false;
+		updateClickActionControls();
+		mClickActionDirty = false;
 	}
+
 	LLFloaterPreferenceProxy * advanced_proxy_settings = LLFloaterReg::findTypedInstance<LLFloaterPreferenceProxy>("prefs_proxy");
 	if (advanced_proxy_settings)
 	{
 
 	// Display selected maturity icons.
 	onChangeMaturity();
+
+	// Load (double-)click to walk/teleport settings.
+	updateClickActionControls();
 	
 	// Enabled/disabled popups, might have been changed by user actions
 	// while preferences floater was closed.
 	}
 }
 
-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::onClickProxySettings()
 {
 	LLFloaterReg::showInstance("prefs_proxy");
 }
 
-void LLFloaterPreference::updateDoubleClickControls()
+void LLFloaterPreference::onClickActionChange()
 {
-	// 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"));
+	mClickActionDirty = true;
+}
+
+void LLFloaterPreference::updateClickActionSettings()
+{
+	const int single_clk_action = getChild<LLComboBox>("single_click_action_combo")->getValue().asInteger();
+	const int double_clk_action = getChild<LLComboBox>("double_click_action_combo")->getValue().asInteger();
+
+	gSavedSettings.setBOOL("ClickToWalk",			single_clk_action == 1);
+	gSavedSettings.setBOOL("DoubleClickAutoPilot",	double_clk_action == 1);
+	gSavedSettings.setBOOL("DoubleClickTeleport",	double_clk_action == 2);
+}
+
+void LLFloaterPreference::updateClickActionControls()
+{
+	const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk");
+	const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot");
+	const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport");
+
+	getChild<LLComboBox>("single_click_action_combo")->setValue((int)click_to_walk);
+	getChild<LLComboBox>("double_click_action_combo")->setValue(dbl_click_to_teleport ? 2 : (int)dbl_click_to_walk);
 }
 
 void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param)

indra/newview/llfloaterpreference.h

 	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();
+
+	// callback for commit in the "Single click on land" and "Double click on land" comboboxes.
+	void onClickActionChange();
+	// updates click/double-click action settings depending on controls values
+	void updateClickActionSettings();
+	// updates click/double-click action controls depending on values from settings.xml
+	void updateClickActionControls();
 	
 	// This function squirrels away the current values of the controls so that
 	// cancel() can restore them.	
 	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 mClickActionDirty; ///< Set to true when the click/double-click options get changed by user.
 	bool mGotPersonalInfo;
 	bool mOriginalIMViaEmail;
 	bool mLanguageChanged;

indra/newview/lltoolpie.cpp

 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llavatarnamecache.h"
-#include "llviewercontrol.h"
 #include "llfocusmgr.h"
 #include "llfirstuse.h"
 #include "llfloaterland.h"
 #include "lltrans.h"
 #include "llviewercamera.h"
 #include "llviewerparcelmedia.h"
+#include "llviewercontrol.h"
 #include "llviewermenu.h"
 #include "llviewerobjectlist.h"
 #include "llviewerobject.h"
 static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp);
 static ECursorType cursor_from_parcel_media(U8 click_action);
 
-
 LLToolPie::LLToolPie()
 :	LLTool(std::string("Pie")),
 	mMouseButtonDown( false ),
 	mClickAction = 0;
 }
 
+void LLToolPie::walkToClickedLocation()
+{
+	if(mAutoPilotDestination) { mAutoPilotDestination->markDead(); }
+	mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
+	mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal);
+	mAutoPilotDestination->setPixelSize(5);
+	mAutoPilotDestination->setColor(LLColor4U(170, 210, 190));
+	mAutoPilotDestination->setDuration(3.f);
+
+	handle_go_to();
+}
+
 // When we get object properties after left-clicking on an object
 // with left-click = buy, if it's the same object, do the buy.
 
 			mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE;
 		}
 		gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
-		if(mAutoPilotDestination) { mAutoPilotDestination->markDead(); }
-		mAutoPilotDestination = (LLHUDEffectBlob *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BLOB, FALSE);
-		mAutoPilotDestination->setPositionGlobal(mPick.mPosGlobal);
-		mAutoPilotDestination->setPixelSize(5);
-		mAutoPilotDestination->setColor(LLColor4U(170, 210, 190));
-		mAutoPilotDestination->setDuration(3.f);
-
-		handle_go_to();
+		walkToClickedLocation();
 		LLFirstUse::notMoving(false);
 
-		mBlockClickToWalk = false;
-
 		return TRUE;
 	}
 	gViewerWindow->setCursor(UI_CURSOR_ARROW);
 
 	if (gSavedSettings.getBOOL("DoubleClickAutoPilot"))
 	{
-		if (mPick.mPickType == LLPickInfo::PICK_LAND
-			&& !mPick.mPosGlobal.isExactlyZero())
+		if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) ||
+			(mPick.mObjectID.notNull()  && !mPick.mPosGlobal.isExactlyZero()))
 		{
-			handle_go_to();
-			return TRUE;
-		}
-		else if (mPick.mObjectID.notNull()
-				 && !mPick.mPosGlobal.isExactlyZero())
-		{
-			handle_go_to();
+			walkToClickedLocation();
 			return TRUE;
 		}
 	}

indra/newview/lltoolpie.h

 	LLViewerObject*		getClickActionObject() { return mClickActionObject; }
 	LLObjectSelection*	getLeftClickSelection() { return (LLObjectSelection*)mLeftClickSelection; }
 	void 				resetSelection();
+	void				walkToClickedLocation();
 	void				blockClickToWalk() { mBlockClickToWalk = true; }
 	void				stopClickToWalk();
 	

indra/newview/skins/default/xui/en/panel_preferences_move.xml

 	 mouse_opaque="false"
 	 visible="true"
 	 width="18"
-   top_pad="2"
+   top_pad="10"
    left="30" />
+  <text
+   follows="left|top"
+   type="string"
+   length="1"
+   height="10"
+   layout="topleft"
+   left="78"
+   name="keyboard_lbl"
+   width="270"
+   top_delta="2">
+   Keyboard:
+  </text>
+  <check_box
+   control_name="ArrowKeysAlwaysMove"
+   follows="left|top"
+   height="20"
+   label="Arrow keys always move me"
+   layout="topleft"
+   left_delta="5"
+   name="arrow_keys_move_avatar_check"
+   width="237"
+   top_pad="5"/>
+  <check_box
+   control_name="AllowTapTapHoldRun"
+   follows="left|top"
+   height="20"
+   label="Tap-tap-hold to run"
+   layout="topleft"
+   left_delta="0"
+   name="tap_tap_hold_to_run"
+   width="237"
+   top_pad="0"/>
+  <text
+   follows="left|top"
+   type="string"
+   length="1"
+   height="10"
+   layout="topleft"
+   left="78"
+   name="mouse_lbl"
+   width="270"
+   top_pad="15">
+   Mouse:
+  </text>
   <check_box
    control_name="FirstPersonAvatarVisible"
    follows="left|top"
    height="20"
    label="Show me in Mouselook"
    layout="topleft"
-   left_pad="30"
+   left_delta="5"
    name="first_person_avatar_visible"
+   top_pad="5"
    width="256" />
   <text
    type="string"
    initial_value="2"
    layout="topleft"
    show_text="false"
-   left_pad="5"
+   left_pad="0"
    max_val="15"
    name="mouse_sensitivity"
    top_delta="-1"
    name="invert_mouse"
    top_delta="0"
    width="128" />
-  <check_box
-   control_name="ArrowKeysAlwaysMove"
+  <text
    follows="left|top"
-   height="20"
-   label="Arrow keys always move me"
+   type="string"
+   length="1"
+   height="10"
    layout="topleft"
-   left="78"
-   name="arrow_keys_move_avatar_check"
-   width="237"
-   top_pad="10"/>
-  <check_box
-   control_name="AllowTapTapHoldRun"
+   left="86"
+   name="single_click_action_lbl"
+   width="150"
+   top_pad="20">
+   Single click on land:
+  </text>
+  <combo_box
+   height="23"
+   layout="topleft"
+   left_pad="10"
+   top_delta="-6"
+   name="single_click_action_combo"
+   width="200">
+    <combo_box.item
+     label="No action"
+     name="0"
+     value="0"/>
+    <combo_box.item
+     label="Move to clicked point"
+     name="1"
+     value="1"/>
+    <combo_box.commit_callback
+     function="Pref.ClickActionChange"/>
+  </combo_box>
+  <text
    follows="left|top"
-   height="20"
-   label="Tap-tap-hold to run"
+   type="string"
+   length="1"
+   height="10"
    layout="topleft"
-   left_delta="0"
-   name="tap_tap_hold_to_run"
-   width="237"
-   top_pad="0"/>
-  <check_box
-   follows="left|top"
-   height="20"
-   label="Double-Click to:"
+   left="86"
+   name="double_click_action_lbl"
+   width="150"
+   top_pad="12">
+   Double click on land:
+  </text>
+  <combo_box
+   height="23"
    layout="topleft"
-   left_delta="0"
-   name="double_click_chkbox"
-   width="237"
-   top_pad="0">
-   <check_box.commit_callback
-    function="Pref.CommitDoubleClickChekbox"/>
-  </check_box>
-  <radio_group
-     height="20"
-     layout="topleft"
-     left_delta="17"
-     top_pad="2"
-     name="double_click_action">
-    <radio_item
-     height="16"
-     label="Teleport"
-     layout="topleft"
-     left="0"
-     name="radio_teleport"
-     top_delta="20"
-     width="110" />
-    <radio_item
-     height="16"
-     label="Auto-pilot"
-     left_pad="0"
-     layout="topleft"
-     name="radio_autopilot"
-     top_delta="0"
-     width="75" />
-    <radio_group.commit_callback
-	     function="Pref.CommitRadioDoubleClick"/>
-  </radio_group>
+   left_pad="10"
+   top_delta="-6"
+   name="double_click_action_combo"
+   width="200">
+    <combo_box.item
+     label="No action"
+     name="0"
+     value="0"/>
+    <combo_box.item
+     label="Move to clicked point"
+     name="1"
+     value="1"/>
+    <combo_box.item
+     label="Teleport to clicked point"
+     name="2"
+     value="2"/>
+    <combo_box.commit_callback
+     function="Pref.ClickActionChange"/>
+  </combo_box>
   <button
    height="23"
    label="Other Devices"