1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Merge pull request #5591 from IntelOrca/refactor/nosdl/keyboard

Refactor keyboard shortcuts to openrct2ui
This commit is contained in:
Ted John
2017-06-11 17:41:21 +01:00
committed by GitHub
28 changed files with 886 additions and 603 deletions

View File

@@ -91,7 +91,6 @@
F76C85C41EC4E88300FA49E2 /* Config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C836E1EC4E7CC00FA49E2 /* Config.cpp */; };
F76C85C71EC4E88300FA49E2 /* IniReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83711EC4E7CC00FA49E2 /* IniReader.cpp */; };
F76C85C91EC4E88300FA49E2 /* IniWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83731EC4E7CC00FA49E2 /* IniWriter.cpp */; };
F76C85CB1EC4E88300FA49E2 /* KeyboardShortcuts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83751EC4E7CC00FA49E2 /* KeyboardShortcuts.cpp */; };
F76C85CC1EC4E88300FA49E2 /* Context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83761EC4E7CC00FA49E2 /* Context.cpp */; };
F76C85CF1EC4E88300FA49E2 /* Console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C837A1EC4E7CC00FA49E2 /* Console.cpp */; };
F76C85D11EC4E88300FA49E2 /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C837C1EC4E7CC00FA49E2 /* Diagnostics.cpp */; };
@@ -128,7 +127,6 @@
F76C86131EC4E88300FA49E2 /* console.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83C01EC4E7CC00FA49E2 /* console.c */; };
F76C86161EC4E88300FA49E2 /* Fonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83C31EC4E7CC00FA49E2 /* Fonts.cpp */; };
F76C86181EC4E88300FA49E2 /* graph.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83C51EC4E7CC00FA49E2 /* graph.c */; };
F76C861A1EC4E88300FA49E2 /* keyboard_shortcut.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83C71EC4E7CC00FA49E2 /* keyboard_shortcut.c */; };
F76C861E1EC4E88300FA49E2 /* Theme.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C83CB1EC4E7CC00FA49E2 /* Theme.cpp */; };
F76C86201EC4E88300FA49E2 /* viewport.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83CD1EC4E7CC00FA49E2 /* viewport.c */; };
F76C86221EC4E88300FA49E2 /* viewport_interaction.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C83CF1EC4E7CC00FA49E2 /* viewport_interaction.c */; };
@@ -368,8 +366,6 @@
F76C87771EC4E88400FA49E2 /* scenery.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C853E1EC4E7CD00FA49E2 /* scenery.c */; };
F76C87781EC4E88400FA49E2 /* server_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C853F1EC4E7CD00FA49E2 /* server_list.cpp */; };
F76C87791EC4E88400FA49E2 /* server_start.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85401EC4E7CD00FA49E2 /* server_start.c */; };
F76C877A1EC4E88400FA49E2 /* shortcut_key_change.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85411EC4E7CD00FA49E2 /* shortcut_key_change.c */; };
F76C877B1EC4E88400FA49E2 /* shortcut_keys.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85421EC4E7CD00FA49E2 /* shortcut_keys.c */; };
F76C877C1EC4E88400FA49E2 /* sign.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85431EC4E7CD00FA49E2 /* sign.c */; };
F76C877D1EC4E88400FA49E2 /* staff.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85441EC4E7CD00FA49E2 /* staff.c */; };
F76C877E1EC4E88400FA49E2 /* staff_fire_prompt.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C85451EC4E7CD00FA49E2 /* staff_fire_prompt.c */; };
@@ -438,6 +434,13 @@
F775F5351EE35A89001F00E7 /* DummyUiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F775F5331EE35A6B001F00E7 /* DummyUiContext.cpp */; };
F775F5371EE3724F001F00E7 /* DummyAudioContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F775F5361EE3724F001F00E7 /* DummyAudioContext.cpp */; };
F775F5381EE3725C001F00E7 /* DummyAudioContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F775F5361EE3724F001F00E7 /* DummyAudioContext.cpp */; };
F7CB863F1EEDA0B50030C877 /* WindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB863D1EEDA0B50030C877 /* WindowManager.cpp */; };
F7CB86431EEDA0F50030C877 /* shortcut_key_change.c in Sources */ = {isa = PBXBuildFile; fileRef = F7CB86411EEDA0F50030C877 /* shortcut_key_change.c */; };
F7CB86441EEDA0F50030C877 /* shortcut_keys.c in Sources */ = {isa = PBXBuildFile; fileRef = F7CB86421EEDA0F50030C877 /* shortcut_keys.c */; };
F7CB86491EEDA1330030C877 /* keyboard_shortcut.c in Sources */ = {isa = PBXBuildFile; fileRef = F7CB86461EEDA1330030C877 /* keyboard_shortcut.c */; };
F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB86471EEDA1330030C877 /* KeyboardShortcuts.cpp */; };
F7CB864D1EEDA1A80030C877 /* DummyWindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB864B1EEDA1A80030C877 /* DummyWindowManager.cpp */; };
F7CB864E1EEDA2050030C877 /* DummyWindowManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F7CB864B1EEDA1A80030C877 /* DummyWindowManager.cpp */; };
F7D7747B1EC5EB6D00BE6EBC /* lay_down_roller_coaster.c in Sources */ = {isa = PBXBuildFile; fileRef = F76C84951EC4E7CC00FA49E2 /* lay_down_roller_coaster.c */; };
F7D7747F1EC61E5100BE6EBC /* UiContext.macOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F7D7747E1EC61E5100BE6EBC /* UiContext.macOS.mm */; };
F7D7748D1EC66F8600BE6EBC /* libopenrct2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F76C809A1EC4D9FA00FA49E2 /* libopenrct2.a */; };
@@ -798,7 +801,6 @@
F76C83721EC4E7CC00FA49E2 /* IniReader.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IniReader.hpp; sourceTree = "<group>"; };
F76C83731EC4E7CC00FA49E2 /* IniWriter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = IniWriter.cpp; sourceTree = "<group>"; };
F76C83741EC4E7CC00FA49E2 /* IniWriter.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = IniWriter.hpp; sourceTree = "<group>"; };
F76C83751EC4E7CC00FA49E2 /* KeyboardShortcuts.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardShortcuts.cpp; sourceTree = "<group>"; };
F76C83761EC4E7CC00FA49E2 /* Context.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Context.cpp; sourceTree = "<group>"; };
F76C83771EC4E7CC00FA49E2 /* Context.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Context.h; sourceTree = "<group>"; };
F76C83791EC4E7CC00FA49E2 /* Collections.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Collections.hpp; sourceTree = "<group>"; };
@@ -877,8 +879,6 @@
F76C83C41EC4E7CC00FA49E2 /* Fonts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Fonts.h; sourceTree = "<group>"; };
F76C83C51EC4E7CC00FA49E2 /* graph.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = graph.c; sourceTree = "<group>"; };
F76C83C61EC4E7CC00FA49E2 /* graph.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = graph.h; sourceTree = "<group>"; };
F76C83C71EC4E7CC00FA49E2 /* keyboard_shortcut.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = keyboard_shortcut.c; sourceTree = "<group>"; };
F76C83C81EC4E7CC00FA49E2 /* keyboard_shortcut.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = keyboard_shortcut.h; sourceTree = "<group>"; };
F76C83CA1EC4E7CC00FA49E2 /* screenshot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = screenshot.h; sourceTree = "<group>"; };
F76C83CB1EC4E7CC00FA49E2 /* Theme.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Theme.cpp; sourceTree = "<group>"; };
F76C83CC1EC4E7CC00FA49E2 /* themes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = themes.h; sourceTree = "<group>"; };
@@ -1228,8 +1228,6 @@
F76C853E1EC4E7CD00FA49E2 /* scenery.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scenery.c; sourceTree = "<group>"; };
F76C853F1EC4E7CD00FA49E2 /* server_list.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = server_list.cpp; sourceTree = "<group>"; };
F76C85401EC4E7CD00FA49E2 /* server_start.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = server_start.c; sourceTree = "<group>"; };
F76C85411EC4E7CD00FA49E2 /* shortcut_key_change.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = shortcut_key_change.c; sourceTree = "<group>"; };
F76C85421EC4E7CD00FA49E2 /* shortcut_keys.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = shortcut_keys.c; sourceTree = "<group>"; };
F76C85431EC4E7CD00FA49E2 /* sign.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sign.c; sourceTree = "<group>"; };
F76C85441EC4E7CD00FA49E2 /* staff.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = staff.c; sourceTree = "<group>"; };
F76C85451EC4E7CD00FA49E2 /* staff_fire_prompt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = staff_fire_prompt.c; sourceTree = "<group>"; };
@@ -1331,6 +1329,15 @@
F775F5321EE35A48001F00E7 /* Ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ui.h; sourceTree = "<group>"; };
F775F5331EE35A6B001F00E7 /* DummyUiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyUiContext.cpp; sourceTree = "<group>"; };
F775F5361EE3724F001F00E7 /* DummyAudioContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyAudioContext.cpp; sourceTree = "<group>"; };
F7CB863D1EEDA0B50030C877 /* WindowManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowManager.cpp; sourceTree = "<group>"; };
F7CB863E1EEDA0B50030C877 /* WindowManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowManager.h; sourceTree = "<group>"; };
F7CB86411EEDA0F50030C877 /* shortcut_key_change.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = shortcut_key_change.c; path = windows/shortcut_key_change.c; sourceTree = "<group>"; };
F7CB86421EEDA0F50030C877 /* shortcut_keys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = shortcut_keys.c; path = windows/shortcut_keys.c; sourceTree = "<group>"; };
F7CB86461EEDA1330030C877 /* keyboard_shortcut.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = keyboard_shortcut.c; path = input/keyboard_shortcut.c; sourceTree = "<group>"; };
F7CB86471EEDA1330030C877 /* KeyboardShortcuts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyboardShortcuts.cpp; path = input/KeyboardShortcuts.cpp; sourceTree = "<group>"; };
F7CB86481EEDA1330030C877 /* KeyboardShortcuts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyboardShortcuts.h; path = input/KeyboardShortcuts.h; sourceTree = "<group>"; };
F7CB864B1EEDA1A80030C877 /* DummyWindowManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyWindowManager.cpp; sourceTree = "<group>"; };
F7CB864C1EEDA1A80030C877 /* WindowManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowManager.h; sourceTree = "<group>"; };
F7D7747E1EC61E5100BE6EBC /* UiContext.macOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UiContext.macOS.mm; sourceTree = "<group>"; usesTabs = 0; };
F7D774841EC66CD700BE6EBC /* OpenRCT2-cli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "OpenRCT2-cli"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@@ -1813,7 +1820,6 @@
F76C83721EC4E7CC00FA49E2 /* IniReader.hpp */,
F76C83731EC4E7CC00FA49E2 /* IniWriter.cpp */,
F76C83741EC4E7CC00FA49E2 /* IniWriter.hpp */,
F76C83751EC4E7CC00FA49E2 /* KeyboardShortcuts.cpp */,
);
path = config;
sourceTree = "<group>";
@@ -1902,8 +1908,6 @@
F76C83C41EC4E7CC00FA49E2 /* Fonts.h */,
F76C83C51EC4E7CC00FA49E2 /* graph.c */,
F76C83C61EC4E7CC00FA49E2 /* graph.h */,
F76C83C71EC4E7CC00FA49E2 /* keyboard_shortcut.c */,
F76C83C81EC4E7CC00FA49E2 /* keyboard_shortcut.h */,
F76C83CA1EC4E7CC00FA49E2 /* screenshot.h */,
F76C83CB1EC4E7CC00FA49E2 /* Theme.cpp */,
F76C83CC1EC4E7CC00FA49E2 /* themes.h */,
@@ -2340,6 +2344,8 @@
F76C85041EC4E7CD00FA49E2 /* ui */ = {
isa = PBXGroup;
children = (
F7CB864B1EEDA1A80030C877 /* DummyWindowManager.cpp */,
F7CB864C1EEDA1A80030C877 /* WindowManager.h */,
F775F5331EE35A6B001F00E7 /* DummyUiContext.cpp */,
F76C85051EC4E7CD00FA49E2 /* UiContext.h */,
);
@@ -2411,8 +2417,6 @@
F76C853E1EC4E7CD00FA49E2 /* scenery.c */,
F76C853F1EC4E7CD00FA49E2 /* server_list.cpp */,
F76C85401EC4E7CD00FA49E2 /* server_start.c */,
F76C85411EC4E7CD00FA49E2 /* shortcut_key_change.c */,
F76C85421EC4E7CD00FA49E2 /* shortcut_keys.c */,
F76C85431EC4E7CD00FA49E2 /* sign.c */,
F76C85441EC4E7CD00FA49E2 /* staff.c */,
F76C85451EC4E7CD00FA49E2 /* staff_fire_prompt.c */,
@@ -2492,21 +2496,25 @@
F76C85801EC4E82600FA49E2 /* openrct2-ui */ = {
isa = PBXGroup;
children = (
F775F5321EE35A48001F00E7 /* Ui.h */,
F76C85811EC4E82600FA49E2 /* audio */,
F76C858D1EC4E82600FA49E2 /* drawing */,
F7CB86451EEDA1200030C877 /* input */,
F7CB86401EEDA0E20030C877 /* windows */,
F76C858A1EC4E82600FA49E2 /* CursorData.cpp */,
F76C858B1EC4E82600FA49E2 /* CursorRepository.cpp */,
F76C858C1EC4E82600FA49E2 /* CursorRepository.h */,
F76C85A81EC4E82600FA49E2 /* SDLException.h */,
F76C85A91EC4E82600FA49E2 /* TextComposition.cpp */,
F76C85AA1EC4E82600FA49E2 /* TextComposition.h */,
F775F5321EE35A48001F00E7 /* Ui.h */,
F76C85AB1EC4E82600FA49E2 /* Ui.cpp */,
F76C85AC1EC4E82600FA49E2 /* UiContext.cpp */,
F76C85AD1EC4E82600FA49E2 /* UiContext.h */,
F76C85AE1EC4E82600FA49E2 /* UiContext.Linux.cpp */,
F7D7747E1EC61E5100BE6EBC /* UiContext.macOS.mm */,
F76C85AF1EC4E82600FA49E2 /* UiContext.Win32.cpp */,
F7CB863E1EEDA0B50030C877 /* WindowManager.h */,
F7CB863D1EEDA0B50030C877 /* WindowManager.cpp */,
);
name = "openrct2-ui";
path = "src/openrct2-ui";
@@ -2573,6 +2581,25 @@
path = opengl;
sourceTree = "<group>";
};
F7CB86401EEDA0E20030C877 /* windows */ = {
isa = PBXGroup;
children = (
F7CB86411EEDA0F50030C877 /* shortcut_key_change.c */,
F7CB86421EEDA0F50030C877 /* shortcut_keys.c */,
);
name = windows;
sourceTree = "<group>";
};
F7CB86451EEDA1200030C877 /* input */ = {
isa = PBXGroup;
children = (
F7CB86461EEDA1330030C877 /* keyboard_shortcut.c */,
F7CB86471EEDA1330030C877 /* KeyboardShortcuts.cpp */,
F7CB86481EEDA1330030C877 /* KeyboardShortcuts.h */,
);
name = input;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -2931,21 +2958,27 @@
4C8B42721EEB1AE400F015CA /* HardwareDisplayDrawingEngine.cpp in Sources */,
F76C887A1EC5324E00FA49E2 /* AudioMixer.cpp in Sources */,
F76C887B1EC5324E00FA49E2 /* FileAudioSource.cpp in Sources */,
F7CB864D1EEDA1A80030C877 /* DummyWindowManager.cpp in Sources */,
F76C887C1EC5324E00FA49E2 /* MemoryAudioSource.cpp in Sources */,
F76C887D1EC5324E00FA49E2 /* CursorData.cpp in Sources */,
F7D7747F1EC61E5100BE6EBC /* UiContext.macOS.mm in Sources */,
F76C887E1EC5324E00FA49E2 /* CursorRepository.cpp in Sources */,
F775F5341EE35A6B001F00E7 /* DummyUiContext.cpp in Sources */,
F76C887F1EC5324E00FA49E2 /* CopyFramebufferShader.cpp in Sources */,
F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */,
F7CB86431EEDA0F50030C877 /* shortcut_key_change.c in Sources */,
F76C88801EC5324E00FA49E2 /* DrawImageShader.cpp in Sources */,
F775F5371EE3724F001F00E7 /* DummyAudioContext.cpp in Sources */,
F76C88811EC5324E00FA49E2 /* DrawLineShader.cpp in Sources */,
F76C88821EC5324E00FA49E2 /* FillRectShader.cpp in Sources */,
F76C88831EC5324E00FA49E2 /* OpenGLAPI.cpp in Sources */,
F7CB863F1EEDA0B50030C877 /* WindowManager.cpp in Sources */,
4C8B42701EEB1ABD00F015CA /* X8DrawingEngine.cpp in Sources */,
F7CB86491EEDA1330030C877 /* keyboard_shortcut.c in Sources */,
F76C88841EC5324E00FA49E2 /* OpenGLDrawingEngine.cpp in Sources */,
F76C88851EC5324E00FA49E2 /* OpenGLFramebuffer.cpp in Sources */,
F76C88861EC5324E00FA49E2 /* OpenGLShaderProgram.cpp in Sources */,
F7CB86441EEDA0F50030C877 /* shortcut_keys.c in Sources */,
F76C88871EC5324E00FA49E2 /* SwapFramebuffer.cpp in Sources */,
F76C88881EC5324E00FA49E2 /* TextureCache.cpp in Sources */,
F76C88891EC5324E00FA49E2 /* SoftwareDrawingEngine.cpp in Sources */,
@@ -2961,6 +2994,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F7CB864E1EEDA2050030C877 /* DummyWindowManager.cpp in Sources */,
F775F5381EE3725C001F00E7 /* DummyAudioContext.cpp in Sources */,
F775F5351EE35A89001F00E7 /* DummyUiContext.cpp in Sources */,
F7D7747B1EC5EB6D00BE6EBC /* lay_down_roller_coaster.c in Sources */,
@@ -2978,7 +3012,6 @@
F76C85C41EC4E88300FA49E2 /* Config.cpp in Sources */,
F76C85C71EC4E88300FA49E2 /* IniReader.cpp in Sources */,
F76C85C91EC4E88300FA49E2 /* IniWriter.cpp in Sources */,
F76C85CB1EC4E88300FA49E2 /* KeyboardShortcuts.cpp in Sources */,
F76C85CC1EC4E88300FA49E2 /* Context.cpp in Sources */,
F76C85CF1EC4E88300FA49E2 /* Console.cpp in Sources */,
F76C85D11EC4E88300FA49E2 /* Diagnostics.cpp in Sources */,
@@ -3015,7 +3048,6 @@
F76C86131EC4E88300FA49E2 /* console.c in Sources */,
F76C86161EC4E88300FA49E2 /* Fonts.cpp in Sources */,
F76C86181EC4E88300FA49E2 /* graph.c in Sources */,
F76C861A1EC4E88300FA49E2 /* keyboard_shortcut.c in Sources */,
F76C861E1EC4E88300FA49E2 /* Theme.cpp in Sources */,
F76C86201EC4E88300FA49E2 /* viewport.c in Sources */,
F76C86221EC4E88300FA49E2 /* viewport_interaction.c in Sources */,
@@ -3255,8 +3287,6 @@
F76C87771EC4E88400FA49E2 /* scenery.c in Sources */,
F76C87781EC4E88400FA49E2 /* server_list.cpp in Sources */,
F76C87791EC4E88400FA49E2 /* server_start.c in Sources */,
F76C877A1EC4E88400FA49E2 /* shortcut_key_change.c in Sources */,
F76C877B1EC4E88400FA49E2 /* shortcut_keys.c in Sources */,
F76C877C1EC4E88400FA49E2 /* sign.c in Sources */,
F76C877D1EC4E88400FA49E2 /* staff.c in Sources */,
F76C877E1EC4E88400FA49E2 /* staff_fire_prompt.c in Sources */,

View File

@@ -32,9 +32,11 @@
#include <openrct2/Version.h>
#include "CursorRepository.h"
#include "drawing/engines/DrawingEngines.h"
#include "input/KeyboardShortcuts.h"
#include "SDLException.h"
#include "TextComposition.h"
#include "UiContext.h"
#include "WindowManager.h"
extern "C"
{
@@ -45,6 +47,7 @@ extern "C"
using namespace OpenRCT2;
using namespace OpenRCT2::Drawing;
using namespace OpenRCT2::Input;
using namespace OpenRCT2::Ui;
#ifdef __MACOSX__
@@ -59,8 +62,8 @@ class UiContext final : public IUiContext
private:
constexpr static uint32 TOUCH_DOUBLE_TIMEOUT = 300;
IPlatformEnvironment * const _env;
IPlatformUiContext * const _platformUiContext;
IWindowManager * const _windowManager;
CursorRepository _cursorRepository;
@@ -76,27 +79,28 @@ private:
bool _steamOverlayActive = false;
// Input
TextComposition _textComposition;
CursorState _cursorState = { 0 };
uint32 _lastKeyPressed = 0;
const uint8 * _keysState = nullptr;
uint8 _keysPressed[256] = { 0 };
uint32 _lastGestureTimestamp = 0;
float _gestureRadius = 0;
KeyboardShortcuts _keyboardShortcuts;
TextComposition _textComposition;
CursorState _cursorState = { 0 };
uint32 _lastKeyPressed = 0;
const uint8 * _keysState = nullptr;
uint8 _keysPressed[256] = { 0 };
uint32 _lastGestureTimestamp = 0;
float _gestureRadius = 0;
public:
UiContext(IPlatformEnvironment * env)
: _env(env),
_platformUiContext(CreatePlatformUiContext())
: _platformUiContext(CreatePlatformUiContext()),
_windowManager(CreateWindowManager()),
_keyboardShortcuts(env)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO)");
}
_cursorRepository.LoadCursors();
// Temporary to prevent warning, will be used for keyboard shortcuts
UNUSED(_env);
_keyboardShortcuts.Reset();
_keyboardShortcuts.Load();
}
~UiContext() override
@@ -565,6 +569,11 @@ public:
return _platformUiContext->ShowDirectoryDialog(_window, title);
}
IWindowManager * GetWindowManager() override
{
return _windowManager;
}
private:
void OnResize(sint32 width, sint32 height)
{

View File

@@ -0,0 +1,57 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include <openrct2/ui/WindowManager.h>
#include "input/KeyboardShortcuts.h"
#include "WindowManager.h"
using namespace OpenRCT2::Ui;
class WindowManager final : public IWindowManager
{
public:
rct_window * OpenWindow(rct_windowclass wc) override
{
switch (wc) {
case WC_KEYBOARD_SHORTCUT_LIST:
return window_shortcut_keys_open();
default:
return nullptr;
}
}
void HandleKeyboardShortcut(sint32 key) override
{
rct_window * w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
keyboard_shortcuts_set(key);
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
} else {
keyboard_shortcut_handle(key);
}
}
void GetKeyboardMapScroll(const uint8 * keysState, sint32 * x, sint32 * y) override
{
get_keyboard_map_scroll(keysState, x, y);
}
};
IWindowManager * OpenRCT2::Ui::CreateWindowManager()
{
return new WindowManager();
}

