Index: depot_gui.cpp =================================================================== --- depot_gui.cpp (revision 27096) +++ depot_gui.cpp (working copy) @@ -28,7 +28,7 @@ #include "vehiclelist.h" #include "order_backup.h" #include "zoom_func.h" - +#include "hotkeys.h" #include "widgets/depot_widget.h" #include "table/strings.h" @@ -81,34 +81,6 @@ EndContainer(), }; -static WindowDesc _train_depot_desc( - WDP_AUTO, "depot_train", 362, 123, - WC_VEHICLE_DEPOT, WC_NONE, - 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) -); - -static WindowDesc _road_depot_desc( - WDP_AUTO, "depot_roadveh", 316, 97, - WC_VEHICLE_DEPOT, WC_NONE, - 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) -); - -static WindowDesc _ship_depot_desc( - WDP_AUTO, "depot_ship", 306, 99, - WC_VEHICLE_DEPOT, WC_NONE, - 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) -); - -static WindowDesc _aircraft_depot_desc( - WDP_AUTO, "depot_aircraft", 332, 99, - WC_VEHICLE_DEPOT, WC_NONE, - 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) -); - extern void DepotSortList(VehicleList *list); /** @@ -995,8 +967,24 @@ return ES_NOT_HANDLED; } + + virtual EventState OnHotkey(int hotkey) + { + if (this->owner != _local_company) return ES_NOT_HANDLED; + return Window::OnHotkey(hotkey); + } + + static HotkeyList hotkeys; }; +static Hotkey depot_hotkeys[] = { + Hotkey(WKC_CTRL | 'F', "depot_go_all", WID_D_START_ALL), + Hotkey('R', "depot_build_vehicle", WID_D_BUILD), + Hotkey(WKC_NONE, "depot_clone_vehicle", WID_D_CLONE), + HOTKEY_LIST_END +}; +HotkeyList DepotWindow::hotkeys("depot_gui", depot_hotkeys); + static void DepotSellAllConfirmationCallback(Window *win, bool confirmed) { if (confirmed) { @@ -1007,6 +995,38 @@ } } +static WindowDesc _train_depot_desc( + WDP_AUTO, "depot_train", 362, 123, + WC_VEHICLE_DEPOT, WC_NONE, + 0, + _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets), + &DepotWindow::hotkeys +); + +static WindowDesc _road_depot_desc( + WDP_AUTO, "depot_roadveh", 316, 97, + WC_VEHICLE_DEPOT, WC_NONE, + 0, + _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets), + &DepotWindow::hotkeys +); + +static WindowDesc _ship_depot_desc( + WDP_AUTO, "depot_ship", 306, 99, + WC_VEHICLE_DEPOT, WC_NONE, + 0, + _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets), + &DepotWindow::hotkeys +); + +static WindowDesc _aircraft_depot_desc( + WDP_AUTO, "depot_aircraft", 332, 99, + WC_VEHICLE_DEPOT, WC_NONE, + 0, + _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets), + &DepotWindow::hotkeys +); + /** * Opens a depot window * @param tile The tile where the depot/hangar is located