Changeset - r26583:eb9fd3944128
[Not reviewed]
master
0 10 0
Peter Nelson - 2 years ago 2022-11-04 12:32:59
peter1138@openttd.org
Change: Standardize progress bar layout.

Progress bars are drawn differently depending on when it was added, with
different layouts and sizes.

This change adds a standard padding size to use, and makes all progress
bars visually similar, with scaled padding.
10 files changed with 149 insertions and 113 deletions:
0 comments (0 inline, 0 general)
src/bootstrap_gui.cpp
Show inline comments
 
@@ -123,8 +123,11 @@ public:
 
/** Nested widgets for the download window. */
 
static const NWidgetPart _nested_bootstrap_download_status_window_widgets[] = {
 
	NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_NCDS_BACKGROUND),
 
		NWidget(NWID_SPACER), SetMinimalSize(350, 0), SetMinimalTextLines(3, WidgetDimensions::unscaled.framerect.Vertical() + 30),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
 
		EndContainer(),
 
	EndContainer(),
 
};
 

	
src/genworld_gui.cpp
Show inline comments
 
@@ -1322,12 +1322,10 @@ void ShowCreateScenario()
 
static const NWidgetPart _nested_generate_progress_widgets[] = {
 
	NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_GENERATION_WORLD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
 
			NWidget(NWID_VERTICAL), SetPIP(11, 8, 11),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_BAR), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_TEXT), SetFill(1, 0),
 
				NWidget(WWT_TEXTBTN, COLOUR_WHITE, WID_GP_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0),
 
			EndContainer(),
 
		NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_BAR), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GP_PROGRESS_TEXT), SetFill(1, 0),
 
			NWidget(WWT_TEXTBTN, COLOUR_WHITE, WID_GP_ABORT), SetDataTip(STR_GENERATION_ABORT, STR_NULL), SetFill(1, 0),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -1424,11 +1422,11 @@ struct GenerateProgressWindow : public W
 
		switch (widget) {
 
			case WID_GP_PROGRESS_BAR: {
 
				/* Draw the % complete with a bar and a text */
 
				DrawFrameRect(r, COLOUR_GREY, FR_BORDERONLY);
 
				DrawFrameRect(r, COLOUR_GREY, FR_BORDERONLY | FR_LOWERED);
 
				Rect br = r.Shrink(WidgetDimensions::scaled.bevel);
 
				DrawFrameRect(br.WithWidth(br.Width() * _gws.percent / 100, false), COLOUR_MAUVE, FR_NONE);
 
				SetDParam(0, _gws.percent);
 
				DrawString(r.left, r.right, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, FONT_HEIGHT_NORMAL), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			}
 

	
src/network/network_content_gui.cpp
Show inline comments
 
@@ -81,14 +81,12 @@ void ShowContentTextfileWindow(TextfileT
 
/** Nested widgets for the download window. */
 
static const NWidgetPart _nested_network_content_download_status_window_widgets[] = {
 
	NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_CONTENT_DOWNLOAD_TITLE, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	NWidget(WWT_PANEL, COLOUR_GREY, WID_NCDS_BACKGROUND),
 
		NWidget(NWID_SPACER), SetMinimalSize(350, 0), SetMinimalTextLines(4, WidgetDimensions::unscaled.framerect.Vertical() + WidgetDimensions::unscaled.frametext.Vertical() * 2),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(125, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCDS_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_BAR), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NCDS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NCDS_CANCELOK), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 4),
 
	EndContainer(),
 
};
 

	
 
@@ -115,36 +113,56 @@ void BaseNetworkContentDownloadStatusWin
 
	this->Window::Close();
 
}
 

	
 
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
{
 
	switch (widget) {
 
		case WID_NCDS_PROGRESS_BAR:
 
			SetDParamMaxDigits(0, 8);
 
			SetDParamMaxDigits(1, 8);
 
			SetDParamMaxDigits(2, 8);
 
			*size = GetStringBoundingBox(STR_CONTENT_DOWNLOAD_PROGRESS_SIZE);
 
			/* We need some spacing for the 'border' */
 
			size->height += WidgetDimensions::scaled.frametext.Horizontal();
 
			size->width  += WidgetDimensions::scaled.frametext.Vertical();
 
			break;
 

	
 
		case WID_NCDS_PROGRESS_TEXT:
 
			size->height = FONT_HEIGHT_NORMAL * 2 + WidgetDimensions::scaled.vsep_normal;
 
			break;
 
	}
 
}
 

	
 
