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_OTHER, 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
00230 _selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
00231 const AirportClass *ac = AirportClass::Get(_selected_airport_class);
00232 this->vscroll->SetCount(ac->GetSpecCount());
00233
00234
00235 _selected_airport_index = Clamp(_selected_airport_index, -1, ac->GetSpecCount() - 1);
00236
00237
00238 bool selectFirstAirport = true;
00239 if (_selected_airport_index != -1) {
00240 const AirportSpec *as = ac->GetSpec(_selected_airport_index);
00241 if (as->IsAvailable()) {
00242
00243 _selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
00244 selectFirstAirport = false;
00245 this->UpdateSelectSize();
00246 }
00247 }
00248
00249 if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
00250 }
00251
00252 virtual ~BuildAirportWindow()
00253 {
00254 DeleteWindowById(WC_SELECT_STATION, 0);
00255 }
00256
00257 virtual void SetStringParameters(int widget) const
00258 {
00259 switch (widget) {
00260 case WID_AP_CLASS_DROPDOWN:
00261 SetDParam(0, AirportClass::Get(_selected_airport_class)->name);
00262 break;
00263
00264 case WID_AP_LAYOUT_NUM:
00265 SetDParam(0, STR_EMPTY);
00266 if (_selected_airport_index != -1) {
00267 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00268 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME);
00269 if (string != STR_UNDEFINED) {
00270 SetDParam(0, string);
00271 } else if (as->num_table > 1) {
00272 SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
00273 SetDParam(1, _selected_airport_layout + 1);
00274 }
00275 }
00276 break;
00277
00278 default: break;
00279 }
00280 }
00281
00282 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
00283 {
00284 switch (widget) {
00285 case WID_AP_CLASS_DROPDOWN: {
00286 Dimension d = {0, 0};
00287 for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
00288 SetDParam(0, AirportClass::Get((AirportClassID)i)->name);
00289 d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
00290 }
00291 d.width += padding.width;
00292 d.height += padding.height;
00293 *size = maxdim(*size, d);
00294 break;
00295 }
00296
00297 case WID_AP_AIRPORT_LIST: {
00298 for (int i = 0; i < NUM_AIRPORTS; i++) {
00299 const AirportSpec *as = AirportSpec::Get(i);
00300 if (!as->enabled) continue;
00301
00302 size->width = max(size->width, GetStringBoundingBox(as->name).width);
00303 }
00304
00305 this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
00306 size->height = 5 * this->line_height;
00307 break;
00308 }
00309
00310 case WID_AP_AIRPORT_SPRITE:
00311 for (int i = 0; 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 SpriteID sprite = GetCustomAirportSprite(as, layout);
00316 if (sprite != 0) {
00317 Dimension d = GetSpriteSize(sprite);
00318 d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
00319 d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
00320 *size = maxdim(d, *size);
00321 }
00322 }
00323 }
00324 break;
00325
00326 case WID_AP_EXTRA_TEXT:
00327 for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
00328 const AirportSpec *as = AirportSpec::Get(i);
00329 if (!as->enabled) continue;
00330 for (byte layout = 0; layout < as->num_table; layout++) {
00331 StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00332 if (string == STR_UNDEFINED) continue;
00333
00334
00335 SetDParam(0, string);
00336 Dimension d = GetStringMultiLineBoundingBox(STR_BLACK_STRING, *size);
00337 *size = maxdim(d, *size);
00338 }
00339 }
00340 break;
00341
00342 default: break;
00343 }
00344 }
00345
00346 virtual void DrawWidget(const Rect &r, int widget) const
00347 {
00348 switch (widget) {
00349 case WID_AP_AIRPORT_LIST: {
00350 int y = r.top;
00351 AirportClass *apclass = AirportClass::Get(_selected_airport_class);
00352 for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < apclass->GetSpecCount(); i++) {
00353 const AirportSpec *as = apclass->GetSpec(i);
00354 if (!as->IsAvailable()) {
00355 GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->line_height - 2, PC_BLACK, FILLRECT_CHECKER);
00356 }
00357 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);
00358 y += this->line_height;
00359 }
00360 break;
00361 }
00362
00363 case WID_AP_AIRPORT_SPRITE:
00364 if (this->preview_sprite != 0) {
00365 Dimension d = GetSpriteSize(this->preview_sprite);
00366 DrawSprite(this->preview_sprite, COMPANY_SPRITE_COLOUR(_local_company), (r.left + r.right - d.width) / 2, (r.top + r.bottom - d.height) / 2);
00367 }
00368 break;
00369
00370 case WID_AP_EXTRA_TEXT:
00371 if (_selected_airport_index != -1) {
00372 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00373 StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_ADDITIONAL_TEXT);
00374 if (string != STR_UNDEFINED) {
00375 SetDParam(0, string);
00376 DrawStringMultiLine(r.left, r.right, r.top, r.bottom, STR_BLACK_STRING);
00377 }
00378 }
00379 break;
00380 }
00381 }
00382
00383 virtual void OnPaint()
00384 {
00385 this->DrawWidgets();
00386
00387 uint16 top = this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->pos_y + this->GetWidget<NWidgetBase>(WID_AP_BTN_DOHILIGHT)->current_y + WD_PAR_VSEP_NORMAL;
00388 NWidgetBase *panel_nwi = this->GetWidget<NWidgetBase>(WID_AP_BOTTOMPANEL);
00389
00390 int right = panel_nwi->pos_x + panel_nwi->current_x;
00391 int bottom = panel_nwi->pos_y + panel_nwi->current_y;
00392
00393 if (_selected_airport_index != -1) {
00394 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00395 int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
00396
00397
00398 if (_settings_game.economy.station_noise_level) {
00399
00400 SetDParam(0, as->noise_level);
00401 DrawString(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_STATION_BUILD_NOISE);
00402 top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
00403 }
00404
00405
00406 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL;
00407 top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL;
00408 }
00409
00410
00411
00412
00413 if (top > bottom) {
00414 ResizeWindow(this, 0, top - bottom);
00415 }
00416 }
00417
00418 void SelectOtherAirport(int airport_index)
00419 {
00420 _selected_airport_index = airport_index;
00421 _selected_airport_layout = 0;
00422
00423 this->UpdateSelectSize();
00424 this->SetDirty();
00425 }
00426
00427 void UpdateSelectSize()
00428 {
00429 if (_selected_airport_index == -1) {
00430 SetTileSelectSize(1, 1);
00431 this->DisableWidget(WID_AP_LAYOUT_DECREASE);
00432 this->DisableWidget(WID_AP_LAYOUT_INCREASE);
00433 } else {
00434 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
00435 int w = as->size_x;
00436 int h = as->size_y;
00437 Direction rotation = as->rotation[_selected_airport_layout];
00438 if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
00439 SetTileSelectSize(w, h);
00440
00441 this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
00442
00443 this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
00444 this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
00445
00446 int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
00447 if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
00448 }
00449 }
00450
00451 virtual void OnClick(Point pt, int widget, int click_count)
00452 {
00453 switch (widget) {
00454 case WID_AP_CLASS_DROPDOWN:
00455 ShowDropDownList(this, BuildAirportClassDropDown(), _selected_airport_class, WID_AP_CLASS_DROPDOWN);
00456 break;
00457
00458 case WID_AP_AIRPORT_LIST: {
00459 int num_clicked = this->vscroll->GetPosition() + (pt.y - this->nested_array[widget]->pos_y) / this->line_height;
00460 if (num_clicked >= this->vscroll->GetCount()) break;
00461 const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
00462 if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
00463 break;
00464 }
00465
00466 case WID_AP_BTN_DONTHILIGHT: case WID_AP_BTN_DOHILIGHT:
00467 _settings_client.gui.station_show_coverage = (widget != WID_AP_BTN_DONTHILIGHT);
00468 this->SetWidgetLoweredState(WID_AP_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
00469 this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
00470 this->SetDirty();
00471 if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
00472 this->UpdateSelectSize();
00473 break;
00474
00475 case WID_AP_LAYOUT_DECREASE:
00476 _selected_airport_layout--;
00477 this->UpdateSelectSize();
00478 this->SetDirty();
00479 break;
00480
00481 case WID_AP_LAYOUT_INCREASE:
00482 _selected_airport_layout++;
00483 this->UpdateSelectSize();
00484 this->SetDirty();
00485 break;
00486 }
00487 }
00488
00494 void SelectFirstAvailableAirport(bool change_class)
00495 {
00496
00497 AirportClass *sel_apclass = AirportClass::Get(_selected_airport_class);
00498 for (uint i = 0; i < sel_apclass->GetSpecCount(); i++) {
00499 const AirportSpec *as = sel_apclass->GetSpec(i);
00500 if (as->IsAvailable()) {
00501 this->SelectOtherAirport(i);
00502 return;
00503 }
00504 }
00505 if (change_class) {
00506
00507
00508 for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
00509 AirportClass *apclass = AirportClass::Get(j);
00510 for (uint i = 0; i < apclass->GetSpecCount(); i++) {
00511 const AirportSpec *as = apclass->GetSpec(i);
00512 if (as->IsAvailable()) {
00513 _selected_airport_class = j;
00514 this->SelectOtherAirport(i);
00515 return;
00516 }
00517 }
00518 }
00519 }
00520
00521 this->SelectOtherAirport(-1);
00522 }
00523
00524 virtual void OnDropdownSelect(int widget, int index)
00525 {
00526 assert(widget == WID_AP_CLASS_DROPDOWN);
00527 _selected_airport_class = (AirportClassID)index;
00528 this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
00529 this->SelectFirstAvailableAirport(false);
00530 }
00531
00532 virtual void OnTick()
00533 {
00534 CheckRedrawStationCoverage(this);
00535 }
00536 };
00537
00538 static const NWidgetPart _nested_build_airport_widgets[] = {
00539 NWidget(NWID_HORIZONTAL),
00540 NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
00541 NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
00542 EndContainer(),
00543 NWidget(WWT_PANEL, COLOUR_DARK_GREEN), SetFill(1, 0), SetPIP(2, 0, 2),
00544 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_AIRPORT_CLASS_LABEL, STR_NULL), SetFill(1, 0),
00545 NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_AP_CLASS_DROPDOWN), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_STATION_BUILD_AIRPORT_TOOLTIP),
00546 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_AIRPORT_SPRITE), SetFill(1, 0),
00547 NWidget(NWID_HORIZONTAL),
00548 NWidget(WWT_MATRIX, COLOUR_GREY, WID_AP_AIRPORT_LIST), SetFill(1, 0), SetMatrixDataTip(1, 5, STR_STATION_BUILD_AIRPORT_TOOLTIP), SetScrollbar(WID_AP_SCROLLBAR),
00549 NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_AP_SCROLLBAR),
00550 EndContainer(),
00551 NWidget(NWID_HORIZONTAL),
00552 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_DECREASE), SetMinimalSize(12, 0), SetDataTip(AWV_DECREASE, STR_NULL),
00553 NWidget(WWT_LABEL, COLOUR_GREY, WID_AP_LAYOUT_NUM), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BLACK_STRING, STR_NULL),
00554 NWidget(WWT_PUSHARROWBTN, COLOUR_GREY, WID_AP_LAYOUT_INCREASE), SetMinimalSize(12, 0), SetDataTip(AWV_INCREASE, STR_NULL),
00555 EndContainer(),
00556 NWidget(WWT_EMPTY, COLOUR_DARK_GREEN, WID_AP_EXTRA_TEXT), SetFill(1, 0), SetMinimalSize(150, 0),
00557 EndContainer(),
00558
00559 NWidget(WWT_PANEL, COLOUR_DARK_GREEN, WID_AP_BOTTOMPANEL), SetPIP(2, 2, 2),
00560 NWidget(WWT_LABEL, COLOUR_DARK_GREEN), SetDataTip(STR_STATION_BUILD_COVERAGE_AREA_TITLE, STR_NULL), SetFill(1, 0),
00561 NWidget(NWID_HORIZONTAL),
00562 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00563 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
00564 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DONTHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00565 SetDataTip(STR_STATION_BUILD_COVERAGE_OFF, STR_STATION_BUILD_COVERAGE_AREA_OFF_TOOLTIP),
00566 NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_AP_BTN_DOHILIGHT), SetMinimalSize(60, 12), SetFill(1, 0),
00567 SetDataTip(STR_STATION_BUILD_COVERAGE_ON, STR_STATION_BUILD_COVERAGE_AREA_ON_TOOLTIP),
00568 EndContainer(),
00569 NWidget(NWID_SPACER), SetMinimalSize(14, 0), SetFill(1, 0),
00570 EndContainer(),
00571 NWidget(NWID_SPACER), SetMinimalSize(0, 10), SetResize(0, 1), SetFill(1, 0),
00572 EndContainer(),
00573 };
00574
00575 static WindowDesc _build_airport_desc(
00576 WDP_AUTO, "build_station_air", 0, 0,
00577 WC_BUILD_STATION, WC_BUILD_TOOLBAR,
00578 WDF_CONSTRUCTION,
00579 _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets)
00580 );
00581
00582 static void ShowBuildAirportPicker(Window *parent)
00583 {
00584 new BuildAirportWindow(&_build_airport_desc, parent);
00585 }
00586
00587 void InitializeAirportGui()
00588 {
00589 _selected_airport_class = APC_BEGIN;
00590 _selected_airport_index = -1;
00591 }