Codechange: Pass by reference to UpdateWidgetSize. (#12457)

These parameters are always provided and not optional.
This commit is contained in:
Peter Nelson
2024-04-09 08:34:45 +01:00
committed by GitHub
parent b5ad28022d
commit de4e00c93f
55 changed files with 602 additions and 602 deletions

View File

@@ -1236,7 +1236,7 @@ public:
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_BRAS_NEWST_LIST: {
@@ -1244,17 +1244,17 @@ public:
for (auto station_class : this->station_classes) {
d = maxdim(d, GetStringBoundingBox(StationClass::Get(station_class)->name));
}
size->width = std::max(size->width, d.width + padding.width);
size.width = std::max(size.width, d.width + padding.width);
this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
size->height = 5 * this->line_height;
resize->height = this->line_height;
size.height = 5 * this->line_height;
resize.height = this->line_height;
break;
}
case WID_BRAS_SHOW_NEWST_TYPE: {
if (!_railstation.newstations) {
size->width = 0;
size->height = 0;
size.width = 0;
size.height = 0;
break;
}
@@ -1269,24 +1269,24 @@ public:
d = maxdim(d, GetStringBoundingBox(str));
}
}
size->width = std::max(size->width, d.width + padding.width);
size.width = std::max(size.width, d.width + padding.width);
break;
}
case WID_BRAS_PLATFORM_DIR_X:
case WID_BRAS_PLATFORM_DIR_Y:
case WID_BRAS_IMAGE:
size->width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size->height = ScaleGUITrad(58) + WidgetDimensions::scaled.fullbevel.Vertical();
size.width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size.height = ScaleGUITrad(58) + WidgetDimensions::scaled.fullbevel.Vertical();
break;
case WID_BRAS_COVERAGE_TEXTS:
size->height = this->coverage_height;
size.height = this->coverage_height;
break;
case WID_BRAS_MATRIX:
fill->height = 1;
resize->height = 1;
fill.height = 1;
resize.height = 1;
break;
}
}
@@ -1752,14 +1752,14 @@ public:
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) {
/* Two digits for signals density. */
size->width = std::max(size->width, 2 * GetDigitWidth() + padding.width + WidgetDimensions::scaled.framerect.Horizontal());
size.width = std::max(size.width, 2 * GetDigitWidth() + padding.width + WidgetDimensions::scaled.framerect.Horizontal());
} else if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) {
size->width = std::max(size->width, this->sig_sprite_size.width + padding.width);
size->height = std::max(size->height, this->sig_sprite_size.height + padding.height);
size.width = std::max(size.width, this->sig_sprite_size.width + padding.width);
size.height = std::max(size.height, this->sig_sprite_size.height + padding.height);
}
}
@@ -1951,12 +1951,12 @@ struct BuildRailDepotWindow : public PickerWindowBase {
this->LowerWidget(WID_BRAD_DEPOT_NE + _build_depot_direction);
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return;
size->width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size->height = ScaleGUITrad(48) + WidgetDimensions::scaled.fullbevel.Vertical();
size.width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size.height = ScaleGUITrad(48) + WidgetDimensions::scaled.fullbevel.Vertical();
}
void DrawWidget(const Rect &r, WidgetID widget) const override
@@ -2106,21 +2106,21 @@ struct BuildRailWaypointWindow : PickerWindowBase {
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_BRW_WAYPOINT_MATRIX:
/* Two blobs high and three wide. */
size->width += resize->width * 2;
size->height += resize->height * 1;
size.width += resize.width * 2;
size.height += resize.height * 1;
/* Resizing in X direction only at blob size, but at pixel level in Y. */
resize->height = 1;
resize.height = 1;
break;
case WID_BRW_WAYPOINT:
size->width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size->height = ScaleGUITrad(58) + WidgetDimensions::scaled.fullbevel.Vertical();
size.width = ScaleGUITrad(64) + WidgetDimensions::scaled.fullbevel.Horizontal();
size.height = ScaleGUITrad(58) + WidgetDimensions::scaled.fullbevel.Vertical();
break;
}
}