void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, int widget) const
 
{
 
	if (widget != WID_NCDS_BACKGROUND) return;
 

	
 
	Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
 
	int y = ir.top + WidgetDimensions::scaled.frametext.top;
 

	
 
	/* Draw nice progress bar :) */
 
	DrawFrameRect(ir.left, y, ir.left + (int)((ir.Width() - 1LL) * this->downloaded_bytes / this->total_bytes), y + FONT_HEIGHT_NORMAL - 1, COLOUR_MAUVE, FR_NONE);
 

	
 
	y += WidgetDimensions::scaled.frametext.bottom + FONT_HEIGHT_NORMAL;
 
	SetDParam(0, this->downloaded_bytes);
 
	SetDParam(1, this->total_bytes);
 
	SetDParam(2, this->downloaded_bytes * 100LL / this->total_bytes);
 
	DrawString(ir.left, ir.right, y, STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_FROMSTRING, SA_HOR_CENTER);
 
	switch (widget) {
 
		case WID_NCDS_PROGRESS_BAR: {
 
			/* Draw the % complete with a bar and a text */
 
			DrawFrameRect(r, COLOUR_GREY, FR_BORDERONLY | FR_LOWERED);
 
			Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
 
			DrawFrameRect(ir.WithWidth((uint64)ir.Width() * this->downloaded_bytes / this->total_bytes, false), COLOUR_MAUVE, FR_NONE);
 
			SetDParam(0, this->downloaded_bytes);
 
			SetDParam(1, this->total_bytes);
 
			SetDParam(2, this->downloaded_bytes * 100LL / this->total_bytes);
 
			DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_FROMSTRING, SA_HOR_CENTER);
 
			break;
 
		}
 

	
 
	StringID str;
 
	if (this->downloaded_bytes == this->total_bytes) {
 
		str = STR_CONTENT_DOWNLOAD_COMPLETE;
 
	} else if (!this->name.empty()) {
 
		SetDParamStr(0, this->name);
 
		SetDParam(1, this->downloaded_files);
 
		SetDParam(2, this->total_files);
 
		str = STR_CONTENT_DOWNLOAD_FILE;
 
	} else {
 
		str = STR_CONTENT_DOWNLOAD_INITIALISE;
 
		case WID_NCDS_PROGRESS_TEXT: {
 
			StringID str;
 
			if (this->downloaded_bytes == this->total_bytes) {
 
				str = STR_CONTENT_DOWNLOAD_COMPLETE;
 
			} else if (!this->name.empty()) {
 
				SetDParamStr(0, this->name);
 
				SetDParam(1, this->downloaded_files);
 
				SetDParam(2, this->total_files);
 
				str = STR_CONTENT_DOWNLOAD_FILE;
 
			} else {
 
				str = STR_CONTENT_DOWNLOAD_INITIALISE;
 
			}
 
			DrawStringMultiLine(r, str, TC_FROMSTRING, SA_CENTER);
 
			break;
 
		}
 
	}
 

	
 
	y += FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.frametext.top;
 
	DrawStringMultiLine(ir.left, ir.right, y, y + FONT_HEIGHT_NORMAL * 2, str, TC_FROMSTRING, SA_CENTER);
 
}
 

	
 
void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInfo *ci, int bytes)
src/network/network_content_gui.h
Show inline comments
 
@@ -33,6 +33,7 @@ public:
 
	BaseNetworkContentDownloadStatusWindow(WindowDesc *desc);
 

	
 
	void Close() override;
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override;
 
	void DrawWidget(const Rect &r, int widget) const override;
 
	void OnDownloadProgress(const ContentInfo *ci, int bytes) override;
 
};
src/network/network_gui.cpp
Show inline comments
 
