1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 18:55:23 +01:00

Refactor ShortcutIds.h constants to kCamelCase

This commit is contained in:
Harry Hopkinson
2024-09-24 19:47:20 +01:00
committed by Harry-Hopkinson
parent d6a7697622
commit e5f66ad553
3 changed files with 47 additions and 47 deletions

View File

@@ -14,22 +14,22 @@
namespace OpenRCT2::Ui::ShortcutId
{
// Interface / general
constexpr std::string_view InterfaceCloseTop = "interface.general.close_top";
constexpr std::string_view InterfaceCloseAll = "interface.general.close_all";
constexpr std::string_view InterfaceRotateConstruction = "interface.general.rotate_construction";
constexpr std::string_view InterfaceCancelConstruction = "interface.general.cancel_construction";
constexpr std::string_view InterfacePause = "interface.general.pause";
constexpr std::string_view InterfaceDecreaseSpeed = "interface.misc.decrease_speed";
constexpr std::string_view InterfaceIncreaseSpeed = "interface.misc.increase_speed";
constexpr std::string_view InterfaceToggleToolbars = "interface.misc.toggle_toolbars";
constexpr std::string_view InterfaceScreenshot = "interface.misc.screenshot";
constexpr std::string_view InterfaceGiantScreenshot = "interface.misc.giant_screenshot";
constexpr std::string_view InterfaceLoadGame = "interface.misc.load_game";
constexpr std::string_view InterfaceSaveGame = "interface.misc.save_game";
constexpr std::string_view InterfaceMute = "interface.misc.mute";
constexpr std::string_view InterfaceSceneryPicker = "interface.misc.scenery_picker";
constexpr std::string_view InterfaceDisableClearance = "interface.misc.disable_clearance";
constexpr std::string_view InterfaceMultiplayerChat = "interface.misc.multiplayer_chat";
constexpr std::string_view kInterfaceCloseTop = "interface.general.close_top";
constexpr std::string_view kInterfaceCloseAll = "interface.general.close_all";
constexpr std::string_view kInterfaceRotateConstruction = "interface.general.rotate_construction";
constexpr std::string_view kInterfaceCancelConstruction = "interface.general.cancel_construction";
constexpr std::string_view kInterfacePause = "interface.general.pause";
constexpr std::string_view kInterfaceDecreaseSpeed = "interface.misc.decrease_speed";
constexpr std::string_view kInterfaceIncreaseSpeed = "interface.misc.increase_speed";
constexpr std::string_view kInterfaceToggleToolbars = "interface.misc.toggle_toolbars";
constexpr std::string_view kInterfaceScreenshot = "interface.misc.screenshot";
constexpr std::string_view kInterfaceGiantScreenshot = "interface.misc.giant_screenshot";
constexpr std::string_view kInterfaceLoadGame = "interface.misc.load_game";
constexpr std::string_view kInterfaceSaveGame = "interface.misc.save_game";
constexpr std::string_view kInterfaceMute = "interface.misc.mute";
constexpr std::string_view kInterfaceSceneryPicker = "interface.misc.scenery_picker";
constexpr std::string_view kInterfaceDisableClearance = "interface.misc.disable_clearance";
constexpr std::string_view kInterfaceMultiplayerChat = "interface.misc.multiplayer_chat";
// Interface / graphics
constexpr std::string_view InterfaceScaleToggleWindowMode = "interface.graphics.toggle_window_mode";

View File

@@ -356,15 +356,15 @@ void ShortcutManager::SaveUserBindings(const fs::path& path)
std::string_view ShortcutManager::GetLegacyShortcutId(size_t index)
{
static constexpr std::string_view _legacyMap[] = {
ShortcutId::InterfaceCloseTop,
ShortcutId::InterfaceCloseAll,
ShortcutId::InterfaceCancelConstruction,
ShortcutId::InterfacePause,
ShortcutId::kInterfaceCloseTop,
ShortcutId::kInterfaceCloseAll,
ShortcutId::kInterfaceCancelConstruction,
ShortcutId::kInterfacePause,
ShortcutId::ViewGeneralZoomOut,
ShortcutId::ViewGeneralZoomIn,
ShortcutId::ViewGeneralRotateClockwise,
ShortcutId::ViewGeneralRotateAnticlockwise,
ShortcutId::InterfaceRotateConstruction,
ShortcutId::kInterfaceRotateConstruction,
ShortcutId::ViewToggleUnderground,
ShortcutId::ViewToggleBaseLand,
ShortcutId::ViewToggleVerticalLand,
@@ -388,19 +388,19 @@ std::string_view ShortcutManager::GetLegacyShortcutId(size_t index)
ShortcutId::InterfaceOpenStaff,
ShortcutId::InterfaceOpenMessages,
ShortcutId::InterfaceOpenMap,
ShortcutId::InterfaceScreenshot,
ShortcutId::InterfaceDecreaseSpeed,
ShortcutId::InterfaceIncreaseSpeed,
ShortcutId::kInterfaceScreenshot,
ShortcutId::kInterfaceDecreaseSpeed,
ShortcutId::kInterfaceIncreaseSpeed,
ShortcutId::InterfaceOpenCheats,
ShortcutId::InterfaceToggleToolbars,
ShortcutId::kInterfaceToggleToolbars,
ShortcutId::ViewScrollUp,
ShortcutId::ViewScrollLeft,
ShortcutId::ViewScrollDown,
ShortcutId::ViewScrollRight,
ShortcutId::InterfaceMultiplayerChat,
ShortcutId::InterfaceSaveGame,
ShortcutId::kInterfaceMultiplayerChat,
ShortcutId::kInterfaceSaveGame,
ShortcutId::InterfaceShowOptions,
ShortcutId::InterfaceMute,
ShortcutId::kInterfaceMute,
ShortcutId::InterfaceScaleToggleWindowMode,
ShortcutId::InterfaceMultiplayerShow,
std::string_view(),
@@ -418,14 +418,14 @@ std::string_view ShortcutManager::GetLegacyShortcutId(size_t index)
ShortcutId::WindowRideConstructionNext,
ShortcutId::WindowRideConstructionBuild,
ShortcutId::WindowRideConstructionDemolish,
ShortcutId::InterfaceLoadGame,
ShortcutId::kInterfaceLoadGame,
ShortcutId::InterfaceClearScenery,
ShortcutId::ViewToggleGridlines,
ShortcutId::ViewToggleCutAway,
ShortcutId::ViewToogleFootpathIssues,
ShortcutId::InterfaceOpenTileInspector,
ShortcutId::DebugAdvanceTick,
ShortcutId::InterfaceSceneryPicker,
ShortcutId::kInterfaceSceneryPicker,
ShortcutId::InterfaceScaleIncrease,
ShortcutId::InterfaceScaleDecrease,
ShortcutId::WindowTileInspectorToggleInvisibility,
@@ -440,7 +440,7 @@ std::string_view ShortcutManager::GetLegacyShortcutId(size_t index)
ShortcutId::WindowTileInspectorDecreaseY,
ShortcutId::WindowTileInspectorIncreaseHeight,
ShortcutId::WindowTileInspectorDecreaseHeight,
ShortcutId::InterfaceDisableClearance,
ShortcutId::kInterfaceDisableClearance,
};
return index < std::size(_legacyMap) ? _legacyMap[index] : std::string_view();
}

View File

@@ -727,8 +727,8 @@ void ShortcutManager::RegisterDefaultShortcuts()
{
// clang-format off
// Interface
RegisterShortcut(ShortcutId::InterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", WindowCloseTop);
RegisterShortcut(ShortcutId::InterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", WindowCloseTop);
RegisterShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
{
WindowCloseAll();
@@ -738,8 +738,8 @@ void ShortcutManager::RegisterDefaultShortcuts()
WindowCloseTop();
}
});
RegisterShortcut(ShortcutId::InterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
RegisterShortcut(ShortcutId::InterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
RegisterShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
{
auto window = WindowFindByClass(WindowClass::Error);
@@ -753,25 +753,25 @@ void ShortcutManager::RegisterDefaultShortcuts()
}
}
});
RegisterShortcut(ShortcutId::InterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
RegisterShortcut(ShortcutId::kInterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
if (!(gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_MANAGER)))
{
auto pauseToggleAction = PauseToggleAction();
GameActions::Execute(&pauseToggleAction);
}
});
RegisterShortcut(ShortcutId::InterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
RegisterShortcut(ShortcutId::InterfaceIncreaseSpeed, STR_SHORTCUT_INCREASE_GAME_SPEED, "=", ShortcutIncreaseGameSpeed);
RegisterShortcut(ShortcutId::InterfaceToggleToolbars, STR_SHORTCUT_TOGGLE_VISIBILITY_OF_TOOLBARS, ShortcutRemoveTopBottomToolbarToggle);
RegisterShortcut(ShortcutId::InterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
RegisterShortcut(ShortcutId::InterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", ScreenshotGiant);
RegisterShortcut(ShortcutId::InterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", ShortcutLoadGame);
RegisterShortcut(ShortcutId::InterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", ShortcutQuickSaveGame);
RegisterShortcut(ShortcutId::InterfaceMute, STR_SHORTCUT_MUTE_SOUND, OpenRCT2::Audio::ToggleAllSounds);
RegisterShortcut(ShortcutId::InterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, ShortcutOpenSceneryPicker);
RegisterShortcut(ShortcutId::kInterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
RegisterShortcut(ShortcutId::kInterfaceIncreaseSpeed, STR_SHORTCUT_INCREASE_GAME_SPEED, "=", ShortcutIncreaseGameSpeed);
RegisterShortcut(ShortcutId::kInterfaceToggleToolbars, STR_SHORTCUT_TOGGLE_VISIBILITY_OF_TOOLBARS, ShortcutRemoveTopBottomToolbarToggle);
RegisterShortcut(ShortcutId::kInterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
RegisterShortcut(ShortcutId::kInterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", ScreenshotGiant);
RegisterShortcut(ShortcutId::kInterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", ShortcutLoadGame);
RegisterShortcut(ShortcutId::kInterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", ShortcutQuickSaveGame);
RegisterShortcut(ShortcutId::kInterfaceMute, STR_SHORTCUT_MUTE_SOUND, OpenRCT2::Audio::ToggleAllSounds);
RegisterShortcut(ShortcutId::kInterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, ShortcutOpenSceneryPicker);
RegisterShortcut(
ShortcutId::InterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks);
RegisterShortcut(ShortcutId::InterfaceMultiplayerChat, STR_SHORTCUT_SEND_MESSAGE, "C", []() {
ShortcutId::kInterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks);
RegisterShortcut(ShortcutId::kInterfaceMultiplayerChat, STR_SHORTCUT_SEND_MESSAGE, "C", []() {
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) && ChatAvailable())
{
ChatToggle();