|
|
|
@ -1367,7 +1367,13 @@ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index)
|
|
|
|
|
static const NWidgetPart _nested_vehicle_list[] = {
|
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
|
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VL_CAPTION),
|
|
|
|
|
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VL_CAPTION_SELECTION),
|
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VL_CAPTION),
|
|
|
|
|
NWidget(NWID_HORIZONTAL),
|
|
|
|
|
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VL_CAPTION_SHARED_ORDERS),
|
|
|
|
|
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VL_ORDER_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_GOTO_ORDER_VIEW, STR_GOTO_ORDER_VIEW_TOOLTIP),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
EndContainer(),
|
|
|
|
|
NWidget(WWT_SHADEBOX, COLOUR_GREY),
|
|
|
|
|
NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
|
|
|
|
|
NWidget(WWT_STICKYBOX, COLOUR_GREY),
|
|
|
|
@ -1642,6 +1648,12 @@ private:
|
|
|
|
|
BP_HIDE_BUTTONS, ///< Show the empty panel.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Enumeration of planes of the title row at the top. */
|
|
|
|
|
enum CaptionPlanes {
|
|
|
|
|
BP_NORMAL, ///< Show shared orders caption and buttons.
|
|
|
|
|
BP_SHARED_ORDERS, ///< Show the normal caption.
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
|
|
|
|
|
{
|
|
|
|
@ -1655,14 +1667,17 @@ public:
|
|
|
|
|
/* Set up the window widgets */
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype;
|
|
|
|
|
|
|
|
|
|
NWidgetStacked *nwi = this->GetWidget<NWidgetStacked>(WID_VL_CAPTION_SELECTION);
|
|
|
|
|
if (this->vli.type == VL_SHARED_ORDERS) {
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_VL_CAPTION_SHARED_ORDERS)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
|
|
|
|
|
/* If we are in the shared orders window, then disable the group-by dropdown menu.
|
|
|
|
|
* Remove this when the group-by dropdown menu has another option apart from grouping by shared orders. */
|
|
|
|
|
this->SetWidgetDisabledState(WID_VL_GROUP_ORDER, true);
|
|
|
|
|
this->SetWidgetDisabledState(WID_VL_GROUP_BY_PULLDOWN, true);
|
|
|
|
|
nwi->SetDisplayedPlane(BP_SHARED_ORDERS);
|
|
|
|
|
} else {
|
|
|
|
|
this->GetWidget<NWidgetCore>(WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype;
|
|
|
|
|
nwi->SetDisplayedPlane(BP_NORMAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->FinishInitNested(window_number);
|
|
|
|
@ -1718,7 +1733,8 @@ public:
|
|
|
|
|
SetDParam(0, STR_VEHICLE_LIST_AVAILABLE_TRAINS + this->vli.vtype);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_VL_CAPTION: {
|
|
|
|
|
case WID_VL_CAPTION:
|
|
|
|
|
case WID_VL_CAPTION_SHARED_ORDERS: {
|
|
|
|
|
switch (this->vli.type) {
|
|
|
|
|
case VL_SHARED_ORDERS: // Shared Orders
|
|
|
|
|
if (this->vehicles.size() == 0) {
|
|
|
|
@ -1806,6 +1822,12 @@ public:
|
|
|
|
|
void OnClick(Point pt, int widget, int click_count) override
|
|
|
|
|
{
|
|
|
|
|
switch (widget) {
|
|
|
|
|
case WID_VL_ORDER_VIEW: // Open the shared orders window
|
|
|
|
|
assert(this->vli.type == VL_SHARED_ORDERS);
|
|
|
|
|
assert(!this->vehicles.empty());
|
|
|
|
|
ShowOrdersWindow(this->vehicles[0]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case WID_VL_SORT_ORDER: // Flip sorting method ascending/descending
|
|
|
|
|
this->vehgroups.ToggleSortOrder();
|
|
|
|
|
this->SetDirty();
|
|
|
|
|