@@ -2166,64 +2166,79 @@ struct NetworkJoinStatusWindow : Window 
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		if (widget != WID_NJS_BACKGROUND) return;
 

	
 
		Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
 
		switch (widget) {
 
			case WID_NJS_PROGRESS_BAR: {
 
				/* Draw the % complete with a bar and a text */
 
				DrawFrameRect(r, COLOUR_GREY, FR_BORDERONLY | FR_LOWERED);
 
				Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
 
				uint8 progress; // used for progress bar
 
				switch (_network_join_status) {
 
					case NETWORK_JOIN_STATUS_CONNECTING:
 
					case NETWORK_JOIN_STATUS_AUTHORIZING:
 
					case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
 
						progress = 10; // first two stages 10%
 
						break;
 
					case NETWORK_JOIN_STATUS_WAITING:
 
						progress = 15; // third stage is 15%
 
						break;
 
					case NETWORK_JOIN_STATUS_DOWNLOADING:
 
						if (_network_join_bytes_total == 0) {
 
							progress = 15; // We don't have the final size yet; the server is still compressing!
 
							break;
 
						}
 
						FALLTHROUGH;
 

	
 
		uint8 progress; // used for progress bar
 
		DrawString(ir.left, ir.right, ir.top + 20, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_HOR_CENTER);
 
		switch (_network_join_status) {
 
			case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING:
 
			case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
 
				progress = 10; // first two stages 10%
 
				break;
 
			case NETWORK_JOIN_STATUS_WAITING:
 
				SetDParam(0, _network_join_waiting);
 
				DrawString(ir.left, ir.right, ir.top + 20 + FONT_HEIGHT_NORMAL, STR_NETWORK_CONNECTING_WAITING, TC_FROMSTRING, SA_HOR_CENTER);
 
				progress = 15; // third stage is 15%
 
					default: // Waiting is 15%, so the resting receivement of map is maximum 70%
 
						progress = 15 + _network_join_bytes * (100 - 15) / _network_join_bytes_total;
 
						break;
 
				}
 
				DrawFrameRect(ir.WithWidth(ir.Width() * progress / 100, false), COLOUR_MAUVE, FR_NONE);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
 
			case NETWORK_JOIN_STATUS_DOWNLOADING:
 
				SetDParam(0, _network_join_bytes);
 
				SetDParam(1, _network_join_bytes_total);
 
				DrawString(ir.left, ir.right, ir.top + 20 + FONT_HEIGHT_NORMAL, _network_join_bytes_total == 0 ? STR_NETWORK_CONNECTING_DOWNLOADING_1 : STR_NETWORK_CONNECTING_DOWNLOADING_2, TC_FROMSTRING, SA_HOR_CENTER);
 
				if (_network_join_bytes_total == 0) {
 
					progress = 15; // We don't have the final size yet; the server is still compressing!
 
					break;
 
			}
 

	
 
			case WID_NJS_PROGRESS_TEXT:
 
				switch (_network_join_status) {
 
					case NETWORK_JOIN_STATUS_WAITING:
 
						SetDParam(0, _network_join_waiting);
 
						DrawStringMultiLine(r, STR_NETWORK_CONNECTING_WAITING, TC_FROMSTRING, SA_CENTER);
 
						break;
 
					case NETWORK_JOIN_STATUS_DOWNLOADING:
 
						SetDParam(0, _network_join_bytes);
 
						SetDParam(1, _network_join_bytes_total);
 
						DrawStringMultiLine(r, _network_join_bytes_total == 0 ? STR_NETWORK_CONNECTING_DOWNLOADING_1 : STR_NETWORK_CONNECTING_DOWNLOADING_2, TC_FROMSTRING, SA_CENTER);
 
						break;
 
					default:
 
						break;
 
				}
 
				FALLTHROUGH;
 

	
 
			default: // Waiting is 15%, so the resting receivement of map is maximum 70%
 
				progress = 15 + _network_join_bytes * (100 - 15) / _network_join_bytes_total;
 
				break;
 
		}
 

	
 
		/* Draw nice progress bar :) */
 
		DrawFrameRect(r.left + 20, r.top + 5, (int)((this->width - 20) * progress / 100), r.top + 15, COLOUR_MAUVE, FR_NONE);
 
	}
 

	
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		if (widget != WID_NJS_BACKGROUND) return;
 

	
 
		size->height = 25 + 2 * FONT_HEIGHT_NORMAL;
 

	
 
		/* Account for the statuses */
 
		uint width = 0;
 
		for (uint i = 0; i < NETWORK_JOIN_STATUS_END; i++) {
 
			width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width);
 
		}
 
		switch (widget) {
 
			case WID_NJS_PROGRESS_BAR:
 
				/* Account for the statuses */
 
				for (uint i = 0; i < NETWORK_JOIN_STATUS_END; i++) {
 
					*size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i));
 
				}
 
				/* For the number of waiting (other) players */
 
				SetDParamMaxValue(0, MAX_CLIENTS);
 
				*size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING));
 
				/* We need some spacing for the 'border' */
 
				size->height += WidgetDimensions::scaled.frametext.Horizontal();
 
				size->width  += WidgetDimensions::scaled.frametext.Vertical();
 
				break;
 

	
 
		/* For the number of waiting (other) players */
 
		SetDParamMaxValue(0, MAX_CLIENTS);
 
		width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width);
 

	
 
		/* Account for downloading ~ 10 MiB */
 
		SetDParamMaxDigits(0, 8);
 
		SetDParamMaxDigits(1, 8);
 
		width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width);
 
		width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width);
 

	
 
		/* Give a bit more clearing for the widest strings than strictly needed */
 
		size->width = width + padding.width + WidgetDimensions::scaled.hsep_indent;
 
			case WID_NJS_PROGRESS_TEXT:
 
				/* Account for downloading ~ 10 MiB */
 
				SetDParamMaxDigits(0, 8);
 
				SetDParamMaxDigits(1, 8);
 
				*size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1));
 
				*size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1));
 
				break;
 
		}
 
	}
 

	
 
	void OnClick(Point pt, int widget, int click_count) override
 
