summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-11-12 14:08:01 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-06-23 14:50:59 +0300
commit708fdb4e67393dbf03a0e0c82608d62f1868926a (patch)
tree2a34fac2b098bdd5cab595ad82eb182869a10d07
parent0d78aa31e2bd2cf55c83a4447027a94b0939ae26 (diff)
SL-6109 Mouse localization support
-rw-r--r--indra/newview/llkeyconflict.cpp43
-rw-r--r--indra/newview/llviewerinput.cpp6
-rw-r--r--indra/newview/llviewerinput.h4
-rw-r--r--indra/newview/skins/default/xui/en/strings.xml9
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 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.
<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>