Changeset - r26563:75f924e74612
[Not reviewed]
master
0 18 0
Peter Nelson - 4 years ago 2021-05-03 15:56:02
peter1138@openttd.org
Codechange: Prefer suggested widget padding.
18 files changed with 38 insertions and 36 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -112,7 +112,7 @@ struct AIListWindow : public Window {
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		if (widget == WID_AIL_LIST) {
 
			this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
			this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 

	
 
			resize->width = 1;
 
			resize->height = this->line_height;
 
@@ -342,7 +342,7 @@ struct AISettingsWindow : public Window 
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		if (widget == WID_AIS_BACKGROUND) {
 
			this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
			this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + padding.height;
 

	
 
			resize->width = 1;
 
			resize->height = this->line_height;
 
@@ -761,7 +761,7 @@ struct AIConfigWindow : public Window {
 
				break;
 

	
 
			case WID_AIC_LIST:
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				resize->height = this->line_height;
 
				size->height = 8 * this->line_height;
 
				break;
src/airport_gui.cpp
Show inline comments
 
@@ -343,7 +343,7 @@ public:
 
					size->width = std::max(size->width, GetStringBoundingBox(as->name).width);
 
				}
 

	
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 5 * this->line_height;
 
				break;
 
			}
 
@@ -356,8 +356,8 @@ public:
 
						SpriteID sprite = GetCustomAirportSprite(as, layout);
 
						if (sprite != 0) {
 
							Dimension d = GetSpriteSize(sprite);
 
							d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
							d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
							d.width += padding.width;
 
							d.height += padding.height;
 
							*size = maxdim(d, *size);
 
						}
 
					}
 
@@ -375,6 +375,8 @@ public:
 
						/* STR_BLACK_STRING is used to start the string with {BLACK} */
 
						SetDParam(0, string);
 
						Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
 
						d.width += padding.width;
 
						d.height += padding.height;
 
						*size = maxdim(d, *size);
 
					}
 
				}
src/autoreplace_gui.cpp
Show inline comments
 
@@ -304,8 +304,8 @@ public:
 
			case WID_RV_INFO_TAB: {
 
				Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
 
				d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
 
				d.width += WD_FRAMETEXT_LEFT +  WD_FRAMETEXT_RIGHT;
 
				d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				d.width += padding.width;
 
				d.height += padding.height;
 
				*size = maxdim(*size, d);
 
				break;
 
			}
src/game/game_gui.cpp
Show inline comments
 
@@ -152,14 +152,14 @@ struct GSConfigWindow : public Window {
 
	{
 
		switch (widget) {
 
			case WID_GSC_SETTINGS:
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + padding.height;
 
				resize->width = 1;
 
				resize->height = this->line_height;
 
				size->height = 5 * this->line_height;
 
				break;
 

	
 
			case WID_GSC_GSLIST:
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 1 * this->line_height;
 
				break;
 
		}
src/genworld_gui.cpp
Show inline comments
 
@@ -662,7 +662,7 @@ struct GenerateLandscapeWindow : public 
 
			}
 
		}
 
		size->width += padding.width;
 
		size->height = std::max(size->height, (uint)(FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM));
 
		size->height = std::max(size->height, (uint)(FONT_HEIGHT_NORMAL + padding.height));
 
	}
 

	
 
	void OnClick(Point pt, int widget, int click_count) override
src/industry_gui.cpp
Show inline comments
 
@@ -422,7 +422,7 @@ public:
 
					if (this->index[i] == INVALID_INDUSTRYTYPE) continue;
 
					d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(this->index[i])->name));
 
				}
 
				resize->height = std::max<uint>(this->legend.height, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				resize->height = std::max<uint>(this->legend.height, FONT_HEIGHT_NORMAL) + padding.height;
 
				d.width += this->legend.width + ScaleFontTrad(7) + padding.width;
 
				d.height = 5 * resize->height;
 
				*size = maxdim(*size, d);
 
@@ -471,8 +471,8 @@ public:
 

	
 
				/* Set it to something more sane :) */
 
				height += extra_lines_prd + extra_lines_req + extra_lines_newgrf;
 
				size->height = height * FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				size->width  = d.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				size->height = height * FONT_HEIGHT_NORMAL + padding.height;
 
				size->width = d.width + padding.width;
 
				break;
 
			}
 

	
src/linkgraph/linkgraph_gui.cpp
Show inline comments
 
@@ -592,8 +592,8 @@ void LinkGraphLegendWindow::UpdateWidget
 
		}
 
		if (str != STR_NULL) {
 
			Dimension dim = GetStringBoundingBox(str);
 
			dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
			dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
			dim.width += padding.width;
 
			dim.height += padding.height;
 
			*size = maxdim(*size, dim);
 
		}
 
	}
 
@@ -601,8 +601,8 @@ void LinkGraphLegendWindow::UpdateWidget
 
		CargoSpec *cargo = CargoSpec::Get(widget - WID_LGL_CARGO_FIRST);
 
		if (cargo->IsValid()) {
 
			Dimension dim = GetStringBoundingBox(cargo->abbrev);
 
			dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
			dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
			dim.width += padding.width;
 
			dim.height += padding.height;
 
			*size = maxdim(*size, dim);
 
		}
 
	}
src/misc_gui.cpp
Show inline comments
 