@@ -2253,13 +2268,11 @@ struct NetworkJoinStatusWindow : Window 
 
static const NWidgetPart _nested_network_join_status_window_widgets[] = {
 
	NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_CONNECTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(WWT_EMPTY, COLOUR_GREY, WID_NJS_BACKGROUND),
 
		NWidget(NWID_HORIZONTAL),
 
			NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NJS_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL),
 
			NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0),
 
		NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NJS_PROGRESS_BAR), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_NJS_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(350, 0),
 
			NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NJS_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_SPACER), SetMinimalSize(0, 4),
 
	EndContainer(),
 
};
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -2165,12 +2165,10 @@ static void ShowSavePresetWindow(const c
 
static const NWidgetPart _nested_scan_progress_widgets[] = {
 
	NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NEWGRF_SCAN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	NWidget(WWT_PANEL, COLOUR_GREY),
 
		NWidget(NWID_HORIZONTAL), SetPIP(20, 0, 20),
 
			NWidget(NWID_VERTICAL), SetPIP(11, 8, 11),
 
				NWidget(WWT_LABEL, INVALID_COLOUR), SetDataTip(STR_NEWGRF_SCAN_MESSAGE, STR_NULL), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_BAR), SetFill(1, 0),
 
				NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_TEXT), SetFill(1, 0),
 
			EndContainer(),
 
		NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_wide, 0), SetPadding(WidgetDimensions::unscaled.modalpopup),
 
			NWidget(WWT_LABEL, INVALID_COLOUR), SetDataTip(STR_NEWGRF_SCAN_MESSAGE, STR_NULL), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_BAR), SetFill(1, 0),
 
			NWidget(WWT_EMPTY, INVALID_COLOUR, WID_SP_PROGRESS_TEXT), SetFill(1, 0), SetMinimalSize(400, 0),
 
		EndContainer(),
 
	EndContainer(),
 
};
 
@@ -2207,8 +2205,8 @@ struct ScanProgressWindow : public Windo
 
				SetDParamMaxValue(0, 100);
 
				*size = GetStringBoundingBox(STR_GENERATION_PROGRESS);
 
				/* We need some spacing for the 'border' */
 
				size->height += 8;
 
				size->width += 8;
 
				size->height += WidgetDimensions::scaled.frametext.Horizontal();
 
				size->width  += WidgetDimensions::scaled.frametext.Vertical();
 
				break;
 
			}
 

	
 
@@ -2217,7 +2215,7 @@ struct ScanProgressWindow : public Windo
 
				SetDParamMaxDigits(1, 4);
 
				/* We really don't know the width. We could determine it by scanning the NewGRFs,
 
				 * but this is the status window for scanning them... */
 
				size->width = std::max(400U, GetStringBoundingBox(STR_NEWGRF_SCAN_STATUS).width);
 
				size->width = std::max<uint>(size->width, GetStringBoundingBox(STR_NEWGRF_SCAN_STATUS).width);
 
				size->height = FONT_HEIGHT_NORMAL * 2 + WidgetDimensions::scaled.vsep_normal;
 
				break;
 
		}
 
