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
00031 #include "widgets/airport_widget.h"
00032
00033
00034 static AirportClassID _selected_airport_class;
00035 static int _selected_airport_index;
00036 static byte _selected_airport_layout;
00037
00038 static void ShowBuildAirportPicker(Window *parent);
00039
00040 SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
00041
00042 void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
00043 {
00044 if (result.Failed()) return;
00045
00046 SndPlayTileFx(SND_1F_SPLAT, tile);
00047 if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
00048 }
00049
00054 static void PlaceAirport(TileIndex tile)
00055 {
00056 if (_selected_airport_index == -1) return;
00057 uint32 p2 = _ctrl_pressed;
00058 SB(p2, 16, 16, INVALID_STATION);
00059
00060 uint32 p1 = AirportClass::Get(_selected_airport_class, _selected_airport_index)->GetIndex();
00061 p1 |= _selected_airport_layout << 8;
00062 CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_AIRPORT | CMD_MSG(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE), CcBuildAirport, "" };
00063 ShowSelectStationIfNeeded(cmdcont, TileArea(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE));
00064 }
00065
00067 struct BuildAirToolbarWindow : Window {
00068 int last_user_action;
00069
00070 BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
00071 {
00072 this->InitNested(desc, window_number);
00073 if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
00074 this->last_user_action = WIDGET_LIST_END;
00075 }
00076
00077 ~BuildAirToolbarWindow()
00078 {
00079 if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false);
00080 }
00081
00082 virtual void OnClick(Point pt, int widget, int click_count)
00083 {
00084 switch (widget) {
00085 case WID_AT_AIRPORT:
00086 if (HandlePlacePushButton(this, WID_AT_AIRPORT, SPR_CURSOR_AIRPORT, HT_RECT)) {
00087 ShowBuildAirportPicker(this);
00088 this->last_user_action = widget;
00089 }
00090 break;
00091
00092 case WID_AT_DEMOLISH:
00093 HandlePlacePushButton(this, WID_AT_DEMOLISH, ANIMCURSOR_DEMOLISH, HT_RECT | HT_DIAGONAL);
00094 this->last_user_action = widget;
00095 break;
00096
00097 default: break;
00098 }
00099 }
00100
00101
00102 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
00103 {
00104 int num = CheckHotkeyMatch(airtoolbar_hotkeys, keycode, this);
00105 if (num == -1) return ES_NOT_HANDLED;
00106 this->OnClick(Point(), num, 1);
00107 return ES_HANDLED;
00108 }
00109
00110 virtual void OnPlaceObject(Point pt, TileIndex tile)
00111 {
00112 switch (this->last_user_action) {
00113 case WID_AT_AIRPORT:
00114 PlaceAirport(tile);
00115 break;
00116
00117 case WID_AT_DEMOLISH:
00118 PlaceProc_DemolishArea(tile);
00119 break;
00120
00121 default: NOT_REACHED();
00122 }
00123 }
00124
00125 virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
00126 {
00127 VpSelectTilesWithMethod(pt.x, pt.y, select_method);
00128 }
00129
00130 virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile)
00131 {
00132 if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) {
00133 GUIPlaceProcDragXY(select_proc, start_tile, end_tile);
00134 }
00135 }
00136
00137 virtual void OnPlaceObjectAbort()
00138 {
00139 this->RaiseButtons();
00140
00141 DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
00142 DeleteWindowById(WC_SELECT_STATION, 0);
00143 }
00144
00145 static Hotkey<BuildAirToolbarWindow> airtoolbar_hotkeys[];
00146 };
00147
00148 Hotkey<BuildAirToolbarWindow> BuildAirToolbarWindow::airtoolbar_hotkeys[] = {
00149 Hotkey<BuildAirToolbarWindow>('1', "airport", WID_AT_AIRPORT),
00150 Hotkey<BuildAirToolbarWindow>('2', "demolish", WID_AT_DEMOLISH),
00151 HOTKEY_LIST_END(BuildAirToolbarWindow)
00152 };
00153 Hotkey<BuildAirToolbarWindow> *_airtoolbar_hotkeys = BuildAirToolbarWindow::airtoolbar_hotkeys;
00154
00155 static const NWidgetPart _nested_air_toolbar_widgets[] = {
00156 NWidget(NWID_HORIZONTAL),
00157 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
00158 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
00159 NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
00160 EndContainer(),
00161 NWidget(NWID_HORIZONTAL),
00162 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),
00163 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetMinimalSize(4, 22), SetFill(1, 1), EndContainer(),
00164 NWidget(WWT_IMGBTN, COLOUR_DARK_GREEN, WID_AT_DEMOLISH), SetFill(0, 1), SetMinimalSize(22, 22), SetDataTip(SPR_IMG_DYNAMITE, STR_TOOLTIP_DEMOLISH_BUILDINGS_ETC),
00165 EndContainer(),
00166 };
00167
00168 static const WindowDesc _air_toolbar_desc(
00169 WDP_ALIGN_TOOLBAR, 0, 0,
00170 WC_BUILD_TOOLBAR, WC_NONE,
00171 WDF_CONSTRUCTION,
00172 _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets)
00173 );
00174
00182 Window *ShowBuildAirToolbar()
00183 {
00184 if (!Company::IsValidID(_local_company)) return NULL;
00185
00186 DeleteWindowByClass(WC_BUILD_TOOLBAR);
00187 return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
00188 }
00189
00190 EventState AirportToolbarGlobalHotkeys(uint16 key, uint16 keycode)
00191 {
00192 if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
00193 int num = CheckHotkeyMatch<BuildAirToolbarWindow>(_airtoolbar_hotkeys, keycode, NULL, true);
00194 if (num == -1) return ES_NOT_HANDLED;
00195 Window *w = ShowBuildAirToolbar();
00196 if (w == NULL) return ES_NOT_HANDLED;
00197 return w->OnKeyPress(key, keycode);
00198 }
00199
00200 class BuildAirportWindow : public PickerWindowBase {
00201 SpriteID preview_sprite;
00202 int line_height;
00203 Scrollbar *vscroll;
00204
00206 static DropDownList *BuildAirportClassDropDown()
00207 {
00208 DropDownList *list = new DropDownList();
00209
00210 for (uint i = 0; i < AirportClass::GetCount(); i++) {
00211 list->push_back(new DropDownListStringItem(AirportClass::GetName((AirportClassID)i), i, false));
00212 }
00213
00214 return list;
00215 }
00216
00217 public:
00218 BuildAirportWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
00219 {
00220 this->CreateNestedTree(desc);
00221
00222 this->vscroll = this->GetScrollbar(WID_AP_SCROLLBAR);
00223 this->vscroll->SetCapacity(5);
00224 this->vscroll->SetPosition(0);
00225
00226 this->FinishInitNested(desc, TRANSPORT_AIR);
00227
00228 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
00229 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
00230 this->OnInvalidateData();
00231
00232 this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class));
00233 this->SelectFirstAvailableAirport(true);
00234 }
00235
00236 virtual ~BuildAirportWindow()
00237 {
00238 DeleteWindowById(WC_SELECT_STATION, 0);
00239 }
00240
00241 virtual void SetStringParameters(int widget) const
00242 {
00243 switch (widget) {
00244 case WID_AP_CLASS_DROPDOWN:
00245 SetDParam(0, AirportClass::GetName(_selected_airport_class));
00246 break;
00247
00248 case WID_AP_LAYOUT_NUM:
00249 SetDParam(0, STR_EMPTY);
00250 if (_selected_airport_index != -1) {
00251 const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
00252 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME);
00253 if (string != STR_UNDEFINED) {
00254 SetDParam(0, string);
00255 } else if (as->num_table > 1) {
00256 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
00257 SetDParam(1, _selected_airport_layout + 1);
00258 }
00259 }
00260 break;
00261
00262 default: break;
00263 }
00264 }
00265
00266 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
00267 {
00268 switch (widget) {
00269 case WID_AP_CLASS_DROPDOWN: {
00270 Dimension d = {0, 0};
00271 for (uint i = 0; i < AirportClass::GetCount(); i++) {
00272 SetDParam(0, AirportClass::GetName((AirportClassID)i));
00273 d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
00274 }
00275 d.width += padding.width;
00276 d.height += padding.height;
00277 *size = maxdim(*size, d);
00278 break;
00279 }
00280
00281 case WID_AP_AIRPORT_LIST: {
00282 for (int i = 0; i < NUM_AIRPORTS; i++) {
00283 const AirportSpec *as = AirportSpec::Get(i);
00284 if (!as->enabled) continue;
00285
00286 size->width = max(size->width, GetStringBoundingBox(as->name).width);
00287 }
00288
00289 this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
00290 size->height = this->vscroll->GetCapacity() * this->line_height;
00291 break;
00292 }
00293
00294 case WID_AP_AIRPORT_SPRITE:
00295 for (int i = 0; i < NUM_AIRPORTS; i++) {
00296 const AirportSpec *as = AirportSpec::Get(i);
00297 if (!as->enabled) continue;
00298 for (byte layout = 0; layout < as->num_table; layout++) {
00299 SpriteID sprite = GetCustomAirportSprite(as, layout);
00300 if (sprite != 0) {
00301 Dimension d = GetSpriteSize(sprite);
00302 d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
00303 d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
00304 *size = maxdim(d, *size);
00305 }
00306 }
00307 }
00308 break;
00309
00310 case WID_AP_EXTRA_TEXT:
00311 for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
00312 const AirportSpec *as = AirportSpec::Get(i);
00313 if (!as->enabled) continue;
00314 for (byte layout = 0; layout < as->num_table; layout++) {
00315 StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00316 if (string == STR_UNDEFINED) continue;
00317
00318
00319 SetDParam(0, string);
00320 Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
00321 *size = maxdim(d, *size);
00322 }
00323 }
00324 break;
00325
00326 default: break;
00327 }
00328 }
00329
00330 virtual void DrawWidget(const Rect &r, int widget) const
00331 {
00332 switch (widget) {
00333 case WID_AP_AIRPORT_LIST: {
00334 int y = r.top;
00335 for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < AirportClass::GetCount(_selected_airport_class); i++) {
00336 const AirportSpec *as = AirportClass::Get(_selected_airport_class, i);
00337 if (!as->IsAvailable()) {
00338 GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
00339 }
00340 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);
00341 y += this->line_height;
00342 }
00343 break;
00344 }
00345
00346 case WID_AP_AIRPORT_SPRITE:
00347 if (this->preview_sprite != 0) {
00348 Dimension d = GetSpriteSize(this->preview_sprite);
00349 DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
00350 }
00351 break;
00352
00353 case WID_AP_EXTRA_TEXT:
00354 if (_selected_airport_index != -1) {
00355 const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
00356 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00357 if (string != STR_UNDEFINED) {
00358 SetDParam(0, string);
00359 DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
00360 }
00361 }
00362 break;
00363 }
00364 }
00365
00366 virtual void OnPaint()
00367 {
00368 this->DrawWidgets();
00369
00370 uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
00371 NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
00372
00373 int right = panel_nwi->pos_x + panel_nwi->current_x;
00374 int bottom = panel_nwi->pos_y + panel_nwi->current_y;
00375
00376 if (_selected_airport_index != -1) {
00377 const AirportSpec *as = AirportClass::Get(_selected_airport_class, _selected_airport_index);
00378 int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
00379
00380
00381 if (_settings_game.economy.station_noise_level) {
00382
00383 SetDParam(0, as->noise_level);
00384 DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
00385 top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
00386 }
00387
00388
00389 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
00390 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
00391 }
00392
00393
00394 if (top > bottom || (top < bottom && panel_nwi->current_y > panel_nwi->smallest_y)) {
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, _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, 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 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 for (uint i = 0; i < AirportClass::GetCount(_selected_airport_class); i++) {
00479 const AirportSpec *as = AirportClass::Get(_selected_airport_class, i);
00480 if (as->IsAvailable()) {
00481 this->SelectOtherAirport(i);
00482 return;
00483 }
00484 }
00485 if (change_class) {
00486
00487
00488 for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
00489 for (uint i = 0; i < AirportClass::GetCount(j); i++) {
00490 const AirportSpec *as = AirportClass::Get(j, i);
00491 if (as->IsAvailable()) {
00492 _selected_airport_class = j;
00493 this->SelectOtherAirport(i);
00494 return;
00495 }
00496 }
00497 }
00498 }
00499
00500 this->SelectOtherAirport(-1);
00501 }
00502
00503 virtual void OnDropdownSelect(int widget, int index)
00504 {
00505 assert(widget == WID_AP_CLASS_DROPDOWN);
00506 _selected_airport_class = (AirportClassID)index;
00507 this->vscroll->SetCount(AirportClass::GetCount(_selected_airport_class));
00508 this->SelectFirstAvailableAirport(false);
00509 }
00510
00511 virtual void OnTick()
00512 {
00513 CheckRedrawStationCoverage(this);
00514 }
00515 };
00516
00517 static const NWidgetPart _nested_build_airport_widgets[] = {
00518 NWidget(NWID_HORIZONTAL),
00519 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
00520 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
00521 EndContainer(),
00522 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
00523 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
00524 NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
00525 NWidget(NWID_HORIZONTAL),
00526 NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetDataTip(0x501, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
00527 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
00528 EndContainer(),
00529 NWidget(NWID_HORIZONTAL),
00530 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
00531 NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
00532 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
00533 EndContainer(),
00534 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
00535 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
00536 EndContainer(),
00537
00538 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
00539 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
00540 NWidget(NWID_HORIZONTAL),
00541 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00542 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
00543 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00544 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
00545 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00546 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
00547 EndContainer(),
00548 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00549 EndContainer(),
00550 NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
00551 EndContainer(),
00552 };
00553
00554 static const WindowDesc _build_airport_desc(
00555 WDP_AUTO, 0, 0,
00556 WC_BUILD_STATION, WC_BUILD_TOOLBAR,
00557 WDF_CONSTRUCTION | WDF_UNCLICK_BUTTONS,
00558 _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
00559 );
00560
00561 static void ShowBuildAirportPicker(Window *parent)
00562 {
00563 new BuildAirportWindow(&_build_airport_desc, parent);
00564 }
00565
00566 void InitializeAirportGui()
00567 {
00568 _selected_airport_class = APC_BEGIN;
00569 _selected_airport_index = -1;
00570 }