Changeset - r15574:ade638420449
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-07-30 12:26:58
rubidium@openttd.org
(svn r20244) -Fix: the caption of the "Available vehicle" lists was black, whereas for building those vehicles, which uses the exact same window, it was white.
3 files changed with 61 insertions and 51 deletions:
0 comments (0 inline, 0 general)
src/group_gui.cpp
Show inline comments
 
@@ -95,13 +95,13 @@ static const NWidgetPart _nested_group_w
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_MATRIX, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE), SetMinimalSize(248, 0), SetDataTip(0x701, STR_NULL), SetResize(1, 1), SetFill(1, 0),
 
				NWidget(WWT_SCROLLBAR, COLOUR_GREY, GRP_WIDGET_LIST_VEHICLE_SCROLLBAR),
 
			EndContainer(),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, GRP_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
 
						SetDataTip(0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
 
						SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
 
						SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
 
						SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, GRP_WIDGET_START_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
 
						SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
 
@@ -194,13 +194,12 @@ public:
 
		this->groups.NeedResort();
 
		this->BuildGroupList(owner);
 
		this->groups.Sort(&GroupNameSorter);
 

	
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_LIST_VEHICLE)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_AVAILABLE_VEHICLES)->widget_data = STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type;
 

	
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_CREATE_GROUP)->widget_data += this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_RENAME_GROUP)->widget_data += this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_DELETE_GROUP)->widget_data += this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_REPLACE_PROTECTION)->widget_data += this->vehicle_type;
 

	
 
@@ -265,28 +264,34 @@ public:
 
		}
 
		this->SetDirty();
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget != GRP_WIDGET_CAPTION) return;
 
		switch (widget) {
 
			case GRP_WIDGET_AVAILABLE_VEHICLES:
 
				SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type);
 
				break;
 

	
 
		/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
 
		 * We list all vehicles or ungrouped vehicles */
 
		if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) {
 
			SetDParam(0, STR_COMPANY_NAME);
 
			SetDParam(1, GB(this->window_number, 0, 8));
 
			SetDParam(2, this->vehicles.Length());
 
			SetDParam(3, this->vehicles.Length());
 
		} else {
 
			const Group *g = Group::Get(this->group_sel);
 
			case GRP_WIDGET_CAPTION:
 
				/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption
 
				 * We list all vehicles or ungrouped vehicles */
 
				if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) {
 
					SetDParam(0, STR_COMPANY_NAME);
 
					SetDParam(1, GB(this->window_number, 0, 8));
 
					SetDParam(2, this->vehicles.Length());
 
					SetDParam(3, this->vehicles.Length());
 
				} else {
 
					const Group *g = Group::Get(this->group_sel);
 

	
 
			SetDParam(0, STR_GROUP_NAME);
 
			SetDParam(1, g->index);
 
			SetDParam(2, g->num_vehicle);
 
			SetDParam(3, g->num_vehicle);
 
					SetDParam(0, STR_GROUP_NAME);
 
					SetDParam(1, g->index);
 
					SetDParam(2, g->num_vehicle);
 
					SetDParam(3, g->num_vehicle);
 
				}
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnPaint()
 
	{
 
		const Owner owner = (Owner)GB(this->window_number, 0, 8);
src/lang/english.txt
Show inline comments
 
@@ -2707,16 +2707,16 @@ STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP     
 
STR_VEHICLE_LIST_ROAD_VEHICLE_TOOLTIP                           :{BLACK}Road vehicles - click on vehicle for information
 
STR_VEHICLE_LIST_SHIP_TOOLTIP                                   :{BLACK}Ships - click on ship for information
 
STR_VEHICLE_LIST_AIRCRAFT_TOOLTIP                               :{BLACK}Aircraft - click on aircraft for information
 

	
 
STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR                     :{TINYFONT}{BLACK}Profit this year: {CURRENCY} (last year: {CURRENCY})
 

	
 
STR_VEHICLE_LIST_AVAILABLE_TRAINS                               :{BLACK}Available Trains
 
STR_VEHICLE_LIST_AVAILABLE_ROAD_VEHICLES                        :{BLACK}Available Vehicles
 
STR_VEHICLE_LIST_AVAILABLE_SHIPS                                :{BLACK}Available Ships
 
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT                             :{BLACK}Available Aircraft
 
STR_VEHICLE_LIST_AVAILABLE_TRAINS                               :Available Trains
 
STR_VEHICLE_LIST_AVAILABLE_ROAD_VEHICLES                        :Available Vehicles
 
STR_VEHICLE_LIST_AVAILABLE_SHIPS                                :Available Ships
 
STR_VEHICLE_LIST_AVAILABLE_AIRCRAFT                             :Available Aircraft
 
STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP                      :{BLACK}See a list of available engine designs for this vehicle type.
 

	
 
STR_VEHICLE_LIST_MANAGE_LIST                                    :{BLACK}Manage list
 
STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP                            :{BLACK}Send instructions to all vehicles in this list
 
STR_VEHICLE_LIST_REPLACE_VEHICLES                               :Replace vehicles
 
STR_VEHICLE_LIST_SEND_FOR_SERVICING                             :Send for Servicing
src/vehicle_gui.cpp
Show inline comments
 
@@ -865,13 +865,13 @@ static const NWidgetPart _nested_vehicle
 
	EndContainer(),
 

	
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(NWID_SELECTION, INVALID_COLOUR, VLW_WIDGET_HIDE_BUTTONS),
 
			NWidget(NWID_HORIZONTAL),
 
				NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, VLW_WIDGET_AVAILABLE_VEHICLES), SetMinimalSize(106, 12), SetFill(0, 1),
 
								SetDataTip(0x0, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
 
								SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
 
				NWidget(WWT_DROPDOWN, COLOUR_GREY, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN), SetMinimalSize(118, 12), SetFill(0, 1),
 
								SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_STOP_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
 
								SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
 
				NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, VLW_WIDGET_START_ALL), SetMinimalSize(12, 12), SetFill(0, 1),
 
								SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
 
