diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-11-12 14:08:01 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-11-12 14:08:01 +0200 |
commit | 0c8f561910cf967d546a7a66ab7e3edcc2ca320e (patch) | |
tree | e7ccb4cca277cff43d9542a26a0536e6f7c98046 | |
parent | f680e5913ab490a0b2f86ce0ec44ca59d56fb32d (diff) |
SL-6109 Mouse localization support
-rw-r--r-- | indra/newview/llkeyconflict.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llviewerinput.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerinput.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 9 |
4 files changed, 27 insertions, 35 deletions
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 a267678bb3..0718a27696 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -922,7 +922,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") { @@ -951,7 +952,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 3a311db25c..0594e18c96 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4069,6 +4069,15 @@ Try enclosing path to the editor with double quotes. <string name="Z">Z</string> <!-- Key names end --> + <!-- Mouse button names (short) begin --> + <string name="LMB">LMB</string> + <string name="MMB">MMB</string> + <string name="RMB">RMB</string> + <string name="MB4">MB4</string> + <string name="MB5">MB5</string> + <string name="Double LMB">Double LMB</string> + <!-- Mouse button names end --> + <!-- llviewerwindow --> <string name="BeaconParticle">Viewing particle beacons (blue)</string> <string name="BeaconPhysical">Viewing physical object beacons (green)</string> |