From f55303b0a83972df4b16ba9844f4d853a337ced2 Mon Sep 17 00:00:00 2001 From: darkvater Date: Wed, 22 Dec 2004 00:45:05 +0000 Subject: (svn r1213) -Feature: Stickified vehicle lists --- ship_gui.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'ship_gui.c') diff --git a/ship_gui.c b/ship_gui.c index 935013187..a8207787c 100644 --- a/ship_gui.c +++ b/ship_gui.c @@ -621,7 +621,7 @@ static void DrawShipDepotWindow(Window *w) tile = w->window_number; /* setup disabled buttons */ - w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<3)|(1<<5)); + w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<4)|(1<<6)); /* determine amount of items for scroller */ num = 0; @@ -743,15 +743,15 @@ static void ShipDepotWndProc(Window *w, WindowEvent *e) { case WE_CLICK: switch(e->click.widget) { - case 2: + case 3: ShipDepotClick(w, e->click.pt.x, e->click.pt.y); break; - case 5: + case 6: ShowBuildShipWindow(w->window_number); break; - case 6: /* scroll to tile */ + case 7: /* scroll to tile */ ScrollMainWindowToTile(w->window_number); break; } @@ -763,7 +763,7 @@ static void ShipDepotWndProc(Window *w, WindowEvent *e) { case WE_DRAGDROP: { switch(e->click.widget) { - case 2: { + case 3: { Vehicle *v; VehicleID sel = WP(w,traindepot_d).sel; @@ -777,12 +777,12 @@ static void ShipDepotWndProc(Window *w, WindowEvent *e) { } } break; - case 3: - if (!HASBIT(w->disabled_state, 3) && + case 4: + if (!HASBIT(w->disabled_state, 4) && WP(w,traindepot_d).sel != INVALID_VEHICLE) { Vehicle *v; - HandleButtonClick(w, 3); + HandleButtonClick(w, 4); v = &_vehicles[WP(w,traindepot_d).sel]; WP(w,traindepot_d).sel = INVALID_VEHICLE; @@ -806,7 +806,8 @@ static void ShipDepotWndProc(Window *w, WindowEvent *e) { static const Widget _ship_depot_widgets[] = { { WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, 14, 11, 304, 0, 13, STR_9803_SHIP_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_CAPTION, 14, 11, 292, 0, 13, STR_9803_SHIP_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, 14, 293, 304, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_MATRIX, 14, 0, 269, 14, 61, 0x203, STR_981F_SHIPS_CLICK_ON_SHIP_FOR}, { WWT_IMGBTN, 14, 270, 293, 14, 61, 0x2A9, STR_9821_DRAG_SHIP_TO_HERE_TO_SELL}, { WWT_SCROLLBAR, 14, 294, 304, 14, 61, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, @@ -818,7 +819,7 @@ static const Widget _ship_depot_widgets[] = { static const WindowDesc _ship_depot_desc = { -1, -1, 305, 74, WC_VEHICLE_DEPOT,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _ship_depot_widgets, ShipDepotWndProc }; @@ -871,7 +872,8 @@ static void DrawSmallShipSchedule(Vehicle *v, int x, int y) { static Widget _player_ships_widgets[] = { { WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP}, { WWT_PANEL, 14, 81, 237, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, { WWT_CLOSEBOX, 14, 238, 248, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, @@ -885,7 +887,8 @@ static Widget _player_ships_widgets[] = { static Widget _other_player_ships_widgets[] = { { WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP}, { WWT_PANEL, 14, 81, 237, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, { WWT_CLOSEBOX, 14, 238, 248, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, @@ -915,7 +918,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) // disable 'Sort By' tooltip on Unsorted sorting criteria if (vl->sort_type == SORT_BY_UNSORTED) - w->disabled_state |= (1 << 2); + w->disabled_state |= (1 << 3); /* draw the widgets */ { @@ -977,15 +980,15 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) case WE_CLICK: { switch(e->click.widget) { - case 2: /* Flip sorting method ascending/descending */ + case 3: /* Flip sorting method ascending/descending */ vl->flags ^= VL_DESC; vl->flags |= VL_RESORT; SetWindowDirty(w); break; - case 3: case 4:/* Select sorting criteria dropdown menu */ - ShowDropDownMenu(w, _vehicle_sort_listing, vl->sort_type, 4, 0); + case 4: case 5:/* Select sorting criteria dropdown menu */ + ShowDropDownMenu(w, _vehicle_sort_listing, vl->sort_type, 5, 0); return; - case 6: { /* Matrix to show vehicles */ + case 7: { /* Matrix to show vehicles */ uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG; if (id_v >= w->vscroll.cap) { return;} // click out of bounds @@ -1005,7 +1008,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) } } break; - case 8: { /* Build new Vehicle */ + case 9: { /* Build new Vehicle */ uint tile; tile = _last_built_ship_depot_tile; @@ -1032,7 +1035,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) // enable 'Sort By' if a sorter criteria is chosen if (vl->sort_type != SORT_BY_UNSORTED) - w->disabled_state &= ~(1 << 2); + w->disabled_state &= ~(1 << 3); } SetWindowDirty(w); break; @@ -1059,7 +1062,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e) static const WindowDesc _player_ships_desc = { -1, -1, 260, 182, WC_SHIPS_LIST,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_ships_widgets, PlayerShipsWndProc }; @@ -1067,7 +1070,7 @@ static const WindowDesc _player_ships_desc = { static const WindowDesc _other_player_ships_desc = { -1, -1, 260, 170, WC_SHIPS_LIST,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_ships_widgets, PlayerShipsWndProc }; -- cgit v1.2.3-54-g00ecf