File diff r24596:eddf98238034 → r24597:afde5721a3b6
src/newgrf_debug_gui.cpp
Show inline comments
 
@@ -371,18 +371,18 @@ struct NewGRFInspectWindow : Window {
 
	void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
 
	{
 
		switch (widget) {
 
			case WID_NGRFI_VEH_CHAIN: {
 
				assert(this->HasChainIndex());
 
				GrfSpecFeature f = GetFeatureNum(this->window_number);
 
				size->height = max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM);
 
				size->height = std::max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM);
 
				break;
 
			}
 

	
 
			case WID_NGRFI_MAINPANEL:
 
				resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
 
				resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1);
 
				resize->width  = 1;
 

	
 
				size->height = 5 * resize->height + TOP_OFFSET + BOTTOM_OFFSET;
 
				break;
 
		}
 
	}
 
@@ -427,13 +427,13 @@ struct NewGRFInspectWindow : Window {
 
				}
 

	
 
				int width = r.right + 1 - r.left - WD_BEVEL_LEFT - WD_BEVEL_RIGHT;
 
				int skip = 0;
 
				if (total_width > width) {
 
					int sel_center = (sel_start + sel_end) / 2;
 
					if (sel_center > width / 2) skip = min(total_width - width, sel_center - width / 2);
 
					if (sel_center > width / 2) skip = std::min(total_width - width, sel_center - width / 2);
 
				}
 

	
 
				GrfSpecFeature f = GetFeatureNum(this->window_number);
 
				int h = GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height;
 
				int y = (r.top + r.bottom - h) / 2;
 
				DrawVehicleImage(v->First(), r.left + WD_BEVEL_LEFT, r.right - WD_BEVEL_RIGHT, y + 1, INVALID_VEHICLE, EIT_IN_DETAILS, skip);
 
@@ -858,13 +858,13 @@ struct SpriteAlignerWindow : Window {
 
	{
 
		switch (widget) {
 
			case WID_SA_SPRITE:
 
				size->height = ScaleGUITrad(200);
 
				break;
 
			case WID_SA_LIST:
 
				resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
 
				resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1);
 
				resize->width  = 1;
 
				break;
 
			default:
 
				break;
 
		}
 
	}
 
@@ -894,13 +894,13 @@ struct SpriteAlignerWindow : Window {
 

	
 
			case WID_SA_LIST: {
 
				const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
 
				int step_size = nwid->resize_y;
 

	
 
				std::vector<SpriteID> &list = _newgrf_debug_sprite_picker.sprites;
 
				int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size());
 
				int max = std::min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size());
 

	
 
				int y = r.top + WD_FRAMERECT_TOP;
 
				for (int i = this->vscroll->GetPosition(); i < max; i++) {
 
					SetDParam(0, list[i]);
 
					DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_BLACK_COMMA, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
 
					y += step_size;