mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 07:06:01 +00:00
(svn r1213) -Feature: Stickified vehicle lists
This commit is contained in:
parent
222d6ca952
commit
f55303b0a8
@ -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
|
||||
};
|
||||
|
@ -483,7 +483,7 @@ static void DrawRoadDepotWindow(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;
|
||||
@ -605,15 +605,15 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_CLICK: {
|
||||
switch(e->click.widget) {
|
||||
case 2:
|
||||
case 3:
|
||||
RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
ShowBuildRoadVehWindow(w->window_number);
|
||||
break;
|
||||
|
||||
case 6: /* scroll to tile */
|
||||
case 7: /* scroll to tile */
|
||||
ScrollMainWindowToTile(w->window_number);
|
||||
break;
|
||||
}
|
||||
@ -625,7 +625,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_DRAGDROP: {
|
||||
switch(e->click.widget) {
|
||||
case 2: {
|
||||
case 3: {
|
||||
Vehicle *v;
|
||||
VehicleID sel = WP(w,traindepot_d).sel;
|
||||
|
||||
@ -639,12 +639,12 @@ static void RoadDepotWndProc(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;
|
||||
@ -670,7 +670,8 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
static const Widget _road_depot_widgets[] = {
|
||||
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 314, 0, 13, STR_9003_ROAD_VEHICLE_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 302, 0, 13, STR_9003_ROAD_VEHICLE_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, 14, 303, 314, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_MATRIX, 14, 0, 279, 14, 55, 0x305, STR_9022_VEHICLES_CLICK_ON_VEHICLE},
|
||||
{ WWT_IMGBTN, 14, 280, 303, 14, 55, 0x2A9, STR_9024_DRAG_ROAD_VEHICLE_TO_HERE},
|
||||
{ WWT_SCROLLBAR, 14, 304, 314, 14, 55, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
@ -682,7 +683,7 @@ static const Widget _road_depot_widgets[] = {
|
||||
static const WindowDesc _road_depot_desc = {
|
||||
-1, -1, 315, 68,
|
||||
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,
|
||||
_road_depot_widgets,
|
||||
RoadDepotWndProc
|
||||
};
|
||||
@ -704,6 +705,7 @@ void ShowRoadDepotWindow(uint tile)
|
||||
static Widget _player_roadveh_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9001_ROAD_VEHICLES, 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},
|
||||
@ -718,7 +720,8 @@ static Widget _player_roadveh_widgets[] = {
|
||||
|
||||
static Widget _other_player_roadveh_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9001_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_9001_ROAD_VEHICLES, 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},
|
||||
@ -748,7 +751,7 @@ static void PlayerRoadVehWndProc(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 */
|
||||
{
|
||||
@ -808,16 +811,16 @@ static void PlayerRoadVehWndProc(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_SMALL;
|
||||
|
||||
if (id_v >= w->vscroll.cap) { return;} // click out of bounds
|
||||
@ -837,7 +840,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
} break;
|
||||
|
||||
case 8: { /* Build new Vehicle */
|
||||
case 9: { /* Build new Vehicle */
|
||||
uint tile;
|
||||
|
||||
tile = _last_built_road_depot_tile;
|
||||
@ -864,7 +867,7 @@ static void PlayerRoadVehWndProc(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;
|
||||
@ -891,7 +894,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||
static const WindowDesc _player_roadveh_desc = {
|
||||
-1, -1, 260, 220,
|
||||
WC_ROADVEH_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_roadveh_widgets,
|
||||
PlayerRoadVehWndProc
|
||||
};
|
||||
@ -899,7 +902,7 @@ static const WindowDesc _player_roadveh_desc = {
|
||||
static const WindowDesc _other_player_roadveh_desc = {
|
||||
-1, -1, 260, 208,
|
||||
WC_ROADVEH_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_roadveh_widgets,
|
||||
PlayerRoadVehWndProc
|
||||
};
|
||||
|
45
ship_gui.c
45
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
|
||||
};
|
||||
|
43
train_gui.c
43
train_gui.c
@ -285,7 +285,7 @@ static void DrawTrainDepotWindow(Window *w)
|
||||
tile = w->window_number;
|
||||
|
||||
/* setup disabled buttons */
|
||||
w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<3)|(1<<4)|(1<<6));
|
||||
w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<4)|(1<<5)|(1<<7));
|
||||
|
||||
/* determine amount of items for scroller */
|
||||
num = 1;
|
||||
@ -493,13 +493,13 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_CLICK: {
|
||||
switch(e->click.widget) {
|
||||
case 6:
|
||||
case 7:
|
||||
ShowBuildTrainWindow(w->window_number);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
ScrollMainWindowToTile(w->window_number);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
TrainDepotClickTrain(w, e->click.pt.x, e->click.pt.y);
|
||||
break;
|
||||
}
|
||||
@ -512,7 +512,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||
case WE_DRAGDROP: {
|
||||
switch(e->click.widget) {
|
||||
case 4:
|
||||
case 3: {
|
||||
case 5: {
|
||||
Vehicle *v;
|
||||
int sell_cmd;
|
||||
|
||||
@ -530,7 +530,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
HandleButtonClick(w, e->click.widget);
|
||||
|
||||
sell_cmd = (e->click.widget == 4 || _ctrl_pressed) ? 1 : 0;
|
||||
sell_cmd = (e->click.widget == 5 || _ctrl_pressed) ? 1 : 0;
|
||||
|
||||
if (v->subtype != 0) {
|
||||
DoCommandP(v->tile, v->index, sell_cmd, NULL, CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE));
|
||||
@ -542,7 +542,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
} break;
|
||||
|
||||
case 2: {
|
||||
case 3: {
|
||||
GetDepotVehiclePtData gdvp;
|
||||
VehicleID sel = WP(w,traindepot_d).sel;
|
||||
|
||||
@ -571,7 +571,8 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
static const Widget _train_depot_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 348, 0, 13, STR_8800_TRAIN_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 336, 0, 13, STR_8800_TRAIN_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, 14, 337, 348, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_MATRIX, 14, 0, 313, 14, 97, 0x601, STR_883F_TRAINS_CLICK_ON_TRAIN_FOR},
|
||||
{ WWT_PANEL, 14, 314, 337, 14, 54, 0x2A9, STR_8841_DRAG_TRAIN_VEHICLE_TO_HERE},
|
||||
{ WWT_PANEL, 14, 314, 337, 55, 108, 0x2BF, STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP},
|
||||
@ -586,7 +587,7 @@ static const Widget _train_depot_widgets[] = {
|
||||
static const WindowDesc _train_depot_desc = {
|
||||
-1, -1, 349, 121,
|
||||
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,
|
||||
_train_depot_widgets,
|
||||
TrainDepotWndProc
|
||||
};
|
||||
@ -1173,7 +1174,8 @@ void ShowTrainDetailsWindow(Vehicle *v)
|
||||
|
||||
static Widget _player_trains_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 324, 0, 13, STR_881B_TRAINS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 312, 0, 13, STR_881B_TRAINS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, 14, 313, 324, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PANEL, 14, 81, 232, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 233, 243, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP},
|
||||
@ -1187,7 +1189,8 @@ static Widget _player_trains_widgets[] = {
|
||||
|
||||
static Widget _other_player_trains_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 14, 11, 324, 0, 13, STR_881B_TRAINS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_CAPTION, 14, 11, 312, 0, 13, STR_881B_TRAINS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, 14, 313, 324, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PANEL, 14, 81, 232, 14, 25, 0x0, STR_SORT_CRITERIA_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 233, 243, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP},
|
||||
@ -1217,7 +1220,7 @@ static void PlayerTrainsWndProc(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 */
|
||||
{
|
||||
@ -1279,17 +1282,17 @@ static void PlayerTrainsWndProc(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_SMALL;
|
||||
|
||||
if (id_v >= w->vscroll.cap) { return;} // click out of bounds
|
||||
@ -1309,7 +1312,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
} break;
|
||||
|
||||
case 8: { /* Build new Vehicle */
|
||||
case 9: { /* Build new Vehicle */
|
||||
uint tile;
|
||||
|
||||
tile = _last_built_train_depot_tile;
|
||||
@ -1336,7 +1339,7 @@ static void PlayerTrainsWndProc(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;
|
||||
@ -1363,7 +1366,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||
static const WindowDesc _player_trains_desc = {
|
||||
-1, -1, 325, 220,
|
||||
WC_TRAINS_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_trains_widgets,
|
||||
PlayerTrainsWndProc
|
||||
};
|
||||
@ -1371,7 +1374,7 @@ static const WindowDesc _player_trains_desc = {
|
||||
static const WindowDesc _other_player_trains_desc = {
|
||||
-1, -1, 325, 208,
|
||||
WC_TRAINS_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_trains_widgets,
|
||||
PlayerTrainsWndProc
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user