diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-12-13 02:21:48 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-12-13 02:21:48 +0200 |
commit | b0265f97563efc5b6e95b9f14352878185c1be05 (patch) | |
tree | c571caa58a448775d502bb122a26e67da6d60e5b /indra/newview/llfloaterpreference.cpp | |
parent | 5f86203f261b376ad74814e1e635dba077c7718b (diff) | |
parent | d656d49a77eeb65ae537c954ea4009bc22da7b2b (diff) |
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 40f13f7fc0..2324c08855 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -124,7 +124,9 @@ char const* const VISIBILITY_DEFAULT = "default"; char const* const VISIBILITY_HIDDEN = "hidden"; //control value for middle mouse as talk2push button -const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; +const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; // for voice client and redability +const static std::string MOUSE_BUTTON_4_CV = "MouseButton4"; +const static std::string MOUSE_BUTTON_5_CV = "MouseButton5"; /// This must equal the maximum value set for the IndirectMaxComplexity slider in panel_preferences_graphics1.xml static const U32 INDIRECT_MAX_ARC_OFF = 101; // all the way to the right == disabled @@ -168,6 +170,7 @@ public: void setParent(LLFloaterPreference* parent) { mParent = parent; } BOOL handleKeyHere(KEY key, MASK mask); + BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); static void onCancel(void* user_data); private: @@ -211,6 +214,25 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask) return result; } +BOOL LLVoiceSetKeyDialog::handleAnyMouseClick(S32 x, S32 y, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) +{ + BOOL result = FALSE; + if (down + && (clicktype == LLMouseHandler::CLICK_MIDDLE || clicktype == LLMouseHandler::CLICK_BUTTON4 || clicktype == LLMouseHandler::CLICK_BUTTON5) + && mask == 0) + { + mParent->setMouse(clicktype); + result = TRUE; + closeFloater(); + } + else + { + result = LLMouseHandler::handleAnyMouseClick(x, y, mask, clicktype, down); + } + + return result; +} + //static void LLVoiceSetKeyDialog::onCancel(void* user_data) { @@ -1698,6 +1720,41 @@ void LLFloaterPreference::setKey(KEY key) getChild<LLUICtrl>("modifier_combo")->onCommit(); } +void LLFloaterPreference::setMouse(LLMouseHandler::EClickType click) +{ + std::string bt_name; + std::string ctrl_value; + switch (click) + { + case LLMouseHandler::CLICK_MIDDLE: + bt_name = "middle_mouse"; + ctrl_value = MIDDLE_MOUSE_CV; + break; + case LLMouseHandler::CLICK_BUTTON4: + bt_name = "button4_mouse"; + ctrl_value = MOUSE_BUTTON_4_CV; + break; + case LLMouseHandler::CLICK_BUTTON5: + bt_name = "button5_mouse"; + ctrl_value = MOUSE_BUTTON_5_CV; + break; + default: + break; + } + + if (!ctrl_value.empty()) + { + LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo"); + // We are using text control names for readability and compatibility with voice + p2t_line_editor->setControlValue(ctrl_value); + LLPanel* advanced_preferences = dynamic_cast<LLPanel*>(p2t_line_editor->getParent()); + if (advanced_preferences) + { + p2t_line_editor->setValue(advanced_preferences->getString(bt_name)); + } + } +} + void LLFloaterPreference::onClickSetMiddleMouse() { LLUICtrl* p2t_line_editor = getChild<LLUICtrl>("modifier_combo"); @@ -2435,10 +2492,19 @@ BOOL LLPanelPreference::postBuild() if (hasChild("modifier_combo", TRUE)) { //localizing if push2talk button is set to middle mouse - if (MIDDLE_MOUSE_CV == getChild<LLUICtrl>("modifier_combo")->getValue().asString()) + std::string modifier_value = getChild<LLUICtrl>("modifier_combo")->getValue().asString(); + if (MIDDLE_MOUSE_CV == modifier_value) { getChild<LLUICtrl>("modifier_combo")->setValue(getString("middle_mouse")); } + else if (MOUSE_BUTTON_4_CV == modifier_value) + { + getChild<LLUICtrl>("modifier_combo")->setValue(getString("button4_mouse")); + } + else if (MOUSE_BUTTON_5_CV == modifier_value) + { + getChild<LLUICtrl>("modifier_combo")->setValue(getString("button5_mouse")); + } } //////////////////////PanelSetup /////////////////// |