Merge PR #457 into jgrpp

This commit is contained in:
Jonathan G Rennison 2022-12-04 11:57:06 +00:00
commit d19771c36b
5 changed files with 70 additions and 57 deletions

View File

@ -98,6 +98,7 @@ protected:
int calc_tick_countdown; ///< The number of ticks to wait until recomputing the departure list. Signed in case it goes below zero.
bool show_types[4]; ///< The vehicle types to show in the departure list.
bool departure_types[3]; ///< The types of departure to show in the departure list.
bool departure_types_both; ///< Arrivals and departures buttons disabled (shown combined as single entry)
bool show_pax; ///< Show passenger vehicles
bool show_freight; ///< Show freight vehicles
bool cargo_buttons_disabled;///< Show pax/freight buttons disabled
@ -136,6 +137,20 @@ protected:
}
}
void SetDepartureTypesDisabledState()
{
this->departure_types_both = _settings_client.gui.departure_show_both;
this->SetWidgetDisabledState(WID_DB_SHOW_DEPS, departure_types_both);
this->SetWidgetDisabledState(WID_DB_SHOW_ARRS, departure_types_both);
if (this->departure_types_both) {
this->LowerWidget(WID_DB_SHOW_DEPS);
this->LowerWidget(WID_DB_SHOW_ARRS);
} else {
this->SetWidgetLoweredState(WID_DB_SHOW_DEPS, this->departure_types[0]);
this->SetWidgetLoweredState(WID_DB_SHOW_ARRS, this->departure_types[1]);
}
}
void FillVehicleList()
{
this->vehicles.clear();
@ -237,6 +252,7 @@ public:
this->RaiseWidget(WID_DB_SHOW_VIA);
this->LowerWidget(WID_DB_SHOW_PAX);
this->LowerWidget(WID_DB_SHOW_FREIGHT);
if (!Twaypoint) this->SetDepartureTypesDisabledState();
this->SetCargoFilterDisabledState();
for (uint i = 0; i < 4; ++i) {
@ -307,8 +323,8 @@ public:
case WID_DB_SHOW_SHIPS:
case WID_DB_SHOW_PLANES: {
uint64 params[1];
params[0] = STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP + (widget - WID_DB_SHOW_TRAINS);
GuiShowTooltips(this, STR_STATION_VIEW_SCHEDULED_TOOLTIP_CTRL_SUFFIX, 1, params, close_cond);
params[0] = STR_DEPARTURES_SHOW_TRAINS_TOOLTIP + (widget - WID_DB_SHOW_TRAINS);
GuiShowTooltips(this, STR_DEPARTURES_SHOW_TYPE_TOOLTIP_CTRL_SUFFIX, 1, params, close_cond);
return true;
}
default:
@ -336,17 +352,12 @@ public:
}
} else {
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->LowerWidget(widget);
}
else {
this->RaiseWidget(widget);
}
this->SetWidgetLoweredState(widget, this->show_types[widget - WID_DB_SHOW_TRAINS]);
/* We need to redraw the button that was pressed. */
this->SetWidgetDirty(widget);
}
/* We need to recompute the departures list. */
this->RefreshVehicleList();
/* We need to redraw the button that was pressed. */
if (_pause_mode != PM_UNPAUSED) this->OnGameTick();
break;
}
@ -359,22 +370,21 @@ public:
case WID_DB_SHOW_VIA:
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->LowerWidget(widget);
} else {
this->RaiseWidget(widget);
}
this->SetWidgetLoweredState(widget, this->departure_types[widget - WID_DB_SHOW_DEPS]);
if (!this->departure_types[0]) {
this->RaiseWidget(WID_DB_SHOW_VIA);
this->DisableWidget(WID_DB_SHOW_VIA);
} else {
this->EnableWidget(WID_DB_SHOW_VIA);
if (this->departure_types[2]) {
this->LowerWidget(WID_DB_SHOW_VIA);
/* Side effects */
if (widget == WID_DB_SHOW_DEPS) {
if (!this->departure_types[0]) {
this->RaiseWidget(WID_DB_SHOW_VIA);
this->DisableWidget(WID_DB_SHOW_VIA);
} else {
this->EnableWidget(WID_DB_SHOW_VIA);
this->SetWidgetLoweredState(WID_DB_SHOW_VIA, this->departure_types[2]);
}
/* Redraw required. */
this->SetWidgetDirty(WID_DB_SHOW_VIA);
}
/* We need to recompute the departures list. */
this->calc_tick_countdown = 0;
/* We need to redraw the button that was pressed. */
@ -459,6 +469,13 @@ public:
this->SetWidgetDirty(WID_DB_SHOW_FREIGHT);
}
if (!Twaypoint && this->departure_types_both != _settings_client.gui.departure_show_both) {
this->SetDepartureTypesDisabledState();
this->calc_tick_countdown = 0;
this->SetWidgetDirty(WID_DB_SHOW_DEPS);
this->SetWidgetDirty(WID_DB_SHOW_ARRS);
}
/* We need to redraw the scrolling text in its new position. */
this->SetWidgetDirty(WID_DB_LIST);
@ -473,7 +490,7 @@ public:
this->DeleteDeparturesList(this->arrivals);
bool show_pax = _settings_client.gui.departure_only_passengers ? true : this->show_pax;
bool show_freight = _settings_client.gui.departure_only_passengers ? false : this->show_freight;
this->departures = (this->departure_types[0] ? MakeDepartureList(this->station, this->vehicles, D_DEPARTURE, Twaypoint || this->departure_types[2], show_pax, show_freight) : new DepartureList());
this->departures = (this->departure_types[0] || _settings_client.gui.departure_show_both ? MakeDepartureList(this->station, this->vehicles, D_DEPARTURE, Twaypoint || this->departure_types[2], show_pax, show_freight) : new DepartureList());
this->arrivals = (this->departure_types[1] && !_settings_client.gui.departure_show_both ? MakeDepartureList(this->station, this->vehicles, D_ARRIVAL, false, show_pax, show_freight) : new DepartureList());
this->departures_invalid = false;
this->SetWidgetDirty(WID_DB_LIST);
@ -504,14 +521,6 @@ public:
virtual void OnPaint() override
{
if (Twaypoint || _settings_client.gui.departure_show_both) {
this->DisableWidget(WID_DB_SHOW_ARRS);
this->DisableWidget(WID_DB_SHOW_DEPS);
} else {
this->EnableWidget(WID_DB_SHOW_ARRS);
this->EnableWidget(WID_DB_SHOW_DEPS);
}
this->vscroll->SetCount(std::min<uint>(_settings_client.gui.max_departures, (uint)this->departures->size() + (uint)this->arrivals->size()));
this->DrawWidgets();
}

View File

@ -4662,7 +4662,6 @@ STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP :{BLACK}Show all
STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP :{BLACK}Show all road vehicles which have this station on their schedule
STR_STATION_VIEW_SCHEDULED_AIRCRAFT_TOOLTIP :{BLACK}Show all aircraft which have this station on their schedule
STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP :{BLACK}Show all ships which have this station on their schedule
STR_STATION_VIEW_SCHEDULED_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Ctrl+Click to show exclusively.
STR_STATION_VIEW_RENAME_STATION_CAPTION :Rename station/loading area
STR_STATION_VIEW_CLOSE_AIRPORT :{BLACK}Close airport
@ -4676,11 +4675,16 @@ STR_DEPARTURES_FREIGHT :{BLACK}{TINY_FO
STR_DEPARTURES_DEPARTURES :{BLACK}{TINY_FONT}D
STR_DEPARTURES_ARRIVALS :{BLACK}{TINY_FONT}A
STR_DEPARTURES_VIA_BUTTON :{BLACK}{TINY_FONT}via
STR_DEPARTURES_PAX_TOOLTIP :{BLACK}Show passenger departures
STR_DEPARTURES_FREIGHT_TOOLTIP :{BLACK}Show freight departures
STR_DEPARTURES_PAX_TOOLTIP :{BLACK}Show passenger arrivals/departures
STR_DEPARTURES_FREIGHT_TOOLTIP :{BLACK}Show freight arrivals/departures
STR_DEPARTURES_DEPARTURES_TOOLTIP :{BLACK}Show timetabled departures
STR_DEPARTURES_ARRIVALS_TOOLTIP :{BLACK}Show timetabled arrivals
STR_DEPARTURES_VIA_TOOLTIP :{BLACK}Show timetabled vehicles that do not stop here
STR_DEPARTURES_SHOW_TRAINS_TOOLTIP :{BLACK}Show upcoming trains on this station's timetable
STR_DEPARTURES_SHOW_ROAD_VEHICLES_TOOLTIP :{BLACK}Show upcoming road vehicles on this station's timetable
STR_DEPARTURES_SHOW_SHIPS_TOOLTIP :{BLACK}Show upcoming ships on this station's timetable
STR_DEPARTURES_SHOW_AIRCRAFT_TOOLTIP :{BLACK}Show upcoming aircraft on this station's timetable
STR_DEPARTURES_SHOW_TYPE_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Ctrl+Click to show exclusively.
STR_DEPARTURES_EMPTY :{ORANGE}No vehicles are currently timetabled for this station.
STR_DEPARTURES_NONE_SELECTED :{ORANGE}No timetable information has been requested.
STR_DEPARTURES_TIME :{ORANGE}{DATE_WALLCLOCK_TINY}
@ -4729,20 +4733,20 @@ STR_DEPARTURES_CANCELLED :{RED}Cancelled
############ config settings
STR_CONFIG_SETTING_DEPARTUREBOARDS :{ORANGE}Departure boards
STR_CONFIG_MAX_DEPARTURES :Show at most {STRING2} departures at each station
STR_CONFIG_MAX_DEPARTURES_HELPTEXT :The maximum number of departures to show on a departure board
STR_CONFIG_MAX_DEPARTURE_TIME :Show departures at most {STRING2} days in advance
STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT :How far in advance to show departures, in days
STR_CONFIG_DEPARTURE_CALC_FREQUENCY :Calculate departures every {STRING2} ticks
STR_CONFIG_DEPARTURE_CALC_FREQUENCY_HELPTEXT :How frequently to refresh a list of departures, in ticks
STR_CONFIG_DEPARTURE_VEHICLE_NAME :Show vehicle name with departures: {STRING2}
STR_CONFIG_DEPARTURE_VEHICLE_NAME_HELPTEXT :Whether to show vehicle names next to their departures
STR_CONFIG_DEPARTURE_GROUP_NAME :Show group name with departures: {STRING2}
STR_CONFIG_DEPARTURE_GROUP_NAME_HELPTEXT :Whether to show names of groups that a vehicle belongs to next to its departures
STR_CONFIG_DEPARTURE_COMPANY_NAME :Show company name with departures: {STRING2}
STR_CONFIG_DEPARTURE_COMPANY_NAME_HELPTEXT :Whether to show a company's name next to its vehicles' departures
STR_CONFIG_DEPARTURE_VEHICLE_TYPE :Show vehicle type icon with departures: {STRING2}
STR_CONFIG_DEPARTURE_VEHICLE_TYPE_HELPTEXT :Whether to show a vehicle's type as an icon next to its departures
STR_CONFIG_MAX_DEPARTURES :Show at most {STRING2} departure board entries for each station
STR_CONFIG_MAX_DEPARTURES_HELPTEXT :The maximum number of entries to show on a departure board
STR_CONFIG_MAX_DEPARTURE_TIME :Show arrivals/departures at most {STRING2} days in advance
STR_CONFIG_MAX_DEPARTURE_TIME_HELPTEXT :How far in advance to show arrivals and departures, in days
STR_CONFIG_DEPARTURE_CALC_FREQUENCY :Calculate departure board entries every {STRING2} ticks
STR_CONFIG_DEPARTURE_CALC_FREQUENCY_HELPTEXT :How frequently to refresh a list of arrivals/departures, in ticks
STR_CONFIG_DEPARTURE_VEHICLE_NAME :Show vehicle name in entries: {STRING2}
STR_CONFIG_DEPARTURE_VEHICLE_NAME_HELPTEXT :Whether to show vehicle names in their departure board entries
STR_CONFIG_DEPARTURE_GROUP_NAME :Show group name in entries: {STRING2}
STR_CONFIG_DEPARTURE_GROUP_NAME_HELPTEXT :Whether to show names of groups that a vehicle belongs to in its departure board entries
STR_CONFIG_DEPARTURE_COMPANY_NAME :Show company name in entries: {STRING2}
STR_CONFIG_DEPARTURE_COMPANY_NAME_HELPTEXT :Whether to show a company's name in its vehicles' departure board entries
STR_CONFIG_DEPARTURE_VEHICLE_TYPE :Show vehicle type icon in entries: {STRING2}
STR_CONFIG_DEPARTURE_VEHICLE_TYPE_HELPTEXT :Whether to show a vehicle's type as an icon in its departure board entries
STR_CONFIG_DEPARTURE_VEHICLE_COLOR :Show vehicle type icon in silver: {STRING2}
STR_CONFIG_DEPARTURE_VEHICLE_COLOR_HELPTEXT :Whether to show vehicle type icons in silver
STR_CONFIG_DEPARTURE_LARGER_FONT :Use larger font for stations called at on departure boards: {STRING2}
@ -4750,20 +4754,20 @@ STR_CONFIG_DEPARTURE_LARGER_FONT_HELPTEXT :Whether to use
STR_CONFIG_DEPARTURE_DESTINATION_TYPE :Show icons for destinations that are docks or airports: {STRING2}
STR_CONFIG_DEPARTURE_DESTINATION_TYPE_HELPTEXT :Whether to show icons next to destinations that are docks or airports
STR_CONFIG_DEPARTURE_SHOW_BOTH :Show arrival and departure times on the same line: {STRING2}
STR_CONFIG_DEPARTURE_SHOW_BOTH_HELPTEXT :Whether to show both arrival and departure times next to departures
STR_CONFIG_DEPARTURE_ONLY_PASSENGERS :Only show departures for vehicles that can carry passengers: {STRING2}
STR_CONFIG_DEPARTURE_ONLY_PASSENGERS_HELPTEXT :Whether to only show departures of vehicles that can carry passengers
STR_CONFIG_DEPARTURE_SHOW_BOTH_HELPTEXT :Whether arrival and departure times for a vehicle are combined into a single entry instead of being listed separately
STR_CONFIG_DEPARTURE_ONLY_PASSENGERS :Only show entries for vehicles that can carry passengers: {STRING2}
STR_CONFIG_DEPARTURE_ONLY_PASSENGERS_HELPTEXT :Whether to only show arrivals and departures of vehicles that can carry passengers
STR_CONFIG_DEPARTURE_SMART_TERMINUS :Don't show termini that can be reached sooner on a later vehicle: {STRING2}
STR_CONFIG_DEPARTURE_SMART_TERMINUS_HELPTEXT :Whether to show termini that can be reached sooner on another vehicle that departs later
STR_CONFIG_DEPARTURE_CONDITIONALS :Handle conditional order jumps by: {STRING2}
STR_CONFIG_DEPARTURE_CONDITIONALS_HELPTEXT :How conditional orders should be dealt with when calculating departures
STR_CONFIG_DEPARTURE_CONDITIONALS_HELPTEXT :How conditional orders should be dealt with when calculating departure board entries
STR_CONFIG_DEPARTURE_CONDITIONALS_1 :giving up
STR_CONFIG_DEPARTURE_CONDITIONALS_2 :assuming they will be taken
STR_CONFIG_DEPARTURE_CONDITIONALS_3 :assuming they will not be taken
STR_CONFIG_DEPARTURE_SHOW_ALL_STOPS :Show all stations called at regardless of loading/unloading: {STRING2}
STR_CONFIG_DEPARTURE_SHOW_ALL_STOPS_HELPTEXT :Whether stations that a vehicle only loads from will be shown in the calling at list
STR_CONFIG_DEPARTURE_MERGE_IDENTICAL :Merge identical departures: {STRING2}
STR_CONFIG_DEPARTURE_MERGE_IDENTICAL_HELPTEXT :Whether identical departures should be merged into a single departure
STR_CONFIG_DEPARTURE_MERGE_IDENTICAL :Merge identical entries: {STRING2}
STR_CONFIG_DEPARTURE_MERGE_IDENTICAL_HELPTEXT :Whether identical departure board entries should be merged into a single one
# Waypoint/buoy view window
STR_WAYPOINT_VIEW_CAPTION :{WHITE}{WAYPOINT}

View File

@ -6398,7 +6398,6 @@ STR_STATION_VIEW_DEPARTURES_BUTTON :{BLACK}Saídas
STR_STATION_VIEW_DEPARTURES_TOOLTIP :{BLACK}Amosa a lista das saídas programadas
STR_STATION_VIEW_HISTORY_BUTTON :{BLACK}Historial
STR_STATION_VIEW_HISTORY_TOOLTIP :{BLACK}Amosa o historial de carga a espera
STR_STATION_VIEW_SCHEDULED_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Ctrl+Click para amosar exclusivamente
STR_DEPARTURES_CAPTION :{WHITE}{STATION} Informaciónd a viaxe en directo
STR_DEPARTURES_CAPTION_WAYPOINT :{WHITE}{WAYPOINT} Informaciónd a viaxe en directo
STR_DEPARTURES_PAX :{BLACK}{TINY_FONT}P
@ -6411,6 +6410,7 @@ STR_DEPARTURES_ARRIVALS :{BLACK}{TINY_FO
STR_DEPARTURES_ARRIVALS_TOOLTIP :{BLACK}Amosar as chegadas programadas
STR_DEPARTURES_VIA_BUTTON :{BLACK}{TINY_FONT}vía
STR_DEPARTURES_VIA_TOOLTIP :{BLACK}Amosar os vehículos programados que non paran aqui
STR_DEPARTURES_SHOW_TYPE_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Ctrl+Click para amosar exclusivamente
STR_DEPARTURES_EMPTY :{ORANGE}Non hai vehículos actualmente programados para esta estación
STR_DEPARTURES_NONE_SELECTED :{ORANGE}Non se solicitou información dos horarios
STR_DEPARTURES_TIME :{ORANGE}{DATE_WALLCLOCK_TINY}

View File

@ -4583,7 +4583,6 @@ STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP :{BLACK}Alle Zü
STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP :{BLACK}Alle Straßenfahrzeuge, die diese Station anfahren, anzeigen
STR_STATION_VIEW_SCHEDULED_AIRCRAFT_TOOLTIP :{BLACK}Alle Flugzeuge, die diesen Flughafen anfliegen, anzeigen
STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP :{BLACK}Alle Schiffe, die diesen Hafen ansteuern, anzeigen
STR_STATION_VIEW_SCHEDULED_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Strg+Klick zur exklusiven Anzeige.
STR_STATION_VIEW_RENAME_STATION_CAPTION :Station/Ladeplatz umbenennen
STR_STATION_VIEW_CLOSE_AIRPORT :{BLACK}Flughafen schließen
@ -4602,6 +4601,7 @@ STR_DEPARTURES_FREIGHT_TOOLTIP :{BLACK}Zeige Fr
STR_DEPARTURES_DEPARTURES_TOOLTIP :{BLACK}Zeige geplante Abfahrten
STR_DEPARTURES_ARRIVALS_TOOLTIP :{BLACK}Zeige geplante Ankünfte
STR_DEPARTURES_VIA_TOOLTIP :{BLACK}Zeige geplante Durchfahrten (halten nicht an)
STR_DEPARTURES_SHOW_TYPE_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. Strg+Klick zur exklusiven Anzeige.
STR_DEPARTURES_EMPTY :{ORANGE}Aktuell sind für diese Station keine Fahrzeuge geplant.
STR_DEPARTURES_NONE_SELECTED :{ORANGE}Es wurde keine Fahrplanauskunft angefordert.
STR_DEPARTURES_TIME :{ORANGE}{DATE_WALLCLOCK_TINY}

View File

@ -4663,7 +4663,6 @@ STR_STATION_VIEW_SCHEDULED_TRAINS_TOOLTIP :{BLACK}이 역
STR_STATION_VIEW_SCHEDULED_ROAD_VEHICLES_TOOLTIP :{BLACK}이 역을 거쳐가는 모든 차량을 보여줍니다
STR_STATION_VIEW_SCHEDULED_AIRCRAFT_TOOLTIP :{BLACK}이 역을 거쳐가는 모든 항공기를 보여줍니다
STR_STATION_VIEW_SCHEDULED_SHIPS_TOOLTIP :{BLACK}이 역을 거쳐가는 모든 선박을 보여줍니다
STR_STATION_VIEW_SCHEDULED_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. CTRL+클릭하면 이 차량 종류만 보여줍니다
STR_STATION_VIEW_RENAME_STATION_CAPTION :이 역의 이름을 변경합니다
STR_STATION_VIEW_CLOSE_AIRPORT :{BLACK}공항 폐쇄
@ -4682,6 +4681,7 @@ STR_DEPARTURES_FREIGHT_TOOLTIP :{BLACK}화물
STR_DEPARTURES_DEPARTURES_TOOLTIP :{BLACK}도착 시간 보이기
STR_DEPARTURES_ARRIVALS_TOOLTIP :{BLACK}출발 시간 보이기
STR_DEPARTURES_VIA_TOOLTIP :{BLACK}통과 열차 보이기
STR_DEPARTURES_SHOW_TYPE_TOOLTIP_CTRL_SUFFIX :{BLACK}{STRING}. CTRL+클릭하면 이 차량 종류만 보여줍니다
STR_DEPARTURES_EMPTY :{ORANGE}시간표가 지정된 차량이 없습니다.
STR_DEPARTURES_NONE_SELECTED :{ORANGE}표시할 정보를 선택하십시오.
STR_DEPARTURES_TIME :{ORANGE}{DATE_WALLCLOCK_TINY}