00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "stdafx.h"
00013 #include "window_gui.h"
00014 #include "station_gui.h"
00015 #include "terraform_gui.h"
00016 #include "sound_func.h"
00017 #include "window_func.h"
00018 #include "strings_func.h"
00019 #include "viewport_func.h"
00020 #include "company_func.h"
00021 #include "tilehighlight_func.h"
00022 #include "company_base.h"
00023 #include "station_type.h"
00024 #include "newgrf_airport.h"
00025 #include "newgrf_callbacks.h"
00026 #include "widgets/dropdown_type.h"
00027 #include "core/geometry_func.hpp"
00028 #include "hotkeys.h"
00029 #include "vehicle_func.h"
00030 #include "gui.h"
00031
00032 #include "widgets/airport_widget.h"
00033
00034
00035 static AirportClassID _selected_airport_class;
00036 static int _selected_airport_index;
00037 static byte _selected_airport_layout;
00038
00039 static void ShowBuildAirportPicker(Window *parent);
00040
00041 SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
00042
00043 void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
00044 {
00045 if (result.Failed()) return;
00046
00047 if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
00048 if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
00049 }
00050
00055 static void PlaceAirport(TileIndex tile)
00056 {
00057 if (_selected_airport_index == -1) return;
00058 uint32 p2 = _ctrl_pressed;
00059 SB(p2, 16, 16, INVALID_STATION);
00060
00061 uint32 p1 = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
00062 p1 |= _selected_airport_layout << 8;
00063 CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, "" };
00064 ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE));
00065 }
00066
00068 struct BuildAirToolbarWindow : Window {
00069 int last_user_action;
00070
00071 BuildAirToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
00072 {
00073 this->InitNested(window_number);
00074 if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
00075 this->last_user_action = WIDGET_LIST_END;
00076 }
00077
00078 ~BuildAirToolbarWindow()
00079 {
00080 if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
00081 }
00082
00083 virtual void OnClick(Point pt, int widget, int click_count)
00084 {
00085 switch (widget) {
00086 case WID_AT_AIRPORT:
00087 if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
00088 ShowBuildAirportPicker(this);
00089 this->last_user_action = widget;
00090 }
00091 break;
00092
00093 case WID_AT_DEMOLISH:
00094 HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
00095 this->last_user_action = widget;
00096 break;
00097
00098 default: break;
00099 }
00100 }
00101
00102
00103 virtual void OnPlaceObject(Point pt, TileIndex tile)
00104 {
00105 switch (this->last_user_action) {
00106 case WID_AT_AIRPORT:
00107 PlaceAirport(tile);
00108 break;
00109
00110 case WID_AT_DEMOLISH:
00111 PlaceProc_DemolishArea(tile);
00112 break;
00113
00114 default: NOT_REACHED();
00115 }
00116 }
00117
00118 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
00119 {
00120 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
00121 }
00122
00123 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
00124 {
00125 if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
00126 GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
00127 }
00128 }
00129
00130 virtual void OnPlaceObjectAbort()
00131 {
00132 this->RaiseButtons();
00133
00134 DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
00135 DeleteWindowById(WC_SELECT_STATION, 0);
00136 }
00137
00138 static HotkeyList hotkeys;
00139 };
00140
00146 static EventState AirportToolbarGlobalHotkeys(int hotkey)
00147 {
00148 if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
00149 Window *w = ShowBuildAirToolbar();
00150 if (w == NULL) return ES_NOT_HANDLED;
00151 return w->OnHotkey(hotkey);
00152 }
00153
00154 static Hotkey airtoolbar_hotkeys[] = {
00155 Hotkey('1', "airport", WID_AT_AIRPORT),
00156 Hotkey('2', "demolish", WID_AT_DEMOLISH),
00157 HOTKEY_LIST_END
00158 };
00159 HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
00160
00161 static const NWidgetPart _nested_air_toolbar_widgets[] = {
00162 NWidget(NWID_HORIZONTAL),
00163 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
00164 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
00165 NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
00166 EndContainer(),
00167 NWidget(NWID_HORIZONTAL),
00168 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),
00169 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
00170 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
00171 EndContainer(),
00172 };
00173
00174 static WindowDesc _air_toolbar_desc(
00175 WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
00176 WC_BUILD_TOOLBAR, WC_NONE,
00177 WDF_CONSTRUCTION,
00178 _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets),
00179 &BuildAirToolbarWindow::hotkeys
00180 );
00181
00189 Window *ShowBuildAirToolbar()
00190 {
00191 if (!Company::IsValidID(_local_company)) return NULL;
00192
00193 DeleteWindowByClass(WC_BUILD_TOOLBAR);
00194 return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
00195 }
00196
00197 class BuildAirportWindow : public PickerWindowBase {
00198 SpriteID preview_sprite;
00199 int line_height;
00200 Scrollbar *vscroll;
00201
00203 static DropDownList *BuildAirportClassDropDown()
00204 {
00205 DropDownList *list = new DropDownList();
00206
00207 for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
00208 *list->Append() = new DropDownListStringItem(AirportClass::Get((AirportClassID)i)->name, i, false);
00209 }
00210
00211 return list;
00212 }
00213
00214 public:
00215 BuildAirportWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
00216 {
00217 this->CreateNestedTree();
00218
00219 this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
00220 this->vscroll->SetCapacity(5);
00221 this->vscroll->SetPosition(0);
00222
00223 this->FinishInitNested(TRANSPORT_AIR);
00224
00225 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
00226 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
00227 this->OnInvalidateData();
00228
00229 this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
00230 this->SelectFirstAvailableAirport(true);
00231 }
00232
00233 virtual ~BuildAirportWindow()
00234 {
00235 DeleteWindowById(WC_SELECT_STATION, 0);
00236 }
00237
00238 virtual void SetStringParameters(int widget) const
00239 {
00240 switch (widget) {
00241 case WID_AP_CLASS_DROPDOWN:
00242 SetDParam(0, AirportClass::Get(_selected_airport_class)->name);
00243 break;
00244
00245 case WID_AP_LAYOUT_NUM:
00246 SetDParam(0, STR_EMPTY);
00247 if (_selected_airport_index != -1) {
00248 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00249 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME);
00250 if (string != STR_UNDEFINED) {
00251 SetDParam(0, string);
00252 } else if (as->num_table > 1) {
00253 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
00254 SetDParam(1, _selected_airport_layout + 1);
00255 }
00256 }
00257 break;
00258
00259 default: break;
00260 }
00261 }
00262
00263 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
00264 {
00265 switch (widget) {
00266 case WID_AP_CLASS_DROPDOWN: {
00267 Dimension d = {0, 0};
00268 for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
00269 SetDParam(0, AirportClass::Get((AirportClassID)i)->name);
00270 d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
00271 }
00272 d.width += padding.width;
00273 d.height += padding.height;
00274 *size = maxdim(*size, d);
00275 break;
00276 }
00277
00278 case WID_AP_AIRPORT_LIST: {
00279 for (int i = 0; i < NUM_AIRPORTS; i++) {
00280 const AirportSpec *as = AirportSpec::Get(i);
00281 if (!as->enabled) continue;
00282
00283 size->width = max(size->width, GetStringBoundingBox(as->name).width);
00284 }
00285
00286 this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
00287 size->height = 5 * this->line_height;
00288 break;
00289 }
00290
00291 case WID_AP_AIRPORT_SPRITE:
00292 for (int i = 0; i < NUM_AIRPORTS; i++) {
00293 const AirportSpec *as = AirportSpec::Get(i);
00294 if (!as->enabled) continue;
00295 for (byte layout = 0; layout < as->num_table; layout++) {
00296 SpriteID sprite = GetCustomAirportSprite(as, layout);
00297 if (sprite != 0) {
00298 Dimension d = GetSpriteSize(sprite);
00299 d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
00300 d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
00301 *size = maxdim(d, *size);
00302 }
00303 }
00304 }
00305 break;
00306
00307 case WID_AP_EXTRA_TEXT:
00308 for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
00309 const AirportSpec *as = AirportSpec::Get(i);
00310 if (!as->enabled) continue;
00311 for (byte layout = 0; layout < as->num_table; layout++) {
00312 StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00313 if (string == STR_UNDEFINED) continue;
00314
00315
00316 SetDParam(0, string);
00317 Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
00318 *size = maxdim(d, *size);
00319 }
00320 }
00321 break;
00322
00323 default: break;
00324 }
00325 }
00326
00327 virtual void DrawWidget(const Rect &r, int widget) const
00328 {
00329 switch (widget) {
00330 case WID_AP_AIRPORT_LIST: {
00331 int y = r.top;
00332 AirportClass *apclass = AirportClass::Get(_selected_airport_class);
00333 for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
00334 const AirportSpec *as = apclass->GetSpec(i);
00335 if (!as->IsAvailable()) {
00336 GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
00337 }
00338 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);
00339 y += this->line_height;
00340 }
00341 break;
00342 }
00343
00344 case WID_AP_AIRPORT_SPRITE:
00345 if (this->preview_sprite != 0) {
00346 Dimension d = GetSpriteSize(this->preview_sprite);
00347 DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
00348 }
00349 break;
00350
00351 case WID_AP_EXTRA_TEXT:
00352 if (_selected_airport_index != -1) {
00353 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00354 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00355 if (string != STR_UNDEFINED) {
00356 SetDParam(0, string);
00357 DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
00358 }
00359 }
00360 break;
00361 }
00362 }
00363
00364 virtual void OnPaint()
00365 {
00366 this->DrawWidgets();
00367
00368 uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
00369 NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
00370
00371 int right = panel_nwi->pos_x + panel_nwi->current_x;
00372 int bottom = panel_nwi->pos_y + panel_nwi->current_y;
00373
00374 if (_selected_airport_index != -1) {
00375 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00376 int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
00377
00378
00379 if (_settings_game.economy.station_noise_level) {
00380
00381 SetDParam(0, as->noise_level);
00382 DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
00383 top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
00384 }
00385
00386
00387 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
00388 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
00389 }
00390
00391
00392
00393
00394 if (top > bottom) {
00395 ResizeWindow(this, 0, top - bottom);
00396 }
00397 }
00398
00399 void SelectOtherAirport(int airport_index)
00400 {
00401 _selected_airport_index = airport_index;
00402 _selected_airport_layout = 0;
00403
00404 this->UpdateSelectSize();
00405 this->SetDirty();
00406 }
00407
00408 void UpdateSelectSize()
00409 {
00410 if (_selected_airport_index == -1) {
00411 SetTileSelectSize(1, 1);
00412 this->DisableWidget(WID_AP_LAYOUT_DECREASE);
00413 this->DisableWidget(WID_AP_LAYOUT_INCREASE);
00414 } else {
00415 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00416 int w = as->size_x;
00417 int h = as->size_y;
00418 Direction rotation = as->rotation[_selected_airport_layout];
00419 if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
00420 SetTileSelectSize(w, h);
00421
00422 this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
00423
00424 this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
00425 this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
00426
00427 int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
00428 if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
00429 }
00430 }
00431
00432 virtual void OnClick(Point pt, int widget, int click_count)
00433 {
00434 switch (widget) {
00435 case WID_AP_CLASS_DROPDOWN:
00436 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, WID_AP_CLASS_DROPDOWN);
00437 break;
00438
00439 case WID_AP_AIRPORT_LIST: {
00440 int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
00441 if (num_clicked >= this->vscroll->GetCount()) break;
00442 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
00443 if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
00444 break;
00445 }
00446
00447 case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT:
00448 _settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT);
00449 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
00450 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
00451 this->SetDirty();
00452 if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
00453 this->UpdateSelectSize();
00454 break;
00455
00456 case WID_AP_LAYOUT_DECREASE:
00457 _selected_airport_layout--;
00458 this->UpdateSelectSize();
00459 this->SetDirty();
00460 break;
00461
00462 case WID_AP_LAYOUT_INCREASE:
00463 _selected_airport_layout++;
00464 this->UpdateSelectSize();
00465 this->SetDirty();
00466 break;
00467 }
00468 }
00469
00475 void SelectFirstAvailableAirport(bool change_class)
00476 {
00477
00478 AirportClass *sel_apclass = AirportClass::Get(_selected_airport_class);
00479 for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) {
00480 const AirportSpec *as = sel_apclass->GetSpec(i);
00481 if (as->IsAvailable()) {
00482 this->SelectOtherAirport(i);
00483 return;
00484 }
00485 }
00486 if (change_class) {
00487
00488
00489 for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
00490 AirportClass *apclass = AirportClass::Get(j);
00491 for (uint i = 0; i < apclass->GetSpecCount(); i++) {
00492 const AirportSpec *as = apclass->GetSpec(i);
00493 if (as->IsAvailable()) {
00494 _selected_airport_class = j;
00495 this->SelectOtherAirport(i);
00496 return;
00497 }
00498 }
00499 }
00500 }
00501
00502 this->SelectOtherAirport(-1);
00503 }
00504
00505 virtual void OnDropdownSelect(int widget, int index)
00506 {
00507 assert(widget == WID_AP_CLASS_DROPDOWN);
00508 _selected_airport_class = (AirportClassID)index;
00509 this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
00510 this->SelectFirstAvailableAirport(false);
00511 }
00512
00513 virtual void OnTick()
00514 {
00515 CheckRedrawStationCoverage(this);
00516 }
00517 };
00518
00519 static const NWidgetPart _nested_build_airport_widgets[] = {
00520 NWidget(NWID_HORIZONTAL),
00521 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
00522 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
00523 EndContainer(),
00524 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
00525 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
00526 NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
00527 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
00528 NWidget(NWID_HORIZONTAL),
00529 NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
00530 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
00531 EndContainer(),
00532 NWidget(NWID_HORIZONTAL),
00533 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
00534 NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
00535 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
00536 EndContainer(),
00537 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
00538 EndContainer(),
00539
00540 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
00541 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
00542 NWidget(NWID_HORIZONTAL),
00543 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00544 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
00545 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00546 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
00547 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00548 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
00549 EndContainer(),
00550 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00551 EndContainer(),
00552 NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
00553 EndContainer(),
00554 };
00555
00556 static WindowDesc _build_airport_desc(
00557 WDP_AUTO, "build_station_air", 0, 0,
00558 WC_BUILD_STATION, WC_BUILD_TOOLBAR,
00559 WDF_CONSTRUCTION,
00560 _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
00561 );
00562
00563 static void ShowBuildAirportPicker(Window *parent)
00564 {
00565 new BuildAirportWindow(&_build_airport_desc, parent);
00566 }
00567
00568 void InitializeAirportGui()
00569 {
00570 _selected_airport_class = APC_BEGIN;
00571 _selected_airport_index = -1;
00572 }