diff options
-rw-r--r-- | aircraft_gui.c | 41 | ||||
-rw-r--r-- | roadveh_gui.c | 41 | ||||
-rw-r--r-- | ship_gui.c | 41 | ||||
-rw-r--r-- | train_gui.c | 45 |
4 files changed, 106 insertions, 62 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 192aa1903..de3ae1b77 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -556,18 +556,20 @@ static void ShowAircraftDetailsWindow(Vehicle *v) static const Widget _aircraft_view_widgets[] = { -{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_A00A, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 231, 14, 103, 0x0, STR_NULL}, -{ WWT_6, RESIZE_NONE, 14, 2, 229, 16, 101, 0x0, STR_NULL}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 0, 249, 104, 115, 0x0, STR_A027_CURRENT_AIRCRAFT_ACTION}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 14, 31, 0x2AB, STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 32, 49, 0x2AF, STR_A02A_SEND_AIRCRAFT_TO_HANGAR}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 50, 67, 0x2B4, STR_A03B_REFIT_AIRCRAFT_TO_CARRY}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 68, 85, 0x2B2, STR_A028_SHOW_AIRCRAFT_S_ORDERS}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 86, 103, 0x2B3, STR_A02B_SHOW_AIRCRAFT_DETAILS}, -{ WIDGETS_END}, +{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, +{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_A00A, STR_018C_WINDOW_TITLE_DRAG_THIS }, +{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON }, +{ WWT_IMGBTN, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL }, +{ WWT_6, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL }, +{ WWT_PUSHIMGBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_A027_CURRENT_AIRCRAFT_ACTION }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, 0x2AB, STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, 0x2AF, STR_A02A_SEND_AIRCRAFT_TO_HANGAR }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2B4, STR_A03B_REFIT_AIRCRAFT_TO_CARRY }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2B2, STR_A028_SHOW_AIRCRAFT_S_ORDERS }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, 0x2B3, STR_A02B_SHOW_AIRCRAFT_DETAILS }, +{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, +{ WIDGETS_END } }; static void AircraftViewWndProc(Window *w, WindowEvent *e) @@ -596,7 +598,8 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); /* draw the flag */ - DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, 2, 105); + DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, + w->widget[5].top + 1); if (v->vehstatus & VS_CRASHED) { str = STR_8863_CRASHED; @@ -630,7 +633,8 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) } } - DrawStringCentered(125, 105, str, 0); + DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2, + w->widget[5].top + 1, str, 0); DrawWindowViewport(w); } break; @@ -659,6 +663,13 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) } } break; + case WE_RESIZE: + w->viewport->width += e->sizing.diff.x; + w->viewport->height += e->sizing.diff.y; + w->viewport->virtual_width += e->sizing.diff.x; + w->viewport->virtual_height += e->sizing.diff.y; + break; + case WE_DESTROY: DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); @@ -671,7 +682,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) static const WindowDesc _aircraft_view_desc = { -1,-1, 250, 116, WC_VEHICLE_VIEW ,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _aircraft_view_widgets, AircraftViewWndProc }; diff --git a/roadveh_gui.c b/roadveh_gui.c index f67365cf0..7c52a24ec 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -217,7 +217,8 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); /* draw the flag */ - DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, 2, 105); + DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, + w->widget[5].top + 1); if (v->u.road.crashed_ctr != 0) { str = STR_8863_CRASHED; @@ -255,7 +256,8 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) } } - DrawStringCentered(125, 105, str, 0); + DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2, + w->widget[5].top + 1, str, 0); DrawWindowViewport(w); } break; @@ -284,6 +286,13 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) } } break; + case WE_RESIZE: + w->viewport->width += e->sizing.diff.x; + w->viewport->height += e->sizing.diff.y; + w->viewport->virtual_width += e->sizing.diff.x; + w->viewport->virtual_height += e->sizing.diff.y; + break; + case WE_DESTROY: DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); @@ -292,24 +301,26 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) } static const Widget _roadveh_view_widgets[] = { -{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_9002, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 231, 14, 103, 0x0, STR_NULL}, -{ WWT_6, RESIZE_NONE, 14, 2, 229, 16, 101, 0x0, STR_NULL}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 0, 249, 104, 115, 0x0, STR_901C_CURRENT_VEHICLE_ACTION}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 14, 31, 0x2AB, STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 32, 49, 0x2AE, STR_901F_SEND_VEHICLE_TO_DEPOT}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 50, 67, 0x2CB, STR_9020_FORCE_VEHICLE_TO_TURN_AROUND}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 68, 85, 0x2B2, STR_901D_SHOW_VEHICLE_S_ORDERS}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 86, 103, 0x2B3, STR_9021_SHOW_ROAD_VEHICLE_DETAILS}, -{ WIDGETS_END}, +{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, +{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_9002, STR_018C_WINDOW_TITLE_DRAG_THIS }, +{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON }, +{ WWT_IMGBTN, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL }, +{ WWT_6, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL }, +{ WWT_PUSHIMGBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_901C_CURRENT_VEHICLE_ACTION }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, 0x2AB, STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, 0x2AE, STR_901F_SEND_VEHICLE_TO_DEPOT }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2CB, STR_9020_FORCE_VEHICLE_TO_TURN_AROUND }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2B2, STR_901D_SHOW_VEHICLE_S_ORDERS }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, 0x2B3, STR_9021_SHOW_ROAD_VEHICLE_DETAILS }, +{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, +{ WIDGETS_END } }; static const WindowDesc _roadveh_view_desc = { -1,-1, 250, 116, WC_VEHICLE_VIEW,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _roadveh_view_widgets, RoadVehViewWndProc, }; diff --git a/ship_gui.c b/ship_gui.c index 31d7081d9..044b36c1f 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -504,7 +504,8 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { DrawWindowWidgets(w); /* draw the flag */ - DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, 2, 105); + DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, + w->widget[5].top + 1); if (v->breakdown_ctr == 1) { str = STR_885C_BROKEN_DOWN; @@ -540,7 +541,8 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { } } - DrawStringCentered(125, 105, str, 0); + DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2, + w->widget[5].top + 1, str, 0); DrawWindowViewport(w); } break; @@ -569,6 +571,13 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { } } break; + case WE_RESIZE: + w->viewport->width += e->sizing.diff.x; + w->viewport->height += e->sizing.diff.y; + w->viewport->virtual_width += e->sizing.diff.x; + w->viewport->virtual_height += e->sizing.diff.y; + break; + case WE_DESTROY: DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); @@ -578,24 +587,26 @@ static void ShipViewWndProc(Window *w, WindowEvent *e) { } static const Widget _ship_view_widgets[] = { -{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_980F, STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 231, 14, 103, 0x0, STR_NULL}, -{ WWT_6, RESIZE_NONE, 14, 2, 229, 16, 101, 0x0, STR_NULL}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 0, 249, 104, 115, 0x0, STR_9827_CURRENT_SHIP_ACTION_CLICK}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 14, 31, 0x2AB, STR_9829_CENTER_MAIN_VIEW_ON_SHIP}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 32, 49, 0x2B0, STR_982A_SEND_SHIP_TO_DEPOT}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 50, 67, 0x2B4, STR_983A_REFIT_CARGO_SHIP_TO_CARRY}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 68, 85, 0x2B2, STR_9828_SHOW_SHIP_S_ORDERS}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 86, 103, 0x2B3, STR_982B_SHOW_SHIP_DETAILS}, -{ WIDGETS_END}, +{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, +{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_980F, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, +{ WWT_IMGBTN, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL}, +{ WWT_6, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL}, +{ WWT_PUSHIMGBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_9827_CURRENT_SHIP_ACTION_CLICK}, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, 0x2AB, STR_9829_CENTER_MAIN_VIEW_ON_SHIP}, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, 0x2B0, STR_982A_SEND_SHIP_TO_DEPOT}, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2B4, STR_983A_REFIT_CARGO_SHIP_TO_CARRY}, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2B2, STR_9828_SHOW_SHIP_S_ORDERS}, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, 0x2B3, STR_982B_SHOW_SHIP_DETAILS}, +{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, +{ WIDGETS_END } }; static const WindowDesc _ship_view_desc = { -1,-1, 250, 116, WC_VEHICLE_VIEW,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _ship_view_widgets, ShipViewWndProc }; diff --git a/train_gui.c b/train_gui.c index 9bd497024..f4f4ae1f7 100644 --- a/train_gui.c +++ b/train_gui.c @@ -789,20 +789,22 @@ static void ShowRailVehicleRefitWindow(Vehicle *v) } static Widget _train_view_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5,STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_882E,STR_018C_WINDOW_TITLE_DRAG_THIS}, -{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, -{ WWT_PANEL, RESIZE_NONE, 14, 0, 231, 14, 121, 0x0, STR_NULL}, -{ WWT_6, RESIZE_NONE, 14, 2, 229, 16, 119, 0x0, STR_NULL}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 0, 249, 122, 133, 0x0, STR_8846_CURRENT_TRAIN_ACTION_CLICK}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 14, 31, 0x2AB, STR_8848_CENTER_MAIN_VIEW_ON_TRAIN}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 32, 49, 0x2AD, STR_8849_SEND_TRAIN_TO_DEPOT}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 50, 67, 0x2B1, STR_884A_FORCE_TRAIN_TO_PROCEED}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 68, 85, 0x2CB, STR_884B_REVERSE_DIRECTION_OF_TRAIN}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 86, 103, 0x2B2, STR_8847_SHOW_TRAIN_S_ORDERS}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 104, 121, 0x2B3, STR_884C_SHOW_TRAIN_DETAILS}, -{ WWT_PUSHIMGBTN, RESIZE_NONE, 14, 232, 249, 68, 85, 0x2B4, STR_RAIL_REFIT_VEHICLE_TO_CARRY}, -{ WIDGETS_END}, +{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, +{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_882E, STR_018C_WINDOW_TITLE_DRAG_THIS }, +{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON }, +{ WWT_PANEL, RESIZE_RB, 14, 0, 231, 14, 121, 0x0, STR_NULL }, +{ WWT_6, RESIZE_RB, 14, 2, 229, 16, 119, 0x0, STR_NULL }, +{ WWT_PUSHIMGBTN, RESIZE_RTB, 14, 0, 237, 122, 133, 0x0, STR_8846_CURRENT_TRAIN_ACTION_CLICK }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, 0x2AB, STR_8848_CENTER_MAIN_VIEW_ON_TRAIN }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, 0x2AD, STR_8849_SEND_TRAIN_TO_DEPOT }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2B1, STR_884A_FORCE_TRAIN_TO_PROCEED }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2CB, STR_884B_REVERSE_DIRECTION_OF_TRAIN }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, 0x2B2, STR_8847_SHOW_TRAIN_S_ORDERS }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 104, 121, 0x2B3, STR_884C_SHOW_TRAIN_DETAILS }, +{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2B4, STR_RAIL_REFIT_VEHICLE_TO_CARRY }, +{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 122, 121, 0x0, STR_NULL }, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 122, 133, 0x0, STR_NULL }, +{ WIDGETS_END } }; static void TrainViewWndProc(Window *w, WindowEvent *e) @@ -840,7 +842,8 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) DrawWindowWidgets(w); /* draw the flag */ - DrawSprite( (v->vehstatus&VS_STOPPED) ? 0xC12 : 0xC13, 2, 123); + DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, + w->widget[5].top + 1); if (v->u.rail.crash_anim_pos != 0) { str = STR_8863_CRASHED; @@ -890,7 +893,8 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) } } - DrawStringCentered(125, 123, str, 0); + DrawStringCentered((w->widget[5].right - w->widget[5].left) / 2, + w->widget[5].top + 1, str, 0); DrawWindowViewport(w); } break; @@ -927,6 +931,13 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) } } break; + case WE_RESIZE: + w->viewport->width += e->sizing.diff.x; + w->viewport->height += e->sizing.diff.y; + w->viewport->virtual_width += e->sizing.diff.x; + w->viewport->virtual_height += e->sizing.diff.y; + break; + case WE_DESTROY: DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); @@ -953,7 +964,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) static const WindowDesc _train_view_desc = { -1,-1, 250, 134, WC_VEHICLE_VIEW,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _train_view_widgets, TrainViewWndProc }; |