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