View File

@@ -0,0 +1,24 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include <openrct2/common.h>
namespace OpenRCT2 { namespace Ui
{
interface IWindowManager;
IWindowManager * CreateWindowManager();
} }

View File

@@ -0,0 +1,313 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include <openrct2/common.h>
#include <SDL.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/core/File.h>
#include <openrct2/core/FileStream.hpp>
#include <openrct2/core/Memory.hpp>
#include <openrct2/core/Path.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/PlatformEnvironment.h>
#include "KeyboardShortcuts.h"
extern "C"
{
#include <openrct2/localisation/localisation.h>
}
using namespace OpenRCT2;
using namespace OpenRCT2::Input;
// Remove when the C calls are removed
static KeyboardShortcuts * _instance;
KeyboardShortcuts::KeyboardShortcuts(IPlatformEnvironment * env)
: _env(env)
{
_instance = this;
}
void KeyboardShortcuts::Reset()
{
for (size_t i = 0; i < SHORTCUT_COUNT; i++)
{
_keys[i] = DefaultKeys[i];
}
}
bool KeyboardShortcuts::Load()
{
bool result = false;
try
{
std::string path = _env->GetFilePath(PATHID::CONFIG_KEYBOARD);
if (File::Exists(path))
{
auto fs = FileStream(path, FILE_MODE_OPEN);
uint16 version = fs.ReadValue<uint16>();
if (version == KeyboardShortcuts::CURRENT_FILE_VERSION)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
_keys[i] = fs.ReadValue<uint16>();
}
result = true;
}
}
}
catch (const Exception &ex)
{
Console::WriteLine("Error reading shortcut keys: %s", ex.GetMessage());
}
return result;
}
bool KeyboardShortcuts::Save()
{
bool result = false;
try
{
std::string path = _env->GetFilePath(PATHID::CONFIG_KEYBOARD);
auto fs = FileStream(path, FILE_MODE_WRITE);
fs.WriteValue<uint16>(KeyboardShortcuts::CURRENT_FILE_VERSION);
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
fs.WriteValue<uint16>(_keys[i]);
}
result = true;
}
catch (const Exception &ex)
{
Console::WriteLine("Error writing shortcut keys: %s", ex.GetMessage());
}
return result;
}
void KeyboardShortcuts::Set(sint32 key)
{
// Unmap shortcut that already uses this key
sint32 shortcut = GetFromKey(key);
if (shortcut != SHORTCUT_UNDEFINED)
{
_keys[shortcut] = SHORTCUT_UNDEFINED;
}
// Map shortcut to this key
_keys[gKeyboardShortcutChangeId] = key;
Save();
}
sint32 KeyboardShortcuts::GetFromKey(sint32 key)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
if (key == _keys[i])
{
return i;
}
}
return SHORTCUT_UNDEFINED;
}
std::string KeyboardShortcuts::GetShortcutString(sint32 shortcut) const
{
utf8 buffer[256] = { 0 };
utf8 formatBuffer[256] = { 0 };
uint16 shortcutKey = _keys[shortcut];
if (shortcutKey == SHORTCUT_UNDEFINED) return std::string();
if (shortcutKey & SHIFT)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_SHIFT_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & CTRL)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_CTRL_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & ALT)
{
#ifdef __MACOSX__
format_string(formatBuffer, sizeof(formatBuffer), STR_OPTION_PLUS, NULL);
#else
format_string(formatBuffer, sizeof(formatBuffer), STR_ALT_PLUS, NULL);
#endif
String::Append(buffer, sizeof(buffer), formatBuffer);
}
if (shortcutKey & CMD)
{
format_string(formatBuffer, sizeof(formatBuffer), STR_CMD_PLUS, NULL);
String::Append(buffer, sizeof(buffer), formatBuffer);
}
String::Append(buffer, sizeof(buffer), SDL_GetScancodeName((SDL_Scancode)(shortcutKey & 0xFF)));
return std::string(buffer);
}
void KeyboardShortcuts::GetKeyboardMapScroll(const uint8 * keysState, sint32 * x, sint32 * y) const
{
for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++)
{
uint16 shortcutKey = _keys[shortcutId];
uint8 scancode = shortcutKey & 0xFF;
if (shortcutKey == 0xFFFF) continue;
if (!keysState[scancode]) continue;
if (shortcutKey & SHIFT) {
if (!keysState[SDL_SCANCODE_LSHIFT] && !keysState[SDL_SCANCODE_RSHIFT]) continue;
}
if (shortcutKey & CTRL) {
if (!keysState[SDL_SCANCODE_LCTRL] && !keysState[SDL_SCANCODE_RCTRL]) continue;
}
if (shortcutKey & ALT) {
if (!keysState[SDL_SCANCODE_LALT] && !keysState[SDL_SCANCODE_RALT]) continue;
}
#ifdef __MACOSX__
if (shortcutKey & CMD) {
if (!keysState[SDL_SCANCODE_LGUI] && !keysState[SDL_SCANCODE_RGUI]) continue;
}
#endif
switch (shortcutId) {
case SHORTCUT_SCROLL_MAP_UP:
*x = 0;
*y = -1;
break;
case SHORTCUT_SCROLL_MAP_LEFT:
*x = -1;
*y = 0;
break;
case SHORTCUT_SCROLL_MAP_DOWN:
*x = 0;
*y = 1;
break;
case SHORTCUT_SCROLL_MAP_RIGHT:
*x = 1;
*y = 0;
break;
default:
*x = 0;
*y = 0;
}
}
}
extern "C"
{
void keyboard_shortcuts_reset()
{
_instance->Reset();
}
bool keyboard_shortcuts_load()
{
return _instance->Load();
}
bool keyboard_shortcuts_save()
{
return _instance->Save();
}
void keyboard_shortcuts_set(sint32 key)
{
return _instance->Set(key);
}
sint32 keyboard_shortcuts_get_from_key(sint32 key)
{
return _instance->GetFromKey(key);
}
void keyboard_shortcuts_format_string(char * buffer, size_t bufferSize, sint32 shortcut)
{
auto str = _instance->GetShortcutString(shortcut);
String::Set(buffer, bufferSize, str.c_str());
}
void get_keyboard_map_scroll(const uint8 * keysState, sint32 * x, sint32 * y)
{
_instance->GetKeyboardMapScroll(keysState, x, y);
}
}
// Default keyboard shortcuts
const uint16 KeyboardShortcuts::DefaultKeys[SHORTCUT_COUNT] =
{
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
SHIFT | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_CLOCKWISE
SHIFT | SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE
SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE
SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE
SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE
SDL_SCANCODE_6, // SHORTCUT_INVISIBLE_PEOPLE_TOGGLE
SDL_SCANCODE_8, // SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE
SDL_SCANCODE_9, // SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE
SDL_SCANCODE_0, // SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE
SDL_SCANCODE_F1, // SHORTCUT_ADJUST_LAND
SDL_SCANCODE_F2, // SHORTCUT_ADJUST_WATER
SDL_SCANCODE_F3, // SHORTCUT_BUILD_SCENERY
SDL_SCANCODE_F4, // SHORTCUT_BUILD_PATHS
SDL_SCANCODE_F5, // SHORTCUT_BUILD_NEW_RIDE
SDL_SCANCODE_F, // SHORTCUT_SHOW_FINANCIAL_INFORMATION
SDL_SCANCODE_D, // SHORTCUT_SHOW_RESEARCH_INFORMATION
SDL_SCANCODE_R, // SHORTCUT_SHOW_RIDES_LIST
SDL_SCANCODE_P, // SHORTCUT_SHOW_PARK_INFORMATION
SDL_SCANCODE_G, // SHORTCUT_SHOW_GUEST_LIST
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
PLATFORM_MODIFIER | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
PLATFORM_MODIFIER | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
PLATFORM_MODIFIER | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_OPTIONS
SHORTCUT_UNDEFINED, // SHORTCUT_MUTE_SOUND
ALT | SDL_SCANCODE_RETURN, // SHORTCUT_WINDOWED_MODE_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_MULTIPLAYER
SHORTCUT_UNDEFINED, // SHORTCUT_PAINT_ORIGINAL_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_DEBUG_PAINT_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SEE_THROUGH_PATHS_TOGGLE
SDL_SCANCODE_KP_4, // SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT
SDL_SCANCODE_KP_6, // SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT
SDL_SCANCODE_KP_5, // SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT
SDL_SCANCODE_KP_2, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN
SDL_SCANCODE_KP_8, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP
SDL_SCANCODE_KP_PLUS, // SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE
SDL_SCANCODE_KP_1, // SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT
SDL_SCANCODE_KP_3, // SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT
SDL_SCANCODE_KP_7, // SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK
SDL_SCANCODE_KP_9, // SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK
SDL_SCANCODE_KP_0, // SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT
SDL_SCANCODE_KP_MINUS, // SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT
};

