Introduce widget::width and widget::height helper functions (#12053)

This commit is contained in:
Aaron van Geffen
2020-06-25 03:44:00 +02:00
committed by GitHub
parent 14a07359b3
commit 681b8d7938
47 changed files with 247 additions and 272 deletions

View File

@@ -208,7 +208,7 @@ static void input_scroll_drag_continue(const ScreenCoordsXY& screenCoords, rct_w
if (scroll->flags & HSCROLLBAR_VISIBLE)
{
int16_t size = widget->right - widget->left - 1;
int16_t size = widget->width() - 1;
if (scroll->flags & VSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll->h_right - size);
@@ -217,7 +217,7 @@ static void input_scroll_drag_continue(const ScreenCoordsXY& screenCoords, rct_w
if (scroll->flags & VSCROLLBAR_VISIBLE)
{
int16_t size = widget->bottom - widget->top - 1;
int16_t size = widget->height() - 1;
if (scroll->flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll->v_bottom - size);
@@ -618,7 +618,7 @@ static void input_scroll_begin(rct_window* w, rct_widgetindex widgetIndex, const
rct_widget* widg = &w->widgets[widgetIndex];
rct_scroll* scroll = &w->scrolls[scroll_id];
int32_t widget_width = widg->right - widg->left - 1;
int32_t widget_width = widg->width() - 1;
if (scroll->flags & VSCROLLBAR_VISIBLE)
widget_width -= SCROLLBAR_WIDTH + 1;
int32_t widget_content_width = std::max(scroll->h_right - widget_width, 0);
@@ -740,7 +740,7 @@ static void input_scroll_part_update_hthumb(rct_window* w, rct_widgetindex widge
int32_t newLeft;
newLeft = w->scrolls[scroll_id].h_right;
newLeft *= x;
x = widget->right - widget->left - 21;
x = widget->width() - 21;
if (w->scrolls[scroll_id].flags & VSCROLLBAR_VISIBLE)
x -= SCROLLBAR_WIDTH + 1;
newLeft /= x;
@@ -750,7 +750,7 @@ static void input_scroll_part_update_hthumb(rct_window* w, rct_widgetindex widge
newLeft += x;
if (newLeft < 0)
newLeft = 0;
x = widget->right - widget->left - 1;
x = widget->width() - 1;
if (w->scrolls[scroll_id].flags & VSCROLLBAR_VISIBLE)
x -= SCROLLBAR_WIDTH + 1;
x *= -1;
@@ -779,7 +779,7 @@ static void input_scroll_part_update_vthumb(rct_window* w, rct_widgetindex widge
int32_t newTop;
newTop = w->scrolls[scroll_id].v_bottom;
newTop *= y;
y = widget->bottom - widget->top - 21;
y = widget->height() - 21;
if (w->scrolls[scroll_id].flags & HSCROLLBAR_VISIBLE)
y -= SCROLLBAR_WIDTH + 1;
newTop /= y;
@@ -789,7 +789,7 @@ static void input_scroll_part_update_vthumb(rct_window* w, rct_widgetindex widge
newTop += y;
if (newTop < 0)
newTop = 0;
y = widget->bottom - widget->top - 1;
y = widget->height() - 1;
if (w->scrolls[scroll_id].flags & HSCROLLBAR_VISIBLE)
y -= SCROLLBAR_WIDTH + 1;
y *= -1;
@@ -833,7 +833,7 @@ static void input_scroll_part_update_hright(rct_window* w, rct_widgetindex widge
{
w->scrolls[scroll_id].flags |= HSCROLLBAR_RIGHT_PRESSED;
w->scrolls[scroll_id].h_left += 3;
int32_t newLeft = widget->right - widget->left - 1;
int32_t newLeft = widget->width() - 1;
if (w->scrolls[scroll_id].flags & VSCROLLBAR_VISIBLE)
newLeft -= SCROLLBAR_WIDTH + 1;
newLeft *= -1;
@@ -876,7 +876,7 @@ static void input_scroll_part_update_vbottom(rct_window* w, rct_widgetindex widg
{
w->scrolls[scroll_id].flags |= VSCROLLBAR_DOWN_PRESSED;
w->scrolls[scroll_id].v_top += 3;
int32_t newTop = widget->bottom - widget->top - 1;
int32_t newTop = widget->height() - 1;
if (w->scrolls[scroll_id].flags & HSCROLLBAR_VISIBLE)
newTop -= SCROLLBAR_WIDTH + 1;
newTop *= -1;

View File

@@ -83,8 +83,8 @@ void land_tool_show_surface_style_dropdown(rct_window* w, rct_widget* widget, ui
uint32_t surfaceCount = itemIndex;
window_dropdown_show_image(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->bottom - widget->top, w->colours[2], 0,
surfaceCount, 47, 36, dropdown_get_appropriate_image_dropdown_items_per_row(surfaceCount));
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, surfaceCount, 47, 36,
dropdown_get_appropriate_image_dropdown_items_per_row(surfaceCount));
gDropdownDefaultIndex = defaultIndex;
}
@@ -113,8 +113,8 @@ void land_tool_show_edge_style_dropdown(rct_window* w, rct_widget* widget, uint8
auto itemsPerRow = dropdown_get_appropriate_image_dropdown_items_per_row(edgeCount);
window_dropdown_show_image(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->bottom - widget->top, w->colours[2], 0, edgeCount,
47, 36, itemsPerRow);
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, edgeCount, 47, 36,
itemsPerRow);
gDropdownDefaultIndex = defaultIndex;
}

View File

@@ -346,7 +346,7 @@ static void widget_text_centred(rct_drawpixelinfo* dpi, rct_window* w, rct_widge
if (widget->type == WWT_BUTTON || widget->type == WWT_TABLE_HEADER)
{
int32_t height = (widget->bottom - widget->top);
int32_t height = widget->height();
if (height >= 10)
topLeft.y += std::max<int32_t>(widget->top, widget->top + (height / 2) - 5);
else
@@ -363,7 +363,7 @@ static void widget_text_centred(rct_drawpixelinfo* dpi, rct_window* w, rct_widge
formatArgs = &widget->string;
}
gfx_draw_string_centred_clipped(
dpi, stringId, formatArgs, colour, { (topLeft.x + r + 1) / 2 - 1, topLeft.y }, widget->right - widget->left - 2);
dpi, stringId, formatArgs, colour, { (topLeft.x + r + 1) / 2 - 1, topLeft.y }, widget->width() - 2);
}
/**
@@ -391,7 +391,7 @@ static void widget_text(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetindex w
if (widget->type == WWT_BUTTON || widget->type == WWT_DROPDOWN || widget->type == WWT_SPINNER
|| widget->type == WWT_TABLE_HEADER)
{
int32_t height = (widget->bottom - widget->top);
int32_t height = widget->height();
if (height >= 10)
t = w->windowPos.y + std::max<int32_t>(widget->top, widget->top + (height / 2) - 5);
else
@@ -548,7 +548,7 @@ static void widget_caption_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widge
return;
topLeft = w->windowPos + ScreenCoordsXY{ widget->left + 2, widget->top + 1 };
int32_t width = widget->right - widget->left - 4;
int32_t width = widget->width() - 4;
if ((widget + 1)->type == WWT_CLOSEBOX)
{
width -= 10;
@@ -595,7 +595,7 @@ static void widget_closebox_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
if (widget_is_disabled(w, widgetIndex))
colour |= COLOUR_FLAG_INSET;
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, colour, topLeft, widget->right - widget->left - 2);
gfx_draw_string_centred_clipped(dpi, widget->text, gCommonFormatArgs, colour, topLeft, widget->width() - 2);
}
/**

View File

@@ -366,7 +366,7 @@ static void window_scroll_wheel_input(rct_window* w, int32_t scrollIndex, int32_
if (scroll->flags & VSCROLLBAR_VISIBLE)
{
int32_t size = widget->bottom - widget->top - 1;
int32_t size = widget->height() - 1;
if (scroll->flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll->v_bottom - size);
@@ -374,7 +374,7 @@ static void window_scroll_wheel_input(rct_window* w, int32_t scrollIndex, int32_
}
else
{
int32_t size = widget->right - widget->left - 1;
int32_t size = widget->width() - 1;
if (scroll->flags & VSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll->h_right - size);

View File

@@ -529,8 +529,8 @@ namespace OpenRCT2::Ui::Windows
std::memcpy(&gDropdownItemsArgs[i], &sz, sizeof(const char*));
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->bottom - widget->top + 1,
w->colours[widget->colour], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->right - widget->left - 3);
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1,
w->colours[widget->colour], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, widget->width() - 3);
}
else if (widgetDesc->Type == "spinner")
{
@@ -669,8 +669,8 @@ namespace OpenRCT2::Ui::Windows
if (widget->type == WWT_SCROLL)
{
auto& listView = info.ListViews[scrollIndex];
auto width = widget->right - widget->left + 1 - 2;
auto height = widget->bottom - widget->top + 1 - 2;
auto width = widget->width() + 1 - 2;
auto height = widget->height() + 1 - 2;
if (listView.GetScrollbars() == ScrollbarType::Horizontal || listView.GetScrollbars() == ScrollbarType::Both)
{
height -= SCROLLBAR_WIDTH + 1;
@@ -755,8 +755,8 @@ namespace OpenRCT2::Ui::Windows
{
auto left = w->windowPos.x + viewportWidget->left + 1;
auto top = w->windowPos.y + viewportWidget->top + 1;
auto width = (viewportWidget->right - viewportWidget->left) - 1;
auto height = (viewportWidget->bottom - viewportWidget->top) - 1;
auto width = viewportWidget->width() - 1;
auto height = viewportWidget->height() - 1;
auto viewport = w->viewport;
if (viewport == nullptr)
{

View File

@@ -201,7 +201,7 @@ namespace OpenRCT2::Scripting
auto widget = GetWidget();
if (widget != nullptr)
{
return widget->right - widget->left;
return widget->width();
}
return 0;
}
@@ -244,7 +244,7 @@ namespace OpenRCT2::Scripting
auto widget = GetWidget();
if (widget != nullptr)
{
return widget->bottom - widget->top;
return widget->height();
}
return 0;
}

View File

@@ -153,9 +153,8 @@ rct_window* window_banner_open(rct_windownumber number)
// Create viewport
viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
viewport_create(
w, w->windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
(viewportWidget->right - viewportWidget->left) - 2, (viewportWidget->bottom - viewportWidget->top) - 2, 0,
{ bannerViewPos, view_z }, 0, SPRITE_INDEX_NULL);
w, w->windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 2,
viewportWidget->height() - 2, 0, { bannerViewPos, view_z }, 0, SPRITE_INDEX_NULL);
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
w->Invalidate();
@@ -235,8 +234,8 @@ static void window_banner_mousedown(rct_window* w, rct_widgetindex widgetIndex,
widget--;
window_dropdown_show_text_custom_width(
{ widget->left + w->windowPos.x, widget->top + w->windowPos.y }, widget->bottom - widget->top + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 13, widget->right - widget->left - 3);
{ widget->left + w->windowPos.x, widget->top + w->windowPos.y }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 13, widget->width() - 3);
dropdown_set_checked(banner->text_colour - 1, true);
break;
@@ -348,9 +347,8 @@ static void window_banner_viewport_rotate(rct_window* w)
// Create viewport
rct_widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
viewport_create(
w, w->windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
(viewportWidget->right - viewportWidget->left) - 1, (viewportWidget->bottom - viewportWidget->top) - 1, 0,
bannerViewPos, 0, SPRITE_INDEX_NULL);
w, w->windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, (viewportWidget->width()) - 1,
(viewportWidget->height()) - 1, 0, bannerViewPos, 0, SPRITE_INDEX_NULL);
if (w->viewport != nullptr)
w->viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;

View File

@@ -736,9 +736,8 @@ static void window_cheats_misc_mousedown(rct_window* w, rct_widgetindex widgetIn
gDropdownItemsArgs[i] = WeatherTypes[i];
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 6,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 6, dropdownWidget->width() - 3);
currentWeather = gClimateCurrent.Weather;
dropdown_set_checked(currentWeather, true);
@@ -757,9 +756,8 @@ static void window_cheats_misc_mousedown(rct_window* w, rct_widgetindex widgetIn
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3, dropdownWidget->width() - 3);
dropdown_set_checked(_selectedStaffSpeed, true);
}
}

View File

@@ -140,8 +140,8 @@ static void custom_currency_window_mousedown(rct_window* w, rct_widgetindex widg
gDropdownItemsArgs[1] = STR_SUFFIX;
window_dropdown_show_text_custom_width(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->bottom - widget->top + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 2, widget->right - widget->left - 3);
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 2, widget->width() - 3);
if (CurrencyDescriptors[CURRENCY_CUSTOM].affix_unicode == CURRENCY_PREFIX)
{

View File

@@ -460,7 +460,7 @@ void window_dropdown_show_colour(rct_window* w, rct_widget* widget, uint8_t drop
// Show dropdown
window_dropdown_show_image(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->bottom - widget->top + 1, dropdownColour,
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
DROPDOWN_FLAG_STAY_OPEN, COLOUR_COUNT, 12, 12, _appropriateImageDropdownItemsPerRow[COLOUR_COUNT]);
gDropdownIsColour = true;

View File

@@ -596,8 +596,8 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
{
rct_drawpixelinfo clipDPI;
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
width = widget->right - widget->left - 1;
int32_t height = widget->bottom - widget->top - 1;
width = widget->width() - 1;
int32_t height = widget->height() - 1;
if (clip_drawpixelinfo(&clipDPI, dpi, screenPos.x, screenPos.y, width, height))
{
object_draw_preview(object, &clipDPI, width, height);
@@ -628,7 +628,7 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
uint8_t paletteIndex = ColourMapA[w->colours[1]].mid_light;
gfx_clear(dpi, paletteIndex);
int16_t boxWidth = (w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].left);
int16_t boxWidth = w->widgets[WIDX_RESEARCH_ORDER_SCROLL].width();
int16_t columnSplitOffset = boxWidth / 2;
int32_t itemY = -SCROLLABLE_ROW_HEIGHT;

View File

@@ -609,7 +609,7 @@ void window_editor_object_selection_mousedown(rct_window* w, rct_widgetindex wid
}
window_dropdown_show_text(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->bottom - widget->top + 1,
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1,
w->colours[widget->colour], DROPDOWN_FLAG_STAY_OPEN, _numSourceGameItems + numSelectionItems);
for (int32_t i = 0; i < _numSourceGameItems; i++)
@@ -916,7 +916,7 @@ static void window_editor_object_selection_invalidate(rct_window* w)
for (int32_t i = WIDX_FILTER_RIDE_TAB_ALL; i <= WIDX_FILTER_RIDE_TAB_STALL; i++)
w->widgets[i].type = WWT_TAB;
int32_t width_limit = (w->widgets[WIDX_LIST].right - w->widgets[WIDX_LIST].left - 15) / 2;
int32_t width_limit = (w->widgets[WIDX_LIST].width() - 15) / 2;
w->widgets[WIDX_LIST_SORT_TYPE].type = WWT_TABLE_HEADER;
w->widgets[WIDX_LIST_SORT_TYPE].top = w->widgets[WIDX_FILTER_TEXT_BOX].bottom + 3;
@@ -1027,8 +1027,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
stringId = _listSortType == RIDE_SORT_TYPE ? static_cast<rct_string_id>(_listSortDescending ? STR_DOWN : STR_UP)
: STR_NONE;
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
gfx_draw_string_left_clipped(
dpi, STR_OBJECTS_SORT_TYPE, &stringId, w->colours[1], screenPos, widget->right - widget->left);
gfx_draw_string_left_clipped(dpi, STR_OBJECTS_SORT_TYPE, &stringId, w->colours[1], screenPos, widget->width());
}
widget = &w->widgets[WIDX_LIST_SORT_RIDE];
if (widget->type != WWT_EMPTY)
@@ -1036,8 +1035,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
stringId = _listSortType == RIDE_SORT_RIDE ? static_cast<rct_string_id>(_listSortDescending ? STR_DOWN : STR_UP)
: STR_NONE;
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
gfx_draw_string_left_clipped(
dpi, STR_OBJECTS_SORT_RIDE, &stringId, w->colours[1], screenPos, widget->right - widget->left);
gfx_draw_string_left_clipped(dpi, STR_OBJECTS_SORT_RIDE, &stringId, w->colours[1], screenPos, widget->width());
}
if (w->selected_list_item == -1 || _loadedObject == nullptr)
@@ -1050,8 +1048,8 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
{
rct_drawpixelinfo clipDPI;
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
width = widget->right - widget->left - 1;
int32_t height = widget->bottom - widget->top - 1;
width = widget->width() - 1;
int32_t height = widget->height() - 1;
if (clip_drawpixelinfo(&clipDPI, dpi, screenPos.x, screenPos.y, width, height))
{
object_draw_preview(_loadedObject, &clipDPI, width, height);
@@ -1168,7 +1166,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
}
int32_t width_limit = w->widgets[WIDX_LIST].right - w->widgets[WIDX_LIST].left - screenCoords.x;
int32_t width_limit = w->widgets[WIDX_LIST].width() - screenCoords.x;
if (ridePage)
{

View File

@@ -486,9 +486,8 @@ static void window_editor_objective_options_show_objective_dropdown(rct_window*
numItems++;
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, numItems, dropdownWidget->width() - 3);
objectiveType = gScenarioObjectiveType;
for (int32_t j = 0; j < numItems; j++)
@@ -514,9 +513,8 @@ static void window_editor_objective_options_show_category_dropdown(rct_window* w
gDropdownItemsArgs[i] = ScenarioCategoryStringIds[i];
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 5,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 5, dropdownWidget->width() - 3);
dropdown_set_checked(gS6Info.category, true);
}

View File

@@ -548,9 +548,8 @@ static void window_editor_scenario_options_show_climate_dropdown(rct_window* w)
gDropdownItemsArgs[i] = ClimateNames[i];
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, CLIMATE_COUNT,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, CLIMATE_COUNT, dropdownWidget->width() - 3);
dropdown_set_checked(gClimate, true);
}
@@ -1240,9 +1239,8 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
gDropdownItemsArgs[2] = STR_PAID_ENTRY_PAID_RIDES;
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top - 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 3, dropdownWidget->width() - 3);
if (gParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES)
dropdown_set_checked(2, true);

View File

@@ -620,7 +620,7 @@ static void window_finances_summary_scrollgetsize(rct_window* w, int32_t scrollI
static void window_finances_summary_invertscroll(rct_window* w)
{
rct_widget summary = w->widgets[WIDX_SUMMARY_SCROLL];
w->scrolls[0].h_left = std::max(0, w->scrolls[0].h_right - ((summary.right - summary.left) - 2));
w->scrolls[0].h_left = std::max(0, w->scrolls[0].h_right - (summary.width() - 2));
widget_scroll_update_thumbs(w, WIDX_SUMMARY_SCROLL);
}
@@ -727,7 +727,7 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo
auto screenCoords = ScreenCoordsXY{ 0, TABLE_CELL_HEIGHT + 2 };
rct_widget self = w->widgets[WIDX_SUMMARY_SCROLL];
int32_t row_width = std::max<uint16_t>(w->scrolls[0].h_right, self.right - self.left);
int32_t row_width = std::max<uint16_t>(w->scrolls[0].h_right, self.width());
// Expenditure / Income row labels
for (int32_t i = 0; i < static_cast<int32_t>(ExpenditureType::Count); i++)
@@ -1326,9 +1326,8 @@ static void window_finances_research_mousedown(rct_window* w, rct_widgetindex wi
gDropdownItemsArgs[i] = ResearchFundingLevelNames[i];
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top },
dropdownWidget->bottom - dropdownWidget->top + 1, w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4,
dropdownWidget->right - dropdownWidget->left - 3);
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 4, dropdownWidget->width() - 3);
int32_t currentResearchLevel = gResearchFundingLevel;
dropdown_set_checked(currentResearchLevel, true);

View File

@@ -685,8 +685,8 @@ static void window_footpath_show_footpath_types_dialog(rct_window* w, rct_widget
auto itemsPerRow = dropdown_get_appropriate_image_dropdown_items_per_row(numPathTypes);
window_dropdown_show_image(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->bottom - widget->top + 1, w->colours[1], 0,
numPathTypes, 47, 36, itemsPerRow);
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, w->colours[1], 0, numPathTypes, 47,
36, itemsPerRow);
}
/**

View File

@@ -585,7 +585,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo* dpi, rc
utf8* newsItemText = newsItem->Text;
auto screenCoords = w->windowPos
+ ScreenCoordsXY{ (middleOutsetWidget->left + middleOutsetWidget->right) / 2, middleOutsetWidget->top + 11 };
width = middleOutsetWidget->right - middleOutsetWidget->left - 62;
width = middleOutsetWidget->width() - 62;
gfx_draw_string_centred_wrapped_partial(
dpi, screenCoords.x, screenCoords.y, width, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, &newsItemText,
newsItem->Ticks);
@@ -690,7 +690,7 @@ static void window_game_bottom_toolbar_draw_middle_panel(rct_drawpixelinfo* dpi,
ScreenCoordsXY middleWidgetCoords(
w->windowPos.x + (middleOutsetWidget->left + middleOutsetWidget->right) / 2,
w->windowPos.y + middleOutsetWidget->top + line_height + 1);
int32_t width = middleOutsetWidget->right - middleOutsetWidget->left - 62;
int32_t width = middleOutsetWidget->width() - 62;
// Check if there is a map tooltip to draw
rct_string_id stringId;

View File

@@ -829,8 +829,8 @@ void window_guest_viewport_init(rct_window* w)
{
auto view_widget = &w->widgets[WIDX_VIEWPORT];
auto screenPos = ScreenCoordsXY{ view_widget->left + 1 + w->windowPos.x, view_widget->top + 1 + w->windowPos.y };
int32_t width = view_widget->right - view_widget->left - 1;
int32_t height = view_widget->bottom - view_widget->top - 1;
int32_t width = view_widget->width() - 1;
int32_t height = view_widget->height() - 1;
viewport_create(
w, screenPos, width, height, 0,
@@ -858,8 +858,8 @@ static void window_guest_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dp
return;
rct_widget* widget = &w->widgets[WIDX_TAB_1];
int32_t width = widget->right - widget->left - 1;
int32_t height = widget->bottom - widget->top - 1;
int32_t width = widget->width() - 1;
int32_t height = widget->height() - 1;
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
if (w->page == WINDOW_GUEST_OVERVIEW)
height++;
@@ -1083,15 +1083,15 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
peep->FormatActionTo(ft);
rct_widget* widget = &w->widgets[WIDX_ACTION_LBL];
auto screenPos = w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top - 1 };
int32_t width = widget->right - widget->left;
int32_t width = widget->width();
gfx_draw_string_centred_clipped(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, screenPos, width);
// Draw the marquee thought
widget = &w->widgets[WIDX_MARQUEE];
width = widget->right - widget->left - 3;
width = widget->width() - 3;
int32_t left = widget->left + 2 + w->windowPos.x;
int32_t top = widget->top + w->windowPos.y;
int32_t height = widget->bottom - widget->top;
int32_t height = widget->height();
rct_drawpixelinfo dpi_marquee;
if (!clip_drawpixelinfo(&dpi_marquee, dpi, left, top, width, height))
{
@@ -1117,7 +1117,7 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
return;
}
screenPos.x = widget->right - widget->left - w->list_information_type;
screenPos.x = widget->width() - w->list_information_type;
peep_thought_set_format_args(&peep->Thoughts[i]);
gfx_draw_string_left(&dpi_marquee, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, { screenPos.x, 0 });
}
@@ -2072,7 +2072,7 @@ void window_guest_inventory_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
rct_widget* pageBackgroundWidget = &window_guest_inventory_widgets[WIDX_PAGE_BACKGROUND];
auto screenCoords = w->windowPos + ScreenCoordsXY{ pageBackgroundWidget->left + 4, pageBackgroundWidget->top + 2 };
int32_t itemNameWidth = pageBackgroundWidget->right - pageBackgroundWidget->left - 8;
int32_t itemNameWidth = pageBackgroundWidget->width() - 8;
int32_t maxY = w->windowPos.y + w->height - 22;
int32_t numItems = 0;

View File

@@ -445,8 +445,8 @@ static void window_guest_list_mousedown(rct_window* w, rct_widgetindex widgetInd
widget = &w->widgets[widgetIndex - 1];
window_dropdown_show_text_custom_width(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->bottom - widget->top + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, _window_guest_list_num_pages, widget->right - widget->left - 3);
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, _window_guest_list_num_pages, widget->width() - 3);
for (i = 0; i < _window_guest_list_num_pages; i++)
{
@@ -467,8 +467,8 @@ static void window_guest_list_mousedown(rct_window* w, rct_widgetindex widgetInd
}
window_dropdown_show_text_custom_width(
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->bottom - widget->top + 1,
w->colours[1], 0, DROPDOWN_FLAG_STAY_OPEN, 2, widget->right - widget->left - 3);
{ w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], 0,
DROPDOWN_FLAG_STAY_OPEN, 2, widget->width() - 3);
dropdown_set_checked(_window_guest_list_selected_view, true);
break;

View File

@@ -749,7 +749,7 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
{
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width - 1, dpi->y + dpi->height - 1, ColourMapA[w->colours[1]].mid_light);
const int32_t listWidth = w->widgets[WIDX_SCROLL].right - w->widgets[WIDX_SCROLL].left;
const int32_t listWidth = w->widgets[WIDX_SCROLL].width();
const int32_t dateAnchor = w->widgets[WIDX_SORT_DATE].left + maxDateWidth + DATE_TIME_GAP;
for (int32_t i = 0; i < w->no_list_items; i++)
@@ -781,7 +781,7 @@ static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
auto ft = Formatter::Common();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(_listItems[i].name.c_str());
int32_t max_file_width = w->widgets[WIDX_SORT_NAME].right - w->widgets[WIDX_SORT_NAME].left - 10;
int32_t max_file_width = w->widgets[WIDX_SORT_NAME].width() - 10;
gfx_draw_string_left_clipped(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, { 10, y }, max_file_width);
// Print formatted modified date, if this is a file

Some files were not shown because too many files have changed in this diff Show More