Import combined Enhanced viewport: zoom out, overlays & tooltips (r53_27127) patch
https://www.tt-forums.net/viewtopic.php?f=33&t=53394
This commit is contained in:

committed by
Jonathan G Rennison

parent
fd3388467f
commit
536a95dfd0
@@ -605,6 +605,32 @@ struct RefitWindow : public Window {
|
||||
this->SetWidgetDisabledState(WID_VR_REFIT, this->sel[0] < 0);
|
||||
}
|
||||
|
||||
~RefitWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) {
|
||||
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnInit()
|
||||
{
|
||||
if (this->cargo != NULL) {
|
||||
@@ -1614,7 +1640,7 @@ public:
|
||||
|
||||
case WID_VL_SORT_BY_PULLDOWN:// Select sorting criteria dropdown menu
|
||||
ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), WID_VL_SORT_BY_PULLDOWN, 0,
|
||||
(this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10));
|
||||
(this->vli.vtype == VEH_TRAIN || this->vli.vtype == VEH_ROAD) ? 0 : (1 << 10), 0, DDSF_LOST_FOCUS);
|
||||
return;
|
||||
|
||||
case WID_VL_LIST: { // Matrix to show vehicles
|
||||
@@ -1875,6 +1901,16 @@ struct VehicleDetailsWindow : Window {
|
||||
this->tab = TDW_TAB_CARGO;
|
||||
}
|
||||
|
||||
~VehicleDetailsWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) {
|
||||
if (!FocusWindowById(WC_VEHICLE_VIEW, this->window_number)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Some data on this window has become invalid.
|
||||
* @param data Information about the changed data.
|
||||
@@ -2173,7 +2209,7 @@ struct VehicleDetailsWindow : Window {
|
||||
|
||||
case WID_VD_SERVICE_INTERVAL_DROPDOWN: {
|
||||
const Vehicle *v = Vehicle::Get(this->window_number);
|
||||
ShowDropDownMenu(this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0);
|
||||
ShowDropDownMenu(this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0, 0, DDSF_LOST_FOCUS);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2223,6 +2259,22 @@ struct VehicleDetailsWindow : Window {
|
||||
this->vscroll->SetCapacityFromWidget(this, WID_VD_MATRIX);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Vehicle details window descriptor. */
|
||||
@@ -2495,12 +2547,30 @@ public:
|
||||
|
||||
~VehicleViewWindow()
|
||||
{
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
DeleteWindowById(WC_VEHICLE_ORDERS, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_REFIT, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_DETAILS, this->window_number, false);
|
||||
DeleteWindowById(WC_VEHICLE_TIMETABLE, this->window_number, false);
|
||||
}
|
||||
|
||||
virtual void OnFocus(Window *previously_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, previously_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnFocusLost(Window *newly_focused_window)
|
||||
{
|
||||
if (HasFocusedVehicleChanged(this->window_number, newly_focused_window)) {
|
||||
if (this->window_number != INVALID_VEHICLE) MarkAllRoutePathsDirty(Vehicle::Get(this->window_number));
|
||||
MarkAllRouteStepsDirty(this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||
{
|
||||
const Vehicle *v = Vehicle::Get(this->window_number);
|
||||
|
Reference in New Issue
Block a user