Removed NWST_STEP and min_step, we don't need two variables doing the same thing
This commit is contained in:
@@ -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;
|
||||
@@ -692,7 +692,11 @@ static const NWidgetPart _nested_ai_config_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL), SetPIP(4, 4, 4),
|
||||
NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_GAMESCRIPT, STR_NULL), SetPadding(0, 5, 4, 5),
|
||||
<<<<<<< HEAD
|
||||
NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_GAMELIST), 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),
|
||||
>>>>>>> e80df6ae8... Removed NWST_STEP and min_step, we don't need two variables doing the same thing
|
||||
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),
|
||||
@@ -771,13 +775,13 @@ 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 = 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->height = this->line_height;
|
||||
size->height = 8 * this->line_height;
|
||||
break;
|
||||
@@ -1100,7 +1104,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;
|
||||
}
|
||||
}
|
||||
@@ -1117,7 +1121,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<NWidgetCore>(i + WID_AID_COMPANY_BUTTON_START);
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
uint GetEngineListHeight(VehicleType type)
|
||||
{
|
||||
uint size = std::max<uint>(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<NWidgetCore>(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;
|
||||
}
|
||||
|
||||
@@ -524,7 +524,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
|
||||
@@ -1385,8 +1385,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};
|
||||
|
||||
@@ -678,7 +678,7 @@ struct DepotWindow : Window {
|
||||
int base_width = this->count_width + this->header_width;
|
||||
|
||||
resize->height = std::max<uint>(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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -650,7 +650,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(),
|
||||
@@ -702,7 +702,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(),
|
||||
@@ -752,7 +752,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(),
|
||||
@@ -808,9 +808,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(),
|
||||
@@ -860,7 +860,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(),
|
||||
|
||||
@@ -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 +
|
||||
|
||||
@@ -941,7 +941,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;
|
||||
}
|
||||
@@ -956,7 +956,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;
|
||||
}
|
||||
@@ -971,7 +971,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 */
|
||||
@@ -1031,9 +1031,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--;
|
||||
@@ -1249,7 +1249,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),
|
||||
@@ -1683,7 +1683,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;
|
||||
|
||||
@@ -734,15 +734,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -114,7 +114,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());
|
||||
}
|
||||
@@ -125,7 +125,7 @@ void NetworkInitChatMessage()
|
||||
MAX_CHAT_MESSAGES = _settings_client.gui.network_chat_box_height;
|
||||
|
||||
_chatmsg_list.clear();
|
||||
_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;
|
||||
@@ -458,7 +458,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -496,14 +496,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:
|
||||
@@ -1303,7 +1303,7 @@ struct NetworkLobbyWindow : public Window {
|
||||
|
||||
case WID_NL_MATRIX:
|
||||
resize->height = WD_MATRIX_TOP + std::max<uint>(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;
|
||||
|
||||
|
||||
@@ -864,7 +864,7 @@ struct SpriteAlignerWindow : Window {
|
||||
break;
|
||||
case WID_SA_LIST:
|
||||
resize->height = FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
resize->height = GetMinSizing(NWST_STEP, resize->height);
|
||||
resize->height = GetMinSizing(NWST_BUTTON, resize->height);
|
||||
resize->width = 1;
|
||||
fill->height = resize->height;
|
||||
break;
|
||||
|
||||
@@ -726,14 +726,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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -479,11 +479,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;
|
||||
@@ -616,7 +614,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;
|
||||
|
||||
@@ -2038,7 +2035,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -268,7 +268,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<uint>(FONT_HEIGHT_NORMAL, spr_dim.height + 2);
|
||||
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;
|
||||
|
||||
@@ -1078,7 +1078,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))
|
||||
{
|
||||
|
||||
@@ -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<size_t>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.size());
|
||||
int y = r.top + WD_FRAMERECT_TOP;
|
||||
uint line_height = this->GetWidget<NWidgetBase>(widget)->resize_y;
|
||||
line_height = GetMinSizing(NWST_STEP, line_height);
|
||||
line_height = GetMinSizing(NWST_BUTTON, line_height);
|
||||
/* Spacing between station name and first rating graph. */
|
||||
int text_spacing = ScaleFontTrad(5);
|
||||
/* Spacing between additional rating graphs. */
|
||||
@@ -761,7 +761,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(),
|
||||
@@ -2313,7 +2313,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<NWidgetBase>(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(1, 0), SetResize(1, 0), 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;
|
||||
|
||||
@@ -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(),
|
||||
};
|
||||
|
||||
|
||||
@@ -743,17 +743,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<uint>(GetMinSizing(NWST_STEP), ScaleGUITrad(GetVehicleHeight(Vehicle::Get(this->window_number)->type)));
|
||||
size->height = std::max<uint>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,8 +627,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) {
|
||||
@@ -909,9 +909,6 @@ void NWidgetResizeBase::SetMinimalSizeAbsolute(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;
|
||||
@@ -2425,7 +2422,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);
|
||||
|
||||
switch (this->type) {
|
||||
@@ -2510,9 +2507,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;
|
||||
}
|
||||
@@ -2523,9 +2520,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;
|
||||
}
|
||||
@@ -2595,7 +2592,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:
|
||||
@@ -2858,7 +2855,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;
|
||||
@@ -3041,7 +3038,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;
|
||||
@@ -3422,7 +3419,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);
|
||||
@@ -3460,9 +3457,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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -1988,7 +1988,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;
|
||||
}
|
||||
|
||||
@@ -2112,7 +2112,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 &&
|
||||
@@ -2691,7 +2691,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 {
|
||||
|
||||
Reference in New Issue
Block a user