From e80df6ae8e35607e56f2419fe7d65f07facce0c2 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Fri, 7 May 2021 22:24:45 +0300 Subject: [PATCH] Removed NWST_STEP and min_step, we don't need two variables doing the same thing --- src/ai/ai_gui.cpp | 14 +++---- src/airport_gui.cpp | 10 ++--- src/bridge_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 12 +++--- src/company_gui.cpp | 66 ++++++++++++++++---------------- src/depot_gui.cpp | 2 +- src/fios_gui.cpp | 2 +- src/graph_gui.cpp | 14 +++---- src/group_gui.cpp | 8 ++-- src/industry_gui.cpp | 16 ++++---- src/linkgraph/linkgraph_gui.cpp | 2 +- src/misc_gui.cpp | 8 ++-- src/music_gui.cpp | 2 +- src/network/network_chat_gui.cpp | 6 +-- src/network/network_gui.cpp | 22 +++++------ src/newgrf_debug_gui.cpp | 2 +- src/newgrf_gui.cpp | 4 +- src/news_gui.cpp | 4 +- src/order_gui.cpp | 2 +- src/rail_gui.cpp | 8 ++-- src/settings_gui.cpp | 5 +-- src/settings_type.h | 1 - src/signs_gui.cpp | 2 +- src/smallmap_gui.cpp | 2 +- src/station_gui.cpp | 8 ++-- src/statusbar_gui.cpp | 2 +- src/subsidy_gui.cpp | 16 ++++---- src/table/misc_settings.ini | 10 ----- src/timetable_gui.cpp | 2 +- src/toolbar_gui.cpp | 2 +- src/town_gui.cpp | 8 ++-- src/transparency_gui.cpp | 2 +- src/vehicle_gui.cpp | 6 +-- src/widget.cpp | 28 ++++++-------- src/widget_type.h | 5 +-- src/widgets/dropdown_type.h | 2 +- src/window.cpp | 6 +-- 37 files changed, 145 insertions(+), 168 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 42ce674f28..a51d0135d8 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -111,7 +111,7 @@ struct AIListWindow : public Window { { if (widget == WID_AIL_LIST) { this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; - this->line_height = GetMinSizing(NWST_STEP, this->line_height); + this->line_height = GetMinSizing(NWST_BUTTON, this->line_height); resize->width = 1; resize->height = this->line_height; @@ -352,7 +352,7 @@ struct AISettingsWindow : public Window { { if (widget == WID_AIS_BACKGROUND) { this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; - this->line_height = GetMinSizing(NWST_STEP, this->line_height); + this->line_height = GetMinSizing(NWST_BUTTON, this->line_height); resize->width = 1; resize->height = this->line_height; @@ -703,7 +703,7 @@ static const NWidgetPart _nested_ai_config_widgets[] = { EndContainer(), NWidget(NWID_SPACER), SetMinimalSize(0, 9), NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_GAMESCRIPT, STR_NULL), SetPadding(0, 5, 4, 5), - NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetSizingType(NWST_STEP), SetMinimalSize(288, 14), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_AI_CONFIG_GAMELIST_TOOLTIP), + NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), SetSizingType(NWST_BUTTON), SetMinimalSize(288, 14), SetFill(1, 0), SetMatrixDataTip(1, 1, STR_AI_CONFIG_GAMELIST_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(7, 0, 7), NWidget(WWT_PUSHTXTBTN, COLOUR_YELLOW, WID_AIC_CHANGE), SetFill(1, 0), SetMinimalSize(93, 0), SetDataTip(STR_AI_CONFIG_CHANGE, STR_AI_CONFIG_CHANGE_TOOLTIP), @@ -782,12 +782,12 @@ struct AIConfigWindow : public Window { { switch (widget) { case WID_AIC_GAMELIST: - this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); + this->line_height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); size->height = this->line_height; break; case WID_AIC_LIST: - this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); + this->line_height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); size->height = 8 * this->line_height; break; @@ -1109,7 +1109,7 @@ struct AIDebugWindow : public Window { void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_AID_LOG_PANEL) { - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); size->height = 14 * resize->height + this->top_offset + this->bottom_offset; } } @@ -1126,7 +1126,7 @@ struct AIDebugWindow : public Window { bool dirty = false; Dimension d = GetSpriteSize(SPR_COMPANY_ICON); - uint offset_y = Center(0, GetMinSizing(NWST_STEP, d.height + WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1), d.height); + uint offset_y = Center(0, GetMinSizing(NWST_BUTTON, d.height + WD_MATRIX_TOP + WD_MATRIX_BOTTOM + 1), d.height); /* Paint the company icons */ for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { NWidgetCore *button = this->GetWidget(i + WID_AID_COMPANY_BUTTON_START); diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 7ab37edde1..b461b19435 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -335,7 +335,7 @@ public: d.width += padding.width; d.height += padding.height; *size = maxdim(*size, d); - size->height = GetMinSizing(NWST_STEP, size->height); + size->height = GetMinSizing(NWST_BUTTON, size->height); break; } @@ -347,7 +347,7 @@ public: size->width = std::max(size->width, GetStringBoundingBox(as->name).width); } - this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); + this->line_height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); size->height = 5 * this->line_height; break; } @@ -591,7 +591,7 @@ static const NWidgetPart _nested_build_airport_widgets[] = { NWidget(NWID_HORIZONTAL), /* Airport dropdown selector and picture. */ NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2), - NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetSizingType(NWST_STEP), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0), + NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetSizingType(NWST_BUTTON), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP), NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0), EndContainer(), @@ -602,9 +602,9 @@ static const NWidgetPart _nested_build_airport_widgets[] = { NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetSizingType(NWST_STEP), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetSizingType(NWST_BUTTON), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL), NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetSizingType(NWST_STEP), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetSizingType(NWST_BUTTON), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL), EndContainer(), NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0), EndContainer(), diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 22d2ecfc1c..2f3dfd03ad 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -199,7 +199,7 @@ public: sprite_dim.height++; // Sprite is rendered one pixel down in the matrix field. text_dim.height++; // Allowing the bottom row pixels to be rendered on the edge of the matrix field. resize->height = std::max(sprite_dim.height, text_dim.height) + 2; // Max of both sizes + account for matrix edges. - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); this->bridgetext_offset = WD_MATRIX_LEFT + sprite_dim.width + 1; // Left edge of text, 1 pixel distance from the sprite. size->width = this->bridgetext_offset + text_dim.width + WD_MATRIX_RIGHT; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index e563ad97ad..d91df2118d 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -45,7 +45,7 @@ uint GetEngineListHeight(VehicleType type) { uint size = std::max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleImageCellSize(type, EIT_PURCHASE).height); - return GetMinSizing(NWST_STEP, size); + return GetMinSizing(NWST_BUTTON, size); } static const NWidgetPart _nested_build_vehicle_widgets[] = { @@ -61,12 +61,12 @@ static const NWidgetPart _nested_build_vehicle_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetSizingType(NWST_STEP), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), SetSizingType(NWST_STEP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_BV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetSizingType(NWST_BUTTON), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_SORT_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), SetSizingType(NWST_BUTTON), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BV_SHOW_HIDDEN_ENGINES), SetSizingType(NWST_STEP), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), SetSizingType(NWST_STEP), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BV_SHOW_HIDDEN_ENGINES), SetSizingType(NWST_BUTTON), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_BV_CARGO_FILTER_DROPDOWN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_FILTER_CRITERIA), SetSizingType(NWST_BUTTON), EndContainer(), NWidget(NWID_SPACER), SetFill(1, 1), EndContainer(), @@ -1566,7 +1566,7 @@ struct BuildVehicleWindow : Window { Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; - d.height = GetMinSizing(NWST_STEP, d.height); + d.height = GetMinSizing(NWST_BUTTON, d.height); *size = maxdim(*size, d); break; } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 20059829d6..600a748f9f 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -527,7 +527,7 @@ public: uint Height(uint width) const override { - return GetMinSizing(NWST_STEP, std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2)); + return GetMinSizing(NWST_BUTTON, std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2)); } bool Selectable() const override @@ -1216,65 +1216,65 @@ static const NWidgetPart _nested_select_company_manager_face_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetFill(1, 0), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_HAIR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_HAIR), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_HAIR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_HAIR_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_HAIR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYEBROWS_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYEBROWS), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_EYEBROWS_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYEBROWS_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_EYEBROWS_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_EYECOLOUR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_EYECOLOUR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_EYECOLOUR_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_EYECOLOUR_TOOLTIP), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_GLASSES_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_GLASSES), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_GLASSES_TOOLTIP_2), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_GLASSES_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_GLASSES_TOOLTIP_2), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_NOSE_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_NOSE), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_NOSE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_NOSE_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_NOSE_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_LIPS_MOUSTACHE_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_LIPS_MOUSTACHE_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_LIPS_MOUSTACHE_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_CHIN_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_CHIN), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_CHIN_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_CHIN_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_CHIN_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_JACKET_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_JACKET), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_JACKET_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_JACKET_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_JACKET_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_COLLAR_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_COLLAR), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_COLLAR_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_COLLAR_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_COLLAR_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SCMF_TIE_EARRING_TEXT), SetFill(1, 0), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetSizingType(NWST_STEP), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetSizingType(NWST_STEP), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetSizingType(NWST_STEP), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_L), SetSizingType(NWST_BUTTON), SetDataTip(AWV_DECREASE, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING), SetSizingType(NWST_BUTTON), SetDataTip(STR_EMPTY, STR_FACE_TIE_EARRING_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_SCMF_TIE_EARRING_R), SetSizingType(NWST_BUTTON), SetDataTip(AWV_INCREASE, STR_FACE_TIE_EARRING_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), @@ -1382,8 +1382,8 @@ public: yesno_dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; yesno_dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - yesno_dim.width = GetMinSizing(NWST_STEP, yesno_dim.width); - yesno_dim.height = GetMinSizing(NWST_STEP, yesno_dim.height); + yesno_dim.width = GetMinSizing(NWST_BUTTON, yesno_dim.width); + yesno_dim.height = GetMinSizing(NWST_BUTTON, yesno_dim.height); /* Size of the number button + arrows. */ Dimension number_dim = {0, 0}; diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 8f392dd097..5a6cdb790e 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -678,7 +678,7 @@ struct DepotWindow : Window { int base_width = this->count_width + this->header_width; resize->height = std::max(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height); - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); if (this->type == VEH_TRAIN) { resize->width = 1; size->width = base_width + 2 * ScaleGUITrad(29); // about 2 parts diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index d4c3021364..09ebea6cb1 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -569,7 +569,7 @@ public: break; case WID_SL_DRIVES_DIRECTORIES_LIST: - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); size->height = resize->height * 5 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; case WID_SL_SORT_BYNAME: diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index e44bd1e701..c8676758bb 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -114,7 +114,7 @@ static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index) for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) { NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_BROWN, widnum); - panel->sizing_type = NWST_STEP; + panel->sizing_type = NWST_BUTTON; panel->SetMinimalSize(246, line_height); panel->SetFill(1, 0); panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP); @@ -647,7 +647,7 @@ static const NWidgetPart _nested_operating_profit_widgets[] = { NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), EndContainer(), EndContainer(), @@ -699,7 +699,7 @@ static const NWidgetPart _nested_income_graph_widgets[] = { NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), EndContainer(), EndContainer(), @@ -749,7 +749,7 @@ static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = { NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), EndContainer(), EndContainer(), @@ -805,9 +805,9 @@ static const NWidgetPart _nested_performance_history_widgets[] = { NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE), EndContainer(), EndContainer(), @@ -857,7 +857,7 @@ static const NWidgetPart _nested_company_value_graph_widgets[] = { NWidget(NWID_VERTICAL), NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1), NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP), - SetSizingType(NWST_STEP), + SetSizingType(NWST_BUTTON), NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), EndContainer(), EndContainer(), diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 6ff239816c..46ce909ffb 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -71,12 +71,12 @@ static const NWidgetPart _nested_group_widgets[] = { /* right part */ NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GL_GROUP_BY_ORDER), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_STATION_VIEW_GROUP, STR_TOOLTIP_GROUP_ORDER), - NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_GROUP_BY_DROPDOWN), SetSizingType(NWST_STEP), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_GL_GROUP_BY_ORDER), SetSizingType(NWST_BUTTON), SetMinimalSize(81, 12), SetDataTip(STR_STATION_VIEW_GROUP, STR_TOOLTIP_GROUP_ORDER), + NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_GROUP_BY_DROPDOWN), SetSizingType(NWST_BUTTON), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_GL_SORT_BY_ORDER), SetSizingType(NWST_BUTTON), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_GL_SORT_BY_DROPDOWN), SetMinimalSize(167, 12), SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA), NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(12, 12), SetResize(1, 0), EndContainer(), EndContainer(), @@ -230,7 +230,7 @@ private: this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_NUMBER].height); this->tiny_step_height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; - this->tiny_step_height = GetMinSizing(NWST_STEP, this->tiny_step_height); + this->tiny_step_height = GetMinSizing(NWST_BUTTON, this->tiny_step_height); return WD_FRAMERECT_LEFT + 8 + this->column_size[VGC_FOLD].width + 2 + diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index fc6f69c12f..1351b53c74 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -421,7 +421,7 @@ public: if (this->index[i] == INVALID_INDUSTRYTYPE) continue; d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(this->index[i])->name)); } - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM); d.width += FONT_HEIGHT_NORMAL * 5 / 4 + padding.width; d.height = 5 * resize->height; *size = maxdim(*size, d); @@ -927,7 +927,7 @@ public: if (first) { if (has_accept) y += WD_PAR_VSEP_WIDE; DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LAST_MONTH_TITLE); - y += this->editable == EA_RATE ? GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) : FONT_HEIGHT_NORMAL; + y += this->editable == EA_RATE ? GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL) : FONT_HEIGHT_NORMAL; if (this->editable == EA_RATE) this->production_offset_y = y; first = false; } @@ -942,7 +942,7 @@ public: if (this->editable == EA_RATE) { DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_RATE1 + j) ? this->clicked_button : 0, i->production_rate[j] > 0, i->production_rate[j] < 255); - y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + y += GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); } else { y += FONT_HEIGHT_NORMAL; } @@ -957,7 +957,7 @@ public: DrawString(x, right - WD_FRAMERECT_RIGHT, y, STR_INDUSTRY_VIEW_PRODUCTION_LEVEL); DrawArrowButtons(left + WD_FRAMETEXT_LEFT, y, COLOUR_YELLOW, (this->clicked_line == IL_MULTIPLIER) ? this->clicked_button : 0, i->prod_level > PRODLEVEL_MINIMUM, i->prod_level < PRODLEVEL_MAXIMUM); - y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + y += GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); } /* Get the extra message for the GUI */ @@ -1017,9 +1017,9 @@ public: case EA_RATE: if (pt.y >= this->production_offset_y) { - if ((pt.y - this->production_offset_y) % GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) > (uint)SETTING_BUTTON_HEIGHT) break;; + if ((pt.y - this->production_offset_y) % GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL) > (uint)SETTING_BUTTON_HEIGHT) break;; - int row = (pt.y - this->production_offset_y) / GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + int row = (pt.y - this->production_offset_y) / GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); for (uint j = 0; j < lengthof(i->produced_cargo); j++) { if (i->produced_cargo[j] == CT_INVALID) continue; row--; @@ -1235,7 +1235,7 @@ static const NWidgetPart _nested_industry_directory_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_ID_DROPDOWN_ORDER), SetSizingType(NWST_STEP), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_ID_DROPDOWN_ORDER), SetSizingType(NWST_BUTTON), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_DROPDOWN_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_FILTER_BY_ACC_CARGO), SetMinimalSize(225, 12), SetFill(0, 1), SetDataTip(STR_INDUSTRY_DIRECTORY_ACCEPTED_CARGO_FILTER, STR_TOOLTIP_FILTER_CRITERIA), NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_ID_FILTER_BY_PROD_CARGO), SetMinimalSize(225, 12), SetFill(0, 1), SetDataTip(STR_INDUSTRY_DIRECTORY_PRODUCED_CARGO_FILTER, STR_TOOLTIP_FILTER_CRITERIA), @@ -1669,7 +1669,7 @@ public: for (uint i = 0; i < this->industries.size(); i++) { d = maxdim(d, GetStringBoundingBox(this->GetIndustryString(this->industries[i]))); } - resize->height = d.height = GetMinSizing(NWST_STEP, d.height); + resize->height = d.height = GetMinSizing(NWST_BUTTON, d.height); d.height *= 5; d.width += padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; d.height += padding.height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index ca929b82e1..6015511ef1 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -403,7 +403,7 @@ NWidgetBase *MakeCargoesLegendLinkGraphGUI(int *biggest_index) row = new NWidgetHorizontal(NC_EQUALSIZE); } NWidgetBackground * wid = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, i + WID_LGL_CARGO_FIRST); - wid->sizing_type = NWST_STEP; + wid->sizing_type = NWST_BUTTON; wid->SetMinimalSize(25, FONT_HEIGHT_SMALL); wid->SetFill(1, 1); wid->SetResize(0, 0); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 4e05dd488f..782f20f458 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -735,15 +735,15 @@ struct TooltipsWindow : public Window /* Correctly position the tooltip position, watch out for window and cursor size * Clamp value to below main toolbar and above statusbar. If tooltip would * go below window, flip it so it is shown above the cursor */ - pt.y = std::min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height - GetMinSizing(NWST_STEP); - if (pt.y < scr_top) pt.y = Clamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot) + GetMinSizing(NWST_STEP); + pt.y = std::min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height - GetMinSizing(NWST_BUTTON); + if (pt.y < scr_top) pt.y = Clamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot) + GetMinSizing(NWST_BUTTON); pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width); if (_settings_client.gui.windows_titlebars) { // Move it to the top of the screen, away from mouse cursor, so it won't steal screen taps on Android pt.y = GetMainViewTop(); - if (_cursor.pos.y < pt.y + (int)GetMinSizing(NWST_STEP)) { - pt.x = _cursor.pos.x > _screen.width / 2 ? GetMinSizing(NWST_STEP) : _screen.width - sm_width - GetMinSizing(NWST_STEP); + if (_cursor.pos.y < pt.y + (int)GetMinSizing(NWST_BUTTON)) { + pt.x = _cursor.pos.x > _screen.width / 2 ? GetMinSizing(NWST_BUTTON) : _screen.width - sm_width - GetMinSizing(NWST_BUTTON); } } diff --git a/src/music_gui.cpp b/src/music_gui.cpp index c050311a6a..80080b7917 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -528,7 +528,7 @@ struct MusicTrackSelectionWindow : public Window { SetDParamStr(2, song->songname); d = maxdim(d, GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME)); } - resize->height = GetMinSizing(NWST_STEP, d.height); + resize->height = GetMinSizing(NWST_BUTTON, d.height); d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; d.height = 7 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; *size = maxdim(*size, d); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 6a6c34dbfe..86b90bb755 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -105,7 +105,7 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const char *m /** Initialize all font-dependent chat box sizes. */ void NetworkReInitChatBoxSize() { - _chatmsg_box.y = GetMinSizing(NWST_STEP, 10) + 5; + _chatmsg_box.y = GetMinSizing(NWST_BUTTON, 10) + 5; _chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 4; _chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel()); } @@ -116,7 +116,7 @@ void NetworkInitChatMessage() MAX_CHAT_MESSAGES = _settings_client.gui.network_chat_box_height; _chatmsg_list = ReallocT(_chatmsg_list, _settings_client.gui.network_chat_box_height); - _chatmsg_box.x = GetMinSizing(NWST_STEP, 10) + 5; + _chatmsg_box.x = GetMinSizing(NWST_BUTTON, 10) + 5; _chatmsg_box.width = _settings_client.gui.network_chat_box_width_pct * _screen.width / 100; NetworkReInitChatBoxSize(); _chatmessage_visible = false; @@ -455,7 +455,7 @@ struct NetworkChatWindow : public Window { Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override { - Point pt = { (int)GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) * 2, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; + Point pt = { (int)GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL) * 2, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; return pt; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index f032ffc881..dfef6f398a 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -501,14 +501,14 @@ public: switch (widget) { case WID_NG_MATRIX: resize->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); fill->height = resize->height; size->height = 5 * resize->height; break; case WID_NG_LASTJOINED: size->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; - size->height = GetMinSizing(NWST_STEP, size->height); + size->height = GetMinSizing(NWST_BUTTON, size->height); break; case WID_NG_LASTJOINED_SPACER: @@ -1366,7 +1366,7 @@ struct NetworkLobbyWindow : public Window { case WID_NL_MATRIX: resize->height = WD_MATRIX_TOP + std::max(std::max(GetSpriteSize(SPR_LOCK).height, GetSpriteSize(SPR_PROFIT_LOT).height), FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); size->height = 6 * resize->height; break; @@ -1713,8 +1713,8 @@ struct NetworkClientListPopupWindow : Window { Window(desc), sel_index(-1), client_id(client_id) { - this->desired_location.x = x - GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); - this->desired_location.y = y + GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) / 2; + this->desired_location.x = x - GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); + this->desired_location.y = y + GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL) / 2; const NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id); @@ -1749,7 +1749,7 @@ struct NetworkClientListPopupWindow : Window { d = maxdim(GetStringBoundingBox(action.name), d); } - d.height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + d.height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); d.height *= (uint)this->actions.size(); d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; @@ -1764,14 +1764,14 @@ struct NetworkClientListPopupWindow : Window { for (const ClientListAction &action : this->actions) { TextColour colour; if (sel-- == 0) { // Selected item, highlight it - GfxFillRect(r.left + 1, y, r.right - 1, y + GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL) - 1, PC_BLACK); + GfxFillRect(r.left + 1, y, r.right - 1, y + GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL) - 1, PC_BLACK); colour = TC_WHITE; } else { colour = TC_BLACK; } - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(y, GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL)), action.name, colour); - y += GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, Center(y, GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL)), action.name, colour); + y += GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); } } @@ -1795,7 +1795,7 @@ struct NetworkClientListPopupWindow : Window { void OnClick(Point pt, int widget, int click_count) override { - int index = (pt.y - WD_FRAMERECT_TOP) / GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + int index = (pt.y - WD_FRAMERECT_TOP) / GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); if (index >= 0 && index < (int)this->actions.size()) { const NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(this->client_id); @@ -1888,7 +1888,7 @@ struct NetworkClientListWindow : Window { this->server_client_width = std::max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT; this->icon_size = GetSpriteSize(SPR_COMPANY_ICON); this->line_height = std::max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL); - this->line_height = GetMinSizing(NWST_STEP, this->line_height); + this->line_height = GetMinSizing(NWST_BUTTON, this->line_height); uint width = 100; // Default width for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) { diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 9d769880cb..eea9409b45 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -864,7 +864,7 @@ struct SpriteAlignerWindow : Window { break; case WID_SA_LIST: resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1); - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); resize->width = 1; break; default: diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index d3537c7d15..8cc3066215 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -721,14 +721,14 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { { Dimension d = maxdim(GetSpriteSize(SPR_SQUARE), GetSpriteSize(SPR_WARNING_SIGN)); resize->height = std::max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U); - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); size->height = std::max(size->height, WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM); break; } case WID_NS_AVAIL_LIST: resize->height = std::max(12, FONT_HEIGHT_NORMAL + 2); - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); size->height = std::max(size->height, WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM); break; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 526d97e705..b2ca288a27 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -194,7 +194,7 @@ static const NWidgetPart _nested_small_news_widgets[] = { NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, WID_N_INSET), SetPadding(2, 2, 2, 2), NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0), EndContainer(), - NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(275, 20), SetFill(1, 0), SetPadding(0, 5, 0, 5), SetSizingType(NWST_STEP), + NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(275, 20), SetFill(1, 0), SetPadding(0, 5, 0, 5), SetSizingType(NWST_BUTTON), EndContainer(), }; @@ -1141,7 +1141,7 @@ struct MessageHistoryWindow : Window { void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_MH_BACKGROUND) { - this->line_height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL + 2); + this->line_height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL + 2); resize->height = this->line_height; /* Months are off-by-one, so it's actually 8. Not using diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 4f55f2c202..a2381b15d5 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -793,7 +793,7 @@ public: { switch (widget) { case WID_O_ORDER_LIST: - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); size->height = 4 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; break; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 3391d90141..6de6827362 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1248,7 +1248,7 @@ public: } size->width = std::max(size->width, d.width + padding.width); this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; - this->line_height = GetMinSizing(NWST_STEP, this->line_height); + this->line_height = GetMinSizing(NWST_BUTTON, this->line_height); size->height = 3 * this->line_height; resize->height = this->line_height; break; @@ -1295,7 +1295,7 @@ public: case WID_BRAS_NEWST_SPACER: size->height = 0; if (_railstation.newstations) { - size->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + size->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); } break; } @@ -1918,10 +1918,10 @@ static const NWidgetPart _nested_signal_builder_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_BS_ELECTRIC_PBS_OWAY), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP), EndContainer(), SetFill(1, 1), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE), SetSizingType(NWST_STEP), SetMinimalSize(9, 12), SetDataTip(AWV_DECREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_DECREASE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_DECREASE), SetSizingType(NWST_BUTTON), SetMinimalSize(9, 12), SetDataTip(AWV_DECREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_DECREASE_TOOLTIP), EndContainer(), NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetDataTip(STR_NULL, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_TOOLTIP), SetFill(1, 1), - NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE), SetSizingType(NWST_STEP), SetMinimalSize(9, 12), SetDataTip(AWV_INCREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP), + NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_BS_DRAG_SIGNALS_DENSITY_INCREASE), SetSizingType(NWST_BUTTON), SetMinimalSize(9, 12), SetDataTip(AWV_INCREASE, STR_BUILD_SIGNAL_DRAG_SIGNALS_DENSITY_INCREASE_TOOLTIP), EndContainer(), EndContainer(), EndContainer(), diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 5e5df4c9d7..85f6c9a551 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -484,11 +484,9 @@ struct GameOptionsWindow : Window { this->SetDirty(); if (_settings_client.gui.min_button == 48 && _settings_client.gui.windows_titlebars) { _settings_client.gui.min_button = 40; - _settings_client.gui.min_step = 40; } if (_settings_client.gui.min_button == 40 && !_settings_client.gui.windows_titlebars) { _settings_client.gui.min_button = 48; - _settings_client.gui.min_step = 48; } ReconstructUserInterface(); break; @@ -621,7 +619,6 @@ struct GameOptionsWindow : Window { case WID_GO_BUTTON_SIZE_DROPDOWN: // Setup screenshot format dropdown _settings_client.gui.min_button = index; - _settings_client.gui.min_step = index; ReconstructUserInterface(); break; @@ -2003,7 +2000,7 @@ struct GameSettingsWindow : Window { { switch (widget) { case WID_GS_OPTIONSPANEL: - resize->height = SETTING_HEIGHT = GetMinSizing(NWST_STEP, std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + 1); + resize->height = SETTING_HEIGHT = GetMinSizing(NWST_BUTTON, std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + 1); resize->width = 1; size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET; diff --git a/src/settings_type.h b/src/settings_type.h index 68012ce697..bf29e6cb6f 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -100,7 +100,6 @@ struct GUISettings { bool windows_titlebars; ///< show or hide titlebars for all windows to increase scrren space bool windows_decorations; ///< draw ornament on all window edges uint min_button; ///< min size of most button widgets - uint min_step; ///< min size of scrollbar/dropdown elements bool show_finances; ///< show finances at end of year bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames bool new_nonstop; ///< ttdpatch compatible nonstop handling diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 088aa50e7d..afd9c18a4f 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -266,7 +266,7 @@ struct SignListWindow : Window, SignList { Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON); this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text. resize->height = std::max(FONT_HEIGHT_NORMAL, spr_dim.height); - resize->height = std::max(GetMinSizing(NWST_STEP), resize->height); + resize->height = std::max(GetMinSizing(NWST_BUTTON), resize->height); Dimension d = {(uint)(this->text_offset + WD_FRAMETEXT_RIGHT), WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM}; *size = maxdim(*size, d); break; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index ad7105c938..a77a78cb43 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1077,7 +1077,7 @@ void SmallMapWindow::SetupWidgetData() SmallMapWindow::SmallMapWindow(WindowDesc *desc, int window_number) : Window(desc), - row_height(std::max(GetMinSizing(NWST_STEP, FONT_HEIGHT_SMALL) * 2 / 3, uint(FONT_HEIGHT_SMALL))), // Default spacing makes legend too tall - shrink it by 1/3 + row_height(std::max(GetMinSizing(NWST_BUTTON, FONT_HEIGHT_SMALL) * 2 / 3, uint(FONT_HEIGHT_SMALL))), // Default spacing makes legend too tall - shrink it by 1/3 show_legend(false), refresh(GUITimer(FORCE_REFRESH_PERIOD)) { diff --git a/src/station_gui.cpp b/src/station_gui.cpp index ebcb6d66ea..161338192a 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -392,7 +392,7 @@ public: case WID_STL_LIST: resize->height = std::max(FONT_HEIGHT_NORMAL, FONT_HEIGHT_SMALL + ScaleFontTrad(3)); - resize->height = GetMinSizing(NWST_STEP, resize->height); + resize->height = GetMinSizing(NWST_BUTTON, resize->height); size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM; /* Determine appropriate width for mini station rating graph */ @@ -447,7 +447,7 @@ public: int max = std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.size()); int y = r.top + WD_FRAMERECT_TOP; uint line_height = this->GetWidget(widget)->resize_y; - line_height = GetMinSizing(NWST_STEP, line_height); + line_height = GetMinSizing(NWST_BUTTON, line_height); y = CenterBounds(y, y + line_height, FONT_HEIGHT_NORMAL); /* Spacing between station name and first rating graph. */ int text_spacing = ScaleFontTrad(5); @@ -762,7 +762,7 @@ static const NWidgetPart _nested_company_stations_widgets[] = { NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetSizingType(NWST_STEP), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_STL_SORTBY), SetSizingType(NWST_BUTTON), SetMinimalSize(81, 12), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_STL_SORTDROPBTN), SetMinimalSize(163, 12), SetDataTip(STR_SORT_BY_NAME, STR_TOOLTIP_SORT_CRITERIA), // widget_data gets overwritten. NWidget(WWT_PANEL, COLOUR_GREY), SetDataTip(0x0, STR_NULL), SetResize(1, 0), SetFill(1, 1), EndContainer(), EndContainer(), @@ -2314,7 +2314,7 @@ struct SelectStationWindow : Window { d = maxdim(d, GetStringBoundingBox(T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_STATION_LIST_WAYPOINT : STR_STATION_LIST_STATION)); } - resize->height = GetMinSizing(NWST_STEP, d.height); + resize->height = GetMinSizing(NWST_BUTTON, d.height); d.height = 5 * resize->height; d.width += WD_FRAMERECT_RIGHT + WD_FRAMERECT_LEFT; d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 1af74f5a85..e14e4d637c 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -107,7 +107,7 @@ struct StatusBarWindow : Window { void FindWindowPlacementAndResize(int def_width, int def_height) override { - Window::FindWindowPlacementAndResize(std::min(_toolbar_width, _screen.width * 2 / 3 - GetMinSizing(NWST_STEP) * 2), def_height); + Window::FindWindowPlacementAndResize(std::min(_toolbar_width, _screen.width * 2 / 3 - GetMinSizing(NWST_BUTTON) * 2), def_height); } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 10565de07d..5b563feeaa 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -129,7 +129,7 @@ struct SubsidyListWindow : Window { { if (widget != WID_SUL_PANEL) return; Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE)); - d.height = GetMinSizing(NWST_STEP, d.height); + d.height = GetMinSizing(NWST_BUTTON, d.height); resize->height = d.height; @@ -149,13 +149,13 @@ struct SubsidyListWindow : Window { int right = r.right - WD_FRAMERECT_RIGHT; int y = r.top + WD_FRAMERECT_TOP; int x = r.left + WD_FRAMERECT_LEFT; - y = Center(y, GetMinSizing(NWST_STEP)); + y = Center(y, GetMinSizing(NWST_BUTTON)); int pos = -this->vscroll->GetPosition(); const int cap = this->vscroll->GetCapacity(); /* Section for drawing the offered subsidies */ - if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_OFFERED_TITLE); + if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_OFFERED_TITLE); pos++; uint num = 0; @@ -165,7 +165,7 @@ struct SubsidyListWindow : Window { /* Displays the two offered towns */ SetupSubsidyDecodeParam(s, true); SetDParam(7, _date - ymd.day + s->remaining * 32); - DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_OFFERED_FROM_TO); + DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_OFFERED_FROM_TO); } pos++; num++; @@ -173,13 +173,13 @@ struct SubsidyListWindow : Window { } if (num == 0) { - if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_NONE); + if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_NONE); pos++; } /* Section for drawing the already granted subsidies */ pos++; - if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_SUBSIDISED_TITLE); + if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_SUBSIDISED_TITLE); pos++; num = 0; @@ -191,7 +191,7 @@ struct SubsidyListWindow : Window { SetDParam(8, _date - ymd.day + s->remaining * 32); /* Displays the two connected stations */ - DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_SUBSIDISED_FROM_TO); + DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_SUBSIDISED_FROM_TO); } pos++; num++; @@ -199,7 +199,7 @@ struct SubsidyListWindow : Window { } if (num == 0) { - if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_STEP), STR_SUBSIDIES_NONE); + if (IsInsideMM(pos, 0, cap)) DrawString(x, right, y + pos * GetMinSizing(NWST_BUTTON), STR_SUBSIDIES_NONE); pos++; } } diff --git a/src/table/misc_settings.ini b/src/table/misc_settings.ini index 8cd77217bf..3e1be42c18 100644 --- a/src/table/misc_settings.ini +++ b/src/table/misc_settings.ini @@ -272,16 +272,6 @@ min = 0 max = 100 cat = SC_EXPERT -[SDTG_VAR] -name = ""min_step_size"" -type = SLE_UINT -var = _settings_client.gui.min_step -def = 48 -min = 0 -max = 100 -cat = SC_EXPERT - - [SDTG_VAR] name = ""sprite_cache_size_px"" type = SLE_UINT diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index a2091bb7d8..b2f3e066f6 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -199,7 +199,7 @@ struct TimetableWindow : Window { case WID_VT_ARRIVAL_DEPARTURE_SELECTION: case WID_VT_TIMETABLE_PANEL: - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); size->height = WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM; break; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index b8b7dab63e..adbbef4a18 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -144,7 +144,7 @@ public: uint Height(uint width) const override { - return GetMinSizing(NWST_STEP, std::max(std::max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL)); + return GetMinSizing(NWST_BUTTON, std::max(std::max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL)); } void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override diff --git a/src/town_gui.cpp b/src/town_gui.cpp index a729bdfa30..d8f882507c 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -100,7 +100,7 @@ public: this->town = Town::Get(window_number); this->InitNested(window_number); this->vscroll = this->GetScrollbar(WID_TA_SCROLLBAR); - this->actions_step = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + this->actions_step = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); this->vscroll->SetCapacity((this->GetWidget(WID_TA_COMMAND_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->actions_step); } @@ -244,7 +244,7 @@ public: } case WID_TA_COMMAND_LIST: - resize->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + resize->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); size->height = WD_FRAMERECT_TOP + 3 * resize->height + WD_FRAMERECT_BOTTOM; size->width = GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTIONS_TITLE).width; for (uint i = 0; i < TACT_COUNT; i++ ) { @@ -650,7 +650,7 @@ static const NWidgetPart _nested_town_directory_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetSizingType(NWST_STEP), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetSizingType(NWST_BUTTON), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_TD_SORT_CRITERIA), SetDataTip(STR_JUST_STRING, STR_TOOLTIP_SORT_CRITERIA), NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_TD_FILTER), SetFill(35, 12), SetDataTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP), EndContainer(), @@ -868,7 +868,7 @@ public: Dimension icon_size = GetSpriteSize(SPR_TOWN_RATING_GOOD); d.width += icon_size.width + 2; d.height = std::max(d.height, icon_size.height); - d.height = GetMinSizing(NWST_STEP, d.height); + d.height = GetMinSizing(NWST_BUTTON, d.height); resize->height = d.height; d.height *= 5; d.width += padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index c824ab8a71..97e7dcd96a 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -142,7 +142,7 @@ static const NWidgetPart _nested_transparency_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 1), EndContainer(), EndContainer(), /* Panel with 'invisibility' buttons. */ - NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_TT_BUTTONS), SetSizingType(NWST_STEP), SetMinimalSize(219, 13), SetDataTip(0x0, STR_TRANSPARENT_INVISIBLE_TOOLTIP), + NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_TT_BUTTONS), SetSizingType(NWST_BUTTON), SetMinimalSize(219, 13), SetDataTip(0x0, STR_TRANSPARENT_INVISIBLE_TOOLTIP), EndContainer(), }; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 0828b2a784..52ac96f7c8 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -744,17 +744,17 @@ struct RefitWindow : public Window { { switch (widget) { case WID_VR_MATRIX: - resize->height = GetMinSizing(NWST_STEP, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); + resize->height = GetMinSizing(NWST_BUTTON, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); size->height = resize->height * 4; break; case WID_VR_VEHICLE_PANEL_DISPLAY: - size->height = std::max(GetMinSizing(NWST_STEP), ScaleGUITrad(GetVehicleHeight(Vehicle::Get(this->window_number)->type))); + size->height = std::max(GetMinSizing(NWST_BUTTON), ScaleGUITrad(GetVehicleHeight(Vehicle::Get(this->window_number)->type))); break; case WID_VR_INFO: size->width = WD_FRAMERECT_LEFT + this->information_width + WD_FRAMERECT_RIGHT; - size->height = GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); + size->height = GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); break; } } diff --git a/src/widget.cpp b/src/widget.cpp index ebb40bbdb8..11c743a472 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -588,8 +588,8 @@ static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicke { int text_offset = std::max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered - int dd_width = GetMinSizing(NWST_STEP, NWidgetLeaf::dropdown_dimension.width); - int dd_height = GetMinSizing(NWST_STEP, NWidgetLeaf::dropdown_dimension.height); + int dd_width = GetMinSizing(NWST_BUTTON, NWidgetLeaf::dropdown_dimension.width); + int dd_height = GetMinSizing(NWST_BUTTON, NWidgetLeaf::dropdown_dimension.height); int image_offset = std::max(0, ((int)(r.bottom - r.top + 1) - dd_height) / 2); if (_current_text_dir == TD_LTR) { @@ -851,9 +851,6 @@ void NWidgetResizeBase::SetMinimalSize(uint min_x, uint min_y) case NWST_BUTTON: min_size = _settings_client.gui.min_button; break; - case NWST_STEP: - min_size = _settings_client.gui.min_step; - break; case NWST_VIEWPORT: min_size = 3 * _settings_client.gui.min_button; break; @@ -2250,7 +2247,7 @@ void Scrollbar::SetCapacityFromWidget(Window *w, int widget, int padding) NWidgetScrollbar::NWidgetScrollbar(WidgetType tp, Colours colour, int index) : NWidgetCore(tp, colour, 1, 1, 0x0, STR_NULL), Scrollbar(tp != NWID_HSCROLLBAR) { assert(tp == NWID_HSCROLLBAR || tp == NWID_VSCROLLBAR); - this->sizing_type = NWST_STEP; + this->sizing_type = NWST_BUTTON; this->SetIndex(index); } @@ -2325,9 +2322,9 @@ void NWidgetScrollbar::Draw(const Window *w) if (vertical_dimension.width == 0) { vertical_dimension = maxdim(GetSpriteSize(SPR_ARROW_UP), GetSpriteSize(SPR_ARROW_DOWN)); vertical_dimension.width += extra.width; - vertical_dimension.width = GetMinSizing(NWST_STEP, vertical_dimension.width); + vertical_dimension.width = GetMinSizing(NWST_BUTTON, vertical_dimension.width); vertical_dimension.height += extra.height; - vertical_dimension.height = GetMinSizing(NWST_STEP, vertical_dimension.height); + vertical_dimension.height = GetMinSizing(NWST_BUTTON, vertical_dimension.height); } return vertical_dimension; } @@ -2338,9 +2335,9 @@ void NWidgetScrollbar::Draw(const Window *w) if (horizontal_dimension.width == 0) { horizontal_dimension = maxdim(GetSpriteSize(SPR_ARROW_LEFT), GetSpriteSize(SPR_ARROW_RIGHT)); horizontal_dimension.width += extra.width; - horizontal_dimension.width = GetMinSizing(NWST_STEP, horizontal_dimension.width); + horizontal_dimension.width = GetMinSizing(NWST_BUTTON, horizontal_dimension.width); horizontal_dimension.height += extra.height; - horizontal_dimension.height = GetMinSizing(NWST_STEP, horizontal_dimension.height); + horizontal_dimension.height = GetMinSizing(NWST_BUTTON, horizontal_dimension.height); } return horizontal_dimension; } @@ -2410,7 +2407,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32 data, case NWID_BUTTON_DROPDOWN: case WWT_DROPDOWN: case WWT_ARROWBTN: - this->sizing_type = NWST_STEP; + this->sizing_type = NWST_BUTTON; this->SetMinimalSize(8, 8); break; default: @@ -2667,7 +2664,7 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array) padding = &extra; if (this->index >= 0) w->SetStringParameters(this->index); Dimension d2 = GetStringBoundingBox(this->widget_data); - d2.width += extra.width + GetMinSizing(NWST_STEP, 11U); + d2.width += extra.width + GetMinSizing(NWST_BUTTON, 11U); d2.height += extra.height; size = maxdim(size, d2); break; @@ -2850,7 +2847,7 @@ void NWidgetLeaf::Draw(const Window *w) */ bool NWidgetLeaf::ButtonHit(const Point &pt) { - uint button_size = GetMinSizing(NWST_STEP, 12); + uint button_size = GetMinSizing(NWST_BUTTON, 12); if (_current_text_dir == TD_LTR) { int button_width = this->pos_x + this->current_x - button_size; return pt.x < button_width; @@ -3215,7 +3212,7 @@ NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int wid } NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, button_colour, widnum); - panel->sizing_type = NWST_STEP; + panel->sizing_type = NWST_BUTTON; panel->SetMinimalSize(sprite_size.width, sprite_size.height); panel->SetFill(1, 1); panel->SetResize(1, 0); @@ -3253,9 +3250,6 @@ uint GetMinSizing(NWidSizingType type, uint min_1) case NWST_BUTTON: min_sizing = _settings_client.gui.min_button; break; - case NWST_STEP: - min_sizing = _settings_client.gui.min_step; - break; case NWST_KEYBOARD: min_sizing = 2 * _settings_client.gui.min_button; break; diff --git a/src/widget_type.h b/src/widget_type.h index 65bb762b8f..07f17cb3b7 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -40,11 +40,8 @@ enum ArrowWidgetValues { /** Values for different minimal sizing of widgets. */ enum NWidSizingType { - NWST_NONE, ///< No sizing type is yet defined. - ///< Most buttons and scrollbars are initialized with this value. - ///< Later, they are automatically set to NWST_BUTTON or NWST_STEP. + NWST_NONE, ///< No sizing type is yet defined. NWST_BUTTON, ///< Size will be set at least _settings_client.gui.min_button. - NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns). NWST_KEYBOARD, ///< Size for keyboard keys. NWST_WINDOW_LENGTH, ///< Width for command errors, message windows and statusbar middle part. NWST_VIEWPORT, ///< Sizing type for viewports. diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index bc8ebaffa6..d825cb19c9 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -29,7 +29,7 @@ public: virtual ~DropDownListItem() {} virtual bool Selectable() const { return false; } - virtual uint Height(uint width) const { return GetMinSizing(NWST_STEP, FONT_HEIGHT_NORMAL); } + virtual uint Height(uint width) const { return GetMinSizing(NWST_BUTTON, FONT_HEIGHT_NORMAL); } virtual uint Width() const { return 0; } virtual void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const; }; diff --git a/src/window.cpp b/src/window.cpp index 34be51f5d8..92843015b5 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2004,7 +2004,7 @@ int SETTING_BUTTON_HEIGHT = 10; */ void CheckWindowMinSizings() { - SETTING_BUTTON_HEIGHT = GetMinSizing(NWST_STEP); + SETTING_BUTTON_HEIGHT = GetMinSizing(NWST_BUTTON); SETTING_BUTTON_WIDTH = 2 * SETTING_BUTTON_HEIGHT; } @@ -2130,7 +2130,7 @@ static void HandleMouseDragNoTitlebars() !_left_button_down || _focused_window == NULL || _dragging_widget || _focused_window->mouse_capture_widget != -1) return; unsigned distance = abs(_cursor.pos.x - _left_button_down_pos.x) + abs(_cursor.pos.y - _left_button_down_pos.y); - if (distance * 2 > GetMinSizing(NWST_STEP) && + if (distance * 2 > GetMinSizing(NWST_BUTTON) && _focused_window->window_class != WC_SELECT_GAME && _focused_window->window_class != WC_STATUS_BAR && _focused_window->window_class != WC_MAIN_TOOLBAR && @@ -2713,7 +2713,7 @@ static EventState HandleViewportScroll() if (_left_button_down) { oldDx += _cursor.delta.x; oldDy += _cursor.delta.y; - if (!_left_button_dragged && (abs(oldDx) + abs(oldDy)) * 2 > (int)GetMinSizing(NWST_STEP, 10)) { + if (!_left_button_dragged && (abs(oldDx) + abs(oldDy)) * 2 > (int)GetMinSizing(NWST_BUTTON, 10)) { _left_button_dragged = true; } } else {