From 708fdb4e67393dbf03a0e0c82608d62f1868926a Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 12 Nov 2019 14:08:01 +0200 Subject: SL-6109 Mouse localization support --- indra/newview/llkeyconflict.cpp | 43 +++++++------------------- indra/newview/llviewerinput.cpp | 6 ++-- indra/newview/llviewerinput.h | 4 +-- indra/newview/skins/default/xui/en/strings.xml | 9 ++++++ 4 files changed, 27 insertions(+), 35 deletions(-) (limited to 'indra') diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index 882a1d0caf..a94836c59d 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -36,6 +36,7 @@ #include "llinitparam.h" #include "llkeyboard.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewerinput.h" #include "llviewermenu.h" @@ -73,7 +74,7 @@ std::string string_from_mask(MASK mask) return res; } -std::string string_from_mouse(EMouseClickType click) +std::string string_from_mouse(EMouseClickType click, bool translate) { std::string res; switch (click) @@ -99,36 +100,12 @@ std::string string_from_mouse(EMouseClickType click) default: break; } - return res; -} -EMouseClickType mouse_from_string(const std::string& input) -{ - if (input == "LMB") - { - return CLICK_LEFT; - } - if (input == "MMB") - { - return CLICK_MIDDLE; - } - if (input == "RMB") - { - return CLICK_RIGHT; - } - if (input == "MB4") - { - return CLICK_BUTTON4; - } - if (input == "MB5") - { - return CLICK_BUTTON5; - } - if (input == "Double LMB") + if (translate && !res.empty()) { - return CLICK_DOUBLELEFT; + res = LLTrans::getString(res); } - return CLICK_NONE; + return res; } // LLKeyConflictHandler @@ -266,7 +243,7 @@ std::string LLKeyConflictHandler::getStringFromKeyData(const LLKeyData& keydata) result = LLKeyboard::stringFromAccelerator(keydata.mMask); } - result += string_from_mouse(keydata.mMouse); + result += string_from_mouse(keydata.mMouse, true); return result; } @@ -300,7 +277,11 @@ void LLKeyConflictHandler::loadFromSettings(const LLViewerInput::KeyMode& keymod { KEY key; MASK mask; - EMouseClickType mouse = it->mouse.isProvided() ? mouse_from_string(it->mouse) : CLICK_NONE; + EMouseClickType mouse = CLICK_NONE; + if (it->mouse.isProvided()) + { + LLViewerInput::mouseFromString(it->mouse.getValue(), &mouse); + } if (it->key.getValue().empty()) { key = KEY_NONE; @@ -528,7 +509,7 @@ void LLKeyConflictHandler::saveToSettings(bool temporary) { // set() because 'optional', for compatibility purposes // just copy old keys.xml and rename to key_bindings.xml, it should work - binding.mouse.set(string_from_mouse(data.mMouse), true); + binding.mouse.set(string_from_mouse(data.mMouse, false), true); } binding.command = iter->first; mode.bindings.add(binding); diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index 369db33642..da61a9b39b 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -924,7 +924,8 @@ LLViewerInput::LLViewerInput() } } -BOOL LLViewerInput::modeFromString(const std::string& string, S32 *mode) const +// static +BOOL LLViewerInput::modeFromString(const std::string& string, S32 *mode) { if (string == "FIRST_PERSON") { @@ -953,7 +954,8 @@ BOOL LLViewerInput::modeFromString(const std::string& string, S32 *mode) const } } -BOOL LLViewerInput::mouseFromString(const std::string& string, EMouseClickType *mode) const +// static +BOOL LLViewerInput::mouseFromString(const std::string& string, EMouseClickType *mode) { if (string == "LMB") { diff --git a/indra/newview/llviewerinput.h b/indra/newview/llviewerinput.h index eff42600fd..1fe55bd585 100644 --- a/indra/newview/llviewerinput.h +++ b/indra/newview/llviewerinput.h @@ -112,8 +112,8 @@ public: S32 loadBindingsXML(const std::string& filename); // returns number bound, 0 on error EKeyboardMode getMode() const; - BOOL modeFromString(const std::string& string, S32 *mode) const; // False on failure - BOOL mouseFromString(const std::string& string, EMouseClickType *mode) const;// False on failure + static BOOL modeFromString(const std::string& string, S32 *mode); // False on failure + static BOOL mouseFromString(const std::string& string, EMouseClickType *mode);// False on failure bool scanKey(KEY key, BOOL key_down, diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 1bfac6aeb7..cd639ded36 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4088,6 +4088,15 @@ Try enclosing path to the editor with double quotes. Z + + LMB + MMB + RMB + MB4 + MB5 + Double LMB + + Viewing particle beacons (blue) Viewing physical object beacons (green) -- cgit v1.2.3