View File

@@ -0,0 +1,166 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#pragma once
#include <openrct2/common.h>
#define SHIFT 0x100
#define CTRL 0x200
#define ALT 0x400
#define CMD 0x800
#ifdef __MACOSX__
#define PLATFORM_MODIFIER CMD
#else
#define PLATFORM_MODIFIER CTRL
#endif
enum
{
SHORTCUT_CLOSE_TOP_MOST_WINDOW,
SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS,
SHORTCUT_CANCEL_CONSTRUCTION_MODE,
SHORTCUT_PAUSE_GAME,
SHORTCUT_ZOOM_VIEW_OUT,
SHORTCUT_ZOOM_VIEW_IN,
SHORTCUT_ROTATE_VIEW_CLOCKWISE,
SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE,
SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE,
SHORTCUT_SEE_THROUGH_RIDES_TOGGLE,
SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE,
SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE,
SHORTCUT_INVISIBLE_PEOPLE_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE,
SHORTCUT_ADJUST_LAND,
SHORTCUT_ADJUST_WATER,
SHORTCUT_BUILD_SCENERY,
SHORTCUT_BUILD_PATHS,
SHORTCUT_BUILD_NEW_RIDE,
SHORTCUT_SHOW_FINANCIAL_INFORMATION,
SHORTCUT_SHOW_RESEARCH_INFORMATION,
SHORTCUT_SHOW_RIDES_LIST,
SHORTCUT_SHOW_PARK_INFORMATION,
SHORTCUT_SHOW_GUEST_LIST,
SHORTCUT_SHOW_STAFF_LIST,
SHORTCUT_SHOW_RECENT_MESSAGES,
SHORTCUT_SHOW_MAP,
SHORTCUT_SCREENSHOT,
// New
SHORTCUT_REDUCE_GAME_SPEED,
SHORTCUT_INCREASE_GAME_SPEED,
SHORTCUT_OPEN_CHEAT_WINDOW,
SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SHORTCUT_SCROLL_MAP_UP,
SHORTCUT_SCROLL_MAP_LEFT,
SHORTCUT_SCROLL_MAP_DOWN,
SHORTCUT_SCROLL_MAP_RIGHT,
SHORTCUT_OPEN_CHAT_WINDOW,
SHORTCUT_QUICK_SAVE_GAME,
SHORTCUT_SHOW_OPTIONS,
SHORTCUT_MUTE_SOUND,
SHORTCUT_WINDOWED_MODE_TOGGLE,
SHORTCUT_SHOW_MULTIPLAYER,
SHORTCUT_PAINT_ORIGINAL_TOGGLE,
SHORTCUT_DEBUG_PAINT_TOGGLE,
SHORTCUT_SEE_THROUGH_PATHS_TOGGLE,
SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT,
SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT,
SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT,
SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN,
SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP,
SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE,
SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT,
SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT,
SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK,
SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK,
SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT,
SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT,
SHORTCUT_COUNT,
SHORTCUT_UNDEFINED = 0xFFFF,
};
#ifdef __cplusplus
#include <string>
namespace OpenRCT2
{
interface IPlatformEnvironment;
namespace Input
{
class KeyboardShortcuts
{
private:
constexpr static sint32 CURRENT_FILE_VERSION = 1;
static const uint16 DefaultKeys[SHORTCUT_COUNT];
IPlatformEnvironment * const _env;
uint16 _keys[SHORTCUT_COUNT];
public:
KeyboardShortcuts(IPlatformEnvironment * env);
void Reset();
bool Load();
bool Save();
std::string GetShortcutString(sint32 shortcut) const;
void Set(sint32 key);
sint32 GetFromKey(sint32 key);
void GetKeyboardMapScroll(const uint8 * keysState, sint32 * x, sint32 * y) const;
};
}
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct rct_window rct_window;
/** The current shortcut being changed. */
extern uint8 gKeyboardShortcutChangeId;
void keyboard_shortcuts_reset();
bool keyboard_shortcuts_load();
bool keyboard_shortcuts_save();
void keyboard_shortcuts_set(sint32 key);
sint32 keyboard_shortcuts_get_from_key(sint32 key);
void keyboard_shortcuts_format_string(char * buffer, size_t bufferSize, sint32 shortcut);
rct_window * window_shortcut_keys_open();
rct_window * window_shortcut_change_open(sint32 selected_key);
void keyboard_shortcut_handle(sint32 key);
void keyboard_shortcut_handle_command(sint32 shortcutIndex);
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey);
void get_keyboard_map_scroll(const uint8 * keysState, sint32 * x, sint32 * y);
#ifdef __cplusplus
}
#endif

