(svn r1213) -Feature: Stickified vehicle lists
This commit is contained in:
@@ -643,7 +643,7 @@ static void DrawAircraftDepotWindow(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;
|
||||
@@ -756,7 +756,8 @@ static void AircraftDepotClickAircraft(Window *w, int x, int y)
|
||||
|
||||
static const Widget _aircraft_depot_widgets[] = {
|
||||
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 330, 0, 13, STR_A002_AIRCRAFT_HANGAR, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 318, 0, 13, STR_A002_AIRCRAFT_HANGAR, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, 14, 319, 330, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_MATRIX, 14, 0, 295, 14, 61, 0x204, STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT},
|
||||
{ WWT_IMGBTN, 14, 296, 319, 14, 61, 0x2A9, STR_A023_DRAG_AIRCRAFT_TO_HERE_TO},
|
||||
{ WWT_SCROLLBAR, 14, 320, 330, 14, 61, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
@@ -775,13 +776,13 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 2: /* click aircraft */
|
||||
case 3: /* click aircraft */
|
||||
AircraftDepotClickAircraft(w, e->click.pt.x, e->click.pt.y);
|
||||
break;
|
||||
case 5: /* show build aircraft window */
|
||||
case 6: /* show build aircraft window */
|
||||
ShowBuildAircraftWindow(w->window_number);
|
||||
break;
|
||||
case 6: /* scroll to tile */
|
||||
case 7: /* scroll to tile */
|
||||
ScrollMainWindowToTile(w->window_number);
|
||||
break;
|
||||
}
|
||||
@@ -793,7 +794,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_DRAGDROP: {
|
||||
switch(e->click.widget) {
|
||||
case 2: {
|
||||
case 3: {
|
||||
Vehicle *v;
|
||||
VehicleID sel = WP(w,traindepot_d).sel;
|
||||
|
||||
@@ -807,12 +808,12 @@ static void AircraftDepotWndProc(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;
|
||||
@@ -839,7 +840,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||
static const WindowDesc _aircraft_depot_desc = {
|
||||
-1, -1, 331, 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,
|
||||
_aircraft_depot_widgets,
|
||||
AircraftDepotWndProc
|
||||
};
|
||||
@@ -889,7 +890,8 @@ static void DrawSmallSchedule(Vehicle *v, int x, int y) {
|
||||
|
||||
static Widget _player_aircraft_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_A009_AIRCRAFT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_A009_AIRCRAFT, 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},
|
||||
@@ -903,7 +905,8 @@ static Widget _player_aircraft_widgets[] = {
|
||||
|
||||
static Widget _other_player_aircraft_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_A009_AIRCRAFT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_A009_AIRCRAFT, 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},
|
||||
@@ -933,7 +936,7 @@ static void PlayerAircraftWndProc(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 */
|
||||
{
|
||||
@@ -995,17 +998,17 @@ static void PlayerAircraftWndProc(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
|
||||
@@ -1025,7 +1028,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
} break;
|
||||
|
||||
case 8: { /* Build new Vehicle */
|
||||
case 9: { /* Build new Vehicle */
|
||||
uint tile;
|
||||
|
||||
tile = _last_built_aircraft_depot_tile;
|
||||
@@ -1052,7 +1055,7 @@ static void PlayerAircraftWndProc(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;
|
||||
@@ -1079,7 +1082,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||
static const WindowDesc _player_aircraft_desc = {
|
||||
-1, -1, 260, 182,
|
||||
WC_AIRCRAFT_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_aircraft_widgets,
|
||||
PlayerAircraftWndProc
|
||||
};
|
||||
@@ -1087,7 +1090,7 @@ static const WindowDesc _player_aircraft_desc = {
|
||||
static const WindowDesc _other_player_aircraft_desc = {
|
||||
-1, -1, 260, 170,
|
||||
WC_AIRCRAFT_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_aircraft_widgets,
|
||||
PlayerAircraftWndProc
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user