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

@@ -191,9 +191,7 @@ struct GoalListWindow : public Window {
void DrawListColumn(GoalColumn column, NWidgetBase *wid, uint progress_col_width) const
{
/* Get column draw area. */
int y = wid->pos_y + WD_FRAMERECT_TOP;
int x = wid->pos_x + WD_FRAMERECT_LEFT;
int right = x + wid->current_x - WD_FRAMERECT_RIGHT;
Rect r = wid->GetCurrentRect().Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
bool rtl = _current_text_dir == TD_RTL;
int pos = -this->vscroll->GetPosition();
@@ -208,7 +206,7 @@ struct GoalListWindow : public Window {
/* Display the goal. */
SetDParamStr(0, s->text);
uint width_reduction = progress_col_width > 0 ? progress_col_width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT : 0;
DrawString(x + (rtl ? width_reduction : 0), right - (rtl ? 0 : width_reduction), y + pos * FONT_HEIGHT_NORMAL, STR_GOALS_TEXT);
DrawString(r.Indent(width_reduction, !rtl), STR_GOALS_TEXT);
break;
}
@@ -216,12 +214,11 @@ struct GoalListWindow : public Window {
if (s->progress != nullptr) {
SetDParamStr(0, s->progress);
StringID str = s->completed ? STR_GOALS_PROGRESS_COMPLETE : STR_GOALS_PROGRESS;
int progress_x = x;
int progress_right = rtl ? x + progress_col_width : right;
DrawString(progress_x, progress_right, y + pos * FONT_HEIGHT_NORMAL, str, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
DrawString(r.WithWidth(progress_col_width, !rtl), str, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
}
break;
}
r.top += FONT_HEIGHT_NORMAL;
}
pos++;
num++;
@@ -230,9 +227,8 @@ struct GoalListWindow : public Window {
if (num == 0) {
if (column == GC_GOAL && IsInsideMM(pos, 0, cap)) {
DrawString(x, right, y + pos * FONT_HEIGHT_NORMAL, STR_GOALS_NONE);
DrawString(r, STR_GOALS_NONE);
}
pos++;
}
}
@@ -296,8 +292,7 @@ static const NWidgetPart _nested_goals_list_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN), SetDataTip(0x0, STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetScrollbar(WID_GOAL_SCROLLBAR),
NWidget(WWT_EMPTY, COLOUR_GREY, WID_GOAL_LIST), SetResize(1, 1), SetMinimalTextLines(2, 0), SetFill(1, 1), SetPadding(WD_FRAMERECT_TOP, 2, WD_FRAMETEXT_BOTTOM, 2),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_GOAL_LIST), SetDataTip(0x0, STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER), SetScrollbar(WID_GOAL_SCROLLBAR), SetResize(1, 1), SetMinimalTextLines(2, 0),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_GOAL_SCROLLBAR),
@@ -411,7 +406,7 @@ struct GoalQuestionWindow : public Window {
if (widget != WID_GQ_QUESTION) return;
SetDParamStr(0, this->question);
DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_JUST_RAW_STRING, this->colour, SA_TOP | SA_HOR_CENTER);
DrawStringMultiLine(r, STR_JUST_RAW_STRING, this->colour, SA_TOP | SA_HOR_CENTER);
}
};