roadveh_gui.c
changeset 1485 34545d21c656
parent 1330 5d76a0522a11
child 1790 47963a0cfca3
equal deleted inserted replaced
1484:e06402a9e572 1485:34545d21c656
   215 		SetDParam(0, v->string_id);
   215 		SetDParam(0, v->string_id);
   216 		SetDParam(1, v->unitnumber);
   216 		SetDParam(1, v->unitnumber);
   217 		DrawWindowWidgets(w);
   217 		DrawWindowWidgets(w);
   218 
   218 
   219 		/* draw the flag */
   219 		/* draw the flag */
   220 		DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12  : 0xC13, 2, 105);
   220 		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2,
       
   221 			w->widget[5].top + 1);
   221 
   222 
   222 		if (v->u.road.crashed_ctr != 0) {
   223 		if (v->u.road.crashed_ctr != 0) {
   223 			str = STR_8863_CRASHED;
   224 			str = STR_8863_CRASHED;
   224 		} else if (v->breakdown_ctr == 1) {
   225 		} else if (v->breakdown_ctr == 1) {
   225 			str = STR_885C_BROKEN_DOWN;
   226 			str = STR_885C_BROKEN_DOWN;
   253 					str = STR_EMPTY;
   254 					str = STR_EMPTY;
   254 				break;
   255 				break;
   255 			}
   256 			}
   256 		}
   257 		}
   257 
   258 
   258 		DrawStringCentered(125, 105, str, 0);
   259 		DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2,
       
   260 			w->widget[5].top + 1, str, 0);
   259 		DrawWindowViewport(w);
   261 		DrawWindowViewport(w);
   260 	} break;
   262 	} break;
   261 
   263 
   262 	case WE_CLICK: {
   264 	case WE_CLICK: {
   263 		Vehicle *v = GetVehicle(w->window_number);
   265 		Vehicle *v = GetVehicle(w->window_number);
   282 			ShowRoadVehDetailsWindow(v);
   284 			ShowRoadVehDetailsWindow(v);
   283 			break;
   285 			break;
   284 		}
   286 		}
   285 	} break;
   287 	} break;
   286 
   288 
       
   289 	case WE_RESIZE:
       
   290 		w->viewport->width  += e->sizing.diff.x;
       
   291 		w->viewport->height += e->sizing.diff.y;
       
   292 		w->viewport->virtual_width  += e->sizing.diff.x;
       
   293 		w->viewport->virtual_height += e->sizing.diff.y;
       
   294 		break;
       
   295 
   287 	case WE_DESTROY:
   296 	case WE_DESTROY:
   288 		DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number);
   297 		DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number);
   289 		DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number);
   298 		DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number);
   290 		break;
   299 		break;
   291 	}
   300 	}
   292 }
   301 }
   293 
   302 
   294 static const Widget _roadveh_view_widgets[] = {
   303 static const Widget _roadveh_view_widgets[] = {
   295 {    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,	STR_018B_CLOSE_WINDOW},
   304 { WWT_TEXTBTN,    RESIZE_NONE,  14,   0,  10,   0,  13, STR_00C5, STR_018B_CLOSE_WINDOW },
   296 {    WWT_CAPTION,   RESIZE_NONE,    14,    11,   237,     0,    13, STR_9002,	STR_018C_WINDOW_TITLE_DRAG_THIS},
   305 { WWT_CAPTION,    RESIZE_RIGHT, 14,  11, 237,   0,  13, STR_9002, STR_018C_WINDOW_TITLE_DRAG_THIS },
   297 {  WWT_STICKYBOX,   RESIZE_NONE,    14,   238,   249,     0,    13, 0x0,       STR_STICKY_BUTTON},
   306 { WWT_STICKYBOX,  RESIZE_LR,    14, 238, 249,   0,  13, 0x0,      STR_STICKY_BUTTON },
   298 {     WWT_IMGBTN,   RESIZE_NONE,    14,     0,   231,    14,   103, 0x0,				STR_NULL},
   307 { WWT_IMGBTN,     RESIZE_RB,    14,   0, 231,  14, 103, 0x0,      STR_NULL },
   299 {          WWT_6,   RESIZE_NONE,    14,     2,   229,    16,   101, 0x0,				STR_NULL},
   308 { WWT_6,          RESIZE_RB,    14,   2, 229,  16, 101, 0x0,      STR_NULL },
   300 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,     0,   249,   104,   115, 0x0,				STR_901C_CURRENT_VEHICLE_ACTION},
   309 { WWT_PUSHIMGBTN, RESIZE_RTB,   14,   0, 237, 104, 115, 0x0,      STR_901C_CURRENT_VEHICLE_ACTION },
   301 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    14,    31, 0x2AB,			STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE},
   310 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  14,  31, 0x2AB,    STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE },
   302 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    32,    49, 0x2AE,			STR_901F_SEND_VEHICLE_TO_DEPOT},
   311 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  32,  49, 0x2AE,    STR_901F_SEND_VEHICLE_TO_DEPOT },
   303 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    50,    67, 0x2CB,			STR_9020_FORCE_VEHICLE_TO_TURN_AROUND},
   312 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  50,  67, 0x2CB,    STR_9020_FORCE_VEHICLE_TO_TURN_AROUND },
   304 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    68,    85, 0x2B2,			STR_901D_SHOW_VEHICLE_S_ORDERS},
   313 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  68,  85, 0x2B2,    STR_901D_SHOW_VEHICLE_S_ORDERS },
   305 { WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   232,   249,    86,   103, 0x2B3,			STR_9021_SHOW_ROAD_VEHICLE_DETAILS},
   314 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  86, 103, 0x2B3,    STR_9021_SHOW_ROAD_VEHICLE_DETAILS },
   306 {   WIDGETS_END},
   315 { WWT_PANEL,      RESIZE_LRB,   14, 232, 249, 104, 103, 0x0,      STR_NULL },
       
   316 { WWT_RESIZEBOX,  RESIZE_LRTB,  14, 238, 249, 104, 115, 0x0,      STR_NULL },
       
   317 { WIDGETS_END }
   307 };
   318 };
   308 
   319 
   309 static const WindowDesc _roadveh_view_desc = {
   320 static const WindowDesc _roadveh_view_desc = {
   310 	-1,-1, 250, 116,
   321 	-1,-1, 250, 116,
   311 	WC_VEHICLE_VIEW,0,
   322 	WC_VEHICLE_VIEW,0,
   312 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
   323 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
   313 	_roadveh_view_widgets,
   324 	_roadveh_view_widgets,
   314 	RoadVehViewWndProc,
   325 	RoadVehViewWndProc,
   315 };
   326 };
   316 
   327 
   317 void ShowRoadVehViewWindow(Vehicle *v)
   328 void ShowRoadVehViewWindow(Vehicle *v)