Merge branch 'master' into jgrpp

# Conflicts:
#	src/cheat_gui.cpp
#	src/main_gui.cpp
#	src/network/network_gui.cpp
#	src/saveload/saveload.h
#	src/smallmap_gui.cpp
#	src/station_cmd.cpp
#	src/timetable_cmd.cpp
#	src/toolbar_gui.cpp
#	src/widget.cpp
#	src/widget_type.h
#	src/widgets/dropdown_type.h
This commit is contained in:
Jonathan G Rennison
2023-11-25 14:02:04 +00:00
100 changed files with 450 additions and 655 deletions

View File

@@ -1178,7 +1178,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
this->legend_width = (FONT_HEIGHT_SMALL - ScaleGUITrad(1)) * 8 / 5;
/* The width of a column is the minimum width of all texts + the size of the blob + some spacing */
this->column_width = min_width + this->legend_width + WidgetDimensions::scaled.framerect.Horizontal();
this->column_width = min_width + WidgetDimensions::scaled.hsep_normal + this->legend_width + WidgetDimensions::scaled.framerect.Horizontal();
}
/* virtual */ void SmallMapWindow::OnPaint()
@@ -1214,7 +1214,7 @@ void SmallMapWindow::RebuildColourIndexIfNecessary()
bool rtl = _current_text_dir == TD_RTL;
uint i = 0; // Row counter for industry legend.
uint row_height = FONT_HEIGHT_SMALL;
int padding = WidgetDimensions::scaled.hsep_normal;
int padding = ScaleGUITrad(1);
Rect origin = r.WithWidth(this->column_width, rtl).Shrink(WidgetDimensions::scaled.framerect).WithHeight(row_height);
Rect text = origin.Indent(this->legend_width + WidgetDimensions::scaled.hsep_normal, rtl);
@@ -1791,30 +1791,6 @@ public:
display->AssignSizePosition(ST_RESIZE, x, y, given_width, display_height, rtl);
bar->AssignSizePosition(ST_RESIZE, x, y + display_height, given_width, bar_height, rtl);
}
NWidgetCore *GetWidgetFromPos(int x, int y) override
{
if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return nullptr;
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
NWidgetCore *widget = child_wid->GetWidgetFromPos(x, y);
if (widget != nullptr) return widget;
}
return nullptr;
}
void Draw(const Window *w) override
{
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) child_wid->Draw(w);
}
void FillDirtyWidgets(std::vector<NWidgetBase *> &dirty_widgets) override
{
if (this->base_flags & WBF_DIRTY) {
dirty_widgets.push_back(this);
} else {
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) child_wid->FillDirtyWidgets(dirty_widgets);
}
}
};
/** Widget parts of the smallmap display. */