summaryrefslogtreecommitdiff
path: root/aircraft_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-11 13:17:39 +0000
committertron <tron@openttd.org>2005-03-11 13:17:39 +0000
commiteab8b9a116091735e80aab152642f49cdd7b880a (patch)
tree4ae2a20d09ff517419b22e7c1111bea910558e81 /aircraft_gui.c
parente98a7ff23916ecf456f47651a7d82db97b96ea7a (diff)
downloadopenttd-eab8b9a116091735e80aab152642f49cdd7b880a.tar.xz
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
Diffstat (limited to 'aircraft_gui.c')
-rw-r--r--aircraft_gui.c41
1 files changed, 26 insertions, 15 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
};