@@ -721,8 +721,8 @@ struct TooltipsWindow : public Window
 
		size->height = GetStringHeight(this->string_id, size->width);
 

	
 
		/* Increase slightly to have some space around the box. */
 
		size->width  += 2 + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
		size->height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
		size->width  += 2 + padding.width;
 
		size->height += 2 + padding.height;
 
	}
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
src/music_gui.cpp
Show inline comments
 
@@ -682,8 +682,8 @@ struct MusicWindow : public Window {
 

	
 
			case WID_M_TRACK_NR: {
 
				Dimension d = GetStringBoundingBox(STR_MUSIC_TRACK_NONE);
 
				d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				d.width += padding.width;
 
				d.height += padding.height;
 
				*size = maxdim(*size, d);
 
				break;
 
			}
 
@@ -694,8 +694,8 @@ struct MusicWindow : public Window {
 
					SetDParamStr(0, song->songname);
 
					d = maxdim(d, GetStringBoundingBox(STR_MUSIC_TITLE_NAME));
 
				}
 
				d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
				d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				d.width += padding.width;
 
				d.height += padding.height;
 
				*size = maxdim(*size, d);
 
				break;
 
			}
src/network/network_content_gui.cpp
Show inline comments
 
@@ -573,7 +573,7 @@ public:
 
			}
 

	
 
			case WID_NCL_MATRIX:
 
				resize->height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				resize->height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + padding.height;
 
				size->height = 10 * resize->height;
 
				break;
 
		}
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -859,7 +859,7 @@ struct SpriteAlignerWindow : Window {
 
				size->height = ScaleGUITrad(200);
 
				break;
 
			case WID_SA_LIST:
 
				resize->height = FONT_HEIGHT_NORMAL + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				resize->height = FONT_HEIGHT_NORMAL + padding.height;
 
				resize->width  = 1;
 
				fill->height = resize->height;
 
				break;
src/newgrf_gui.cpp
Show inline comments
 
@@ -732,13 +732,13 @@ struct NewGRFWindow : public Window, New
 
			{
 
				Dimension d = maxdim(GetSpriteSize(SPR_SQUARE), GetSpriteSize(SPR_WARNING_SIGN));
 
				resize->height = std::max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U);
 
				size->height = std::max(size->height, WD_FRAMERECT_TOP + 6 * resize->height + WD_FRAMERECT_BOTTOM);
 
				size->height = std::max(size->height, padding.height + 6 * resize->height);
 
				break;
 
			}
 

	
 
			case WID_NS_AVAIL_LIST:
 
				resize->height = std::max(12, FONT_HEIGHT_NORMAL + 2);
 
				size->height = std::max(size->height, WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM);
 
				size->height = std::max(size->height, padding.height + 8 * resize->height);
 
				break;
 

	
 
			case WID_NS_NEWGRF_INFO_TITLE: {
src/object_gui.cpp
Show inline comments
 
@@ -239,7 +239,7 @@ public:
 
					size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width);
 
				}
 
				size->width += padding.width;
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				resize->height = this->line_height;
 
				size->height = 5 * this->line_height;
 
				break;
src/order_gui.cpp
Show inline comments
 
@@ -793,7 +793,7 @@ public:
 
		switch (widget) {
 
			case WID_O_ORDER_LIST:
 
				resize->height = FONT_HEIGHT_NORMAL;
 
				size->height = 6 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
				size->height = 6 * resize->height + padding.height;
 
				break;
 

	
 
			case WID_O_COND_VARIABLE: {
src/rail_gui.cpp
Show inline comments
 
@@ -1201,7 +1201,7 @@ public:
 
					d = maxdim(d, GetStringBoundingBox(StationClass::Get(station_class)->name));
 
				}
 
				size->width = std::max(size->width, d.width + padding.width);
 
				this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
 
				this->line_height = FONT_HEIGHT_NORMAL + padding.height;
 
				size->height = 5 * this->line_height;
 
				resize->height = this->line_height;
 
				break;
src/station_gui.cpp
Show inline comments
 
@@ -392,7 +392,7 @@ public:
 

	
 
			case WID_STL_LIST:
 
				resize->height = std::max(FONT_HEIGHT_NORMAL, FONT_HEIGHT_SMALL + ScaleFontTrad(3));
 
				size->height = WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM;
 
				size->height = padding.height + 5 * resize->height;
 

	
 
				/* Determine appropriate width for mini station rating graph */
 
				this->rating_width = 0;
src/subsidy_gui.cpp
Show inline comments
 
@@ -133,8 +133,8 @@ struct SubsidyListWindow : Window {
 
		resize->height = d.height;
 

	
 
		d.height *= 5;
 
		d.width += padding.width + WD_FRAMERECT_RIGHT + WD_FRAMERECT_LEFT;
 
		d.height += padding.height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
		d.width += padding.width;
 
		d.height += padding.height;
 
		*size = maxdim(*size, d);
 
	}
 

	
src/tree_gui.cpp
Show inline comments
 
@@ -159,8 +159,8 @@ public:
 
		if (widget >= WID_BT_TYPE_BUTTON_FIRST) {
 
			/* Ensure tree type buttons are sized after the largest tree type */
 
			Dimension d = GetMaxTreeSpriteSize();
 
			size->width = d.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
			size->height = d.height + WD_FRAMERECT_RIGHT + WD_FRAMERECT_BOTTOM + ScaleGUITrad(BUTTON_BOTTOM_OFFSET); // we need some more space
 
			size->width = d.width + padding.width;
 
			size->height = d.height + padding.height + ScaleGUITrad(BUTTON_BOTTOM_OFFSET); // we need some more space
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)