author | Tero Marttila <terom@fixme.fi> |
Fri, 18 Jul 2008 21:28:42 +0300 | |
changeset 11175 | 020c61e39c94 |
parent 11161 | 7d0fac8f14cd |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
10397
diff
changeset
|
3 |
/** @file airport_gui.cpp The GUI for airports. */ |
6443
b8f06d8eb7be
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6368
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1784
diff
changeset
|
6 |
#include "openttd.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
7 |
#include "window_gui.h" |
0 | 8 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
9 |
#include "station_gui.h" |
8701
051036216675
(svn r11768) -Codechange: move some terraform related gui stuff from main_gui.cpp to terraform_gui.cpp (and introduce terraform_gui.h). Based on a patch by Roujin.
rubidium
parents:
8653
diff
changeset
|
10 |
#include "terraform_gui.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8603
diff
changeset
|
11 |
#include "command_func.h" |
0 | 12 |
#include "airport.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8640
diff
changeset
|
13 |
#include "sound_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8617
diff
changeset
|
14 |
#include "window_func.h" |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
15 |
#include "strings_func.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
16 |
#include "settings_type.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8707
diff
changeset
|
17 |
#include "viewport_func.h" |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8707
diff
changeset
|
18 |
#include "gfx_func.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8733
diff
changeset
|
19 |
#include "player_func.h" |
9280
9c03416d26b1
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
9070
diff
changeset
|
20 |
#include "order_func.h" |
10222
b6919c94cc77
(svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents:
10148
diff
changeset
|
21 |
#include "station_type.h" |
10445
2dd7d9d0a957
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
10441
diff
changeset
|
22 |
#include "tilehighlight_func.h" |
0 | 23 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
24 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
25 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
26 |
|
0 | 27 |
static byte _selected_airport_type; |
28 |
||
10686
8e02259158f3
(svn r13230) -Fix [FS#2030](r13171): When closing toolbars, also close their PickerWindows.
frosch
parents:
10682
diff
changeset
|
29 |
static void ShowBuildAirportPicker(Window *parent); |
0 | 30 |
|
31 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
32 |
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 33 |
{ |
34 |
if (success) { |
|
541 | 35 |
SndPlayTileFx(SND_1F_SPLAT, tile); |
0 | 36 |
ResetObjectToPlace(); |
37 |
} |
|
38 |
} |
|
39 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1914
diff
changeset
|
40 |
static void PlaceAirport(TileIndex tile) |
0 | 41 |
{ |
8017
8c46e61c510f
(svn r11040) -Fix [FS#1179]: removing CMD_AUTO from some commands could remotely trigger an assertion.
rubidium
parents:
7837
diff
changeset
|
42 |
DoCommandP(tile, _selected_airport_type, _ctrl_pressed, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE)); |
0 | 43 |
} |
44 |
||
45 |
||
5147
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
46 |
enum { |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
47 |
ATW_AIRPORT = 3, |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
48 |
ATW_DEMOLISH = 4 |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
49 |
}; |
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
50 |
|
db717cde801d
(svn r7239) Enumerate the widgets in the airport, dock, rail and road toolbars
tron
parents:
5072
diff
changeset
|
51 |
|
0 | 52 |
static void BuildAirClick_Airport(Window *w) |
53 |
{ |
|
10686
8e02259158f3
(svn r13230) -Fix [FS#2030](r13171): When closing toolbars, also close their PickerWindows.
frosch
parents:
10682
diff
changeset
|
54 |
if (HandlePlacePushButton(w, ATW_AIRPORT, SPR_CURSOR_AIRPORT, VHM_RECT, PlaceAirport)) ShowBuildAirportPicker(w); |
0 | 55 |
} |
56 |
||
57 |
static void BuildAirClick_Demolish(Window *w) |
|
58 |
{ |
|
10441
09655ce4bfa3
(svn r12983) -Codechange [FS#1987] : Unification of all dynamite tools calls to only one. Thanks to Roujin
belugas
parents:
10434
diff
changeset
|
59 |
HandlePlacePushButton(w, ATW_DEMOLISH, ANIMCURSOR_DEMOLISH, VHM_RECT, PlaceProc_DemolishArea); |
0 | 60 |
} |
61 |
||
62 |
||
63 |
typedef void OnButtonClick(Window *w); |
|
64 |
static OnButtonClick * const _build_air_button_proc[] = { |
|
65 |
BuildAirClick_Airport, |
|
66 |
BuildAirClick_Demolish, |
|
67 |
}; |
|
68 |
||
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
69 |
struct BuildAirToolbarWindow : Window { |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
70 |
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
71 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
72 |
this->FindWindowPlacementAndResize(desc); |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
73 |
if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); |
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
74 |
} |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4709
diff
changeset
|
75 |
|
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
76 |
~BuildAirToolbarWindow() |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
77 |
{ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
78 |
if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); |
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
79 |
} |
10115
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
80 |
|
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
81 |
virtual void OnPaint() |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
82 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
83 |
this->DrawWidgets(); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
84 |
} |
10115
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
85 |
|
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
86 |
virtual void OnClick(Point pt, int widget) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
87 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
88 |
if (widget - 3 >= 0) { |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
89 |
_build_air_button_proc[widget - 3](this); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
90 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
91 |
} |
10115
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
92 |
|
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
93 |
|
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
94 |
virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
95 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
96 |
switch (keycode) { |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
97 |
case '1': BuildAirClick_Airport(this); break; |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
98 |
case '2': BuildAirClick_Demolish(this); break; |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
99 |
default: return ES_NOT_HANDLED; |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
100 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
101 |
return ES_HANDLED; |
0 | 102 |
} |
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
103 |
|
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
104 |
virtual void OnPlaceObject(Point pt, TileIndex tile) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
105 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
106 |
_place_proc(tile); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
107 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
108 |
|
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
109 |
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
110 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
111 |
VpSelectTilesWithMethod(pt.x, pt.y, select_method); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
112 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
113 |
|
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
114 |
virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
115 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
116 |
if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) { |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
117 |
GUIPlaceProcDragXY(select_proc, start_tile, end_tile); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
118 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
119 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
120 |
|
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
121 |
virtual void OnPlaceObjectAbort() |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
122 |
{ |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
123 |
this->RaiseButtons(); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
124 |
|
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
125 |
delete FindWindowById(WC_BUILD_STATION, 0); |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
126 |
} |
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
127 |
}; |
0 | 128 |
|
129 |
static const Widget _air_toolbar_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4171
diff
changeset
|
130 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
5933
0835f3342b79
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5838
diff
changeset
|
131 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 51, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
0835f3342b79
(svn r8143) Remove the landscaping button from the build toolbars.
tron
parents:
5838
diff
changeset
|
132 |
{ WWT_STICKYBOX, RESIZE_NONE, 7, 52, 63, 0, 13, 0x0, STR_STICKY_BUTTON }, |
4937
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
133 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 0, 41, 14, 35, SPR_IMG_AIRPORT, STR_A01E_BUILD_AIRPORT }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4848
diff
changeset
|
134 |
{ WWT_IMGBTN, RESIZE_NONE, 7, 42, 63, 14, 35, SPR_IMG_DYNAMITE, STR_018D_DEMOLISH_BUILDINGS_ETC }, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
0
diff
changeset
|
135 |
{ WIDGETS_END}, |
0 | 136 |
}; |
137 |
||
138 |
||
139 |
static const WindowDesc _air_toolbar_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7737
diff
changeset
|
140 |
WDP_ALIGN_TBR, 22, 64, 36, 64, 36, |
6144
5a0ffbf27ced
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
6111
diff
changeset
|
141 |
WC_BUILD_TOOLBAR, WC_NONE, |
756
d1f1dc31b6f4
(svn r1212) -Feature: sticky windows all build-toolbars
darkvater
parents:
751
diff
changeset
|
142 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, |
0 | 143 |
_air_toolbar_widgets, |
144 |
}; |
|
145 |
||
6573 | 146 |
void ShowBuildAirToolbar() |
0 | 147 |
{ |
11161
7d0fac8f14cd
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
10775
diff
changeset
|
148 |
if (!IsValidPlayerID(_current_player)) return; |
5005
21e84e53c732
(svn r7022) -Fix [FS#292]: Properly guard against viewing company-sensitive information from
Darkvater
parents:
4968
diff
changeset
|
149 |
|
10397
84e97769583b
(svn r12939) -Codechange: do not use the window proc to determine whether a toolbar is a rail toolbar, but use the window number.
rubidium
parents:
10377
diff
changeset
|
150 |
DeleteWindowByClass(WC_BUILD_TOOLBAR); |
10627
641632e80093
(svn r13171) -Codechange: make a class of the Build[Air|Rail|Road|Dock]ToolbarWindows.
rubidium
parents:
10616
diff
changeset
|
151 |
AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR); |
0 | 152 |
} |
153 |
||
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
154 |
class AirportPickerWindow : public PickerWindowBase { |
10115
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
155 |
|
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
156 |
enum { |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
157 |
BAW_BOTTOMPANEL = 10, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
158 |
BAW_SMALL_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
159 |
BAW_CITY_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
160 |
BAW_HELIPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
161 |
BAW_METRO_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
162 |
BAW_STR_INTERNATIONAL_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
163 |
BAW_COMMUTER_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
164 |
BAW_HELIDEPOT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
165 |
BAW_STR_INTERCONTINENTAL_AIRPORT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
166 |
BAW_HELISTATION, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
167 |
BAW_LAST_AIRPORT = BAW_HELISTATION, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
168 |
BAW_AIRPORT_COUNT = BAW_LAST_AIRPORT - BAW_SMALL_AIRPORT + 1, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
169 |
BAW_BTN_DONTHILIGHT = BAW_LAST_AIRPORT + 1, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
170 |
BAW_BTN_DOHILIGHT, |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
171 |
}; |
0 | 172 |
|
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
173 |
public: |
0 | 174 |
|
10686
8e02259158f3
(svn r13230) -Fix [FS#2030](r13171): When closing toolbars, also close their PickerWindows.
frosch
parents:
10682
diff
changeset
|
175 |
AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent) |
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
176 |
{ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
177 |
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
178 |
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
179 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
1109
1bab892228cd
(svn r1610) Remove trailing whitespace (last time ever, i hope)
tron
parents:
1093
diff
changeset
|
180 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
181 |
if (_settings_game.economy.station_noise_level) { |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
182 |
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10); |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
183 |
} |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
184 |
|
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
185 |
this->FindWindowPlacementAndResize(desc); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
186 |
} |
10115
f925c509343d
(svn r12646) -Codechange: another run of code-style cleanup
belugas
parents:
10114
diff
changeset
|
187 |
|
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
188 |
virtual void OnPaint() |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
189 |
{ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
190 |
int i; // airport enabling loop |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
191 |
uint16 y_noise_offset = 0; |
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
192 |
uint32 avail_airports; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
193 |
const AirportFTAClass *airport; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
194 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
195 |
avail_airports = GetValidAirports(); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
196 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
197 |
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
198 |
if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
199 |
if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
200 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
201 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
202 |
/* 'Country Airport' starts at widget BAW_SMALL_AIRPORT, and if its bit is set, it is |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
203 |
* available, so take its opposite value to set the disabled state. |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
204 |
* There are 9 buildable airports |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
205 |
* XXX TODO : all airports should be held in arrays, with all relevant data. |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
206 |
* This should be part of newgrf-airports, i suppose |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
207 |
*/ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
208 |
for (i = 0; i < BAW_AIRPORT_COUNT; i++) this->SetWidgetDisabledState(i + BAW_SMALL_AIRPORT, !HasBit(avail_airports, i)); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
209 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
210 |
/* select default the coverage area to 'Off' (16) */ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
211 |
airport = GetAirport(_selected_airport_type); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
212 |
SetTileSelectSize(airport->size_x, airport->size_y); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
213 |
|
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
214 |
int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; |
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
215 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
216 |
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
217 |
|
10595
7957c71b0dfe
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
10590
diff
changeset
|
218 |
this->DrawWidgets(); |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
219 |
|
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
220 |
/* only show the station (airport) noise, if the noise option is activated */ |
10775
7061477bfbcf
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
10703
diff
changeset
|
221 |
if (_settings_game.economy.station_noise_level) { |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
222 |
/* show the noise of the selected airport */ |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
223 |
SetDParam(0, airport->noise_level); |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
224 |
DrawString(2, 206, STR_STATION_NOISE, 0); |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
225 |
y_noise_offset = 10; |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
226 |
} |
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
227 |
|
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
228 |
/* strings such as 'Size' and 'Coverage Area' */ |
10682
3b753d908205
(svn r13226) -Feature: Allow to have more than only two airports per town. The number of airports is now controlled by the noise each of them generates, the distance from town's center and how tolerant the town is.
belugas
parents:
10641
diff
changeset
|
229 |
int text_end = DrawStationCoverageAreaText(2, this->widget[BAW_BTN_DOHILIGHT].bottom + 4 + y_noise_offset, SCT_ALL, rad, false); |
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
230 |
text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
231 |
if (text_end != this->widget[BAW_BOTTOMPANEL].bottom) { |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
232 |
this->SetDirty(); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
233 |
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, text_end - this->widget[BAW_BOTTOMPANEL].bottom); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
234 |
this->SetDirty(); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
235 |
} |
0 | 236 |
} |
10590
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
237 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
238 |
virtual void OnClick(Point pt, int widget) |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
239 |
{ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
240 |
switch (widget) { |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
241 |
case BAW_SMALL_AIRPORT: case BAW_CITY_AIRPORT: case BAW_HELIPORT: case BAW_METRO_AIRPORT: |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
242 |
case BAW_STR_INTERNATIONAL_AIRPORT: case BAW_COMMUTER_AIRPORT: case BAW_HELIDEPOT: |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
243 |
case BAW_STR_INTERCONTINENTAL_AIRPORT: case BAW_HELISTATION: |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
244 |
this->RaiseWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
245 |
_selected_airport_type = widget - BAW_SMALL_AIRPORT; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
246 |
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
247 |
SndPlayFx(SND_15_BEEP); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
248 |
this->SetDirty(); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
249 |
break; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
250 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
251 |
case BAW_BTN_DONTHILIGHT: case BAW_BTN_DOHILIGHT: |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
252 |
_station_show_coverage = (widget != BAW_BTN_DONTHILIGHT); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
253 |
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_station_show_coverage); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
254 |
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
255 |
SndPlayFx(SND_15_BEEP); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
256 |
this->SetDirty(); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
257 |
break; |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
258 |
} |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
259 |
} |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
260 |
|
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
261 |
virtual void OnTick() |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
262 |
{ |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
263 |
CheckRedrawStationCoverage(this); |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
264 |
} |
e96b16b574a7
(svn r13134) -Codechange: make a class of the Airport Picker Window.
belugas
parents:
10560
diff
changeset
|
265 |
}; |
0 | 266 |
|
267 |
static const Widget _build_airport_picker_widgets[] = { |
|
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
268 |
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
269 |
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
270 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 52, 0x0, STR_NULL}, |
10148
363d2c719c41
(svn r12679) -Codechange : a little bit of widget enumification
belugas
parents:
10116
diff
changeset
|
271 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 14, 27, STR_SMALL_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
272 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 53, 89, 0x0, STR_NULL}, |
10148
363d2c719c41
(svn r12679) -Codechange : a little bit of widget enumification
belugas
parents:
10116
diff
changeset
|
273 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 52, 65, STR_LARGE_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
274 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 90, 127, 0x0, STR_NULL}, |
10148
363d2c719c41
(svn r12679) -Codechange : a little bit of widget enumification
belugas
parents:
10116
diff
changeset
|
275 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 90, 103, STR_HUB_AIRPORTS, STR_NULL}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
276 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 128, 177, 0x0, STR_NULL}, |
10148
363d2c719c41
(svn r12679) -Codechange : a little bit of widget enumification
belugas
parents:
10116
diff
changeset
|
277 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 128, 141, STR_HELIPORTS, STR_NULL}, |
363d2c719c41
(svn r12679) -Codechange : a little bit of widget enumification
belugas
parents:
10116
diff
changeset
|
278 |
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 178, 239, 0x0, STR_NULL}, // bottom general box |
4968
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
279 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 27, 38, STR_SMALL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
280 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 65, 76, STR_CITY_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
281 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 141, 152, STR_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
282 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 77, 88, STR_METRO_AIRPORT , STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
283 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 103, 114, STR_INTERNATIONAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
284 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 39, 50, STR_COMMUTER_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
285 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 165, 176, STR_HELIDEPOT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
286 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 115, 126, STR_INTERCONTINENTAL_AIRPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
6cfec8858f17
(svn r6971) -Fix r6961: WWT_NODISTXTBTN buttons were normal buttons not push buttons
glx
parents:
4963
diff
changeset
|
287 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 145, 153, 164, STR_HELISTATION, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT}, |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
288 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 191, 202, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
289 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 191, 202, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA}, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
290 |
{ WWT_LABEL, RESIZE_NONE, 7, 0, 147, 178, 191, STR_3066_COVERAGE_AREA_HIGHLIGHT, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
0
diff
changeset
|
291 |
{ WIDGETS_END}, |
0 | 292 |
}; |
293 |
||
294 |
static const WindowDesc _build_airport_desc = { |
|
7837
65d7362153a6
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7737
diff
changeset
|
295 |
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240, |
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
5005
diff
changeset
|
296 |
WC_BUILD_STATION, WC_BUILD_TOOLBAR, |
0 | 297 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
298 |
_build_airport_picker_widgets, |
|
299 |
}; |
|
300 |
||
10686
8e02259158f3
(svn r13230) -Fix [FS#2030](r13171): When closing toolbars, also close their PickerWindows.
frosch
parents:
10682
diff
changeset
|
301 |
static void ShowBuildAirportPicker(Window *parent) |
0 | 302 |
{ |
10686
8e02259158f3
(svn r13230) -Fix [FS#2030](r13171): When closing toolbars, also close their PickerWindows.
frosch
parents:
10682
diff
changeset
|
303 |
new AirportPickerWindow(&_build_airport_desc, parent); |
0 | 304 |
} |
305 |
||
6573 | 306 |
void InitializeAirportGui() |
0 | 307 |
{ |
308 |
_selected_airport_type = AT_SMALL; |
|
309 |
} |