mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-11 01:52:32 +01:00
Rename members of ShortcutManager
This commit is contained in:
@@ -126,7 +126,7 @@ public:
|
|||||||
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)");
|
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)");
|
||||||
}
|
}
|
||||||
_cursorRepository.LoadCursors();
|
_cursorRepository.LoadCursors();
|
||||||
_shortcutManager.LoadUserBindings();
|
_shortcutManager.loadUserBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
~UiContext() override
|
~UiContext() override
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ public:
|
|||||||
std::string GetKeyboardShortcutString(std::string_view shortcutId) override
|
std::string GetKeyboardShortcutString(std::string_view shortcutId) override
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
auto* shortcut = shortcutManager.GetShortcut(shortcutId);
|
auto* shortcut = shortcutManager.getShortcut(shortcutId);
|
||||||
return shortcut != nullptr ? shortcut->getDisplayString() : std::string();
|
return shortcut != nullptr ? shortcut->getDisplayString() : std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ void InputManager::process(const InputEvent& e)
|
|||||||
auto& console = GetInGameConsole();
|
auto& console = GetInGameConsole();
|
||||||
if (console.IsOpen())
|
if (console.IsOpen())
|
||||||
{
|
{
|
||||||
if (!shortcutManager.ProcessEventForSpecificShortcut(e, ShortcutId::kDebugToggleConsole))
|
if (!shortcutManager.processEventForSpecificShortcut(e, ShortcutId::kDebugToggleConsole))
|
||||||
{
|
{
|
||||||
processInGameConsole(e);
|
processInGameConsole(e);
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ void InputManager::process(const InputEvent& e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shortcutManager.ProcessEvent(e);
|
shortcutManager.processEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::processInGameConsole(const InputEvent& e)
|
void InputManager::processInGameConsole(const InputEvent& e)
|
||||||
@@ -465,7 +465,7 @@ void InputManager::processHoldEvents()
|
|||||||
if (!hasTextInputFocus())
|
if (!hasTextInputFocus())
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
if (!shortcutManager.IsPendingShortcutChange())
|
if (!shortcutManager.isPendingShortcutChange())
|
||||||
{
|
{
|
||||||
processViewScrollEvent(ShortcutId::kViewScrollUp, { 0, -1 });
|
processViewScrollEvent(ShortcutId::kViewScrollUp, { 0, -1 });
|
||||||
processViewScrollEvent(ShortcutId::kViewScrollDown, { 0, 1 });
|
processViewScrollEvent(ShortcutId::kViewScrollDown, { 0, 1 });
|
||||||
@@ -480,7 +480,7 @@ void InputManager::processHoldEvents()
|
|||||||
void InputManager::processViewScrollEvent(std::string_view shortcutId, const ScreenCoordsXY& delta)
|
void InputManager::processViewScrollEvent(std::string_view shortcutId, const ScreenCoordsXY& delta)
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
auto shortcut = shortcutManager.GetShortcut(shortcutId);
|
auto shortcut = shortcutManager.getShortcut(shortcutId);
|
||||||
if (shortcut != nullptr && getState(*shortcut))
|
if (shortcut != nullptr && getState(*shortcut))
|
||||||
{
|
{
|
||||||
_viewScroll.x += delta.x;
|
_viewScroll.x += delta.x;
|
||||||
|
|||||||
@@ -113,49 +113,49 @@ std::string RegisteredShortcut::getDisplayString() const
|
|||||||
ShortcutManager::ShortcutManager(IPlatformEnvironment& env)
|
ShortcutManager::ShortcutManager(IPlatformEnvironment& env)
|
||||||
: _env(env)
|
: _env(env)
|
||||||
{
|
{
|
||||||
RegisterDefaultShortcuts();
|
registerDefaultShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::RegisterShortcut(RegisteredShortcut&& shortcut)
|
void ShortcutManager::registerShortcut(RegisteredShortcut&& shortcut)
|
||||||
{
|
{
|
||||||
if (!shortcut.id.empty() && GetShortcut(shortcut.id) == nullptr)
|
if (!shortcut.id.empty() && getShortcut(shortcut.id) == nullptr)
|
||||||
{
|
{
|
||||||
auto id = std::make_unique<std::string>(shortcut.id);
|
auto id = std::make_unique<std::string>(shortcut.id);
|
||||||
auto idView = std::string_view(*id);
|
auto idView = std::string_view(*id);
|
||||||
_ids.push_back(std::move(id));
|
_ids.push_back(std::move(id));
|
||||||
shortcut.orderIndex = Shortcuts.size();
|
shortcut.orderIndex = shortcuts.size();
|
||||||
Shortcuts[idView] = shortcut;
|
shortcuts[idView] = shortcut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisteredShortcut* ShortcutManager::GetShortcut(std::string_view id)
|
RegisteredShortcut* ShortcutManager::getShortcut(std::string_view id)
|
||||||
{
|
{
|
||||||
auto result = Shortcuts.find(id);
|
auto result = shortcuts.find(id);
|
||||||
return result == Shortcuts.end() ? nullptr : &result->second;
|
return result == shortcuts.end() ? nullptr : &result->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::RemoveShortcut(std::string_view id)
|
void ShortcutManager::removeShortcut(std::string_view id)
|
||||||
{
|
{
|
||||||
Shortcuts.erase(id);
|
shortcuts.erase(id);
|
||||||
_ids.erase(
|
_ids.erase(
|
||||||
std::remove_if(_ids.begin(), _ids.end(), [id](const std::unique_ptr<std::string>& x) { return *x == id; }), _ids.end());
|
std::remove_if(_ids.begin(), _ids.end(), [id](const std::unique_ptr<std::string>& x) { return *x == id; }), _ids.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShortcutManager::IsPendingShortcutChange() const
|
bool ShortcutManager::isPendingShortcutChange() const
|
||||||
{
|
{
|
||||||
return !_pendingShortcutChange.empty();
|
return !_pendingShortcutChange.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::SetPendingShortcutChange(std::string_view id)
|
void ShortcutManager::setPendingShortcutChange(std::string_view id)
|
||||||
{
|
{
|
||||||
_pendingShortcutChange = id;
|
_pendingShortcutChange = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::ProcessEvent(const InputEvent& e)
|
void ShortcutManager::processEvent(const InputEvent& e)
|
||||||
{
|
{
|
||||||
if (!IsPendingShortcutChange())
|
if (!isPendingShortcutChange())
|
||||||
{
|
{
|
||||||
for (const auto& shortcut : Shortcuts)
|
for (const auto& shortcut : shortcuts)
|
||||||
{
|
{
|
||||||
if (shortcut.second.matches(e))
|
if (shortcut.second.matches(e))
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ void ShortcutManager::ProcessEvent(const InputEvent& e)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto shortcut = GetShortcut(_pendingShortcutChange);
|
auto shortcut = getShortcut(_pendingShortcutChange);
|
||||||
if (shortcut != nullptr && shortcut->isSuitableInputEvent(e))
|
if (shortcut != nullptr && shortcut->isSuitableInputEvent(e))
|
||||||
{
|
{
|
||||||
auto shortcutInput = ShortcutInput::fromInputEvent(e);
|
auto shortcutInput = ShortcutInput::fromInputEvent(e);
|
||||||
@@ -178,14 +178,14 @@ void ShortcutManager::ProcessEvent(const InputEvent& e)
|
|||||||
|
|
||||||
auto* windowMgr = Ui::GetWindowManager();
|
auto* windowMgr = Ui::GetWindowManager();
|
||||||
windowMgr->CloseByClass(WindowClass::changeKeyboardShortcut);
|
windowMgr->CloseByClass(WindowClass::changeKeyboardShortcut);
|
||||||
SaveUserBindings();
|
saveUserBindings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShortcutManager::ProcessEventForSpecificShortcut(const InputEvent& e, std::string_view id)
|
bool ShortcutManager::processEventForSpecificShortcut(const InputEvent& e, std::string_view id)
|
||||||
{
|
{
|
||||||
auto shortcut = GetShortcut(id);
|
auto shortcut = getShortcut(id);
|
||||||
if (shortcut != nullptr && shortcut->matches(e))
|
if (shortcut != nullptr && shortcut->matches(e))
|
||||||
{
|
{
|
||||||
shortcut->action();
|
shortcut->action();
|
||||||
@@ -194,14 +194,14 @@ bool ShortcutManager::ProcessEventForSpecificShortcut(const InputEvent& e, std::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::LoadUserBindings()
|
void ShortcutManager::loadUserBindings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
|
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
|
||||||
if (fs::exists(path))
|
if (fs::exists(path))
|
||||||
{
|
{
|
||||||
LoadUserBindings(path);
|
loadUserBindings(path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -211,8 +211,8 @@ void ShortcutManager::LoadUserBindings()
|
|||||||
auto legacyPath = fs::u8path(_env.GetFilePath(PathId::configShortcutsLegacy));
|
auto legacyPath = fs::u8path(_env.GetFilePath(PathId::configShortcutsLegacy));
|
||||||
if (fs::exists(legacyPath))
|
if (fs::exists(legacyPath))
|
||||||
{
|
{
|
||||||
LoadLegacyBindings(legacyPath);
|
loadLegacyBindings(legacyPath);
|
||||||
SaveUserBindings();
|
saveUserBindings();
|
||||||
Console::WriteLine("Legacy shortcuts imported");
|
Console::WriteLine("Legacy shortcuts imported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ void ShortcutManager::LoadUserBindings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ShortcutInput> ShortcutManager::ConvertLegacyBinding(uint16_t binding)
|
std::optional<ShortcutInput> ShortcutManager::convertLegacyBinding(uint16_t binding)
|
||||||
{
|
{
|
||||||
constexpr uint16_t kNullBinding = 0xFFFF;
|
constexpr uint16_t kNullBinding = 0xFFFF;
|
||||||
constexpr uint16_t kShift = 0x100;
|
constexpr uint16_t kShift = 0x100;
|
||||||
@@ -255,7 +255,7 @@ std::optional<ShortcutInput> ShortcutManager::ConvertLegacyBinding(uint16_t bind
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::LoadLegacyBindings(const fs::path& path)
|
void ShortcutManager::loadLegacyBindings(const fs::path& path)
|
||||||
{
|
{
|
||||||
constexpr int32_t kSupportedFileVersion = 1;
|
constexpr int32_t kSupportedFileVersion = 1;
|
||||||
constexpr int32_t kMaxLegacyShortcuts = 85;
|
constexpr int32_t kMaxLegacyShortcuts = 85;
|
||||||
@@ -267,14 +267,14 @@ void ShortcutManager::LoadLegacyBindings(const fs::path& path)
|
|||||||
for (size_t i = 0; i < kMaxLegacyShortcuts; i++)
|
for (size_t i = 0; i < kMaxLegacyShortcuts; i++)
|
||||||
{
|
{
|
||||||
auto value = fs.ReadValue<uint16_t>();
|
auto value = fs.ReadValue<uint16_t>();
|
||||||
auto shortcutId = GetLegacyShortcutId(i);
|
auto shortcutId = getLegacyShortcutId(i);
|
||||||
if (!shortcutId.empty())
|
if (!shortcutId.empty())
|
||||||
{
|
{
|
||||||
auto shortcut = GetShortcut(shortcutId);
|
auto shortcut = getShortcut(shortcutId);
|
||||||
if (shortcut != nullptr)
|
if (shortcut != nullptr)
|
||||||
{
|
{
|
||||||
shortcut->current.clear();
|
shortcut->current.clear();
|
||||||
auto input = ConvertLegacyBinding(value);
|
auto input = convertLegacyBinding(value);
|
||||||
if (input.has_value())
|
if (input.has_value())
|
||||||
{
|
{
|
||||||
shortcut->current.push_back(std::move(input.value()));
|
shortcut->current.push_back(std::move(input.value()));
|
||||||
@@ -285,7 +285,7 @@ void ShortcutManager::LoadLegacyBindings(const fs::path& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::LoadUserBindings(const fs::path& path)
|
void ShortcutManager::loadUserBindings(const fs::path& path)
|
||||||
{
|
{
|
||||||
auto root = Json::ReadFromFile(path.u8string());
|
auto root = Json::ReadFromFile(path.u8string());
|
||||||
if (root.is_object())
|
if (root.is_object())
|
||||||
@@ -295,7 +295,7 @@ void ShortcutManager::LoadUserBindings(const fs::path& path)
|
|||||||
const auto& key = it.key();
|
const auto& key = it.key();
|
||||||
const auto& value = it.value();
|
const auto& value = it.value();
|
||||||
|
|
||||||
const auto& shortcut = GetShortcut(key);
|
const auto& shortcut = getShortcut(key);
|
||||||
if (shortcut != nullptr)
|
if (shortcut != nullptr)
|
||||||
{
|
{
|
||||||
shortcut->current.clear();
|
shortcut->current.clear();
|
||||||
@@ -315,12 +315,12 @@ void ShortcutManager::LoadUserBindings(const fs::path& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::SaveUserBindings()
|
void ShortcutManager::saveUserBindings()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
|
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
|
||||||
SaveUserBindings(path);
|
saveUserBindings(path);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
@@ -328,7 +328,7 @@ void ShortcutManager::SaveUserBindings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutManager::SaveUserBindings(const fs::path& path)
|
void ShortcutManager::saveUserBindings(const fs::path& path)
|
||||||
{
|
{
|
||||||
json_t root;
|
json_t root;
|
||||||
if (fs::exists(path))
|
if (fs::exists(path))
|
||||||
@@ -336,7 +336,7 @@ void ShortcutManager::SaveUserBindings(const fs::path& path)
|
|||||||
root = Json::ReadFromFile(path.u8string());
|
root = Json::ReadFromFile(path.u8string());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& shortcut : Shortcuts)
|
for (const auto& shortcut : shortcuts)
|
||||||
{
|
{
|
||||||
auto& jShortcut = root[shortcut.second.id];
|
auto& jShortcut = root[shortcut.second.id];
|
||||||
if (shortcut.second.current.size() == 1)
|
if (shortcut.second.current.size() == 1)
|
||||||
@@ -356,7 +356,7 @@ void ShortcutManager::SaveUserBindings(const fs::path& path)
|
|||||||
Json::WriteToFile(path.u8string(), root);
|
Json::WriteToFile(path.u8string(), root);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string_view ShortcutManager::GetLegacyShortcutId(size_t index)
|
std::string_view ShortcutManager::getLegacyShortcutId(size_t index)
|
||||||
{
|
{
|
||||||
static constexpr std::string_view _legacyMap[] = {
|
static constexpr std::string_view _legacyMap[] = {
|
||||||
ShortcutId::kInterfaceCloseTop,
|
ShortcutId::kInterfaceCloseTop,
|
||||||
|
|||||||
@@ -115,37 +115,37 @@ namespace OpenRCT2::Ui
|
|||||||
IPlatformEnvironment& _env;
|
IPlatformEnvironment& _env;
|
||||||
std::string _pendingShortcutChange;
|
std::string _pendingShortcutChange;
|
||||||
|
|
||||||
static std::optional<ShortcutInput> ConvertLegacyBinding(uint16_t binding);
|
static std::optional<ShortcutInput> convertLegacyBinding(uint16_t binding);
|
||||||
void LoadLegacyBindings(const fs::path& path);
|
void loadLegacyBindings(const fs::path& path);
|
||||||
void LoadUserBindings(const fs::path& path);
|
void loadUserBindings(const fs::path& path);
|
||||||
void SaveUserBindings(const fs::path& path);
|
void saveUserBindings(const fs::path& path);
|
||||||
|
|
||||||
// We store the IDs separately so that we can safely use them for string_view in the map
|
// We store the IDs separately so that we can safely use them for string_view in the map
|
||||||
std::vector<std::unique_ptr<std::string>> _ids;
|
std::vector<std::unique_ptr<std::string>> _ids;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::unordered_map<std::string_view, RegisteredShortcut> Shortcuts;
|
std::unordered_map<std::string_view, RegisteredShortcut> shortcuts;
|
||||||
|
|
||||||
ShortcutManager(IPlatformEnvironment& env);
|
ShortcutManager(IPlatformEnvironment& env);
|
||||||
ShortcutManager(const ShortcutManager&) = delete;
|
ShortcutManager(const ShortcutManager&) = delete;
|
||||||
|
|
||||||
void LoadUserBindings();
|
void loadUserBindings();
|
||||||
void SaveUserBindings();
|
void saveUserBindings();
|
||||||
|
|
||||||
void RegisterShortcut(RegisteredShortcut&& shortcut);
|
void registerShortcut(RegisteredShortcut&& shortcut);
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void RegisterShortcut(Args&&... args)
|
void registerShortcut(Args&&... args)
|
||||||
{
|
{
|
||||||
RegisterShortcut(RegisteredShortcut(std::forward<Args>(args)...));
|
registerShortcut(RegisteredShortcut(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
void RegisterDefaultShortcuts();
|
void registerDefaultShortcuts();
|
||||||
RegisteredShortcut* GetShortcut(std::string_view id);
|
RegisteredShortcut* getShortcut(std::string_view id);
|
||||||
void RemoveShortcut(std::string_view id);
|
void removeShortcut(std::string_view id);
|
||||||
bool IsPendingShortcutChange() const;
|
bool isPendingShortcutChange() const;
|
||||||
void SetPendingShortcutChange(std::string_view id);
|
void setPendingShortcutChange(std::string_view id);
|
||||||
void ProcessEvent(const InputEvent& e);
|
void processEvent(const InputEvent& e);
|
||||||
bool ProcessEventForSpecificShortcut(const InputEvent& e, std::string_view id);
|
bool processEventForSpecificShortcut(const InputEvent& e, std::string_view id);
|
||||||
|
|
||||||
static std::string_view GetLegacyShortcutId(size_t index);
|
static std::string_view getLegacyShortcutId(size_t index);
|
||||||
};
|
};
|
||||||
} // namespace OpenRCT2::Ui
|
} // namespace OpenRCT2::Ui
|
||||||
|
|||||||
@@ -746,15 +746,15 @@ static void ShortcutToggleTransparentWater()
|
|||||||
|
|
||||||
using namespace OpenRCT2::Ui;
|
using namespace OpenRCT2::Ui;
|
||||||
|
|
||||||
void ShortcutManager::RegisterDefaultShortcuts()
|
void ShortcutManager::registerDefaultShortcuts()
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// Interface
|
// Interface
|
||||||
RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", []() {
|
registerShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", []() {
|
||||||
auto* windowMgr = Ui::GetWindowManager();
|
auto* windowMgr = Ui::GetWindowManager();
|
||||||
windowMgr->CloseTop();
|
windowMgr->CloseTop();
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
|
registerShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
|
||||||
auto* windowMgr = GetWindowManager();
|
auto* windowMgr = GetWindowManager();
|
||||||
if (gLegacyScene != LegacyScene::scenarioEditor)
|
if (gLegacyScene != LegacyScene::scenarioEditor)
|
||||||
{
|
{
|
||||||
@@ -765,8 +765,8 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||||||
windowMgr->CloseTop();
|
windowMgr->CloseTop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
|
registerShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
|
registerShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
|
||||||
if (gLegacyScene != LegacyScene::titleSequence)
|
if (gLegacyScene != LegacyScene::titleSequence)
|
||||||
{
|
{
|
||||||
auto* windowMgr = GetWindowManager();
|
auto* windowMgr = GetWindowManager();
|
||||||
@@ -781,58 +781,58 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
|
registerShortcut(ShortcutId::kInterfacePause, STR_SHORTCUT_PAUSE_GAME, "PAUSE", []() {
|
||||||
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
|
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
|
||||||
{
|
{
|
||||||
auto pauseToggleAction = GameActions::PauseToggleAction();
|
auto pauseToggleAction = GameActions::PauseToggleAction();
|
||||||
GameActions::Execute(&pauseToggleAction, getGameState());
|
GameActions::Execute(&pauseToggleAction, getGameState());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
|
registerShortcut(ShortcutId::kInterfaceDecreaseSpeed, STR_SHORTCUT_REDUCE_GAME_SPEED, "-", ShortcutReduceGameSpeed);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceIncreaseSpeed, STR_SHORTCUT_INCREASE_GAME_SPEED, "=", ShortcutIncreaseGameSpeed);
|
registerShortcut(ShortcutId::kInterfaceIncreaseSpeed, STR_SHORTCUT_INCREASE_GAME_SPEED, "=", ShortcutIncreaseGameSpeed);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceToggleToolbars, STR_SHORTCUT_TOGGLE_VISIBILITY_OF_TOOLBARS, ShortcutRemoveTopBottomToolbarToggle);
|
registerShortcut(ShortcutId::kInterfaceToggleToolbars, STR_SHORTCUT_TOGGLE_VISIBILITY_OF_TOOLBARS, ShortcutRemoveTopBottomToolbarToggle);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
|
registerShortcut(ShortcutId::kInterfaceScreenshot, STR_SHORTCUT_SCREENSHOT, "CTRL+S", []() { gScreenshotCountdown = 2; });
|
||||||
RegisterShortcut(ShortcutId::kInterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", ScreenshotGiant);
|
registerShortcut(ShortcutId::kInterfaceGiantScreenshot, STR_SHORTCUT_GIANT_SCREENSHOT, "CTRL+SHIFT+S", ScreenshotGiant);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", ShortcutLoadGame);
|
registerShortcut(ShortcutId::kInterfaceLoadGame, STR_LOAD_GAME, "CTRL+L", ShortcutLoadGame);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", ShortcutQuickSaveGame);
|
registerShortcut(ShortcutId::kInterfaceSaveGame, STR_SAVE_GAME, "CTRL+F10", ShortcutQuickSaveGame);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceMute, STR_SHORTCUT_MUTE_SOUND, OpenRCT2::Audio::ToggleAllSounds);
|
registerShortcut(ShortcutId::kInterfaceMute, STR_SHORTCUT_MUTE_SOUND, OpenRCT2::Audio::ToggleAllSounds);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, ShortcutOpenSceneryPicker);
|
registerShortcut(ShortcutId::kInterfaceSceneryPicker, STR_SHORTCUT_OPEN_SCENERY_PICKER, ShortcutOpenSceneryPicker);
|
||||||
RegisterShortcut(
|
registerShortcut(
|
||||||
ShortcutId::kInterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks);
|
ShortcutId::kInterfaceDisableClearance, STR_SHORTCUT_TOGGLE_CLEARANCE_CHECKS, ShortcutToggleClearanceChecks);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceMultiplayerChat, STR_SHORTCUT_SEND_MESSAGE, "C", []() {
|
registerShortcut(ShortcutId::kInterfaceMultiplayerChat, STR_SHORTCUT_SEND_MESSAGE, "C", []() {
|
||||||
if (gLegacyScene != LegacyScene::titleSequence && ChatAvailable())
|
if (gLegacyScene != LegacyScene::titleSequence && ChatAvailable())
|
||||||
{
|
{
|
||||||
ChatToggle();
|
ChatToggle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfaceScaleToggleWindowMode, STR_SHORTCUT_WINDOWED_MODE_TOGGLE, "ALT+RETURN", ToggleWindowedMode);
|
registerShortcut(ShortcutId::kInterfaceScaleToggleWindowMode, STR_SHORTCUT_WINDOWED_MODE_TOGGLE, "ALT+RETURN", ToggleWindowedMode);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceScaleIncrease, STR_SHORTCUT_SCALE_UP, ShortcutScaleUp);
|
registerShortcut(ShortcutId::kInterfaceScaleIncrease, STR_SHORTCUT_SCALE_UP, ShortcutScaleUp);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceScaleDecrease, STR_SHORTCUT_SCALE_DOWN, ShortcutScaleDown);
|
registerShortcut(ShortcutId::kInterfaceScaleDecrease, STR_SHORTCUT_SCALE_DOWN, ShortcutScaleDown);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenLand, STR_SHORTCUT_ADJUST_LAND, "F1", ShortcutAdjustLand);
|
registerShortcut(ShortcutId::kInterfaceOpenLand, STR_SHORTCUT_ADJUST_LAND, "F1", ShortcutAdjustLand);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenWater, STR_SHORTCUT_ADJUST_WATER, "F2", ShortcutAdjustWater);
|
registerShortcut(ShortcutId::kInterfaceOpenWater, STR_SHORTCUT_ADJUST_WATER, "F2", ShortcutAdjustWater);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceClearScenery, STR_SHORTCUT_CLEAR_SCENERY, "B", ShortcutClearScenery);
|
registerShortcut(ShortcutId::kInterfaceClearScenery, STR_SHORTCUT_CLEAR_SCENERY, "B", ShortcutClearScenery);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenScenery, STR_SHORTCUT_BUILD_SCENERY, "F3", ShortcutBuildScenery);
|
registerShortcut(ShortcutId::kInterfaceOpenScenery, STR_SHORTCUT_BUILD_SCENERY, "F3", ShortcutBuildScenery);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenFootpaths, STR_SHORTCUT_BUILD_PATHS, "F4", ShortcutBuildPaths);
|
registerShortcut(ShortcutId::kInterfaceOpenFootpaths, STR_SHORTCUT_BUILD_PATHS, "F4", ShortcutBuildPaths);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenNewRide, STR_SHORTCUT_BUILD_NEW_RIDE, "F5", ShortcutBuildNewRide);
|
registerShortcut(ShortcutId::kInterfaceOpenNewRide, STR_SHORTCUT_BUILD_NEW_RIDE, "F5", ShortcutBuildNewRide);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenFinances, STR_SHORTCUT_SHOW_FINANCIAL_INFORMATION, "F", ShortcutShowFinancialInformation);
|
registerShortcut(ShortcutId::kInterfaceOpenFinances, STR_SHORTCUT_SHOW_FINANCIAL_INFORMATION, "F", ShortcutShowFinancialInformation);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenResearch, STR_SHORTCUT_SHOW_RESEARCH_INFORMATION, "D", ShortcutShowResearchInformation);
|
registerShortcut(ShortcutId::kInterfaceOpenResearch, STR_SHORTCUT_SHOW_RESEARCH_INFORMATION, "D", ShortcutShowResearchInformation);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenRides, STR_SHORTCUT_SHOW_RIDES_LIST, "R", ShortcutShowRidesList);
|
registerShortcut(ShortcutId::kInterfaceOpenRides, STR_SHORTCUT_SHOW_RIDES_LIST, "R", ShortcutShowRidesList);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenPark, STR_SHORTCUT_SHOW_PARK_INFORMATION, "P", ShortcutShowParkInformation);
|
registerShortcut(ShortcutId::kInterfaceOpenPark, STR_SHORTCUT_SHOW_PARK_INFORMATION, "P", ShortcutShowParkInformation);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenGuests, STR_SHORTCUT_SHOW_GUEST_LIST, "G", ShortcutShowGuestList);
|
registerShortcut(ShortcutId::kInterfaceOpenGuests, STR_SHORTCUT_SHOW_GUEST_LIST, "G", ShortcutShowGuestList);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenStaff, STR_SHORTCUT_SHOW_STAFF_LIST, "S", ShortcutShowStaffList);
|
registerShortcut(ShortcutId::kInterfaceOpenStaff, STR_SHORTCUT_SHOW_STAFF_LIST, "S", ShortcutShowStaffList);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenMessages, STR_SHORTCUT_SHOW_RECENT_MESSAGES, "M", ShortcutShowRecentMessages);
|
registerShortcut(ShortcutId::kInterfaceOpenMessages, STR_SHORTCUT_SHOW_RECENT_MESSAGES, "M", ShortcutShowRecentMessages);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenMap, STR_SHORTCUT_SHOW_MAP, "TAB", ShortcutShowMap);
|
registerShortcut(ShortcutId::kInterfaceOpenMap, STR_SHORTCUT_SHOW_MAP, "TAB", ShortcutShowMap);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, std::bind(ContextOpenWindow, WindowClass::options));
|
registerShortcut(ShortcutId::kInterfaceShowOptions, STR_SHORTCUT_SHOW_OPTIONS, std::bind(ContextOpenWindow, WindowClass::options));
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenKeyboardShortcuts, STR_SHORTCUT_OPEN_KEYBOARD_SHORTCUTS_WINDOW, "SHIFT+/", ShortcutOpenKeyboardShortcutsWindow);
|
registerShortcut(ShortcutId::kInterfaceOpenKeyboardShortcuts, STR_SHORTCUT_OPEN_KEYBOARD_SHORTCUTS_WINDOW, "SHIFT+/", ShortcutOpenKeyboardShortcutsWindow);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenTransparencyOptions, STR_SHORTCUT_OPEN_TRANSPARENCY_OPTIONS, "CTRL+T", ShortcutOpenTransparencyWindow);
|
registerShortcut(ShortcutId::kInterfaceOpenTransparencyOptions, STR_SHORTCUT_OPEN_TRANSPARENCY_OPTIONS, "CTRL+T", ShortcutOpenTransparencyWindow);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenCheats, STR_SHORTCUT_OPEN_CHEATS_WINDOW, "CTRL+ALT+C", ShortcutOpenCheatWindow);
|
registerShortcut(ShortcutId::kInterfaceOpenCheats, STR_SHORTCUT_OPEN_CHEATS_WINDOW, "CTRL+ALT+C", ShortcutOpenCheatWindow);
|
||||||
RegisterShortcut(ShortcutId::kInterfaceOpenTileInspector, STR_SHORTCUT_OPEN_TILE_INSPECTOR, []() {
|
registerShortcut(ShortcutId::kInterfaceOpenTileInspector, STR_SHORTCUT_OPEN_TILE_INSPECTOR, []() {
|
||||||
if (Config::Get().interface.ToolbarShowCheats)
|
if (Config::Get().interface.ToolbarShowCheats)
|
||||||
{
|
{
|
||||||
OpenWindow(WindowClass::tileInspector);
|
OpenWindow(WindowClass::tileInspector);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kInterfaceMultiplayerShow, STR_SHORTCUT_SHOW_MULTIPLAYER, []() {
|
registerShortcut(ShortcutId::kInterfaceMultiplayerShow, STR_SHORTCUT_SHOW_MULTIPLAYER, []() {
|
||||||
if (Network::GetMode() != Network::Mode::none)
|
if (Network::GetMode() != Network::Mode::none)
|
||||||
{
|
{
|
||||||
OpenWindow(WindowClass::multiplayer);
|
OpenWindow(WindowClass::multiplayer);
|
||||||
@@ -840,70 +840,70 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||||||
});
|
});
|
||||||
|
|
||||||
// View
|
// View
|
||||||
RegisterShortcut(ShortcutId::kViewGeneralZoomOut, STR_SHORTCUT_ZOOM_VIEW_OUT, "PAGEUP", std::bind(MainWindowZoom, false, false));
|
registerShortcut(ShortcutId::kViewGeneralZoomOut, STR_SHORTCUT_ZOOM_VIEW_OUT, "PAGEUP", std::bind(MainWindowZoom, false, false));
|
||||||
RegisterShortcut(ShortcutId::kViewGeneralZoomIn, STR_SHORTCUT_ZOOM_VIEW_IN, "PAGEDOWN", std::bind(MainWindowZoom, true, false));
|
registerShortcut(ShortcutId::kViewGeneralZoomIn, STR_SHORTCUT_ZOOM_VIEW_IN, "PAGEDOWN", std::bind(MainWindowZoom, true, false));
|
||||||
RegisterShortcut(ShortcutId::kViewGeneralRotateClockwise, STR_SHORTCUT_ROTATE_VIEW_CLOCKWISE, "RETURN", "MOUSE 6", std::bind(RotateCamera, 1));
|
registerShortcut(ShortcutId::kViewGeneralRotateClockwise, STR_SHORTCUT_ROTATE_VIEW_CLOCKWISE, "RETURN", "MOUSE 6", std::bind(RotateCamera, 1));
|
||||||
RegisterShortcut(ShortcutId::kViewGeneralRotateAnticlockwise, STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE, "SHIFT+RETURN", "MOUSE 5", std::bind(RotateCamera, -1));
|
registerShortcut(ShortcutId::kViewGeneralRotateAnticlockwise, STR_SHORTCUT_ROTATE_VIEW_ANTICLOCKWISE, "SHIFT+RETURN", "MOUSE 5", std::bind(RotateCamera, -1));
|
||||||
RegisterShortcut(ShortcutId::kViewScrollUp, STR_SHORTCUT_SCROLL_MAP_UP, "UP", []() {});
|
registerShortcut(ShortcutId::kViewScrollUp, STR_SHORTCUT_SCROLL_MAP_UP, "UP", []() {});
|
||||||
RegisterShortcut(ShortcutId::kViewScrollLeft, STR_SHORTCUT_SCROLL_MAP_LEFT, "LEFT", []() {});
|
registerShortcut(ShortcutId::kViewScrollLeft, STR_SHORTCUT_SCROLL_MAP_LEFT, "LEFT", []() {});
|
||||||
RegisterShortcut(ShortcutId::kViewScrollRight, STR_SHORTCUT_SCROLL_MAP_RIGHT, "RIGHT", []() {});
|
registerShortcut(ShortcutId::kViewScrollRight, STR_SHORTCUT_SCROLL_MAP_RIGHT, "RIGHT", []() {});
|
||||||
RegisterShortcut(ShortcutId::kViewScrollDown, STR_SHORTCUT_SCROLL_MAP_DOWN, "DOWN", []() {});
|
registerShortcut(ShortcutId::kViewScrollDown, STR_SHORTCUT_SCROLL_MAP_DOWN, "DOWN", []() {});
|
||||||
RegisterShortcut(ShortcutId::kViewToggleUnderground, STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE, "1", std::bind(ToggleViewFlag, VIEWPORT_FLAG_UNDERGROUND_INSIDE));
|
registerShortcut(ShortcutId::kViewToggleUnderground, STR_SHORTCUT_UNDERGROUND_VIEW_TOGGLE, "1", std::bind(ToggleViewFlag, VIEWPORT_FLAG_UNDERGROUND_INSIDE));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleTransparentWater, STR_VIEWPORT_TRANSPARENT_WATER, "2", ShortcutToggleTransparentWater);
|
registerShortcut(ShortcutId::kViewToggleTransparentWater, STR_VIEWPORT_TRANSPARENT_WATER, "2", ShortcutToggleTransparentWater);
|
||||||
RegisterShortcut(ShortcutId::kViewToggleBaseLand, STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE, "H", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_BASE));
|
registerShortcut(ShortcutId::kViewToggleBaseLand, STR_SHORTCUT_REMOVE_BASE_LAND_TOGGLE, "H", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_BASE));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleVerticalLand, STR_SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE, "V", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VERTICAL));
|
registerShortcut(ShortcutId::kViewToggleVerticalLand, STR_SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE, "V", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VERTICAL));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleRides, STR_SHORTCUT_SEE_THROUGH_RIDES_TOGGLE, "3", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_RIDES));
|
registerShortcut(ShortcutId::kViewToggleRides, STR_SHORTCUT_SEE_THROUGH_RIDES_TOGGLE, "3", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_RIDES));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleVehicles, STR_SHORTCUT_SEE_THROUGH_VEHICLES_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEHICLES));
|
registerShortcut(ShortcutId::kViewToggleVehicles, STR_SHORTCUT_SEE_THROUGH_VEHICLES_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEHICLES));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleVegetation, STR_SHORTCUT_SEE_THROUGH_VEGETATION_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEGETATION));
|
registerShortcut(ShortcutId::kViewToggleVegetation, STR_SHORTCUT_SEE_THROUGH_VEGETATION_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_VEGETATION));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleScenery, STR_SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE, "4", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SCENERY));
|
registerShortcut(ShortcutId::kViewToggleScenery, STR_SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE, "4", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SCENERY));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleFootpaths, STR_SHORTCUT_SEE_THROUGH_PATHS_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_PATHS));
|
registerShortcut(ShortcutId::kViewToggleFootpaths, STR_SHORTCUT_SEE_THROUGH_PATHS_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_PATHS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleSupports, STR_SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE, "5", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SUPPORTS));
|
registerShortcut(ShortcutId::kViewToggleSupports, STR_SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE, "5", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_SUPPORTS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleGuests, STR_SHORTCUT_SEE_THROUGH_GUESTS_TOGGLE, "6", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_GUESTS));
|
registerShortcut(ShortcutId::kViewToggleGuests, STR_SHORTCUT_SEE_THROUGH_GUESTS_TOGGLE, "6", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_GUESTS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleStaff, STR_SHORTCUT_SEE_THROUGH_STAFF_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_STAFF));
|
registerShortcut(ShortcutId::kViewToggleStaff, STR_SHORTCUT_SEE_THROUGH_STAFF_TOGGLE, std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIDE_STAFF));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleLandHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE, "8", std::bind(ToggleViewFlag, VIEWPORT_FLAG_LAND_HEIGHTS));
|
registerShortcut(ShortcutId::kViewToggleLandHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE, "8", std::bind(ToggleViewFlag, VIEWPORT_FLAG_LAND_HEIGHTS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleTrackHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE, "9", std::bind(ToggleViewFlag, VIEWPORT_FLAG_TRACK_HEIGHTS));
|
registerShortcut(ShortcutId::kViewToggleTrackHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE, "9", std::bind(ToggleViewFlag, VIEWPORT_FLAG_TRACK_HEIGHTS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleFootpathHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE, "0", std::bind(ToggleViewFlag, VIEWPORT_FLAG_PATH_HEIGHTS));
|
registerShortcut(ShortcutId::kViewToggleFootpathHeightMarkers, STR_SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE, "0", std::bind(ToggleViewFlag, VIEWPORT_FLAG_PATH_HEIGHTS));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleGridlines, STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, "7", std::bind(ToggleViewFlag, VIEWPORT_FLAG_GRIDLINES));
|
registerShortcut(ShortcutId::kViewToggleGridlines, STR_SHORTCUT_GRIDLINES_DISPLAY_TOGGLE, "7", std::bind(ToggleViewFlag, VIEWPORT_FLAG_GRIDLINES));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleCutAway, STR_SHORTCUT_VIEW_CLIPPING, std::bind(OpenWindow, WindowClass::viewClipping));
|
registerShortcut(ShortcutId::kViewToggleCutAway, STR_SHORTCUT_VIEW_CLIPPING, std::bind(OpenWindow, WindowClass::viewClipping));
|
||||||
RegisterShortcut(ShortcutId::kViewToggleFootpathIssues, STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, "I", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES));
|
registerShortcut(ShortcutId::kViewToggleFootpathIssues, STR_SHORTCUT_HIGHLIGHT_PATH_ISSUES_TOGGLE, "I", std::bind(ToggleViewFlag, VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES));
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionTurnLeft, STR_SHORTCUT_CONSTRUCTION_TURN_LEFT, "NUMPAD 4", ShortcutConstructionTurnLeft);
|
registerShortcut(ShortcutId::kWindowRideConstructionTurnLeft, STR_SHORTCUT_CONSTRUCTION_TURN_LEFT, "NUMPAD 4", ShortcutConstructionTurnLeft);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionTurnRight, STR_SHORTCUT_CONSTRUCTION_TURN_RIGHT, "NUMPAD 6", ShortcutConstructionTurnRight);
|
registerShortcut(ShortcutId::kWindowRideConstructionTurnRight, STR_SHORTCUT_CONSTRUCTION_TURN_RIGHT, "NUMPAD 6", ShortcutConstructionTurnRight);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionDefault, STR_SHORTCUT_CONSTRUCTION_USE_TRACK_DEFAULT, "NUMPAD 5", WindowRideConstructionKeyboardShortcutUseTrackDefault);
|
registerShortcut(ShortcutId::kWindowRideConstructionDefault, STR_SHORTCUT_CONSTRUCTION_USE_TRACK_DEFAULT, "NUMPAD 5", WindowRideConstructionKeyboardShortcutUseTrackDefault);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionSlopeDown, STR_SHORTCUT_CONSTRUCTION_SLOPE_DOWN, "NUMPAD 2", ShortcutConstructionSlopeDown);
|
registerShortcut(ShortcutId::kWindowRideConstructionSlopeDown, STR_SHORTCUT_CONSTRUCTION_SLOPE_DOWN, "NUMPAD 2", ShortcutConstructionSlopeDown);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionSlopeUp, STR_SHORTCUT_CONSTRUCTION_SLOPE_UP, "NUMPAD 8", ShortcutConstructionSlopeUp);
|
registerShortcut(ShortcutId::kWindowRideConstructionSlopeUp, STR_SHORTCUT_CONSTRUCTION_SLOPE_UP, "NUMPAD 8", ShortcutConstructionSlopeUp);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionChainLift, STR_SHORTCUT_CONSTRUCTION_CHAIN_LIFT_TOGGLE, "NUMPAD +", WindowRideConstructionKeyboardShortcutChainLiftToggle);
|
registerShortcut(ShortcutId::kWindowRideConstructionChainLift, STR_SHORTCUT_CONSTRUCTION_CHAIN_LIFT_TOGGLE, "NUMPAD +", WindowRideConstructionKeyboardShortcutChainLiftToggle);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionBankLeft, STR_SHORTCUT_CONSTRUCTION_BANK_LEFT, "NUMPAD 1", WindowRideConstructionKeyboardShortcutBankLeft);
|
registerShortcut(ShortcutId::kWindowRideConstructionBankLeft, STR_SHORTCUT_CONSTRUCTION_BANK_LEFT, "NUMPAD 1", WindowRideConstructionKeyboardShortcutBankLeft);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionBankRight, STR_SHORTCUT_CONSTRUCTION_BANK_RIGHT, "NUMPAD 3", WindowRideConstructionKeyboardShortcutBankRight);
|
registerShortcut(ShortcutId::kWindowRideConstructionBankRight, STR_SHORTCUT_CONSTRUCTION_BANK_RIGHT, "NUMPAD 3", WindowRideConstructionKeyboardShortcutBankRight);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionPrevious, STR_SHORTCUT_CONSTRUCTION_PREVIOUS_TRACK, "NUMPAD 7", WindowRideConstructionKeyboardShortcutPreviousTrack);
|
registerShortcut(ShortcutId::kWindowRideConstructionPrevious, STR_SHORTCUT_CONSTRUCTION_PREVIOUS_TRACK, "NUMPAD 7", WindowRideConstructionKeyboardShortcutPreviousTrack);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionNext, STR_SHORTCUT_CONSTRUCTION_NEXT_TRACK, "NUMPAD 9", WindowRideConstructionKeyboardShortcutNextTrack);
|
registerShortcut(ShortcutId::kWindowRideConstructionNext, STR_SHORTCUT_CONSTRUCTION_NEXT_TRACK, "NUMPAD 9", WindowRideConstructionKeyboardShortcutNextTrack);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", ShortcutConstructionBuildCurrent);
|
registerShortcut(ShortcutId::kWindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", ShortcutConstructionBuildCurrent);
|
||||||
RegisterShortcut(ShortcutId::kWindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", ShortcutConstructionDemolishCurrent);
|
registerShortcut(ShortcutId::kWindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", ShortcutConstructionDemolishCurrent);
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, WindowTileInspectorKeyboardShortcutToggleInvisibility);
|
registerShortcut(ShortcutId::kWindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, WindowTileInspectorKeyboardShortcutToggleInvisibility);
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY));
|
registerShortcut(ShortcutId::kWindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE));
|
registerShortcut(ShortcutId::kWindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorSort, STR_SHORTCUT_SORT_ELEMENTS, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_SORT));
|
registerShortcut(ShortcutId::kWindowTileInspectorSort, STR_SHORTCUT_SORT_ELEMENTS, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_SORT));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE));
|
registerShortcut(ShortcutId::kWindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorMoveUp, STR_SHORTCUT_MOVE_ELEMENT_UP, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP));
|
registerShortcut(ShortcutId::kWindowTileInspectorMoveUp, STR_SHORTCUT_MOVE_ELEMENT_UP, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorMoveDown, STR_SHORTCUT_MOVE_ELEMENT_DOWN, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN));
|
registerShortcut(ShortcutId::kWindowTileInspectorMoveDown, STR_SHORTCUT_MOVE_ELEMENT_DOWN, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorIncreaseX, STR_SHORTCUT_INCREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE));
|
registerShortcut(ShortcutId::kWindowTileInspectorIncreaseX, STR_SHORTCUT_INCREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorDecreaseX, STR_SHORTCUT_DECREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE));
|
registerShortcut(ShortcutId::kWindowTileInspectorDecreaseX, STR_SHORTCUT_DECREASE_X_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorIncreaseY, STR_SHORTCUT_INCREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE));
|
registerShortcut(ShortcutId::kWindowTileInspectorIncreaseY, STR_SHORTCUT_INCREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorDecreaseY, STR_SHORTCUT_DECREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE));
|
registerShortcut(ShortcutId::kWindowTileInspectorDecreaseY, STR_SHORTCUT_DECREASE_Y_COORD, std::bind(TileInspectorMouseDown, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE));
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorIncreaseHeight, STR_SHORTCUT_INCREASE_ELEM_HEIGHT, ShortcutIncreaseElementHeight);
|
registerShortcut(ShortcutId::kWindowTileInspectorIncreaseHeight, STR_SHORTCUT_INCREASE_ELEM_HEIGHT, ShortcutIncreaseElementHeight);
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorDecreaseHeight, STR_SHORTCUT_DECREASE_ELEM_HEIGHT, ShortcutDecreaseElementHeight);
|
registerShortcut(ShortcutId::kWindowTileInspectorDecreaseHeight, STR_SHORTCUT_DECREASE_ELEM_HEIGHT, ShortcutDecreaseElementHeight);
|
||||||
RegisterShortcut(ShortcutId::kWindowTileInspectorChangeWallSlope, STR_SHORTCUT_TOGGLE_WALL_SLOPE, ShortcutToggleWallSlope);
|
registerShortcut(ShortcutId::kWindowTileInspectorChangeWallSlope, STR_SHORTCUT_TOGGLE_WALL_SLOPE, ShortcutToggleWallSlope);
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
RegisterShortcut(ShortcutId::kDebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole);
|
registerShortcut(ShortcutId::kDebugToggleConsole, STR_CONSOLE, "`", ShortcutToggleConsole);
|
||||||
RegisterShortcut(ShortcutId::kDebugAdvanceTick, STR_SHORTCUT_ADVANCE_TO_NEXT_TICK, []() {
|
registerShortcut(ShortcutId::kDebugAdvanceTick, STR_SHORTCUT_ADVANCE_TO_NEXT_TICK, []() {
|
||||||
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
|
if (gLegacyScene != LegacyScene::titleSequence && gLegacyScene != LegacyScene::scenarioEditor && gLegacyScene != LegacyScene::trackDesignsManager)
|
||||||
{
|
{
|
||||||
gDoSingleUpdate = true;
|
gDoSingleUpdate = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RegisterShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
|
registerShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
|
||||||
if (gLegacyScene != LegacyScene::titleSequence)
|
if (gLegacyScene != LegacyScene::titleSequence)
|
||||||
{
|
{
|
||||||
auto* windowMgr = GetWindowManager();
|
auto* windowMgr = GetWindowManager();
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ namespace OpenRCT2::Scripting
|
|||||||
registeredShortcut.standard.emplace_back(binding);
|
registeredShortcut.standard.emplace_back(binding);
|
||||||
}
|
}
|
||||||
registeredShortcut.current = registeredShortcut.standard;
|
registeredShortcut.current = registeredShortcut.standard;
|
||||||
shortcutManager.RegisterShortcut(std::move(registeredShortcut));
|
shortcutManager.registerShortcut(std::move(registeredShortcut));
|
||||||
shortcutManager.LoadUserBindings();
|
shortcutManager.loadUserBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomShortcut::~CustomShortcut()
|
CustomShortcut::~CustomShortcut()
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
shortcutManager.RemoveShortcut(Id);
|
shortcutManager.removeShortcut(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomShortcut::Invoke() const
|
void CustomShortcut::Invoke() const
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
static ChangeShortcutWindow* Open(std::string_view shortcutId)
|
static ChangeShortcutWindow* Open(std::string_view shortcutId)
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
auto registeredShortcut = shortcutManager.GetShortcut(shortcutId);
|
auto registeredShortcut = shortcutManager.getShortcut(shortcutId);
|
||||||
if (registeredShortcut != nullptr)
|
if (registeredShortcut != nullptr)
|
||||||
{
|
{
|
||||||
auto* windowMgr = GetWindowManager();
|
auto* windowMgr = GetWindowManager();
|
||||||
@@ -85,7 +85,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
w->_shortcutId = shortcutId;
|
w->_shortcutId = shortcutId;
|
||||||
w->_shortcutLocalisedName = registeredShortcut->localisedName;
|
w->_shortcutLocalisedName = registeredShortcut->localisedName;
|
||||||
w->_shortcutCustomName = registeredShortcut->customName;
|
w->_shortcutCustomName = registeredShortcut->customName;
|
||||||
shortcutManager.SetPendingShortcutChange(registeredShortcut->id);
|
shortcutManager.setPendingShortcutChange(registeredShortcut->id);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
void onClose() override
|
void onClose() override
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
shortcutManager.SetPendingShortcutChange({});
|
shortcutManager.setPendingShortcutChange({});
|
||||||
NotifyShortcutKeysWindow();
|
NotifyShortcutKeysWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,11 +143,11 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
void Remove()
|
void Remove()
|
||||||
{
|
{
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
auto* shortcut = shortcutManager.GetShortcut(_shortcutId);
|
auto* shortcut = shortcutManager.getShortcut(_shortcutId);
|
||||||
if (shortcut != nullptr)
|
if (shortcut != nullptr)
|
||||||
{
|
{
|
||||||
shortcut->current.clear();
|
shortcut->current.clear();
|
||||||
shortcutManager.SaveUserBindings();
|
shortcutManager.saveUserBindings();
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
@@ -346,13 +346,13 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
for (const auto& item : _list)
|
for (const auto& item : _list)
|
||||||
{
|
{
|
||||||
auto shortcut = shortcutManager.GetShortcut(item.ShortcutId);
|
auto shortcut = shortcutManager.getShortcut(item.ShortcutId);
|
||||||
if (shortcut != nullptr)
|
if (shortcut != nullptr)
|
||||||
{
|
{
|
||||||
shortcut->current = shortcut->standard;
|
shortcut->current = shortcut->standard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shortcutManager.SaveUserBindings();
|
shortcutManager.saveUserBindings();
|
||||||
RefreshBindings();
|
RefreshBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
{
|
{
|
||||||
std::vector<const RegisteredShortcut*> result;
|
std::vector<const RegisteredShortcut*> result;
|
||||||
auto& shortcutManager = GetShortcutManager();
|
auto& shortcutManager = GetShortcutManager();
|
||||||
for (const auto& shortcut : shortcutManager.Shortcuts)
|
for (const auto& shortcut : shortcutManager.shortcuts)
|
||||||
{
|
{
|
||||||
if (IsInCurrentTab(shortcut.second))
|
if (IsInCurrentTab(shortcut.second))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user