View File

@@ -14,24 +14,24 @@
*****************************************************************************/
#pragma endregion
#include "../audio/audio.h"
#include "../config/Config.h"
#include "../editor.h"
#include "../game.h"
#include "../input.h"
#include "../interface/chat.h"
#include "../interface/Screenshot.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
#include "../platform/platform.h"
#include "../ride/track.h"
#include "../ride/track_paint.h"
#include "../title/TitleScreen.h"
#include "../util/util.h"
#include "keyboard_shortcut.h"
#include "viewport.h"
#include "widget.h"
#include "window.h"
#include <openrct2/audio/audio.h>
#include <openrct2/config/Config.h>
#include <openrct2/editor.h>
#include <openrct2/game.h>
#include <openrct2/input.h>
#include <openrct2/interface/chat.h>
#include <openrct2/interface/Screenshot.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/network/network.h>
#include <openrct2/platform/platform.h>
#include <openrct2/ride/track.h>
#include <openrct2/ride/track_paint.h>
#include <openrct2/title/TitleScreen.h>
#include <openrct2/util/util.h>
#include <openrct2/interface/viewport.h>
#include <openrct2/interface/widget.h>
#include <openrct2/interface/window.h>
#include "KeyboardShortcuts.h"
uint8 gKeyboardShortcutChangeId;
@@ -39,46 +39,13 @@ typedef void (*shortcut_action)();
static const shortcut_action shortcut_table[SHORTCUT_COUNT];
/**
*
* rct2: 0x006E3E91
*/
void keyboard_shortcut_set(sint32 key)
{
sint32 i;
// Unmap shortcut that already uses this key
for (i = 0; i < SHORTCUT_COUNT; i++) {
if (key == gShortcutKeys[i]) {
gShortcutKeys[i] = SHORTCUT_UNDEFINED;
break;
}
}
// Map shortcut to this key
gShortcutKeys[gKeyboardShortcutChangeId] = key;
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
window_invalidate_by_class(WC_KEYBOARD_SHORTCUT_LIST);
config_shortcut_keys_save();
}
static sint32 keyboard_shortcut_get_from_key(sint32 key)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++) {
if (key == gShortcutKeys[i]) {
return i;
}
}
return -1;
}
/**
*
* rct2: 0x006E3E68
*/
void keyboard_shortcut_handle(sint32 key)
{
sint32 shortcut = keyboard_shortcut_get_from_key(key);
sint32 shortcut = keyboard_shortcuts_get_from_key(key);
if (shortcut != -1) {
keyboard_shortcut_handle_command(shortcut);
}
@@ -94,36 +61,6 @@ void keyboard_shortcut_handle_command(sint32 shortcutIndex)
}
}
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey)
{
char formatBuffer[256];
if (size == 0) return;
*buffer = 0;
if (shortcutKey == SHORTCUT_UNDEFINED) return;
if (shortcutKey & 0x100) {
format_string(formatBuffer, 256, STR_SHIFT_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x200) {
format_string(formatBuffer, 256, STR_CTRL_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x400) {
#ifdef __MACOSX__
format_string(formatBuffer, 256, STR_OPTION_PLUS, NULL);
#else
format_string(formatBuffer, 256, STR_ALT_PLUS, NULL);
#endif
safe_strcat(buffer, formatBuffer, size);
}
if (shortcutKey & 0x800) {
format_string(formatBuffer, 256, STR_CMD_PLUS, NULL);
safe_strcat(buffer, formatBuffer, size);
}
safe_strcat(buffer, SDL_GetScancodeName(shortcutKey & 0xFF), size);
}
#pragma region Shortcut Commands
static void toggle_view_flag(sint32 viewportFlag)

View File

@@ -41,11 +41,16 @@
<ClCompile Include="drawing\engines\opengl\SwapFramebuffer.cpp" />
<ClCompile Include="drawing\engines\opengl\TextureCache.cpp" />
<ClCompile Include="drawing\engines\SoftwareDrawingEngine.cpp" />
<ClCompile Include="input\KeyboardShortcuts.cpp" />
<ClCompile Include="input\keyboard_shortcut.c" />
<ClCompile Include="TextComposition.cpp" />
<ClCompile Include="Ui.cpp" />
<ClCompile Include="UiContext.cpp" />
<ClCompile Include="UiContext.Linux.cpp" />
<ClCompile Include="UiContext.Win32.cpp" />
<ClCompile Include="WindowManager.cpp" />
<ClCompile Include="windows\shortcut_keys.c" />
<ClCompile Include="windows\shortcut_key_change.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="audio\AudioContext.h" />
@@ -63,10 +68,12 @@
<ClInclude Include="drawing\engines\opengl\OpenGLShaderProgram.h" />
<ClInclude Include="drawing\engines\opengl\SwapFramebuffer.h" />
<ClInclude Include="drawing\engines\opengl\TextureCache.h" />
<ClInclude Include="input\KeyboardShortcuts.h" />
<ClInclude Include="SDLException.h" />
<ClInclude Include="TextComposition.h" />
<ClInclude Include="Ui.h" />
<ClInclude Include="UiContext.h" />
<ClInclude Include="WindowManager.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8DD8AB7D-2EA6-44E3-8265-BAF08E832951}</ProjectGuid>

View File

@@ -14,11 +14,11 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include <openrct2/config/Config.h>
#include <openrct2/interface/window.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include "../input/KeyboardShortcuts.h"
extern const rct_string_id ShortcutStringIds[];
@@ -74,16 +74,18 @@ static rct_window_event_list window_shortcut_change_events = {
NULL
};
void window_shortcut_change_open(sint32 selected_key){
rct_window * window_shortcut_change_open(sint32 selected_key)
{
// Move this to window_shortcut_change_open
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
// Save the item we are selecting for new window
gKeyboardShortcutChangeId = selected_key;
rct_window* w = window_create_centred(WW, WH, &window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);
rct_window * w = window_create_centred(WW, WH, &window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);
w->widgets = window_shortcut_change_widgets;
w->enabled_widgets = (1ULL << WIDX_CLOSE);
window_init_scroll_widgets(w);
return w;
}
/**

View File

@@ -14,12 +14,12 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../interface/window.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../platform/platform.h"
#include "../interface/keyboard_shortcut.h"
#include <openrct2/config/Config.h>
#include <openrct2/interface/window.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/platform/platform.h>
#include "../input/KeyboardShortcuts.h"
#define WW 420
#define WH 280
@@ -155,26 +155,25 @@ const rct_string_id ShortcutStringIds[] = {
*
* rct2: 0x006E3884
*/
void window_shortcut_keys_open()
rct_window * window_shortcut_keys_open()
{
rct_window* w;
rct_window * w = window_bring_to_front_by_class(WC_KEYBOARD_SHORTCUT_LIST);
if (w == NULL)
{
w = window_create_auto_pos(WW, WH, &window_shortcut_events, WC_KEYBOARD_SHORTCUT_LIST, WF_RESIZABLE);
w = window_bring_to_front_by_class(WC_KEYBOARD_SHORTCUT_LIST);
w->widgets = window_shortcut_widgets;
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RESET);
window_init_scroll_widgets(w);
if (w) return;
w = window_create_auto_pos(WW, WH, &window_shortcut_events, WC_KEYBOARD_SHORTCUT_LIST, WF_RESIZABLE);
w->widgets = window_shortcut_widgets;
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_RESET);
window_init_scroll_widgets(w);
w->no_list_items = SHORTCUT_COUNT;
w->selected_list_item = -1;
w->min_width = WW;
w->min_height = WH;
w->max_width = WW_SC_MAX;
w->max_height = WH_SC_MAX;
w->no_list_items = SHORTCUT_COUNT;
w->selected_list_item = -1;
w->min_width = WW;
w->min_height = WH;
w->max_width = WW_SC_MAX;
w->max_height = WH_SC_MAX;
}
return w;
}
/**
@@ -188,8 +187,8 @@ static void window_shortcut_mouseup(rct_window *w, rct_widgetindex widgetIndex)
window_close(w);
break;
case WIDX_RESET:
config_reset_shortcut_keys();
config_shortcut_keys_save();
keyboard_shortcuts_reset();
keyboard_shortcuts_save();
window_invalidate(w);
break;
}
@@ -289,7 +288,7 @@ static void window_shortcut_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, s
}
char templateString[128];
keyboard_shortcut_format_string(templateString, 128, gShortcutKeys[i]);
keyboard_shortcuts_format_string(templateString, 128, i);
set_format_arg(0, rct_string_id, STR_SHORTCUT_ENTRY_FORMAT);
set_format_arg(2, rct_string_id, ShortcutStringIds[i]);

View File

@@ -37,6 +37,7 @@
#include "scenario/ScenarioRepository.h"
#include "title/TitleScreen.h"
#include "title/TitleSequenceManager.h"
#include "ui/WindowManager.h"
#include "Version.h"
extern "C"
@@ -652,6 +653,24 @@ extern "C"
GetContext()->GetUiContext()->SetCursorTrap(value);
}
rct_window * context_open_window(rct_windowclass wc)
{
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
return windowManager->OpenWindow(wc);
}
void context_handle_keyboard_shortcut(sint32 key)
{
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
windowManager->HandleKeyboardShortcut(key);
}
void context_get_keyboard_map_scroll(const uint8 * keysState, sint32 * x, sint32 * y)
{
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
windowManager->GetKeyboardMapScroll(keysState, x, y);
}
bool platform_open_common_file_dialog(utf8 * outFilename, file_dialog_desc * desc, size_t outSize)
{
try

View File

@@ -18,6 +18,16 @@
#include "common.h"
#ifdef __cplusplus
extern "C"
{
#endif
#include "interface/window.h"
#ifdef __cplusplus
}
#endif
typedef struct CursorState
{
sint32 x, y;
@@ -117,7 +127,9 @@ extern "C"
sint32 context_get_height();
bool context_has_focus();
void context_set_cursor_trap(bool value);
rct_window * context_open_window(rct_windowclass wc);
void context_handle_keyboard_shortcut(sint32 key);
void context_get_keyboard_map_scroll(const uint8 * keysState, sint32 * x, sint32 * y);
#ifdef __cplusplus
}
#endif

View File

@@ -1,173 +0,0 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "../common.h"
#include "../core/Console.hpp"
#include "../core/File.h"
#include "../core/FileStream.hpp"
#include "../core/Memory.hpp"
#include "../core/Path.hpp"
#include "../core/String.hpp"
extern "C"
{
#include "../interface/keyboard_shortcut.h"
#include "../platform/platform.h"
}
// Current keyboard shortcuts
uint16 gShortcutKeys[SHORTCUT_COUNT];
namespace KeyboardShortcuts
{
// Default keyboard shortcuts
static const uint16 _defaultShortcutKeys[SHORTCUT_COUNT] =
{
SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_TOP_MOST_WINDOW
SHIFT | SDL_SCANCODE_BACKSPACE, // SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS
SDL_SCANCODE_ESCAPE, // SHORTCUT_CANCEL_CONSTRUCTION_MODE
SDL_SCANCODE_PAUSE, // SHORTCUT_PAUSE_GAME
SDL_SCANCODE_PAGEUP, // SHORTCUT_ZOOM_VIEW_OUT
SDL_SCANCODE_PAGEDOWN, // SHORTCUT_ZOOM_VIEW_IN
SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_CLOCKWISE
SHIFT | SDL_SCANCODE_RETURN, // SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE
SDL_SCANCODE_Z, // SHORTCUT_ROTATE_CONSTRUCTION_OBJECT
SDL_SCANCODE_1, // SHORTCUT_UNDERGROUND_VIEW_TOGGLE
SDL_SCANCODE_H, // SHORTCUT_REMOVE_BASE_LAND_TOGGLE
SDL_SCANCODE_V, // SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE
SDL_SCANCODE_3, // SHORTCUT_SEE_THROUGH_RIDES_TOGGLE
SDL_SCANCODE_4, // SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE
SDL_SCANCODE_5, // SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE
SDL_SCANCODE_6, // SHORTCUT_INVISIBLE_PEOPLE_TOGGLE
SDL_SCANCODE_8, // SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE
SDL_SCANCODE_9, // SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE
SDL_SCANCODE_0, // SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE
SDL_SCANCODE_F1, // SHORTCUT_ADJUST_LAND
SDL_SCANCODE_F2, // SHORTCUT_ADJUST_WATER
SDL_SCANCODE_F3, // SHORTCUT_BUILD_SCENERY
SDL_SCANCODE_F4, // SHORTCUT_BUILD_PATHS
SDL_SCANCODE_F5, // SHORTCUT_BUILD_NEW_RIDE
SDL_SCANCODE_F, // SHORTCUT_SHOW_FINANCIAL_INFORMATION
SDL_SCANCODE_D, // SHORTCUT_SHOW_RESEARCH_INFORMATION
SDL_SCANCODE_R, // SHORTCUT_SHOW_RIDES_LIST
SDL_SCANCODE_P, // SHORTCUT_SHOW_PARK_INFORMATION
SDL_SCANCODE_G, // SHORTCUT_SHOW_GUEST_LIST
SDL_SCANCODE_S, // SHORTCUT_SHOW_STAFF_LIST
SDL_SCANCODE_M, // SHORTCUT_SHOW_RECENT_MESSAGES
SDL_SCANCODE_TAB, // SHORTCUT_SHOW_MAP
PLATFORM_MODIFIER | SDL_SCANCODE_S, // SHORTCUT_SCREENSHOT
SDL_SCANCODE_MINUS, // SHORTCUT_REDUCE_GAME_SPEED,
SDL_SCANCODE_EQUALS, // SHORTCUT_INCREASE_GAME_SPEED,
PLATFORM_MODIFIER | ALT | SDL_SCANCODE_C, // SHORTCUT_OPEN_CHEAT_WINDOW,
SDL_SCANCODE_T, // SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SDL_SCANCODE_UP, // SHORTCUT_SCROLL_MAP_UP
SDL_SCANCODE_LEFT, // SHORTCUT_SCROLL_MAP_LEFT
SDL_SCANCODE_DOWN, // SHORTCUT_SCROLL_MAP_DOWN
SDL_SCANCODE_RIGHT, // SHORTCUT_SCROLL_MAP_RIGHT
SDL_SCANCODE_C, // SHORTCUT_OPEN_CHAT_WINDOW
PLATFORM_MODIFIER | SDL_SCANCODE_F10, // SHORTCUT_QUICK_SAVE_GAME
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_OPTIONS
SHORTCUT_UNDEFINED, // SHORTCUT_MUTE_SOUND
ALT | SDL_SCANCODE_RETURN, // SHORTCUT_WINDOWED_MODE_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SHOW_MULTIPLAYER
SHORTCUT_UNDEFINED, // SHORTCUT_PAINT_ORIGINAL_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_DEBUG_PAINT_TOGGLE
SHORTCUT_UNDEFINED, // SHORTCUT_SEE_THROUGH_PATHS_TOGGLE
SDL_SCANCODE_KP_4, // SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT
SDL_SCANCODE_KP_6, // SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT
SDL_SCANCODE_KP_5, // SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT
SDL_SCANCODE_KP_2, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN
SDL_SCANCODE_KP_8, // SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP
SDL_SCANCODE_KP_PLUS, // SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE
SDL_SCANCODE_KP_1, // SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT
SDL_SCANCODE_KP_3, // SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT
SDL_SCANCODE_KP_7, // SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK
SDL_SCANCODE_KP_9, // SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK
SDL_SCANCODE_KP_0, // SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT
SDL_SCANCODE_KP_MINUS, // SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT
};
constexpr sint32 CURRENT_FILE_VERSION = 1;
static void Reset()
{
Memory::Copy(gShortcutKeys, _defaultShortcutKeys, sizeof(gShortcutKeys));
}
static std::string GetPath()
{
utf8 path[MAX_PATH];
platform_get_user_directory(path, nullptr, sizeof(path));
Path::Append(path, sizeof(path), "hotkeys.cfg");
return path;
}
}
extern "C"
{
void config_reset_shortcut_keys()
{
KeyboardShortcuts::Reset();
}
bool config_shortcut_keys_load()
{
bool result = false;
try
{
std::string path = KeyboardShortcuts::GetPath();
if (File::Exists(path))
{
auto fs = FileStream(path, FILE_MODE_OPEN);
uint16 version = fs.ReadValue<uint16>();
if (version == KeyboardShortcuts::CURRENT_FILE_VERSION)
{
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
gShortcutKeys[i] = fs.ReadValue<uint16>();
}
result = true;
}
}
}
catch (const Exception &ex)
{
Console::WriteLine("Error reading shortcut keys: %s", ex.GetMessage());
}
return result;
}
bool config_shortcut_keys_save()
{
bool result = false;
try
{
std::string path = KeyboardShortcuts::GetPath();
auto fs = FileStream(path, FILE_MODE_WRITE);
fs.WriteValue<uint16>(KeyboardShortcuts::CURRENT_FILE_VERSION);
for (sint32 i = 0; i < SHORTCUT_COUNT; i++)
{
fs.WriteValue<uint16>(gShortcutKeys[i]);
}
result = true;
}
catch (const Exception &ex)
{
Console::WriteLine("Error writing shortcut keys: %s", ex.GetMessage());
}
return result;
}
}

View File

@@ -23,7 +23,6 @@
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/Cursors.h"
#include "interface/keyboard_shortcut.h"
#include "interface/viewport.h"
#include "interface/widget.h"
#include "interface/window.h"
@@ -1435,87 +1434,19 @@ static void input_handle_chat(sint32 key)
}
}
/**
*
* rct2: 0x006E3B43
*/
void title_handle_keyboard_input()
static void input_handle_keyboard(bool isTitle)
{
rct_window *w;
sint32 key;
if (gOpenRCT2Headless) {
return;
}
if (!gConsoleOpen) {
// Handle modifier keys and key scrolling
gInputPlaceObjectModifier = PLACE_OBJECT_MODIFIER_NONE;
const uint8 * keysState = context_get_keys_state();
if (keysState[SDL_SCANCODE_LSHIFT] || keysState[SDL_SCANCODE_RSHIFT])
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_SHIFT_Z;
if (keysState[SDL_SCANCODE_LCTRL] || keysState[SDL_SCANCODE_RCTRL])
gInputPlaceObjectModifier |= PLACE_OBJECT_MODIFIER_COPY_Z;
if (keysState[SDL_SCANCODE_LALT] || keysState[SDL_SCANCODE_RALT])
gInputPlaceObjectModifier |= 4;
#ifdef __MACOSX__
if (keysState[SDL_SCANCODE_LGUI] || keysState[SDL_SCANCODE_RGUI]) {
gInputPlaceObjectModifier |= 8;
}
#endif
}
while ((key = get_next_key()) != 0) {
if (key == 255)
continue;
// Reserve backtick for console
if (key == SDL_SCANCODE_GRAVE) {
if ((gConfigGeneral.debugging_tools && !context_is_input_active()) || gConsoleOpen) {
window_cancel_textbox();
console_toggle();
}
continue;
} else if (gConsoleOpen) {
input_handle_console(key);
continue;
}
key |= gInputPlaceObjectModifier << 8;
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
if (w != NULL) {
keyboard_shortcut_set(key);
} else {
w = window_find_by_class(WC_TEXTINPUT);
if (w != NULL) {
window_text_input_key(w, key);
}
else if (!gUsingWidgetTextBox) {
keyboard_shortcut_handle(key);
}
}
}
}
/**
*
* rct2: 0x006E3B43
*/
void game_handle_keyboard_input()
{
rct_window *w;
sint32 key;
if (gOpenRCT2Headless) {
return;
}
if (!gConsoleOpen) {
// Handle mouse scrolling
if (_inputState == INPUT_STATE_NORMAL && gConfigGeneral.edge_scrolling) {
if (!(gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_SHIFT_Z | PLACE_OBJECT_MODIFIER_COPY_Z))) {
game_handle_edge_scroll();
if (!isTitle) {
// Handle mouse scrolling
if (_inputState == INPUT_STATE_NORMAL && gConfigGeneral.edge_scrolling) {
if (!(gInputPlaceObjectModifier & (PLACE_OBJECT_MODIFIER_SHIFT_Z | PLACE_OBJECT_MODIFIER_COPY_Z))) {
game_handle_edge_scroll();
}
}
}
@@ -1536,11 +1467,13 @@ void game_handle_keyboard_input()
gInputPlaceObjectModifier |= 8;
}
#endif
game_handle_key_scroll();
if (!isTitle) {
game_handle_key_scroll();
}
}
// Handle key input
sint32 key;
while (!gOpenRCT2Headless && (key = get_next_key()) != 0) {
if (key == 255)
continue;
@@ -1555,27 +1488,40 @@ void game_handle_keyboard_input()
} else if (gConsoleOpen) {
input_handle_console(key);
continue;
} else if (gChatOpen) {
} else if (!isTitle && gChatOpen) {
input_handle_chat(key);
continue;
}
key |= gInputPlaceObjectModifier << 8;
w = window_find_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
rct_window * w = window_find_by_class(WC_TEXTINPUT);
if (w != NULL) {
keyboard_shortcut_set(key);
} else {
w = window_find_by_class(WC_TEXTINPUT);
if (w != NULL) {
window_text_input_key(w, key);
} else if (!gUsingWidgetTextBox) {
keyboard_shortcut_handle(key);
}
window_text_input_key(w, key);
} else if (!gUsingWidgetTextBox) {
context_handle_keyboard_shortcut(key);
}
}
}
/**
*
* rct2: 0x006E3B43
*/
void title_handle_keyboard_input()
{
input_handle_keyboard(true);
}
/**
*
* rct2: 0x006E3B43
*/
void game_handle_keyboard_input()
{
input_handle_keyboard(false);
}
/**
*
* rct2: 0x00406CD2
@@ -1705,45 +1651,8 @@ void game_handle_key_scroll()
scrollX = 0;
scrollY = 0;
const uint8 * keysState = context_get_keys_state();
for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) {
uint16 shortcutKey = gShortcutKeys[shortcutId];
uint8 scancode = shortcutKey & 0xFF;
if (shortcutKey == 0xFFFF) continue;
if (!keysState[scancode]) continue;
if (shortcutKey & SHIFT) {
if (!keysState[SDL_SCANCODE_LSHIFT] && !keysState[SDL_SCANCODE_RSHIFT]) continue;
}
if (shortcutKey & CTRL) {
if (!keysState[SDL_SCANCODE_LCTRL] && !keysState[SDL_SCANCODE_RCTRL]) continue;
}
if (shortcutKey & ALT) {
if (!keysState[SDL_SCANCODE_LALT] && !keysState[SDL_SCANCODE_RALT]) continue;
}
#ifdef __MACOSX__
if (shortcutKey & CMD) {
if (!keysState[SDL_SCANCODE_LGUI] && !keysState[SDL_SCANCODE_RGUI]) continue;
}
#endif
switch (shortcutId) {
case SHORTCUT_SCROLL_MAP_UP:
scrollY = -1;
break;
case SHORTCUT_SCROLL_MAP_LEFT:
scrollX = -1;
break;
case SHORTCUT_SCROLL_MAP_DOWN:
scrollY = 1;
break;
case SHORTCUT_SCROLL_MAP_RIGHT:
scrollX = 1;
break;
}
}
context_get_keyboard_map_scroll(keysState, &scrollX, &scrollY);
// Scroll viewport
if (scrollX != 0) {

View File

@@ -1,112 +0,0 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#ifndef _INTERFACE_KEYBOARD_SHORTCUT_H_
#define _INTERFACE_KEYBOARD_SHORTCUT_H_
#include "../common.h"
#define SHORTCUT_UNDEFINED 0xFFFF
/** The current shortcut being changed. */
extern uint8 gKeyboardShortcutChangeId;
void keyboard_shortcut_set(sint32 key);
void keyboard_shortcut_handle(sint32 key);
void keyboard_shortcut_handle_command(sint32 shortcutIndex);
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey);
void config_reset_shortcut_keys();
bool config_shortcut_keys_load();
bool config_shortcut_keys_save();
typedef struct shortcut_entry {
uint8 key;
uint8 modifier;
} shortcut_entry;
enum {
SHORTCUT_CLOSE_TOP_MOST_WINDOW,
SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS,
SHORTCUT_CANCEL_CONSTRUCTION_MODE,
SHORTCUT_PAUSE_GAME,
SHORTCUT_ZOOM_VIEW_OUT,
SHORTCUT_ZOOM_VIEW_IN,
SHORTCUT_ROTATE_VIEW_CLOCKWISE,
SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE,
SHORTCUT_ROTATE_CONSTRUCTION_OBJECT,
SHORTCUT_UNDERGROUND_VIEW_TOGGLE,
SHORTCUT_REMOVE_BASE_LAND_TOGGLE,
SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE,
SHORTCUT_SEE_THROUGH_RIDES_TOGGLE,
SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE,
SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE,
SHORTCUT_INVISIBLE_PEOPLE_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE,
SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE,
SHORTCUT_ADJUST_LAND,
SHORTCUT_ADJUST_WATER,
SHORTCUT_BUILD_SCENERY,
SHORTCUT_BUILD_PATHS,
SHORTCUT_BUILD_NEW_RIDE,
SHORTCUT_SHOW_FINANCIAL_INFORMATION,
SHORTCUT_SHOW_RESEARCH_INFORMATION,
SHORTCUT_SHOW_RIDES_LIST,
SHORTCUT_SHOW_PARK_INFORMATION,
SHORTCUT_SHOW_GUEST_LIST,
SHORTCUT_SHOW_STAFF_LIST,
SHORTCUT_SHOW_RECENT_MESSAGES,
SHORTCUT_SHOW_MAP,
SHORTCUT_SCREENSHOT,
// New
SHORTCUT_REDUCE_GAME_SPEED,
SHORTCUT_INCREASE_GAME_SPEED,
SHORTCUT_OPEN_CHEAT_WINDOW,
SHORTCUT_REMOVE_TOP_BOTTOM_TOOLBAR_TOGGLE,
SHORTCUT_SCROLL_MAP_UP,
SHORTCUT_SCROLL_MAP_LEFT,
SHORTCUT_SCROLL_MAP_DOWN,
SHORTCUT_SCROLL_MAP_RIGHT,
SHORTCUT_OPEN_CHAT_WINDOW,
SHORTCUT_QUICK_SAVE_GAME,
SHORTCUT_SHOW_OPTIONS,
SHORTCUT_MUTE_SOUND,
SHORTCUT_WINDOWED_MODE_TOGGLE,
SHORTCUT_SHOW_MULTIPLAYER,
SHORTCUT_PAINT_ORIGINAL_TOGGLE,
SHORTCUT_DEBUG_PAINT_TOGGLE,
SHORTCUT_SEE_THROUGH_PATHS_TOGGLE,
SHORTCUT_RIDE_CONSTRUCTION_TURN_LEFT,
SHORTCUT_RIDE_CONSTRUCTION_TURN_RIGHT,
SHORTCUT_RIDE_CONSTRUCTION_USE_TRACK_DEFAULT,
SHORTCUT_RIDE_CONSTRUCTION_SLOPE_DOWN,
SHORTCUT_RIDE_CONSTRUCTION_SLOPE_UP,
SHORTCUT_RIDE_CONSTRUCTION_CHAIN_LIFT_TOGGLE,
SHORTCUT_RIDE_CONSTRUCTION_BANK_LEFT,
SHORTCUT_RIDE_CONSTRUCTION_BANK_RIGHT,
SHORTCUT_RIDE_CONSTRUCTION_PREVIOUS_TRACK,
SHORTCUT_RIDE_CONSTRUCTION_NEXT_TRACK,
SHORTCUT_RIDE_CONSTRUCTION_BUILD_CURRENT,
SHORTCUT_RIDE_CONSTRUCTION_DEMOLISH_CURRENT,
SHORTCUT_COUNT
};
extern uint16 gShortcutKeys[SHORTCUT_COUNT];
#endif