@@ -2228,10 +2226,10 @@ struct ScanProgressWindow : public Windo
 
		switch (widget) {
 
			case WID_SP_PROGRESS_BAR: {
 
				/* Draw the % complete with a bar and a text */
 
				DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY);
 
				DrawFrameRect(r, COLOUR_GREY, FR_BORDERONLY | FR_LOWERED);
 
				Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
 
				uint percent = scanned * 100 / std::max(1U, _settings_client.gui.last_newgrf_count);
 
				DrawFrameRect(ir.left, ir.top, ir.left + (ir.Width() - 1) * percent / 100, ir.bottom, COLOUR_MAUVE, FR_NONE);
 
				DrawFrameRect(ir.WithWidth(ir.Width() * percent / 100, false), COLOUR_MAUVE, FR_NONE);
 
				SetDParam(0, percent);
 
				DrawString(ir.left, ir.right, CenterBounds(ir.top, ir.bottom, FONT_HEIGHT_NORMAL), STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER);
 
				break;
src/widget.cpp
Show inline comments
 
@@ -149,6 +149,7 @@ const WidgetDimensions WidgetDimensions:
 
	{WD_CLOSEBOX_LEFT,     WD_CLOSEBOX_TOP,     WD_CLOSEBOX_RIGHT,     WD_CLOSEBOX_BOTTOM},     ///< closebox
 
	{WD_CAPTIONTEXT_LEFT,  WD_CAPTIONTEXT_TOP,  WD_CAPTIONTEXT_RIGHT,  WD_CAPTIONTEXT_BOTTOM},  ///< captiontext
 
	{WD_DROPDOWNTEXT_LEFT, WD_DROPDOWNTEXT_TOP, WD_DROPDOWNTEXT_RIGHT, WD_DROPDOWNTEXT_BOTTOM}, ///< dropdowntext
 
	{20, 10, 20, 10},    ///< modalpopup
 
	1,                   ///< pressed
 
	WD_PAR_VSEP_NORMAL,  ///< vsep_normal
 
	WD_PAR_VSEP_WIDE,    ///< vsep_wide
 
@@ -218,6 +219,7 @@ void SetupWidgetDimensions()
 
	WidgetDimensions::scaled.closebox     = ScaleGUITrad(WidgetDimensions::unscaled.closebox);
 
	WidgetDimensions::scaled.captiontext  = ScaleGUITrad(WidgetDimensions::unscaled.captiontext);
 
	WidgetDimensions::scaled.dropdowntext = ScaleGUITrad(WidgetDimensions::unscaled.dropdowntext);
 
	WidgetDimensions::scaled.modalpopup   = ScaleGUITrad(WidgetDimensions::unscaled.modalpopup);
 

	
 
	WidgetDimensions::scaled.pressed      = ScaleGUITrad(WidgetDimensions::unscaled.pressed);
 
	WidgetDimensions::scaled.vsep_normal  = ScaleGUITrad(WidgetDimensions::unscaled.vsep_normal);
src/widgets/network_content_widget.h
Show inline comments
 
@@ -14,8 +14,9 @@
 

	
 
/** Widgets of the #NetworkContentDownloadStatusWindow class. */
 
enum NetworkContentDownloadStatusWidgets {
 
	WID_NCDS_BACKGROUND, ///< Background of the window.
 
	WID_NCDS_CANCELOK,   ///< (Optional) Cancel/OK button.
 
	WID_NCDS_PROGRESS_BAR,  ///< Simple progress bar.
 
	WID_NCDS_PROGRESS_TEXT, ///< Text explaining what is happening.
 
	WID_NCDS_CANCELOK,      ///< (Optional) Cancel/OK button.
 
};
 

	
 
/** Widgets of the #NetworkContentListWindow class. */
src/widgets/network_widget.h
Show inline comments
 
@@ -94,8 +94,9 @@ enum ClientListWidgets {
 

	
 
/** Widgets of the #NetworkJoinStatusWindow class. */
 
enum NetworkJoinStatusWidgets {
 
	WID_NJS_BACKGROUND, ///< Background of the window.
 
	WID_NJS_CANCELOK,   ///< Cancel / OK button.
 
	WID_NJS_PROGRESS_BAR,  ///< Simple progress bar.
 
	WID_NJS_PROGRESS_TEXT, ///< Text explaining what is happening.
 
	WID_NJS_CANCELOK,      ///< Cancel / OK button.
 
};
 

	
 
/** Widgets of the #NetworkCompanyPasswordWindow class. */
src/window_gui.h
Show inline comments
 
@@ -52,6 +52,7 @@ struct WidgetDimensions {
 
	RectPadding closebox;
 
	RectPadding captiontext;  ///< Offsets of text within a caption.
 
	RectPadding dropdowntext; ///< Offsets of text within a dropdown widget.
 
	RectPadding modalpopup;   ///< Padding for a modal popup.
 

	
 
	int pressed;              ///< Offset for contents of depressed widget.
 
	int vsep_normal;          ///< Normal vertical spacing.
0 comments (0 inline, 0 general)