mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Reimplement hotkey handler for toggling visibility
This commit is contained in:
@@ -501,6 +501,25 @@ static void TileInspectorMouseDown(rct_widgetindex widgetIndex)
|
||||
}
|
||||
}
|
||||
|
||||
static void ShortcutToggleVisibility()
|
||||
{
|
||||
// TODO: Once the tile inspector window has its own class, move this to its own function
|
||||
if (windowTileInspectorSelectedIndex < 0)
|
||||
return;
|
||||
|
||||
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
||||
extern TileCoordsXY windowTileInspectorTile;
|
||||
TileElement* tileElement = map_get_nth_element_at(windowTileInspectorTile.ToCoordsXY(), windowTileInspectorSelectedIndex);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
tileElement->SetInvisible(!tileElement->IsInvisible());
|
||||
w->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
static void ShortcutIncreaseElementHeight()
|
||||
{
|
||||
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
|
||||
@@ -851,7 +870,7 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
||||
RegisterShortcut(ShortcutId::WindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", []() { ShortcutConstructionBuildCurrent(); });
|
||||
RegisterShortcut(ShortcutId::WindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", []() { ShortcutConstructionDemolishCurrent(); });
|
||||
|
||||
RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_TOGGLE_INVISIBILITY); });
|
||||
RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, []() { ShortcutToggleVisibility(); });
|
||||
RegisterShortcut(ShortcutId::WindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_COPY); });
|
||||
RegisterShortcut(ShortcutId::WindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE); });
|
||||
RegisterShortcut(ShortcutId::WindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, []() { TileInspectorMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE); });
|
||||
|
||||
@@ -531,7 +531,6 @@ enum
|
||||
#define WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 21
|
||||
#define WC_STAFF__WIDX_PICKUP 9
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE 13
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_TOGGLE_INVISIBILITY 10
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_COPY 16
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE 15
|
||||
#define WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE 10
|
||||
|
||||
Reference in New Issue
Block a user