2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file airport_gui.cpp The GUI for airports. */
11 #include "window_gui.h"
12 #include "station_gui.h"
13 #include "terraform_gui.h"
14 #include "sound_func.h"
15 #include "window_func.h"
16 #include "strings_func.h"
17 #include "viewport_func.h"
18 #include "company_func.h"
19 #include "tilehighlight_func.h"
20 #include "company_base.h"
21 #include "station_type.h"
22 #include "newgrf_airport.h"
23 #include "newgrf_callbacks.h"
24 #include "widgets/dropdown_type.h"
25 #include "core/geometry_func.hpp"
27 #include "vehicle_func.h"
30 #include "widgets/airport_widget.h"
32 #include "safeguards.h"
35 static AirportClassID _selected_airport_class
; ///< the currently visible airport class
36 static int _selected_airport_index
; ///< the index of the selected airport in the current class or -1
37 static byte _selected_airport_layout
; ///< selected airport layout number.
39 static void ShowBuildAirportPicker(Window
*parent
);
41 SpriteID
GetCustomAirportSprite(const AirportSpec
*as
, byte layout
);
43 void CcBuildAirport(const CommandCost
&result
, TileIndex tile
, uint32 p1
, uint32 p2
, uint32 cmd
)
45 if (result
.Failed()) return;
47 if (_settings_client
.sound
.confirm
) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER
, tile
);
48 if (!_settings_client
.gui
.persistent_buildingtools
) ResetObjectToPlace();
53 * @param tile Position to put the new airport.
55 static void PlaceAirport(TileIndex tile
)
57 if (_selected_airport_index
== -1) return;
58 uint32 p2
= _ctrl_pressed
;
59 SB(p2
, 16, 16, INVALID_STATION
); // no station to join
61 uint32 p1
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
)->GetIndex();
62 p1
|= _selected_airport_layout
<< 8;
63 CommandContainer cmdcont
= { tile
, p1
, p2
, CMD_BUILD_AIRPORT
| CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE
), CcBuildAirport
, "" };
64 ShowSelectStationIfNeeded(cmdcont
, TileArea(tile
, _thd
.size
.x
/ TILE_SIZE
, _thd
.size
.y
/ TILE_SIZE
));
67 /** Airport build toolbar window handler. */
68 struct BuildAirToolbarWindow
: Window
{
69 int last_user_action
; // Last started user action.
71 BuildAirToolbarWindow(WindowDesc
*desc
, WindowNumber window_number
) : Window(desc
)
73 this->InitNested(window_number
);
74 this->OnInvalidateData();
75 if (_settings_client
.gui
.link_terraform_toolbar
) ShowTerraformToolbar(this);
76 this->last_user_action
= WIDGET_LIST_END
;
79 ~BuildAirToolbarWindow()
81 if (this->IsWidgetLowered(WID_AT_AIRPORT
)) SetViewportCatchmentStation(nullptr, true);
82 if (_settings_client
.gui
.link_terraform_toolbar
) DeleteWindowById(WC_SCEN_LAND_GEN
, 0, false);
86 * Some data on this window has become invalid.
87 * @param data Information about the changed data.
88 * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
90 void OnInvalidateData(int data
= 0, bool gui_scope
= true) override
92 if (!gui_scope
) return;
94 bool can_build
= CanBuildVehicleInfrastructure(VEH_AIRCRAFT
);
95 this->SetWidgetsDisabledState(!can_build
,
99 DeleteWindowById(WC_BUILD_STATION
, TRANSPORT_AIR
);
101 /* Show in the tooltip why this button is disabled. */
102 this->GetWidget
<NWidgetCore
>(WID_AT_AIRPORT
)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE
);
104 this->GetWidget
<NWidgetCore
>(WID_AT_AIRPORT
)->SetToolTip(STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP
);
108 void OnClick(Point pt
, int widget
, int click_count
) override
112 if (HandlePlacePushButton(this, WID_AT_AIRPORT
, SPR_CURSOR_AIRPORT
, HT_RECT
)) {
113 ShowBuildAirportPicker(this);
114 this->last_user_action
= widget
;
118 case WID_AT_DEMOLISH
:
119 HandlePlacePushButton(this, WID_AT_DEMOLISH
, ANIMCURSOR_DEMOLISH
, HT_RECT
| HT_DIAGONAL
);
120 this->last_user_action
= widget
;
128 void OnPlaceObject(Point pt
, TileIndex tile
) override
130 switch (this->last_user_action
) {
135 case WID_AT_DEMOLISH
:
136 PlaceProc_DemolishArea(tile
);
139 default: NOT_REACHED();
143 void OnPlaceDrag(ViewportPlaceMethod select_method
, ViewportDragDropSelectionProcess select_proc
, Point pt
) override
145 VpSelectTilesWithMethod(pt
.x
, pt
.y
, select_method
);
148 void OnPlaceMouseUp(ViewportPlaceMethod select_method
, ViewportDragDropSelectionProcess select_proc
, Point pt
, TileIndex start_tile
, TileIndex end_tile
) override
150 if (pt
.x
!= -1 && select_proc
== DDSP_DEMOLISH_AREA
) {
151 GUIPlaceProcDragXY(select_proc
, start_tile
, end_tile
);
155 void OnPlaceObjectAbort() override
157 if (this->IsWidgetLowered(WID_AT_AIRPORT
)) SetViewportCatchmentStation(nullptr, true);
159 this->RaiseButtons();
161 DeleteWindowById(WC_BUILD_STATION
, TRANSPORT_AIR
);
162 DeleteWindowById(WC_SELECT_STATION
, 0);
165 static HotkeyList hotkeys
;
169 * Handler for global hotkeys of the BuildAirToolbarWindow.
170 * @param hotkey Hotkey
171 * @return ES_HANDLED if hotkey was accepted.
173 static EventState
AirportToolbarGlobalHotkeys(int hotkey
)
175 if (_game_mode
!= GM_NORMAL
) return ES_NOT_HANDLED
;
176 Window
*w
= ShowBuildAirToolbar();
177 if (w
== nullptr) return ES_NOT_HANDLED
;
178 return w
->OnHotkey(hotkey
);
181 static Hotkey airtoolbar_hotkeys
[] = {
182 Hotkey('1', "airport", WID_AT_AIRPORT
),
183 Hotkey('2', "demolish", WID_AT_DEMOLISH
),
186 HotkeyList
BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys
, AirportToolbarGlobalHotkeys
);
188 static const NWidgetPart _nested_air_toolbar_widgets
[] = {
189 NWidget(NWID_HORIZONTAL
),
190 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
191 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
192 NWidget(WWT_STICKYBOX
, COLOUR_DARK_GREEN
),
194 NWidget(NWID_HORIZONTAL
),
195 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, WID_AT_AIRPORT
), SetFill(0, 1), SetMinimalSize(42, 22), SetDataTip(SPR_IMG_AIRPORT
, STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP
),
196 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
197 NWidget(WWT_IMGBTN
, COLOUR_DARK_GREEN
, WID_AT_DEMOLISH
), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE
, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC
),
201 static WindowDesc
_air_toolbar_desc(
202 WDP_ALIGN_TOOLBAR
, "toolbar_air", 0, 0,
203 WC_BUILD_TOOLBAR
, WC_NONE
,
205 _nested_air_toolbar_widgets
, lengthof(_nested_air_toolbar_widgets
),
206 &BuildAirToolbarWindow::hotkeys
210 * Open the build airport toolbar window
212 * If the terraform toolbar is linked to the toolbar, that window is also opened.
214 * @return newly opened airport toolbar, or nullptr if the toolbar could not be opened.
216 Window
*ShowBuildAirToolbar()
218 if (!Company::IsValidID(_local_company
)) return nullptr;
220 DeleteWindowByClass(WC_BUILD_TOOLBAR
);
221 return AllocateWindowDescFront
<BuildAirToolbarWindow
>(&_air_toolbar_desc
, TRANSPORT_AIR
);
224 class BuildAirportWindow
: public PickerWindowBase
{
225 SpriteID preview_sprite
; ///< Cached airport preview sprite.
229 /** Build a dropdown list of available airport classes */
230 static DropDownList
BuildAirportClassDropDown()
234 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
235 list
.emplace_back(new DropDownListStringItem(AirportClass::Get((AirportClassID
)i
)->name
, i
, false));
242 BuildAirportWindow(WindowDesc
*desc
, Window
*parent
) : PickerWindowBase(desc
, parent
)
244 this->CreateNestedTree();
246 this->vscroll
= this->GetScrollbar(WID_AP_SCROLLBAR
);
247 this->vscroll
->SetCapacity(5);
248 this->vscroll
->SetPosition(0);
250 this->FinishInitNested(TRANSPORT_AIR
);
252 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
253 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
254 this->OnInvalidateData();
256 /* Ensure airport class is valid (changing NewGRFs). */
257 _selected_airport_class
= Clamp(_selected_airport_class
, APC_BEGIN
, (AirportClassID
)(AirportClass::GetClassCount() - 1));
258 const AirportClass
*ac
= AirportClass::Get(_selected_airport_class
);
259 this->vscroll
->SetCount(ac
->GetSpecCount());
261 /* Ensure the airport index is valid for this class (changing NewGRFs). */
262 _selected_airport_index
= Clamp(_selected_airport_index
, -1, ac
->GetSpecCount() - 1);
264 /* Only when no valid airport was selected, we want to select the first airport. */
265 bool selectFirstAirport
= true;
266 if (_selected_airport_index
!= -1) {
267 const AirportSpec
*as
= ac
->GetSpec(_selected_airport_index
);
268 if (as
->IsAvailable()) {
269 /* Ensure the airport layout is valid. */
270 _selected_airport_layout
= Clamp(_selected_airport_layout
, 0, as
->num_table
- 1);
271 selectFirstAirport
= false;
272 this->UpdateSelectSize();
276 if (selectFirstAirport
) this->SelectFirstAvailableAirport(true);
279 virtual ~BuildAirportWindow()
281 DeleteWindowById(WC_SELECT_STATION
, 0);
284 void SetStringParameters(int widget
) const override
287 case WID_AP_CLASS_DROPDOWN
:
288 SetDParam(0, AirportClass::Get(_selected_airport_class
)->name
);
291 case WID_AP_LAYOUT_NUM
:
292 SetDParam(0, STR_EMPTY
);
293 if (_selected_airport_index
!= -1) {
294 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
295 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_LAYOUT_NAME
);
296 if (string
!= STR_UNDEFINED
) {
297 SetDParam(0, string
);
298 } else if (as
->num_table
> 1) {
299 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME
);
300 SetDParam(1, _selected_airport_layout
+ 1);
309 void UpdateWidgetSize(int widget
, Dimension
*size
, const Dimension
&padding
, Dimension
*fill
, Dimension
*resize
) override
312 case WID_AP_CLASS_DROPDOWN
: {
313 Dimension d
= {0, 0};
314 for (uint i
= 0; i
< AirportClass::GetClassCount(); i
++) {
315 SetDParam(0, AirportClass::Get((AirportClassID
)i
)->name
);
316 d
= maxdim(d
, GetStringBoundingBox(STR_BLACK_STRING
));
318 d
.width
+= padding
.width
;
319 d
.height
+= padding
.height
;
320 *size
= maxdim(*size
, d
);
324 case WID_AP_AIRPORT_LIST
: {
325 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
326 const AirportSpec
*as
= AirportSpec::Get(i
);
327 if (!as
->enabled
) continue;
329 size
->width
= std::max(size
->width
, GetStringBoundingBox(as
->name
).width
);
332 this->line_height
= FONT_HEIGHT_NORMAL
+ WD_MATRIX_TOP
+ WD_MATRIX_BOTTOM
;
333 size
->height
= 5 * this->line_height
;
337 case WID_AP_AIRPORT_SPRITE
:
338 for (int i
= 0; i
< NUM_AIRPORTS
; i
++) {
339 const AirportSpec
*as
= AirportSpec::Get(i
);
340 if (!as
->enabled
) continue;
341 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
342 SpriteID sprite
= GetCustomAirportSprite(as
, layout
);
344 Dimension d
= GetSpriteSize(sprite
);
345 d
.width
+= WD_FRAMERECT_LEFT
+ WD_FRAMERECT_RIGHT
;
346 d
.height
+= WD_FRAMERECT_TOP
+ WD_FRAMERECT_BOTTOM
;
347 *size
= maxdim(d
, *size
);
353 case WID_AP_EXTRA_TEXT
:
354 for (int i
= NEW_AIRPORT_OFFSET
; i
< NUM_AIRPORTS
; i
++) {
355 const AirportSpec
*as
= AirportSpec::Get(i
);
356 if (!as
->enabled
) continue;
357 for (byte layout
= 0; layout
< as
->num_table
; layout
++) {
358 StringID string
= GetAirportTextCallback(as
, layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
359 if (string
== STR_UNDEFINED
) continue;
361 /* STR_BLACK_STRING is used to start the string with {BLACK} */
362 SetDParam(0, string
);
363 Dimension d
= GetStringMultiLineBoundingBox(STR_BLACK_STRING
, *size
);
364 *size
= maxdim(d
, *size
);
373 void DrawWidget(const Rect
&r
, int widget
) const override
376 case WID_AP_AIRPORT_LIST
: {
378 AirportClass
*apclass
= AirportClass::Get(_selected_airport_class
);
379 for (uint i
= this->vscroll
->GetPosition(); this->vscroll
->IsVisible(i
) && i
< apclass
->GetSpecCount(); i
++) {
380 const AirportSpec
*as
= apclass
->GetSpec(i
);
381 if (!as
->IsAvailable()) {
382 GfxFillRect(r
.left
+ 1, y
+ 1, r
.right
- 1, y
+ this->line_height
- 2, PC_BLACK
, FILLRECT_CHECKER
);
384 DrawString(r
.left
+ WD_MATRIX_LEFT
, r
.right
- WD_MATRIX_RIGHT
, y
+ WD_MATRIX_TOP
, as
->name
, ((int)i
== _selected_airport_index
) ? TC_WHITE
: TC_BLACK
);
385 y
+= this->line_height
;
390 case WID_AP_AIRPORT_SPRITE
:
391 if (this->preview_sprite
!= 0) {
392 Dimension d
= GetSpriteSize(this->preview_sprite
);
393 DrawSprite(this->preview_sprite
, COMPANY_SPRITE_COLOUR(_local_company
), (r
.left
+ r
.right
- d
.width
) / 2, (r
.top
+ r
.bottom
- d
.height
) / 2);
397 case WID_AP_EXTRA_TEXT
:
398 if (_selected_airport_index
!= -1) {
399 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
400 StringID string
= GetAirportTextCallback(as
, _selected_airport_layout
, CBID_AIRPORT_ADDITIONAL_TEXT
);
401 if (string
!= STR_UNDEFINED
) {
402 SetDParam(0, string
);
403 DrawStringMultiLine(r
.left
, r
.right
, r
.top
, r
.bottom
, STR_BLACK_STRING
);
410 void OnPaint() override
414 uint16 top
= this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->pos_y
+ this->GetWidget
<NWidgetBase
>(WID_AP_BTN_DOHILIGHT
)->current_y
+ WD_PAR_VSEP_NORMAL
;
415 NWidgetBase
*panel_nwi
= this->GetWidget
<NWidgetBase
>(WID_AP_BOTTOMPANEL
);
417 int right
= panel_nwi
->pos_x
+ panel_nwi
->current_x
;
418 int bottom
= panel_nwi
->pos_y
+ panel_nwi
->current_y
;
420 if (_selected_airport_index
!= -1) {
421 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
422 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
424 /* only show the station (airport) noise, if the noise option is activated */
425 if (_settings_game
.economy
.station_noise_level
) {
426 /* show the noise of the selected airport */
427 SetDParam(0, as
->noise_level
);
428 DrawString(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, STR_STATION_BUILD_NOISE
);
429 top
+= FONT_HEIGHT_NORMAL
+ WD_PAR_VSEP_NORMAL
;
432 /* strings such as 'Size' and 'Coverage Area' */
433 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, false) + WD_PAR_VSEP_NORMAL
;
434 top
= DrawStationCoverageAreaText(panel_nwi
->pos_x
+ WD_FRAMERECT_LEFT
, right
- WD_FRAMERECT_RIGHT
, top
, SCT_ALL
, rad
, true) + WD_PAR_VSEP_NORMAL
;
437 /* Resize background if the window is too small.
438 * Never make the window smaller to avoid oscillating if the size change affects the acceptance.
439 * (This is the case, if making the window bigger moves the mouse into the window.) */
441 ResizeWindow(this, 0, top
- bottom
, false);
445 void SelectOtherAirport(int airport_index
)
447 _selected_airport_index
= airport_index
;
448 _selected_airport_layout
= 0;
450 this->UpdateSelectSize();
454 void UpdateSelectSize()
456 if (_selected_airport_index
== -1) {
457 SetTileSelectSize(1, 1);
458 this->DisableWidget(WID_AP_LAYOUT_DECREASE
);
459 this->DisableWidget(WID_AP_LAYOUT_INCREASE
);
461 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(_selected_airport_index
);
464 Direction rotation
= as
->rotation
[_selected_airport_layout
];
465 if (rotation
== DIR_E
|| rotation
== DIR_W
) Swap(w
, h
);
466 SetTileSelectSize(w
, h
);
468 this->preview_sprite
= GetCustomAirportSprite(as
, _selected_airport_layout
);
470 this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE
, _selected_airport_layout
== 0);
471 this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE
, _selected_airport_layout
+ 1 >= as
->num_table
);
473 int rad
= _settings_game
.station
.modified_catchment
? as
->catchment
: (uint
)CA_UNMODIFIED
;
474 if (_settings_client
.gui
.station_show_coverage
) SetTileSelectBigSize(-rad
, -rad
, 2 * rad
, 2 * rad
);
478 void OnClick(Point pt
, int widget
, int click_count
) override
481 case WID_AP_CLASS_DROPDOWN
:
482 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class
, WID_AP_CLASS_DROPDOWN
);
485 case WID_AP_AIRPORT_LIST
: {
486 int num_clicked
= this->vscroll
->GetPosition() + (pt
.y
- this->nested_array
[widget
]->pos_y
) / this->line_height
;
487 if (num_clicked
>= this->vscroll
->GetCount()) break;
488 const AirportSpec
*as
= AirportClass::Get(_selected_airport_class
)->GetSpec(num_clicked
);
489 if (as
->IsAvailable()) this->SelectOtherAirport(num_clicked
);
493 case WID_AP_BTN_DONTHILIGHT
: case WID_AP_BTN_DOHILIGHT
:
494 _settings_client
.gui
.station_show_coverage
= (widget
!= WID_AP_BTN_DONTHILIGHT
);
495 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT
, !_settings_client
.gui
.station_show_coverage
);
496 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT
, _settings_client
.gui
.station_show_coverage
);
498 if (_settings_client
.sound
.click_beep
) SndPlayFx(SND_15_BEEP
);
499 this->UpdateSelectSize();
500 SetViewportCatchmentStation(nullptr, true);
503 case WID_AP_LAYOUT_DECREASE
:
504 _selected_airport_layout
--;
505 this->UpdateSelectSize();
509 case WID_AP_LAYOUT_INCREASE
:
510 _selected_airport_layout
++;
511 this->UpdateSelectSize();
518 * Select the first available airport.
519 * @param change_class If true, change the class if no airport in the current
520 * class is available.
522 void SelectFirstAvailableAirport(bool change_class
)
524 /* First try to select an airport in the selected class. */
525 AirportClass
*sel_apclass
= AirportClass::Get(_selected_airport_class
);
526 for (uint i
= 0; i
< sel_apclass
->GetSpecCount(); i
++) {
527 const AirportSpec
*as
= sel_apclass
->GetSpec(i
);
528 if (as
->IsAvailable()) {
529 this->SelectOtherAirport(i
);
534 /* If that fails, select the first available airport
535 * from a random class. */
536 for (AirportClassID j
= APC_BEGIN
; j
< APC_MAX
; j
++) {
537 AirportClass
*apclass
= AirportClass::Get(j
);
538 for (uint i
= 0; i
< apclass
->GetSpecCount(); i
++) {
539 const AirportSpec
*as
= apclass
->GetSpec(i
);
540 if (as
->IsAvailable()) {
541 _selected_airport_class
= j
;
542 this->SelectOtherAirport(i
);
548 /* If all airports are unavailable, select nothing. */
549 this->SelectOtherAirport(-1);
552 void OnDropdownSelect(int widget
, int index
) override
554 assert(widget
== WID_AP_CLASS_DROPDOWN
);
555 _selected_airport_class
= (AirportClassID
)index
;
556 this->vscroll
->SetCount(AirportClass::Get(_selected_airport_class
)->GetSpecCount());
557 this->SelectFirstAvailableAirport(false);
560 void OnRealtimeTick(uint delta_ms
) override
562 CheckRedrawStationCoverage(this);
566 static const NWidgetPart _nested_build_airport_widgets
[] = {
567 NWidget(NWID_HORIZONTAL
),
568 NWidget(WWT_CLOSEBOX
, COLOUR_DARK_GREEN
),
569 NWidget(WWT_CAPTION
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION
, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS
),
571 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
), SetFill(1, 0), SetPIP(2, 0, 2),
572 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL
, STR_NULL
), SetFill(1, 0),
573 NWidget(WWT_DROPDOWN
, COLOUR_GREY
, WID_AP_CLASS_DROPDOWN
), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_STATION_BUILD_AIRPORT_TOOLTIP
),
574 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_AIRPORT_SPRITE
), SetFill(1, 0),
575 NWidget(NWID_HORIZONTAL
),
576 NWidget(WWT_MATRIX
, COLOUR_GREY
, WID_AP_AIRPORT_LIST
), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP
), SetScrollbar(WID_AP_SCROLLBAR
),
577 NWidget(NWID_VSCROLLBAR
, COLOUR_GREY
, WID_AP_SCROLLBAR
),
579 NWidget(NWID_HORIZONTAL
),
580 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_DECREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE
, STR_NULL
),
581 NWidget(WWT_LABEL
, COLOUR_GREY
, WID_AP_LAYOUT_NUM
), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING
, STR_NULL
),
582 NWidget(WWT_PUSHARROWBTN
, COLOUR_GREY
, WID_AP_LAYOUT_INCREASE
), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE
, STR_NULL
),
584 NWidget(WWT_EMPTY
, COLOUR_DARK_GREEN
, WID_AP_EXTRA_TEXT
), SetFill(1, 0), SetMinimalSize(150, 0),
587 NWidget(WWT_PANEL
, COLOUR_DARK_GREEN
, WID_AP_BOTTOMPANEL
), SetPIP(2, 2, 2),
588 NWidget(WWT_LABEL
, COLOUR_DARK_GREEN
), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE
, STR_NULL
), SetFill(1, 0),
589 NWidget(NWID_HORIZONTAL
),
590 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
591 NWidget(NWID_HORIZONTAL
, NC_EQUALSIZE
),
592 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DONTHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
593 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF
, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP
),
594 NWidget(WWT_TEXTBTN
, COLOUR_GREY
, WID_AP_BTN_DOHILIGHT
), SetMinimalSize(60, 12), SetFill(1, 0),
595 SetDataTip(STR_STATION_BUILD_COVERAGE_ON
, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP
),
597 NWidget(NWID_SPACER
), SetMinimalSize(14, 0), SetFill(1, 0),
599 NWidget(NWID_SPACER
), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
603 static WindowDesc
_build_airport_desc(
604 WDP_AUTO
, "build_station_air", 0, 0,
605 WC_BUILD_STATION
, WC_BUILD_TOOLBAR
,
607 _nested_build_airport_widgets
, lengthof(_nested_build_airport_widgets
)
610 static void ShowBuildAirportPicker(Window
*parent
)
612 new BuildAirportWindow(&_build_airport_desc
, parent
);
615 void InitializeAirportGui()
617 _selected_airport_class
= APC_BEGIN
;
618 _selected_airport_index
= -1;