Merge branch 'master' into jgrpp

# Conflicts:
#	src/build_vehicle_gui.cpp
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/error_gui.cpp
#	src/fios_gui.cpp
#	src/gfx_func.h
#	src/graph_gui.cpp
#	src/group_gui.cpp
#	src/misc_gui.cpp
#	src/newgrf_debug_gui.cpp
#	src/order_gui.cpp
#	src/road_gui.cpp
#	src/roadveh_gui.cpp
#	src/settings_gui.cpp
#	src/ship_gui.cpp
#	src/station_gui.cpp
#	src/statusbar_gui.cpp
#	src/subsidy_gui.cpp
#	src/timetable_gui.cpp
#	src/town_gui.cpp
#	src/train_gui.cpp
#	src/tree_gui.cpp
#	src/vehicle_gui.cpp
#	src/widget.cpp
#	src/widgets/dropdown.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2022-12-04 13:53:36 +00:00
53 changed files with 1478 additions and 1416 deletions

View File

@@ -1241,8 +1241,9 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
{
switch (widget) {
case WID_SM_MAP: {
Rect ir = r.Shrink(WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM);
DrawPixelInfo new_dpi;
if (!FillDrawPixelInfo(&new_dpi, r.left + 1, r.top + 1, r.Width(), r.Height())) return;
if (!FillDrawPixelInfo(&new_dpi, ir.left, ir.top, ir.Width(), ir.Height())) return;
this->DrawSmallMap(&new_dpi);
break;
}
@@ -1251,17 +1252,13 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
uint columns = this->GetNumberColumnsLegend(r.Width());
uint number_of_rows = this->GetNumberRowsLegend(columns);
bool rtl = _current_text_dir == TD_RTL;
uint y_org = r.top + WD_FRAMERECT_TOP;
uint x = rtl ? r.right - this->column_width - WD_FRAMERECT_RIGHT : r.left + WD_FRAMERECT_LEFT;
uint y = y_org;
uint i = 0; // Row counter for industry legend.
uint row_height = FONT_HEIGHT_SMALL;
int padding = ScaleFontTrad(1);
uint text_left = rtl ? 0 : this->legend_width + WD_FRAMERECT_LEFT;
uint text_right = this->column_width - padding - (rtl ? this->legend_width + WD_FRAMERECT_RIGHT : 0);
uint blob_left = rtl ? this->column_width - padding - this->legend_width : 0;
uint blob_right = rtl ? this->column_width - padding : this->legend_width;
Rect origin = r.WithWidth(this->column_width, rtl).Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM).WithHeight(row_height);
Rect text = origin.Indent(this->legend_width + padding, rtl);
Rect icon = origin.WithWidth(this->legend_width, rtl).Shrink(0, padding, 0, 0);
StringID string = STR_NULL;
switch (this->map_type) {
@@ -1282,8 +1279,10 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
if (tbl->col_break || ((this->map_type == SMT_INDUSTRY || this->map_type == SMT_OWNER || this->map_type == SMT_LINKSTATS) && i++ >= number_of_rows)) {
/* Column break needed, continue at top, COLUMN_WIDTH pixels
* (one "row") to the right. */
x += rtl ? -(int)this->column_width : this->column_width;
y = y_org;
int x = rtl ? -(int)this->column_width : this->column_width;
int y = origin.top - text.top;
text = text.Translate(x, y);
icon = icon.Translate(x, y);
i = 1;
}
@@ -1310,10 +1309,10 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
if (!tbl->show_on_map) {
/* Simply draw the string, not the black border of the legend colour.
* This will enforce the idea of the disabled item */
DrawString(x + text_left, x + text_right, y, string, TC_GREY);
DrawString(text, string, TC_GREY);
} else {
DrawString(x + text_left, x + text_right, y, string, TC_BLACK);
GfxFillRect(x + blob_left, y + padding, x + blob_right, y + row_height - 1, PC_BLACK); // Outer border of the legend colour
DrawString(text, string, TC_BLACK);
GfxFillRect(icon, PC_BLACK); // Outer border of the legend colour
}
break;
}
@@ -1322,13 +1321,14 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
default:
if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->height * TILE_HEIGHT_STEP);
/* Anything that is not an industry or a company is using normal process */
GfxFillRect(x + blob_left, y + padding, x + blob_right, y + row_height - 1, PC_BLACK);
DrawString(x + text_left, x + text_right, y, tbl->legend);
GfxFillRect(icon, PC_BLACK);
DrawString(text, tbl->legend);
break;
}
GfxFillRect(x + blob_left + 1, y + padding + 1, x + blob_right - 1, y + row_height - 2, legend_colour); // Legend colour
GfxFillRect(icon.Shrink(WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM), legend_colour); // Legend colour
y += row_height;
text = text.Translate(0, row_height);
icon = icon.Translate(0, row_height);
}
}
}