| 1951 | } |
| 1952 | |
| 1953 | void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override |
| 1954 | { |
| 1955 | Window *w = FindWindowByClass(WC_QUERY_STRING); |
| 1956 | |
| 1957 | switch (widget) { |
| 1958 | case WID_SV_WAITING: |
| 1959 | this->HandleCargoWaitingClick(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_SV_WAITING, WidgetDimensions::scaled.framerect.top) - this->vscroll->GetPosition()); |
| 1960 | break; |
| 1961 | |
| 1962 | case WID_SV_CATCHMENT: |
| 1963 | SetViewportCatchmentStation(Station::Get(this->window_number), !this->IsWidgetLowered(WID_SV_CATCHMENT)); |
| 1964 | |
| 1965 | if (w != nullptr && this->IsWidgetLowered(WID_SV_CATCHMENT)) { |
| 1966 | if (w->parent->window_class == WC_STATION_VIEW && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportStationRect(Station::Get(w->parent->window_number), true); |
| 1967 | if (w->parent->window_class == WC_WAYPOINT_VIEW && w->IsWidgetLowered(WID_QS_MOVE)) SetViewportWaypointRect(Waypoint::Get(w->parent->window_number), true); |
| 1968 | } |
| 1969 | break; |
| 1970 | |
| 1971 | case WID_SV_LOCATION: |
| 1972 | if (_ctrl_pressed) { |
| 1973 | ShowExtraViewportWindow(Station::Get(this->window_number)->xy); |
| 1974 | } else { |
| 1975 | ScrollMainWindowToTile(Station::Get(this->window_number)->xy); |
| 1976 | } |
| 1977 | break; |
| 1978 | |
| 1979 | case WID_SV_ACCEPTS_RATINGS: { |
| 1980 | /* Swap between 'accepts' and 'ratings' view. */ |
| 1981 | int height_change; |
| 1982 | NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS); |
| 1983 | if (this->GetWidget<NWidgetCore>(WID_SV_ACCEPTS_RATINGS)->GetString() == STR_STATION_VIEW_RATINGS_BUTTON) { |
| 1984 | nwi->SetStringTip(STR_STATION_VIEW_ACCEPTS_BUTTON, STR_STATION_VIEW_ACCEPTS_TOOLTIP); // Switch to accepts view. |
| 1985 | height_change = this->rating_lines - this->accepts_lines; |
| 1986 | } else { |
| 1987 | nwi->SetStringTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP); // Switch to ratings view. |
| 1988 | height_change = this->accepts_lines - this->rating_lines; |
| 1989 | } |
| 1990 | this->ReInit(0, height_change * GetCharacterHeight(FS_NORMAL)); |
| 1991 | break; |
| 1992 | } |
| 1993 | |
| 1994 | case WID_SV_RENAME: |
| 1995 | ShowQueryString(GetString(STR_STATION_NAME, this->window_number), STR_STATION_VIEW_EDIT_STATION_SIGN, MAX_LENGTH_STATION_NAME_CHARS, |
| 1996 | this, CS_ALPHANUMERAL, {QueryStringFlag::EnableDefault, QueryStringFlag::LengthIsInChars, QueryStringFlag::EnableMove}); |
| 1997 | break; |
| 1998 | |
| 1999 | case WID_SV_CLOSE_AIRPORT: |
| 2000 | Command<CMD_OPEN_CLOSE_AIRPORT>::Post(this->window_number); |
| 2001 | break; |
| 2002 | |
| 2003 | case WID_SV_TRAINS: // Show list of scheduled trains to this station |
| 2004 | case WID_SV_ROADVEHS: // Show list of scheduled road-vehicles to this station |
| 2005 | case WID_SV_SHIPS: // Show list of scheduled ships to this station |
| 2006 | case WID_SV_PLANES: { // Show list of scheduled aircraft to this station |
| 2007 | Owner owner = Station::Get(this->window_number)->owner; |
| 2008 | ShowVehicleListWindow(owner, (VehicleType)(widget - WID_SV_TRAINS), static_cast<StationID>(this->window_number)); |
| 2009 | break; |
| 2010 | } |
nothing calls this directly
no test coverage detected