Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Widget to TitleCase #13355

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/openrct2-ui/input/KeyboardShortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static void ShortcutRotateConstructionObject()

// Rotate scenery
rct_window* w = window_find_by_class(WC_SCENERY);
if (w != nullptr && !widget_is_disabled(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON)
if (w != nullptr && !WidgetIsDisabled(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON)
&& w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON);
Expand All @@ -171,7 +171,7 @@ static void ShortcutRotateConstructionObject()

// Rotate construction track piece
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
if (w != nullptr && !widget_is_disabled(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE)
if (w != nullptr && !WidgetIsDisabled(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE)
&& w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].type != WWT_EMPTY)
{
// Check if building a maze...
Expand All @@ -184,7 +184,7 @@ static void ShortcutRotateConstructionObject()

// Rotate track design preview
w = window_find_by_class(WC_TRACK_DESIGN_LIST);
if (w != nullptr && !widget_is_disabled(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE);
Expand All @@ -193,7 +193,7 @@ static void ShortcutRotateConstructionObject()

// Rotate track design placement
w = window_find_by_class(WC_TRACK_DESIGN_PLACE);
if (w != nullptr && !widget_is_disabled(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE)
&& w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE);
Expand All @@ -202,15 +202,15 @@ static void ShortcutRotateConstructionObject()

// Rotate park entrance
w = window_find_by_class(WC_MAP);
if (w != nullptr && !widget_is_disabled(w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WWT_EMPTY)
if (w != nullptr && !WidgetIsDisabled(w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_MAP__WIDX_ROTATE_90);
return;
}

// Rotate selected element in tile inspector
w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE);
Expand Down Expand Up @@ -801,7 +801,7 @@ static void ShortcutOpenSceneryPicker()
}

window_scenery = window_find_by_class(WC_SCENERY);
if (window_scenery != nullptr && !widget_is_disabled(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON)
if (window_scenery != nullptr && !WidgetIsDisabled(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON)
&& window_scenery->widgets[WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON].type != WWT_EMPTY
&& !gWindowSceneryEyedropperEnabled)
{
Expand Down Expand Up @@ -833,7 +833,7 @@ static void ShortcutScaleDown()
static void ShortcutInsertCorruptElement()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_CORRUPT);
Expand All @@ -844,7 +844,7 @@ static void ShortcutInsertCorruptElement()
static void ShortcutCopyElement()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_COPY].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY);
Expand All @@ -855,7 +855,7 @@ static void ShortcutCopyElement()
static void ShortcutPasteElement()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE);
Expand All @@ -866,7 +866,7 @@ static void ShortcutPasteElement()
static void ShortcutRemoveElement()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE);
Expand All @@ -877,7 +877,7 @@ static void ShortcutRemoveElement()
static void ShortcutMoveElementUp()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_UP);
Expand All @@ -888,7 +888,7 @@ static void ShortcutMoveElementUp()
static void ShortcutMoveElementDown()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN].type != WWT_EMPTY)
{
window_event_mouse_up_call(w, WC_TILE_INSPECTOR__WIDX_BUTTON_MOVE_DOWN);
Expand All @@ -899,7 +899,7 @@ static void ShortcutMoveElementDown()
static void ShortcutIncreaseXCoord()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE].type != WWT_EMPTY)
{
window_event_mouse_down_call(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_INCREASE);
Expand All @@ -910,7 +910,7 @@ static void ShortcutIncreaseXCoord()
static void ShortcutDecreaseXCoord()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE].type != WWT_EMPTY)
{
window_event_mouse_down_call(w, WC_TILE_INSPECTOR__WIDX_SPINNER_X_DECREASE);
Expand All @@ -921,7 +921,7 @@ static void ShortcutDecreaseXCoord()
static void ShortcutIncreaseYCoord()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE].type != WWT_EMPTY)
{
window_event_mouse_down_call(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_INCREASE);
Expand All @@ -932,7 +932,7 @@ static void ShortcutIncreaseYCoord()
static void ShortcutDecreaseYCoord()
{
rct_window* w = window_find_by_class(WC_TILE_INSPECTOR);
if (w != nullptr && !widget_is_disabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE)
if (w != nullptr && !WidgetIsDisabled(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE)
&& w->widgets[WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE].type != WWT_EMPTY)
{
window_event_mouse_down_call(w, WC_TILE_INSPECTOR__WIDX_SPINNER_Y_DECREASE);
Expand Down Expand Up @@ -976,7 +976,7 @@ static void ShortcutIncreaseElementHeight()
action = WC_TILE_INSPECTOR__WIDX_CORRUPT_SPINNER_HEIGHT_INCREASE;
break;
}
if (action != -1 && !widget_is_disabled(w, action) && w->widgets[action].type != WWT_EMPTY)
if (action != -1 && !WidgetIsDisabled(w, action) && w->widgets[action].type != WWT_EMPTY)
window_event_mouse_down_call(w, action);
return;
}
Expand Down Expand Up @@ -1018,7 +1018,7 @@ static void ShortcutDecreaseElementHeight()
action = WC_TILE_INSPECTOR__WIDX_CORRUPT_SPINNER_HEIGHT_DECREASE;
break;
}
if (action != -1 && !widget_is_disabled(w, action) && w->widgets[action].type != WWT_EMPTY)
if (action != -1 && !WidgetIsDisabled(w, action) && w->widgets[action].type != WWT_EMPTY)
window_event_mouse_down_call(w, action);
return;
}
Expand Down
26 changes: 13 additions & 13 deletions src/openrct2-ui/input/MouseInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void InputScrollDragContinue(const ScreenCoordsXY& screenCoords, rct_wind
scroll->v_top = std::min<uint16_t>(std::max(0, scroll->v_top + differentialCoords.y), size);
}

widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
window_invalidate_by_number(w->classification, w->number);

ScreenCoordsXY fixedCursorPosition = { static_cast<int32_t>(std::ceil(gInputDragLast.x * gConfigGeneral.window_scale)),
Expand Down Expand Up @@ -601,7 +601,7 @@ static void InputScrollBegin(rct_window* w, rct_widgetindex widgetIndex, const S
int32_t scroll_area, scroll_id;
ScreenCoordsXY scrollCoords;
scroll_id = 0; // safety
widget_scroll_get_part(w, widget, screenCoords, scrollCoords, &scroll_area, &scroll_id);
WidgetScrollGetPart(w, widget, screenCoords, scrollCoords, &scroll_area, &scroll_id);

_currentScrollArea = scroll_area;
_currentScrollIndex = scroll_id;
Expand Down Expand Up @@ -654,7 +654,7 @@ static void InputScrollBegin(rct_window* w, rct_widgetindex widgetIndex, const S
default:
break;
}
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
window_invalidate_by_number(widgetIndex, w->classification);
}

Expand All @@ -674,7 +674,7 @@ static void InputScrollContinue(rct_window* w, rct_widgetindex widgetIndex, cons
}

ScreenCoordsXY newScreenCoords;
widget_scroll_get_part(w, widget, screenCoords, newScreenCoords, &scroll_part, &scroll_id);
WidgetScrollGetPart(w, widget, screenCoords, newScreenCoords, &scroll_part, &scroll_id);

if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB)
{
Expand Down Expand Up @@ -757,7 +757,7 @@ static void InputScrollPartUpdateHThumb(rct_window* w, rct_widgetindex widgetInd
if (newLeft > x)
newLeft = x;
w->scrolls[scroll_id].h_left = newLeft;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand Down Expand Up @@ -796,7 +796,7 @@ static void InputScrollPartUpdateVThumb(rct_window* w, rct_widgetindex widgetInd
if (newTop > y)
newTop = y;
w->scrolls[scroll_id].v_top = newTop;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand All @@ -813,7 +813,7 @@ static void InputScrollPartUpdateHLeft(rct_window* w, rct_widgetindex widgetInde
w->scrolls[scroll_id].flags |= HSCROLLBAR_LEFT_PRESSED;
if (w->scrolls[scroll_id].h_left >= 3)
w->scrolls[scroll_id].h_left -= 3;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand All @@ -839,7 +839,7 @@ static void InputScrollPartUpdateHRight(rct_window* w, rct_widgetindex widgetInd
newLeft = 0;
if (w->scrolls[scroll_id].h_left > newLeft)
w->scrolls[scroll_id].h_left = newLeft;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand All @@ -856,7 +856,7 @@ static void InputScrollPartUpdateVTop(rct_window* w, rct_widgetindex widgetIndex
w->scrolls[scroll_id].flags |= VSCROLLBAR_UP_PRESSED;
if (w->scrolls[scroll_id].v_top >= 3)
w->scrolls[scroll_id].v_top -= 3;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand All @@ -882,7 +882,7 @@ static void InputScrollPartUpdateVBottom(rct_window* w, rct_widgetindex widgetIn
newTop = 0;
if (w->scrolls[scroll_id].v_top > newTop)
w->scrolls[scroll_id].v_top = newTop;
widget_scroll_update_thumbs(w, widgetIndex);
WidgetScrollUpdateThumbs(w, widgetIndex);
widget_invalidate_by_number(w->classification, w->number, widgetIndex);
}
}
Expand Down Expand Up @@ -914,7 +914,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, rct_window* w, r
{
int32_t scroll_part, scrollId;
ScreenCoordsXY newScreenCoords;
widget_scroll_get_part(w, widget, screenCoords, newScreenCoords, &scroll_part, &scrollId);
WidgetScrollGetPart(w, widget, screenCoords, newScreenCoords, &scroll_part, &scrollId);

if (scroll_part != SCROLL_PART_VIEW)
window_tooltip_close();
Expand Down Expand Up @@ -1042,7 +1042,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, rct_window* w, r
InputScrollBegin(w, widgetIndex, screenCoords);
break;
default:
if (widget_is_enabled(w, widgetIndex) && !widget_is_disabled(w, widgetIndex))
if (WidgetIsEnabled(w, widgetIndex) && !WidgetIsDisabled(w, widgetIndex))
{
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, w->windowPos.x + widget->midX());

Expand Down Expand Up @@ -1118,7 +1118,7 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords)
{
int32_t output_scroll_area, scroll_id;
ScreenCoordsXY scrollCoords;
widget_scroll_get_part(
WidgetScrollGetPart(
window, &window->widgets[widgetId], screenCoords, scrollCoords, &output_scroll_area, &scroll_id);
if (output_scroll_area != SCROLL_PART_VIEW)
{
Expand Down