Departure boards: Refactor widget toggling
This commit is contained in:
@@ -336,12 +336,7 @@ public:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->show_types[widget - WID_DB_SHOW_TRAINS] = !this->show_types[widget - WID_DB_SHOW_TRAINS];
|
this->show_types[widget - WID_DB_SHOW_TRAINS] = !this->show_types[widget - WID_DB_SHOW_TRAINS];
|
||||||
if (this->show_types[widget - WID_DB_SHOW_TRAINS]) {
|
this->SetWidgetLoweredState(widget, this->show_types[widget - WID_DB_SHOW_TRAINS]);
|
||||||
this->LowerWidget(widget);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this->RaiseWidget(widget);
|
|
||||||
}
|
|
||||||
this->SetWidgetDirty(widget);
|
this->SetWidgetDirty(widget);
|
||||||
}
|
}
|
||||||
/* We need to recompute the departures list. */
|
/* We need to recompute the departures list. */
|
||||||
@@ -359,11 +354,7 @@ public:
|
|||||||
case WID_DB_SHOW_VIA:
|
case WID_DB_SHOW_VIA:
|
||||||
|
|
||||||
this->departure_types[widget - WID_DB_SHOW_DEPS] = !this->departure_types[widget - WID_DB_SHOW_DEPS];
|
this->departure_types[widget - WID_DB_SHOW_DEPS] = !this->departure_types[widget - WID_DB_SHOW_DEPS];
|
||||||
if (this->departure_types[widget - WID_DB_SHOW_DEPS]) {
|
this->SetWidgetLoweredState(widget, this->departure_types[widget - WID_DB_SHOW_DEPS]);
|
||||||
this->LowerWidget(widget);
|
|
||||||
} else {
|
|
||||||
this->RaiseWidget(widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Side effects */
|
/* Side effects */
|
||||||
if (widget == WID_DB_SHOW_DEPS) {
|
if (widget == WID_DB_SHOW_DEPS) {
|
||||||
|
Reference in New Issue
Block a user