openMSX
KeyboardSettings.cc
Go to the documentation of this file.
1 #include "KeyboardSettings.hh"
2 #include "stl.hh"
3 #include "strCat.hh"
4 
5 namespace openmsx {
6 
7 [[nodiscard]] static EnumSetting<Keys::KeyCode>::Map getAllowedKeysMap()
8 {
9  return {
10  {"RALT", Keys::K_RALT},
11  {"MENU", Keys::K_MENU},
12  {"RCTRL", Keys::K_RCTRL},
13  {"HENKAN_MODE", Keys::K_HENKAN_MODE},
14  {"RSHIFT", Keys::K_RSHIFT},
15  {"RMETA", Keys::K_RSUPER}, // TODO correct???
16  {"LMETA", Keys::K_LSUPER}, //
17  {"LSUPER", Keys::K_LSUPER},
18  {"RSUPER", Keys::K_RSUPER},
19  {"HELP", Keys::K_HELP},
20  {"UNDO", Keys::K_UNDO},
21  {"END", Keys::K_END},
22  {"PAGEUP", Keys::K_PAGEUP},
23  {"PAGEDOWN", Keys::K_PAGEDOWN}
24  };
25 }
26 
28  : deadkeyHostKey(generate_array<3>([&](auto i) {
29  static constexpr static_string_view description[3] = {
30  "Host key that maps to deadkey 1. Not applicable to Japanese and Korean MSX models",
31  "Host key that maps to deadkey 2. Only applicable to Brazilian MSX models (Sharp Hotbit and Gradiente)",
32  "Host key that maps to deadkey 3. Only applicable to Brazilian Sharp Hotbit MSX models",
33  };
34  static constexpr Keys::KeyCode defaultKey[3] = {
36  };
38  commandController, tmpStrCat("kbd_deadkey", i + 1, "_host_key"),
39  description[i], defaultKey[i], getAllowedKeysMap());
40  }))
41  , codeKanaHostKey(commandController,
42  "kbd_code_kana_host_key",
43  "Host key that maps to the MSX CODE/KANA key. Please note that the HENKAN_MODE key only exists on Japanese host keyboards)",
44  Keys::K_RALT, getAllowedKeysMap())
45  , kpEnterMode(commandController,
46  "kbd_numkeypad_enter_key",
47  "MSX key that the enter key on the host numeric keypad must map to",
48  MSX_KP_COMMA, EnumSetting<KpEnterMode>::Map{
49  {"KEYPAD_COMMA", MSX_KP_COMMA},
50  {"ENTER", MSX_ENTER}})
51  , mappingMode(commandController,
52  "kbd_mapping_mode",
53  "Keyboard mapping mode",
54  CHARACTER_MAPPING, EnumSetting<MappingMode>::Map{
55  {"KEY", KEY_MAPPING},
56  {"CHARACTER", CHARACTER_MAPPING},
57  {"POSITIONAL", POSITIONAL_MAPPING}})
58  , alwaysEnableKeypad(commandController,
59  "kbd_numkeypad_always_enabled",
60  "Numeric keypad is always enabled, even on an MSX that does not have one",
61  false)
62  , traceKeyPresses(commandController,
63  "kbd_trace_key_presses",
64  "Trace key presses (show SDL key code, SDL modifiers and Unicode code-point value)",
65  false, Setting::DONT_SAVE)
66  , autoToggleCodeKanaLock(commandController,
67  "kbd_auto_toggle_code_kana_lock",
68  "Automatically toggle the CODE/KANA lock, based on the characters entered on the host keyboard",
69  true)
70 {
71 }
72 
73 } // namespace openmsx
KeyboardSettings(CommandController &commandController)
static_string_view
KeyCode
Constants that identify keys and key modifiers.
Definition: Keys.hh:26
@ K_HENKAN_MODE
Definition: Keys.hh:200
@ K_PAGEDOWN
Definition: Keys.hh:132
This file implemented 3 utility functions:
Definition: Autofire.cc:9
TemporaryString tmpStrCat(Ts &&... ts)
Definition: strCat.hh:659