Show manage slots in veh/group window drop down even when no vehicles.

This commit is contained in:
Jonathan G Rennison
2017-03-31 00:08:25 +01:00
parent 7dbf99fa33
commit 870216d27c
3 changed files with 24 additions and 13 deletions

View File

@@ -484,16 +484,16 @@ public:
this->vscroll->SetCount(this->vehicles.Length());
/* The drop down menu is out, *but* it may not be used, retract it. */
if (this->vehicles.Length() == 0 && this->IsWidgetLowered(WID_GL_MANAGE_VEHICLES_DROPDOWN)) {
if (!this->ShouldShowActionDropdownList() && this->IsWidgetLowered(WID_GL_MANAGE_VEHICLES_DROPDOWN)) {
this->RaiseWidget(WID_GL_MANAGE_VEHICLES_DROPDOWN);
HideDropDownMenu(this);
}
/* Disable all lists management button when the list is empty */
this->SetWidgetDisabledState(WID_GL_MANAGE_VEHICLES_DROPDOWN, !this->ShouldShowActionDropdownList() || _local_company != this->vli.company);
this->SetWidgetsDisabledState(this->vehicles.Length() == 0 || _local_company != this->vli.company,
WID_GL_STOP_ALL,
WID_GL_START_ALL,
WID_GL_MANAGE_VEHICLES_DROPDOWN,
WIDGET_LIST_END);
/* Disable the group specific function when we select the default group or all vehicles */
@@ -703,7 +703,7 @@ public:
case WID_GL_MANAGE_VEHICLES_DROPDOWN: {
DropDownList *list = this->BuildActionDropdownList(true, Group::IsValidID(this->vli.index));
ShowDropDownList(this, list, 0, WID_GL_MANAGE_VEHICLES_DROPDOWN);
ShowDropDownList(this, list, -1, WID_GL_MANAGE_VEHICLES_DROPDOWN);
break;
}
@@ -826,7 +826,7 @@ public:
break;
case WID_GL_MANAGE_VEHICLES_DROPDOWN:
assert(this->vehicles.Length() != 0);
assert(this->ShouldShowActionDropdownList());
switch (index) {
case ADI_REPLACE: // Replace window