View File

@@ -25,7 +25,6 @@
#include "../ride/track_design.h"
#include "../ride/vehicle.h"
#include "../scenario/scenario.h"
#include "../scenario/ScenarioRepository.h"
#include "../world/park.h"
#include "colour.h"
@@ -34,6 +33,7 @@ union rct_window_event;
struct track_design_file_ref;
struct TitleSequence;
struct TextInputSession;
typedef struct scenario_index_entry scenario_index_entry;
#define TEXT_INPUT_SIZE 1024
#define TOP_TOOLBAR_HEIGHT 27
@@ -702,8 +702,6 @@ void window_guest_list_open();
void window_guest_list_open_with_filter(sint32 type, sint32 index);
void window_map_open();
void window_options_open();
void window_shortcut_keys_open();
void window_shortcut_change_open(sint32 selected_key);
void window_guest_open(rct_peep* peep);
rct_window *window_staff_open(rct_peep* peep);
void window_staff_fire_prompt_open(rct_peep* peep);

View File

@@ -57,7 +57,6 @@ extern "C" {
#include "../game.h"
#include "../interface/chat.h"
#include "../interface/window.h"
#include "../interface/keyboard_shortcut.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../management/finance.h"
@@ -2364,7 +2363,7 @@ void network_chat_show_connected_message()
{
char templateBuffer[128];
char *templateString = templateBuffer;
keyboard_shortcut_format_string(templateBuffer, 128, gShortcutKeys[SHORTCUT_OPEN_CHAT_WINDOW]);
// keyboard_shortcuts_format_string(templateBuffer, sizeof(templateBuffer), SHORTCUT_OPEN_CHAT_WINDOW);
utf8 buffer[256];
NetworkPlayer server;
server.Name = "Server";

View File

@@ -154,11 +154,11 @@ static void ride_entrance_exit_paint(uint8 direction, sint32 height, rct_map_ele
string_id = STR_RIDE_ENTRANCE_NAME;
}
utf8 entrance_string[MAX_PATH];
utf8 entrance_string[256];
if (gConfigGeneral.upper_case_banners) {
format_string_to_upper(entrance_string, MAX_PATH, string_id, gCommonFormatArgs);
format_string_to_upper(entrance_string, sizeof(entrance_string), string_id, gCommonFormatArgs);
} else {
format_string(entrance_string, MAX_PATH, string_id, gCommonFormatArgs);
format_string(entrance_string, sizeof(entrance_string), string_id, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
@@ -237,11 +237,11 @@ static void park_entrance_paint(uint8 direction, sint32 height, rct_map_element*
park_text_id = STR_BANNER_TEXT_FORMAT;
}
utf8 park_name[MAX_PATH];
utf8 park_name[256];
if (gConfigGeneral.upper_case_banners) {
format_string_to_upper(park_name, MAX_PATH, park_text_id, gCommonFormatArgs);
format_string_to_upper(park_name, sizeof(park_name), park_text_id, gCommonFormatArgs);
} else {
format_string(park_name, MAX_PATH, park_text_id, gCommonFormatArgs);
format_string(park_name, sizeof(park_name), park_text_id, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;

View File

@@ -369,12 +369,12 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
set_format_arg(2, uint32, ride->name_arguments);
}
utf8 signString[MAX_PATH];
utf8 signString[256];
rct_string_id stringId = STR_SCROLLING_SIGN_TEXT;
if (gConfigGeneral.upper_case_banners) {
format_string_to_upper(signString, MAX_PATH, stringId, gCommonFormatArgs);
format_string_to_upper(signString, sizeof(signString), stringId, gCommonFormatArgs);
} else {
format_string(signString, MAX_PATH, stringId, gCommonFormatArgs);
format_string(signString, sizeof(signString), stringId, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;

View File

@@ -262,8 +262,8 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
stringId = ride->name;
set_format_arg(0, uint32, ride->name_arguments);
}
utf8 signString[MAX_PATH];
format_string(signString, MAX_PATH, stringId, gCommonFormatArgs);
utf8 signString[256];
format_string(signString, sizeof(signString), stringId, gCommonFormatArgs);
rct_large_scenery_text *text = entry->large_scenery.text;
sint32 y_offset = (text->offset[(direction & 1)].y * 2);
if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) {
@@ -352,12 +352,12 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
set_format_arg(0, rct_string_id, ride->name);
set_format_arg(2, uint32, ride->name_arguments);
}
utf8 signString[MAX_PATH];
utf8 signString[256];
rct_string_id stringId = STR_SCROLLING_SIGN_TEXT;
if (gConfigGeneral.upper_case_banners) {
format_string_to_upper(signString, MAX_PATH, stringId, gCommonFormatArgs);
format_string_to_upper(signString, sizeof(signString), stringId, gCommonFormatArgs);
} else {
format_string(signString, MAX_PATH, stringId, gCommonFormatArgs);
format_string(signString, sizeof(signString), stringId, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;

View File

@@ -27,7 +27,6 @@
#include "../input.h"
#include "../interface/console.h"
#include "../interface/Cursors.h"
#include "../interface/keyboard_shortcut.h"
#include "../interface/window.h"
#include "../localisation/currency.h"
#include "../localisation/localisation.h"

View File

@@ -28,7 +28,6 @@
#include "input.h"
#include "interface/chat.h"
#include "interface/console.h"
#include "interface/keyboard_shortcut.h"
#include "interface/viewport.h"
#include "intro.h"
#include "localisation/date.h"
@@ -151,10 +150,7 @@ bool rct2_init()
gScenarioTicks = 0;
util_srand((uint32)time(0));
config_reset_shortcut_keys();
config_shortcut_keys_load();
input_reset_place_obj_modifier();
// config_load();
if (!gfx_load_g1()) {
return false;

View File

@@ -177,8 +177,8 @@ bool track_design_save(uint8 rideIndex)
}
}
utf8 track_name[MAX_PATH];
format_string(track_name, MAX_PATH, ride->name, &ride->name_arguments);
utf8 track_name[256];
format_string(track_name, sizeof(track_name), ride->name, &ride->name_arguments);
window_loadsave_open(LOADSAVETYPE_TRACK | LOADSAVETYPE_SAVE, track_name);
window_loadsave_set_loadsave_callback(track_design_save_callback);

View File

@@ -16,6 +16,7 @@
#include "../drawing/X8DrawingEngine.h"
#include "UiContext.h"
#include "WindowManager.h"
using namespace OpenRCT2::Drawing;
@@ -26,6 +27,10 @@ namespace OpenRCT2 { namespace Ui
*/
class DummyUiContext final : public IUiContext
{
private:
IWindowManager * const _windowManager = CreateDummyWindowManager();
public:
void CreateWindow() override { }
void CloseWindow() override { }
void * GetWindow() override { return nullptr; }
@@ -39,32 +44,38 @@ namespace OpenRCT2 { namespace Ui
void ProcessMessages() override { }
void TriggerResize() override { }
virtual void ShowMessageBox(const std::string &message) override { }
virtual std::string ShowFileDialog(const FileDialogDesc &desc) override { return std::string(); }
virtual std::string ShowDirectoryDialog(const std::string &title) override { return std::string(); }
void ShowMessageBox(const std::string &message) override { }
std::string ShowFileDialog(const FileDialogDesc &desc) override { return std::string(); }
std::string ShowDirectoryDialog(const std::string &title) override { return std::string(); }
// Input
virtual const CursorState * GetCursorState() override { return nullptr; }
virtual CURSOR_ID GetCursor() override { return CURSOR_ARROW; }
virtual void SetCursor(CURSOR_ID cursor) override { }
virtual void SetCursorVisible(bool value) override { }
virtual void GetCursorPosition(sint32 * x, sint32 * y) override { }
virtual void SetCursorPosition(sint32 x, sint32 y) override { }
virtual void SetCursorTrap(bool value) override { }
virtual const uint8 * GetKeysState() override { return nullptr; }
virtual const uint8 * GetKeysPressed() override { return nullptr; }
virtual void SetKeysPressed(uint32 keysym, uint8 scancode) override { }
const CursorState * GetCursorState() override { return nullptr; }
CURSOR_ID GetCursor() override { return CURSOR_ARROW; }
void SetCursor(CURSOR_ID cursor) override { }
void SetCursorVisible(bool value) override { }
void GetCursorPosition(sint32 * x, sint32 * y) override { }
void SetCursorPosition(sint32 x, sint32 y) override { }
void SetCursorTrap(bool value) override { }
const uint8 * GetKeysState() override { return nullptr; }
const uint8 * GetKeysPressed() override { return nullptr; }
void SetKeysPressed(uint32 keysym, uint8 scancode) override { }
// Drawing
virtual Drawing::IDrawingEngine * CreateDrawingEngine(Drawing::DRAWING_ENGINE_TYPE type) override
Drawing::IDrawingEngine * CreateDrawingEngine(Drawing::DRAWING_ENGINE_TYPE type) override
{
return new X8DrawingEngine();
}
// Text input
virtual bool IsTextInputActive() override { return false; }
virtual TextInputSession * StartTextInput(utf8 * buffer, size_t bufferSize) override { return nullptr; }
virtual void StopTextInput() override { }
bool IsTextInputActive() override { return false; }
TextInputSession * StartTextInput(utf8 * buffer, size_t bufferSize) override { return nullptr; }
void StopTextInput() override { }
// In-game UI
IWindowManager * GetWindowManager() override
{
return _windowManager;
}
};
IUiContext * CreateDummyUiContext()

View File

@@ -0,0 +1,32 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#include "WindowManager.h"
namespace OpenRCT2 { namespace Ui
{
class DummyWindowManager final : public IWindowManager
{
rct_window * OpenWindow(rct_windowclass wc) override { return nullptr; }
void HandleKeyboardShortcut(sint32 key) override { }
void GetKeyboardMapScroll(const uint8 * keysState, sint32 * x, sint32 * y) override { }
};
IWindowManager * CreateDummyWindowManager()
{
return new DummyWindowManager();
}
} }

View File

@@ -32,6 +32,8 @@ namespace OpenRCT2
namespace Ui
{
interface IWindowManager;
enum class FULLSCREEN_MODE
{
WINDOWED,
@@ -126,6 +128,9 @@ namespace OpenRCT2
virtual bool IsTextInputActive() abstract;
virtual TextInputSession * StartTextInput(utf8 * buffer, size_t bufferSize) abstract;
virtual void StopTextInput() abstract;
// In-game UI
virtual IWindowManager * GetWindowManager() abstract;
};
IUiContext * CreateDummyUiContext();

View File

@@ -0,0 +1,44 @@
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#pragma once
#include "../common.h"
extern "C"
{
#include "../interface/window.h"
}
namespace OpenRCT2
{
namespace Ui
{
/**
* Manager of in-game windows and widgets.
*/
interface IWindowManager
{
virtual ~IWindowManager() = default;
virtual rct_window * OpenWindow(rct_windowclass wc) abstract;
virtual void HandleKeyboardShortcut(sint32 key) abstract;
virtual void GetKeyboardMapScroll(const uint8 * keysState, sint32 * x, sint32 * y) abstract;
};
IWindowManager * CreateDummyWindowManager();
}
}

View File

@@ -738,7 +738,7 @@ static void window_options_mouseup(rct_window *w, rct_widgetindex widgetIndex)
case WINDOW_OPTIONS_PAGE_CONTROLS_AND_INTERFACE:
switch (widgetIndex) {
case WIDX_HOTKEY_DROPDOWN:
window_shortcut_keys_open();
context_open_window(WC_KEYBOARD_SHORTCUT_LIST);
break;
case WIDX_SCREEN_EDGE_SCROLLING:
gConfigGeneral.edge_scrolling ^= 1;