summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2020-01-06 20:28:37 +0200
committerAndreyL ProductEngine <alihatskiy@productengine.com>2020-01-06 20:28:37 +0200
commit2076f4af0fc946c3bd79754a1deefc495ee7edb9 (patch)
tree859f1a0a7a82a571dde9a26c738e59a862cd6c05 /indra/newview/llfloaterpreference.cpp
parent4c006e76e39a8b59dc6f9c890e5a27d38b5ece50 (diff)
parentd656d49a77eeb65ae537c954ea4009bc22da7b2b (diff)
Merged in viewer-release
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rw-r--r--indra/newview/llfloaterpreference.cpp70
1 files changed, 68 insertions, 2 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index fe347a91a3..e0a3585c93 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)
{
@@ -1694,6 +1716,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");
@@ -2431,10 +2488,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 ///////////////////