Change: Use scaled WidgetDimensions.

This commit is contained in:
Peter Nelson
2022-09-23 09:36:22 +01:00
committed by PeterN
parent 61da064b82
commit 890b2666d3
60 changed files with 881 additions and 864 deletions

View File

@@ -65,11 +65,11 @@ struct GraphLegendWindow : Window {
bool rtl = _current_text_dir == TD_RTL;
const Rect ir = r.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
const Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
Dimension d = GetSpriteSize(SPR_COMPANY_ICON);
DrawCompanyIcon(cid, rtl ? ir.right - d.width : ir.left, CenterBounds(ir.top, ir.bottom, d.height));
const Rect tr = ir.Indent(d.width + ScaleGUITrad(2), rtl);
const Rect tr = ir.Indent(d.width + WidgetDimensions::scaled.hsep_normal, rtl);
SetDParam(0, cid);
SetDParam(1, cid);
DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE);
@@ -118,8 +118,8 @@ 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->SetMinimalSize(246, sprite_height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM);
panel->SetMinimalTextLines(1, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM, FS_NORMAL);
panel->SetMinimalSize(246, sprite_height + WidgetDimensions::unscaled.framerect.Vertical());
panel->SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical(), FS_NORMAL);
panel->SetFill(1, 1);
panel->SetDataTip(0x0, STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP);
vert->Add(panel);
@@ -299,15 +299,15 @@ protected:
/* Rect r will be adjusted to contain just the graph, with labels being
* placed outside the area. */
r.top += 5 + GetCharacterHeight(FS_SMALL) / 2;
r.bottom -= (this->month == 0xFF ? 1 : 2) * GetCharacterHeight(FS_SMALL) + 4;
r.left += 9;
r.right -= 5;
r.top += ScaleGUITrad(5) + GetCharacterHeight(FS_SMALL) / 2;
r.bottom -= (this->month == 0xFF ? 1 : 2) * GetCharacterHeight(FS_SMALL) + ScaleGUITrad(4);
r.left += ScaleGUITrad(9);
r.right -= ScaleGUITrad(5);
/* Initial number of horizontal lines. */
int num_hori_lines = 160 / MIN_GRID_PIXEL_SIZE;
int num_hori_lines = 160 / ScaleGUITrad(MIN_GRID_PIXEL_SIZE);
/* For the rest of the height, the number of horizontal lines will increase more slowly. */
int resize = (r.bottom - r.top - 160) / (2 * MIN_GRID_PIXEL_SIZE);
int resize = (r.bottom - r.top - 160) / (2 * ScaleGUITrad(MIN_GRID_PIXEL_SIZE));
if (resize > 0) num_hori_lines += resize;
interval = GetValuesInterval(num_hori_lines);
@@ -345,7 +345,7 @@ protected:
y = r.bottom;
for (int i = 0; i < (num_hori_lines + 1); i++) {
GfxFillRect(r.left - 3, y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
GfxFillRect(r.left - ScaleGUITrad(3), y, r.left - 1, y, GRAPH_AXIS_LINE_COLOUR);
GfxFillRect(r.left, y, r.right, y, GRAPH_GRID_COLOUR);
y -= y_sep;
}
@@ -372,7 +372,7 @@ protected:
for (int i = 0; i < (num_hori_lines + 1); i++) {
SetDParam(0, this->format_str_y_axis);
SetDParam(1, y_label);
DrawString(r.left - label_width - 4, r.left - 4, y, STR_GRAPH_Y_LABEL, GRAPH_AXIS_LABEL_COLOUR, SA_RIGHT);
DrawString(r.left - label_width - ScaleGUITrad(4), r.left - ScaleGUITrad(4), y, STR_GRAPH_Y_LABEL, GRAPH_AXIS_LABEL_COLOUR, SA_RIGHT);
y_label -= y_label_separation;
y += y_sep;
@@ -381,7 +381,7 @@ protected:
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
if (this->month != 0xFF) {
x = r.left;
y = r.bottom + 2;
y = r.bottom + ScaleGUITrad(2);
byte month = this->month;
Year year = this->year;
for (int i = 0; i < this->num_on_x_axis; i++) {
@@ -402,7 +402,7 @@ protected:
} else {
/* Draw x-axis labels for graphs not based on quarterly performance (cargo payment rates). */
x = r.left;
y = r.bottom + 2;
y = r.bottom + ScaleGUITrad(2);
uint16 label = this->x_values_start;
for (int i = 0; i < this->num_on_x_axis; i++) {
@@ -522,8 +522,8 @@ public:
SetDParam(1, INT64_MAX);
uint y_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL).width;
size->width = std::max<uint>(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9);
size->height = std::max<uint>(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4);
size->width = std::max<uint>(size->width, ScaleGUITrad(5) + y_label_width + this->num_on_x_axis * (x_label_width + ScaleGUITrad(5)) + ScaleGUITrad(9));
size->height = std::max<uint>(size->height, ScaleGUITrad(5) + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + ScaleGUITrad(4));
size->height = std::max<uint>(size->height, size->width / 3);
}
@@ -636,7 +636,7 @@ static const NWidgetPart _nested_operating_profit_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_OPERATING_PROFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -687,7 +687,7 @@ static const NWidgetPart _nested_income_graph_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_INCOME_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -736,7 +736,7 @@ static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_CARGO_DELIVERED_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -791,8 +791,8 @@ static const NWidgetPart _nested_performance_history_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
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),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_DETAILED_PERFORMANCE), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_PERFORMANCE_DETAIL_KEY, STR_GRAPH_PERFORMANCE_DETAIL_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_PHG_KEY), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -841,7 +841,7 @@ static const NWidgetPart _nested_company_value_graph_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_GRAPH_COMPANY_VALUES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
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),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_CV_KEY_BUTTON), SetMinimalSize(50, 0), SetMinimalTextLines(1, WidgetDimensions::unscaled.framerect.Vertical() + 2), SetDataTip(STR_GRAPH_KEY_BUTTON, STR_GRAPH_KEY_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
@@ -924,9 +924,9 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
for (const CargoSpec *cs : _sorted_standard_cargo_specs) {
SetDParam(0, cs->name);
Dimension d = GetStringBoundingBox(STR_GRAPH_CARGO_PAYMENT_CARGO);
d.width += this->legend_width + 4; // colour field
d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
d.width += this->legend_width + WidgetDimensions::scaled.hsep_normal; // colour field
d.width += WidgetDimensions::scaled.framerect.Horizontal();
d.height += WidgetDimensions::scaled.framerect.Vertical();
*size = maxdim(d, *size);
}
@@ -958,16 +958,16 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
/* Redraw frame if lowered */
if (lowered) DrawFrameRect(line, COLOUR_BROWN, FR_LOWERED);
const Rect text = line.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM).Translate(lowered ? 1 : 0, lowered ? 1 : 0);
const Rect text = line.Shrink(WidgetDimensions::scaled.framerect).Translate(lowered ? WidgetDimensions::scaled.pressed : 0, lowered ? WidgetDimensions::scaled.pressed : 0);
/* Cargo-colour box with outline */
const Rect cargo = text.WithWidth(this->legend_width, rtl);
GfxFillRect(cargo, PC_BLACK);
GfxFillRect(cargo.Shrink(WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM), cs->legend_colour);
GfxFillRect(cargo.Shrink(WidgetDimensions::scaled.bevel), cs->legend_colour);
/* Cargo name */
SetDParam(0, cs->name);
DrawString(text.Indent(this->legend_width + 4, rtl), STR_GRAPH_CARGO_PAYMENT_CARGO);
DrawString(text.Indent(this->legend_width + WidgetDimensions::scaled.hsep_normal, rtl), STR_GRAPH_CARGO_PAYMENT_CARGO);
line = line.Translate(0, this->line_height);
}
@@ -1079,7 +1079,7 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
NWidget(NWID_SPACER), SetMinimalSize(5, 0), SetFill(0, 1), SetResize(0, 1),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_SPACER), SetMinimalSize(WD_RESIZEBOX_WIDTH, 0), SetFill(1, 0), SetResize(1, 0),
NWidget(NWID_SPACER), SetMinimalSize(12, 0), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_TEXT, COLOUR_BROWN, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL),
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE),
@@ -1179,7 +1179,7 @@ public:
{
if (widget != WID_CL_BACKGROUND) return;
Rect ir = r.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
int icon_y_offset = (this->line_height - this->icon.height) / 2;
int text_y_offset = (this->line_height - FONT_HEIGHT_NORMAL) / 2;
@@ -1210,7 +1210,7 @@ public:
for (uint i = 0; i < MAX_COMPANIES; i++) {
this->ordinal_width = std::max(this->ordinal_width, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i).width);
}
this->ordinal_width += 5; // Keep some extra spacing
this->ordinal_width += WidgetDimensions::scaled.hsep_wide; // Keep some extra spacing
uint widest_width = 0;
uint widest_title = 0;
@@ -1223,7 +1223,7 @@ public:
}
this->icon = GetSpriteSize(SPR_COMPANY_ICON);
this->line_height = std::max<int>(this->icon.height + 2, FONT_HEIGHT_NORMAL);
this->line_height = std::max<int>(this->icon.height + WidgetDimensions::scaled.vsep_normal, FONT_HEIGHT_NORMAL);
for (const Company *c : Company::Iterate()) {
SetDParam(0, c->index);
@@ -1232,10 +1232,10 @@ public:
widest_width = std::max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width);
}
this->text_width = widest_width + 30; // Keep some extra spacing
this->text_width = widest_width + WidgetDimensions::scaled.hsep_indent * 3; // Keep some extra spacing
size->width = WD_FRAMERECT_LEFT + this->ordinal_width + WD_FRAMERECT_RIGHT + this->icon.width + WD_FRAMERECT_LEFT + this->text_width + WD_FRAMERECT_RIGHT;
size->height = WD_FRAMERECT_TOP + this->line_height * MAX_COMPANIES + WD_FRAMERECT_BOTTOM;
size->width = WidgetDimensions::scaled.framerect.Horizontal() + this->ordinal_width + this->icon.width + this->text_width + WidgetDimensions::scaled.framerect.Horizontal();
size->height = this->line_height * MAX_COMPANIES + WidgetDimensions::scaled.framerect.Vertical();
}
@@ -1269,7 +1269,7 @@ static const NWidgetPart _nested_company_league_widgets[] = {
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CL_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_CL_BACKGROUND), SetMinimalSize(400, 0), SetMinimalTextLines(15, WidgetDimensions::unscaled.framerect.Vertical()),
};
static WindowDesc _company_league_desc(
@@ -1324,18 +1324,18 @@ struct PerformanceRatingDetailWindow : Window {
{
switch (widget) {
case WID_PRD_SCORE_FIRST:
this->bar_height = FONT_HEIGHT_NORMAL + 4;
size->height = this->bar_height + 2 * WD_MATRIX_TOP;
this->bar_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.fullbevel.Vertical();
size->height = this->bar_height + WidgetDimensions::scaled.matrix.Vertical();
uint score_info_width = 0;
for (uint i = SCORE_BEGIN; i < SCORE_END; i++) {
score_info_width = std::max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width);
}
SetDParamMaxValue(0, 1000);
score_info_width += GetStringBoundingBox(STR_BLACK_COMMA).width + WD_FRAMERECT_LEFT;
score_info_width += GetStringBoundingBox(STR_BLACK_COMMA).width + WidgetDimensions::scaled.hsep_wide;
SetDParamMaxValue(0, 100);
this->bar_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_PERCENT).width + 20; // Wide bars!
this->bar_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_PERCENT).width + WidgetDimensions::scaled.hsep_indent * 2; // Wide bars!
/* At this number we are roughly at the max; it can become wider,
* but then you need at 1000 times more money. At that time you're
@@ -1361,9 +1361,9 @@ struct PerformanceRatingDetailWindow : Window {
SetDParam(1, max);
uint score_detail_width = GetStringBoundingBox(STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY).width;
size->width = 7 + score_info_width + 5 + this->bar_width + 5 + score_detail_width + 7;
uint left = 7;
uint right = size->width - 7;
size->width = WidgetDimensions::scaled.frametext.Horizontal() + score_info_width + WidgetDimensions::scaled.hsep_wide + this->bar_width + WidgetDimensions::scaled.hsep_wide + score_detail_width;
uint left = WidgetDimensions::scaled.frametext.left;
uint right = size->width - WidgetDimensions::scaled.frametext.right;
bool rtl = _current_text_dir == TD_RTL;
this->score_info_left = rtl ? right - score_info_width : left;
@@ -1372,8 +1372,8 @@ struct PerformanceRatingDetailWindow : Window {
this->score_detail_left = rtl ? left : right - score_detail_width;
this->score_detail_right = rtl ? left + score_detail_width : right;
this->bar_left = left + (rtl ? score_detail_width : score_info_width) + 5;
this->bar_right = this->bar_left + this->bar_width;
this->bar_left = left + (rtl ? score_detail_width : score_info_width) + WidgetDimensions::scaled.hsep_wide;
this->bar_right = this->bar_left + this->bar_width - 1;
break;
}
}
@@ -1386,7 +1386,7 @@ struct PerformanceRatingDetailWindow : Window {
if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) {
if (this->IsWidgetDisabled(widget)) return;
CompanyID cid = (CompanyID)(widget - WID_PRD_COMPANY_FIRST);
int offset = (cid == this->company) ? 1 : 0;
int offset = (cid == this->company) ? WidgetDimensions::scaled.pressed : 0;
Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
DrawCompanyIcon(cid, CenterBounds(r.left, r.right, sprite_size.width) + offset, CenterBounds(r.top, r.bottom, sprite_size.height) + offset);
return;
@@ -1411,8 +1411,8 @@ struct PerformanceRatingDetailWindow : Window {
needed = SCORE_MAX;
}
uint bar_top = r.top + WD_MATRIX_TOP;
uint text_top = bar_top + 2;
uint bar_top = CenterBounds(r.top, r.bottom, this->bar_height);
uint text_top = CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL);
DrawString(this->score_info_left, this->score_info_right, text_top, STR_PERFORMANCE_DETAIL_VEHICLES + score_type);
@@ -1430,8 +1430,8 @@ struct PerformanceRatingDetailWindow : Window {
}
/* Draw the bar */
if (x != this->bar_left) GfxFillRect(this->bar_left, bar_top, x, bar_top + this->bar_height, rtl ? colour_notdone : colour_done);
if (x != this->bar_right) GfxFillRect(x, bar_top, this->bar_right, bar_top + this->bar_height, rtl ? colour_done : colour_notdone);
if (x != this->bar_left) GfxFillRect(this->bar_left, bar_top, x, bar_top + this->bar_height - 1, rtl ? colour_notdone : colour_done);
if (x != this->bar_right) GfxFillRect(x, bar_top, this->bar_right, bar_top + this->bar_height - 1, rtl ? colour_done : colour_notdone);
/* Draw it */
SetDParam(0, Clamp<int64>(val, 0, needed) * 100 / needed);
@@ -1562,7 +1562,7 @@ static const NWidgetPart _nested_performance_rating_detail_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidgetFunction(MakeCompanyButtonRowsGraphGUI), SetPadding(0, 1, 1, 2),
NWidgetFunction(MakeCompanyButtonRowsGraphGUI), SetPadding(2),
EndContainer(),
NWidgetFunction(MakePerformanceDetailPanels),
};