File diff r5069:e99ecf2f674b → r5070:6da414a78d0e
aircraft_gui.c
Show inline comments
 
@@ -146,49 +146,49 @@ do_change_service_int:
 
	case WE_ON_EDIT_TEXT:
 
		if (e->we.edittext.str[0] != '\0') {
 
			_cmd_text = e->we.edittext.str;
 
			DoCommandP(0, w->window_number, 0, NULL,
 
				CMD_NAME_VEHICLE | CMD_MSG(STR_A031_CAN_T_NAME_AIRCRAFT));
 
		}
 
		break;
 
	}
 
}
 

	
 

	
 
static const Widget _aircraft_details_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,         STR_018B_CLOSE_WINDOW },
 
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   349,     0,    13, STR_A00C_DETAILS, STR_018C_WINDOW_TITLE_DRAG_THIS },
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,    14,   350,   389,     0,    13, STR_01AA_NAME,    STR_A032_NAME_AIRCRAFT },
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   389,    14,    55, 0x0,              STR_NULL },
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   389,    56,   101, 0x0,              STR_NULL },
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,    14,     0,    10,   102,   107, STR_0188,         STR_884D_INCREASE_SERVICING_INTERVAL },
 
{ WWT_PUSHTXTBTN,   RESIZE_NONE,    14,     0,    10,   108,   113, STR_0189,         STR_884E_DECREASE_SERVICING_INTERVAL },
 
{      WWT_PANEL,   RESIZE_NONE,    14,    11,   389,   102,   113, 0x0,              STR_NULL },
 
{   WIDGETS_END},
 
};
 

	
 
static const WindowDesc _aircraft_details_desc = {
 
	-1, -1, 390, 114,
 
	WDP_AUTO, WDP_AUTO, 390, 114,
 
	WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 
	_aircraft_details_widgets,
 
	AircraftDetailsWndProc
 
};
 

	
 

	
 
static void ShowAircraftDetailsWindow(const Vehicle *v)
 
{
 
	Window *w;
 
	VehicleID veh = v->index;
 

	
 
	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 
	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
 

	
 
	_alloc_wnd_parent_num = veh;
 
	w = AllocateWindowDesc(&_aircraft_details_desc);
 
	w->window_number = veh;
 
	w->caption_color = v->owner;
 
//	w->vscroll.cap = 6;
 
//	w->traindetails_d.tab = 0;
 
}
 

	
 

	
 
@@ -310,41 +310,41 @@ static void AircraftViewWndProc(Window *
 
	case WE_DESTROY:
 
		DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number);
 
		DeleteWindowById(WC_VEHICLE_REFIT, w->window_number);
 
		DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number);
 
		break;
 

	
 
	case WE_MOUSELOOP: {
 
		const Vehicle *v = GetVehicle(w->window_number);
 
		bool plane_stopped = IsAircraftInHangarStopped(v);
 

	
 
		/* Widget 7 (send to hangar) must be hidden if the plane is already stopped in hangar.
 
		 * Widget 11 (clone) should then be shown, since cloning is allowed only while in hangar and stopped.
 
		 * This sytem allows to have two buttons, on top of each other*/
 
		if (plane_stopped != IsWindowWidgetHidden(w, 7) || plane_stopped == IsWindowWidgetHidden(w, 11)) {
 
			SetWindowWidgetHiddenState(w,  7, plane_stopped);  // send to hangar
 
			SetWindowWidgetHiddenState(w, 11, !plane_stopped); // clone
 
			SetWindowDirty(w);
 
		}
 
	} break;
 
	}
 
}
 

	
 

	
 
static const WindowDesc _aircraft_view_desc = {
 
	-1,-1, 250, 116,
 
	WDP_AUTO, WDP_AUTO, 250, 116,
 
	WC_VEHICLE_VIEW ,0,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
 
	_aircraft_view_widgets,
 
	AircraftViewWndProc
 
};
 

	
 

	
 
void ShowAircraftViewWindow(const Vehicle *v)
 
{
 
	Window *w = AllocateWindowDescFront(&_aircraft_view_desc, v->index);
 

	
 
	if (w != NULL) {
 
		w->caption_color = v->owner;
 
		AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), 0);
 
	}
 
}