@@ -1059,14 +1059,13 @@ public:
 
		this->BuildVehicleList(company, GB(window_number, 16, 16), window_type);
 
		this->SortVehicleList();
 

	
 
		this->CreateNestedTree(desc);
 

	
 
		/* Set up the window widgets */
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->tool_tip                  = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_AVAILABLE_VEHICLES)->widget_data = STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type;
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vehicle_type;
 

	
 
		if (window_type == VLW_SHARED_ORDERS) {
 
			this->GetWidget<NWidgetCore>(VLW_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
 
		} else {
 
			this->GetWidget<NWidgetCore>(VLW_WIDGET_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vehicle_type;
 
		}
 
@@ -1110,44 +1109,50 @@ public:
 
			}
 
		}
 
	}
 

	
 
	virtual void SetStringParameters(int widget) const
 
	{
 
		if (widget != VLW_WIDGET_CAPTION) return;
 

	
 
		const uint16 index = GB(this->window_number, 16, 16);
 
		switch (this->window_number & VLW_MASK) {
 
			case VLW_SHARED_ORDERS: // Shared Orders
 
				if (this->vehicles.Length() == 0) {
 
					/* We can't open this window without vehicles using this order
 
					 * and we should close the window when deleting the order      */
 
					NOT_REACHED();
 
				}
 
				SetDParam(0, this->vscroll.GetCount());
 
		switch (widget) {
 
			case VLW_WIDGET_AVAILABLE_VEHICLES:
 
				SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vehicle_type);
 
				break;
 

	
 
			case VLW_STANDARD: // Company Name
 
				SetDParam(0, STR_COMPANY_NAME);
 
				SetDParam(1, index);
 
				SetDParam(3, this->vscroll.GetCount());
 
				break;
 
			case VLW_WIDGET_CAPTION: {
 
				const uint16 index = GB(this->window_number, 16, 16);
 
				switch (this->window_number & VLW_MASK) {
 
					case VLW_SHARED_ORDERS: // Shared Orders
 
						if (this->vehicles.Length() == 0) {
 
							/* We can't open this window without vehicles using this order
 
							* and we should close the window when deleting the order      */
 
							NOT_REACHED();
 
						}
 
						SetDParam(0, this->vscroll.GetCount());
 
						break;
 

	
 
			case VLW_STATION_LIST: // Station/Waypoint Name
 
				SetDParam(0, Station::IsExpected(BaseStation::Get(index)) ? STR_STATION_NAME : STR_WAYPOINT_NAME);
 
				SetDParam(1, index);
 
				SetDParam(3, this->vscroll.GetCount());
 
				break;
 
					case VLW_STANDARD: // Company Name
 
						SetDParam(0, STR_COMPANY_NAME);
 
						SetDParam(1, index);
 
						SetDParam(3, this->vscroll.GetCount());
 
						break;
 

	
 
			case VLW_DEPOT_LIST:
 
				SetDParam(0, STR_DEPOT_CAPTION);
 
				SetDParam(1, this->vehicle_type);
 
				SetDParam(2, index);
 
				SetDParam(3, this->vscroll.GetCount());
 
				break;
 
			default: NOT_REACHED();
 
					case VLW_STATION_LIST: // Station/Waypoint Name
 
						SetDParam(0, Station::IsExpected(BaseStation::Get(index)) ? STR_STATION_NAME : STR_WAYPOINT_NAME);
 
						SetDParam(1, index);
 
						SetDParam(3, this->vscroll.GetCount());
 
						break;
 

	
 
					case VLW_DEPOT_LIST:
 
						SetDParam(0, STR_DEPOT_CAPTION);
 
						SetDParam(1, this->vehicle_type);
 
						SetDParam(2, index);
 
						SetDParam(3, this->vscroll.GetCount());
 
						break;
 
					default: NOT_REACHED();
 
				}
 
			} break;
 
		}
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		switch (widget) {
0 comments (0 inline, 0 general)