diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rwxr-xr-x | indra/newview/llfloaterpreference.cpp | 103 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 16 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 127 | ||||
-rw-r--r-- | indra/newview/lltoolpie.h | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_move.xml | 132 |
6 files changed, 77 insertions, 319 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5ffbbc6163..be4ec93946 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13566,17 +13566,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>ClickToTeleport</key> - <map> - <key>Comment</key> - <string>Click in world to teleport to location</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>ShowOfferedInventory</key> <map> <key>Comment</key> diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5dd1cc3b97..9630d7b29f 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -348,10 +348,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) sSkin = gSavedSettings.getString("SkinCurrent"); - mCommitCallbackRegistrar.add("Pref.CommitClickToWalkCheckbox", boost::bind(&LLFloaterPreference::onWalkCheckboxCommit, this)); - mCommitCallbackRegistrar.add("Pref.CommitClickToTeleportCheckbox", boost::bind(&LLFloaterPreference::onTeleportCheckboxCommit, this)); - mCommitCallbackRegistrar.add("Pref.CommitWalkTriggerRadio", boost::bind(&LLFloaterPreference::onWalkTriggerRadioCommit, this)); - mCommitCallbackRegistrar.add("Pref.CommitTeleportTriggerRadio", boost::bind(&LLFloaterPreference::onTeleportTriggerRadioCommit, 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)); @@ -1512,111 +1509,29 @@ void LLFloaterPreference::onClickProxySettings() LLFloaterReg::showInstance("prefs_proxy"); } -void LLFloaterPreference::onWalkCheckboxCommit() -{ - LLCheckBoxCtrl* walk_trigger_cb = getChild<LLCheckBoxCtrl>("walk_to_chkbox"); - LLRadioGroup* walk_trigger_radio = getChild<LLRadioGroup>("walk_trigger_radio"); - const bool checked = walk_trigger_cb->getValue().asBoolean(); - - mClickActionDirty = true; - walk_trigger_radio->setEnabled(checked); - if (checked) - { - fixWalkRadioValue(); // don't allow two actions on click or double click - } -} - -void LLFloaterPreference::onTeleportCheckboxCommit() -{ - LLCheckBoxCtrl* teleport_trigger_cb = getChild<LLCheckBoxCtrl>("teleport_to_chkbox"); - LLRadioGroup* teleport_trigger_radio = getChild<LLRadioGroup>("teleport_trigger_radio"); - const bool checked = teleport_trigger_cb->getValue().asBoolean(); - - mClickActionDirty = true; - teleport_trigger_radio->setEnabled(checked); - if (checked) - { - fixTeleportRadioValue(); // don't allow two actions on click or double click - } -} - -void LLFloaterPreference::onWalkTriggerRadioCommit() -{ - mClickActionDirty = true; - fixTeleportRadioValue(); -} - -void LLFloaterPreference::onTeleportTriggerRadioCommit() +void LLFloaterPreference::onClickActionChange() { mClickActionDirty = true; - fixWalkRadioValue(); -} - -void LLFloaterPreference::fixWalkRadioValue() -{ - LLRadioGroup* walk_trigger_radio = getChild<LLRadioGroup>("walk_trigger_radio"); - LLRadioGroup* teleport_trigger_radio = getChild<LLRadioGroup>("teleport_trigger_radio"); - - walk_trigger_radio->setSelectedIndex(!teleport_trigger_radio->getSelectedIndex()); -} - - -void LLFloaterPreference::fixTeleportRadioValue() -{ - LLRadioGroup* walk_trigger_radio = getChild<LLRadioGroup>("walk_trigger_radio"); - LLRadioGroup* teleport_trigger_radio = getChild<LLRadioGroup>("teleport_trigger_radio"); - - teleport_trigger_radio->setSelectedIndex(!walk_trigger_radio->getSelectedIndex()); } void LLFloaterPreference::updateClickActionSettings() { - const bool walk_trigger_enabled = getChild<LLCheckBoxCtrl>("walk_to_chkbox")->getValue().asBoolean(); - const bool teleport_trigger_enabled = getChild<LLCheckBoxCtrl>("teleport_to_chkbox")->getValue().asBoolean(); - - const bool walk_on_dbl_click = (bool) getChild<LLRadioGroup>("walk_trigger_radio")->getSelectedIndex(); - const bool teleport_on_dbl_click = (bool) getChild<LLRadioGroup>("teleport_trigger_radio")->getSelectedIndex(); + 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", walk_trigger_enabled && !walk_on_dbl_click); - gSavedSettings.setBOOL("ClickToTeleport", teleport_trigger_enabled && !teleport_on_dbl_click); - gSavedSettings.setBOOL("DoubleClickAutoPilot", walk_trigger_enabled && walk_on_dbl_click); - gSavedSettings.setBOOL("DoubleClickTeleport", teleport_trigger_enabled && teleport_on_dbl_click); + gSavedSettings.setBOOL("ClickToWalk", single_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickAutoPilot", double_clk_action == 1); + gSavedSettings.setBOOL("DoubleClickTeleport", double_clk_action == 2); } void LLFloaterPreference::updateClickActionControls() { - LLCheckBoxCtrl* walk_trigger_cb = getChild<LLCheckBoxCtrl>("walk_to_chkbox"); - LLCheckBoxCtrl* teleport_trigger_cb = getChild<LLCheckBoxCtrl>("teleport_to_chkbox"); - - LLRadioGroup* walk_trigger_radio = getChild<LLRadioGroup>("walk_trigger_radio"); - LLRadioGroup* teleport_trigger_radio = getChild<LLRadioGroup>("teleport_trigger_radio"); - const bool click_to_walk = gSavedSettings.getBOOL("ClickToWalk"); - const bool click_to_teleport = gSavedSettings.getBOOL("ClickToTeleport"); const bool dbl_click_to_walk = gSavedSettings.getBOOL("DoubleClickAutoPilot"); const bool dbl_click_to_teleport = gSavedSettings.getBOOL("DoubleClickTeleport"); - const bool walk_trigger_enabled = click_to_walk || dbl_click_to_walk; - const bool teleport_trigger_enabled = click_to_teleport || dbl_click_to_teleport; - - walk_trigger_cb->setValue(walk_trigger_enabled); - teleport_trigger_cb->setValue(teleport_trigger_enabled); - - walk_trigger_radio->setEnabled(walk_trigger_enabled); - walk_trigger_radio->setSelectedIndex(dbl_click_to_walk); - - teleport_trigger_radio->setEnabled(teleport_trigger_enabled); - teleport_trigger_radio->setSelectedIndex(dbl_click_to_teleport); - - // Make sure it doesn't look like there is more than one action per trigger. - if (teleport_trigger_enabled) - { - fixWalkRadioValue(); - } - else - { - fixTeleportRadioValue(); - } + 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) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index b7263f0ac3..5c74e9f60c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -105,18 +105,8 @@ protected: // callback for when client turns on shaders void onVertexShaderEnable(); - // callback for clicking the "Walk to Click Point" checkbox - void onWalkCheckboxCommit(); - // callback for clicking the "Teleport to Click Point" checkbox - void onTeleportCheckboxCommit(); - // callback for selecting trigger for "Walk to Click Point" - void onWalkTriggerRadioCommit(); - // callback for selecting trigger for "Teleport to Click Point" - void onTeleportTriggerRadioCommit(); - // make sure the radio buttons have mutually exclusive values - void fixWalkRadioValue(); - // make sure the radio buttons have mutually exclusive values - void fixTeleportRadioValue(); + // 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 @@ -173,8 +163,6 @@ 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 mClickActionDirty; ///< Set to true when the click/double-click options get changed by user. bool mGotPersonalInfo; bool mOriginalIMViaEmail; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index a05fc9536e..b0d9bd5d70 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -35,7 +35,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "llavatarnamecache.h" -#include "lleventtimer.h" #include "llfocusmgr.h" #include "llfirstuse.h" #include "llfloaterland.h" @@ -77,42 +76,6 @@ static void handle_click_action_play(); static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp); static ECursorType cursor_from_parcel_media(U8 click_action); -/** - * Schedule teleport to the specified location when user clicks in world. - * - * Deferring teleport is needed for double-click-to-walk to work. - * If double click in the world view occurs, teleport gets canceled. - */ -class LLClickToTeleportTimer : public LLEventTimer -{ - LOG_CLASS(LLClickToTeleportTimer); -public: - LLClickToTeleportTimer(const LLVector3d& pos); - ~LLClickToTeleportTimer(); - /*virtual*/ BOOL tick(); - -private: - LLVector3d mTeleportPos; -}; - -LLClickToTeleportTimer::LLClickToTeleportTimer(const LLVector3d& pos) -: LLEventTimer(0.33f) // should be greater than double click interval -, mTeleportPos(pos) -{ -}; - -LLClickToTeleportTimer::~LLClickToTeleportTimer() -{ - LLToolPie::instance().mClickToTeleportTimer = NULL; -} - -BOOL LLClickToTeleportTimer::tick() -{ - lldebugs << "Teleporting to " << mTeleportPos << llendl; - gAgent.teleportViaLocationLookAt(mTeleportPos); - return TRUE; // destroy the timer -} - LLToolPie::LLToolPie() : LLTool(std::string("Pie")), mMouseButtonDown( false ), @@ -120,8 +83,6 @@ LLToolPie::LLToolPie() mMouseSteerX(-1), mMouseSteerY(-1), mBlockClickToWalk(false), - mBlockClickToTeleport(false), - mClickToTeleportTimer(NULL), mClickAction(0), mClickActionBuyEnabled( gSavedSettings.getBOOL("ClickActionBuyEnabled") ), mClickActionPayEnabled( gSavedSettings.getBOOL("ClickActionPayEnabled") ) @@ -687,64 +648,35 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) mMouseButtonDown = false; if (click_action == CLICK_ACTION_NONE // not doing 1-click action + && gSavedSettings.getBOOL("ClickToWalk") // click to walk enabled && !gAgent.getFlying() // don't auto-navigate while flying until that works && gAgentAvatarp && !gAgentAvatarp->isSitting() + && !mBlockClickToWalk // another behavior hasn't cancelled click to walk && !mPick.mPosGlobal.isExactlyZero() // valid coordinates for pick && (mPick.mPickType == LLPickInfo::PICK_LAND // we clicked on land || mPick.mObjectID.notNull())) // or on an object { - if (gSavedSettings.getBOOL("ClickToWalk") - && !mBlockClickToWalk) // another behavior hasn't cancelled click to walk - { - // handle special cases of steering picks - LLViewerObject* avatar_object = mPick.getObject(); - - // get pointer to avatar - while (avatar_object && !avatar_object->isAvatar()) - { - avatar_object = (LLViewerObject*)avatar_object->getParent(); - } - - if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf()) - { - const F64 SELF_CLICK_WALK_DISTANCE = 3.0; - // pretend we picked some point a bit in front of avatar - mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; - } - gAgentCamera.setFocusOnAvatar(TRUE, TRUE); - walkToClickedLocation(); - LLFirstUse::notMoving(false); + // handle special cases of steering picks + LLViewerObject* avatar_object = mPick.getObject(); - return TRUE; - } - else if (gSavedSettings.getBOOL("ClickToTeleport") && !mBlockClickToTeleport) + // get pointer to avatar + while (avatar_object && !avatar_object->isAvatar()) { - LLViewerObject* objp = mPick.getObject(); - LLViewerObject* parentp = objp ? objp->getRootEdit() : NULL; - - bool is_in_world = mPick.mObjectID.notNull() && objp && !objp->isHUDAttachment(); - bool is_land = mPick.mPickType == LLPickInfo::PICK_LAND; - bool has_touch_handler = (objp && objp->flagHandleTouch()) || (parentp && parentp->flagHandleTouch()); - bool has_click_action = final_click_action(objp); - - if (is_land || (is_in_world && !has_touch_handler && !has_click_action)) - { - LLVector3d pos = mPick.mPosGlobal; - pos.mdV[VZ] += gAgentAvatarp->getPelvisToFoot(); + avatar_object = (LLViewerObject*)avatar_object->getParent(); + } - if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) - { - // defer for more than the double click interval. - scheduleTeleport(pos); - } - else - { - gAgent.teleportViaLocationLookAt(pos); - } - return TRUE; - } + if (avatar_object && ((LLVOAvatar*)avatar_object)->isSelf()) + { + const F64 SELF_CLICK_WALK_DISTANCE = 3.0; + // pretend we picked some point a bit in front of avatar + mPick.mPosGlobal = gAgent.getPositionGlobal() + LLVector3d(LLViewerCamera::instance().getAtAxis()) * SELF_CLICK_WALK_DISTANCE; } + gAgentCamera.setFocusOnAvatar(TRUE, TRUE); + walkToClickedLocation(); + LLFirstUse::notMoving(false); + + return TRUE; } gViewerWindow->setCursor(UI_CURSOR_ARROW); if (hasMouseCapture()) @@ -756,7 +688,6 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask) gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on mBlockClickToWalk = false; - mBlockClickToTeleport = false; return LLTool::handleMouseUp(x, y, mask); } @@ -777,13 +708,8 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) llinfos << "LLToolPie handleDoubleClick (becoming mouseDown)" << llendl; } - cancelScheduledTeleport(); - if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) { - // Avoid teleporting for the second time when user releases mouse button after double click. - mBlockClickToTeleport = true; - if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) || (mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero())) { @@ -1443,23 +1369,6 @@ bool LLToolPie::inCameraSteerMode() return mMouseButtonDown && mMouseOutsideSlop && gSavedSettings.getBOOL("ClickToWalk"); } -void LLToolPie::scheduleTeleport(const LLVector3d& pos) -{ - // cancel previously scheduled teleport (if any) - cancelScheduledTeleport(); - - // and schedule new one - mClickToTeleportTimer = new LLClickToTeleportTimer(pos); -} - -void LLToolPie::cancelScheduledTeleport() -{ - if (mClickToTeleportTimer) - { - delete mClickToTeleportTimer; - } -} - // true if x,y outside small box around start_x,start_y BOOL LLToolPie::outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y) { diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 7e84170549..68fe8bc4a5 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -32,7 +32,6 @@ #include "llviewerwindow.h" // for LLPickInfo #include "llhudeffectblob.h" // for LLPointer<LLHudEffectBlob>, apparently -class LLClickToTeleportTimer; class LLViewerObject; class LLObjectSelection; @@ -98,12 +97,8 @@ private: void startCameraSteering(); void stopCameraSteering(); bool inCameraSteerMode(); - void scheduleTeleport(const LLVector3d& pos); - void cancelScheduledTeleport(); private: - friend class LLClickToTeleportTimer; - bool mMouseButtonDown; bool mMouseOutsideSlop; // for this drag, has mouse moved outside slop region S32 mMouseDownX; @@ -114,8 +109,6 @@ private: LLPointer<LLHUDEffectBlob> mMouseSteerGrabPoint; bool mClockwise; bool mBlockClickToWalk; - bool mBlockClickToTeleport; - LLClickToTeleportTimer* mClickToTeleportTimer; LLUUID mMediaMouseCaptureID; LLPickInfo mPick; LLPickInfo mHoverPick; 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 5a70acddeb..cb547d7c6b 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -201,100 +201,64 @@ length="1" height="10" layout="topleft" - left="259" - name="single_click_lbl" - width="100" - top_pad="10"> - Single-Click + 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" type="string" length="1" height="10" layout="topleft" - left="368" - name="double_click_lbl" - width="100" - top_delta="0"> - Double-Click + left="86" + name="double_click_action_lbl" + width="150" + top_pad="12"> + Double click on land: </text> - <check_box - follows="left|top" - height="20" - label="Walk to Click Point:" - layout="topleft" - left="83" - name="walk_to_chkbox" - width="237" - top_pad="7"> - <check_box.commit_callback - function="Pref.CommitClickToWalkCheckbox"/> - </check_box> - <radio_group - height="20" - layout="topleft" - left="280" - top_delta="3" - name="walk_trigger_radio" - width="200"> - <radio_item - height="16" - label="" - layout="topleft" - left="0" - name="walk_single_click" - top_delta="20" - width="110" /> - <radio_item - height="16" - label="" - left_pad="0" - layout="topleft" - name="walk_double_click" - top_delta="0" - width="75" /> - <radio_group.commit_callback - function="Pref.CommitWalkTriggerRadio"/> - </radio_group> - <check_box - follows="left|top" - height="20" - label="Teleport to Click Point:" - layout="topleft" - left="83" - name="teleport_to_chkbox" - width="237" - top_pad="0"> - <check_box.commit_callback - function="Pref.CommitClickToTeleportCheckbox"/> - </check_box> - <radio_group - height="20" + <combo_box + height="23" layout="topleft" - left="280" - top_delta="3" - name="teleport_trigger_radio" + left_pad="10" + top_delta="-6" + name="double_click_action_combo" width="200"> - <radio_item - height="16" - label="" - layout="topleft" - left="0" - name="teleport_single_click" - top_delta="20" - width="110" /> - <radio_item - height="16" - label="" - left_pad="0" - layout="topleft" - name="teleport_double_click" - top_delta="0" - width="75" /> - <radio_group.commit_callback - function="Pref.CommitTeleportTriggerRadio"/> - </radio_group> + <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" |