diff options
Diffstat (limited to 'indra/llwindow/llkeyboard.cpp')
-rw-r--r-- | indra/llwindow/llkeyboard.cpp | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 5404ac50e5..f6f6c3931c 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -327,7 +327,7 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) // static -std::string LLKeyboard::stringFromKey(KEY key, bool translate) +std::string LLKeyboard::stringFromKey(KEY key) { std::string res = get_if_there(sKeysToNames, key, std::string()); if (res.empty()) @@ -338,60 +338,16 @@ std::string LLKeyboard::stringFromKey(KEY key, bool translate) res = std::string(buffer); } - if (translate) + LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; + if (trans != NULL) { - LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - if (trans != NULL) - { - res = trans(res.c_str()); - } + res = trans(res.c_str()); } return res; } -//static -std::string LLKeyboard::stringFromAccelerator(MASK accel_mask) -{ - std::string res; - - LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - - if (trans == NULL) - { - LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; - return res; - } - // Append any masks -#ifdef LL_DARWIN - // Standard Mac names for modifier keys in menu equivalents - // We could use the symbol characters, but they only exist in certain fonts. - if (accel_mask & MASK_CONTROL) - { - if (accel_mask & MASK_MAC_CONTROL) - { - res.append(trans("accel-mac-control")); - } - else - { - res.append(trans("accel-mac-command")); // Symbol would be "\xE2\x8C\x98" - } - } - if (accel_mask & MASK_ALT) - res.append(trans("accel-mac-option")); // Symbol would be "\xE2\x8C\xA5" - if (accel_mask & MASK_SHIFT) - res.append(trans("accel-mac-shift")); // Symbol would be "\xE2\x8C\xA7" -#else - if (accel_mask & MASK_CONTROL) - res.append(trans("accel-win-control")); - if (accel_mask & MASK_ALT) - res.append(trans("accel-win-alt")); - if (accel_mask & MASK_SHIFT) - res.append(trans("accel-win-shift")); -#endif - return res; -} //static std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) { @@ -403,7 +359,41 @@ std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) return res; } - res.append(stringFromAccelerator(accel_mask)); + LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; + + if( trans == NULL ) + { + LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; + return res; + } + + // Append any masks +#ifdef LL_DARWIN + // Standard Mac names for modifier keys in menu equivalents + // We could use the symbol characters, but they only exist in certain fonts. + if( accel_mask & MASK_CONTROL ) + { + if ( accel_mask & MASK_MAC_CONTROL ) + { + res.append( trans("accel-mac-control") ); + } + else + { + res.append( trans("accel-mac-command") ); // Symbol would be "\xE2\x8C\x98" + } + } + if( accel_mask & MASK_ALT ) + res.append( trans("accel-mac-option") ); // Symbol would be "\xE2\x8C\xA5" + if( accel_mask & MASK_SHIFT ) + res.append( trans("accel-mac-shift") ); // Symbol would be "\xE2\x8C\xA7" +#else + if( accel_mask & MASK_CONTROL ) + res.append( trans("accel-win-control") ); + if( accel_mask & MASK_ALT ) + res.append( trans("accel-win-alt") ); + if( accel_mask & MASK_SHIFT ) + res.append( trans("accel-win-shift") ); +#endif std::string key_string = LLKeyboard::stringFromKey(key); if ((accel_mask & MASK_NORMALKEYS) && (key_string[0] == '-' || key_string[0] == '=' || key_string[0] == '+')) |