just moves some code in more...
|
1 |
# vim: set foldmethod=marker foldmarker={{{,}}} : |
fix MFD page selection syste...
|
2 |
displayClass.MFD = { |
adds MFD menu for Aux/System...
|
3 |
AUX: { |
add flight planning menu
|
4 |
'TRIP PLANNING' : func { |
5 |
me.device.buttons.CLR = func { |
|
6 |
me.device.buttons.CLR = func; |
|
7 |
fgcommand('dialog-close', { 'dialog-name' : 'route-manager' }); |
|
8 |
fgcommand('dialog-close', { 'dialog-name' : 'map' }); |
|
9 |
}; |
|
10 |
fgcommand('dialog-show', { 'dialog-name' : 'map' }); |
|
11 |
fgcommand('dialog-show', { 'dialog-name' : 'route-manager' }); |
|
12 |
}, |
|
adapt menu entry to the cont...
|
13 |
'NAVBOX ITEMS SELECTION' : func { |
adds MFD menu for Aux/System...
|
14 |
var obj_infos = [ |
15 |
{text: 'NAV BOX DATA FIELDS', type: 'title'}, |
|
16 |
{type: 'separator'}, |
|
17 |
{text: 'DATA FIELD NUMBER', type: 'normal'}, |
|
18 |
{text: ' 1 >', type: 'selected|end-of-line', choices: [' 1 >', '< 2 >', '< 3 >', '< 4 ']}, |
|
19 |
]; |
|
navigation box content
|
20 |
foreach (var item; keys(me.device.display.navbox)) { |
21 |
if (item == 'LEG') # LEG only displayed on PFD navigation box |
|
22 |
continue; |
|
adds MFD menu for Aux/System...
|
23 |
append(obj_infos, { |
navigation box content
|
24 |
text: sprintf('%-3s ', item), |
25 |
type: 'editable', |
|
adds MFD menu for Aux/System...
|
26 |
callback: func (id, selected) { |
improve MFD system settings ...
|
27 |
var field = string.trim(me.device.windows.state[id].objects[3].text, |
28 |
0, |
|
29 |
func (c) c == `<` or c == `>` or c == ` `); |
|
adds MFD menu for Aux/System...
|
30 |
me.device.display.screenElements['DATA-FIELD' ~ field ~ '-ID-text'] |
improve MFD system settings ...
|
31 |
.setText(string.trim(me.device.windows.state[id].objects[selected].text, 1)); |
adds MFD menu for Aux/System...
|
32 |
} |
33 |
}); |
|
navigation box content
|
34 |
append(obj_infos, { |
35 |
text: sprintf('(%s)', me.device.display.navbox[item][1]), |
|
36 |
type: 'normal|end-of-line', |
|
37 |
}); |
|
adds MFD menu for Aux/System...
|
38 |
} |
39 |
var windowId = 'SYSTEM SETUP'; |
|
make use of new window drawi...
|
40 |
me.device.windows.draw( windowId, obj_infos ); |
adds MFD menu for Aux/System...
|
41 |
me.device.buttons.CLR = func { |
42 |
me.device.windows.del(windowId); |
|
43 |
me.device.buttons.ENT = func; |
|
44 |
me.device.buttons.CLR = func; |
|
45 |
me.device.knobs.FmsInner = func; |
|
46 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
47 |
} |
|
48 |
me.device.knobs.FmsInner = me.device.knobs.MenuSettings; |
|
49 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
50 |
me.device.buttons.ENT = me.device.buttons.ValidateTMRREF; |
|
fix MFD page selection syste...
|
51 |
}, |
52 |
}, |
|
add flightplan display
|
53 |
FPL : { |
54 |
'ACTIVE FLIGHT PLAN' : func { |
|
55 |
me.device.windows.del(id); |
|
56 |
var flightplan = props.globals.getNode('/autopilot/route-manager'); |
|
57 |
var route = flightplan.getNode('route'); |
|
58 |
var obj_infos = [ |
|
59 |
{text: 'ACTIVE FLIGTHPLAN', type: 'title'}, |
|
60 |
{type: 'separator'}, |
|
61 |
]; |
|
62 |
if (route.getValue('num')) { |
|
63 |
append(obj_infos, {text: sprintf('DEP: %s', flightplan.getNode('departure').getValue('airport')), type: 'normal|end-of-line'}); |
|
64 |
append(obj_infos, {text: sprintf('ARR: %s', flightplan.getNode('destination').getValue('airport')), type: 'normal|end-of-line'}); |
|
65 |
append(obj_infos, {text: sprintf('DIS: %dnm', flightplan.getValue('total-distance')), type: 'normal|end-of-line'}); |
|
66 |
append(obj_infos, {type: 'separator'}); |
|
67 |
var current_wp = flightplan.getValue('current-wp'); |
|
68 |
var firstEntry = 1; |
|
69 |
for (var n = 1; n < route.getValue('num'); n += 1) { |
|
70 |
var wp = route.getChild('wp', n); |
|
71 |
append(obj_infos, {text: sprintf('%1s %-7s %3d° %3dnm %s', |
|
72 |
n == current_wp ? utf8.chstr(9658) : ' ', |
|
73 |
wp.getValue('id'), |
|
74 |
math.round(wp.getValue('leg-bearing-true-deg')), |
|
75 |
math.round(wp.getValue('leg-distance-nm')), |
|
76 |
wp.getValue('altitude-ft') > -100 ? ' ' ~ wp.getValue('altitude-ft') ~ 'ft': '' |
|
77 |
), |
|
78 |
type: (firstEntry ? 'selected' : 'editable') ~ '|end-of-line', |
|
fix active FP display issue ...
|
79 |
scrollgroup: n - 1 |
add flightplan display
|
80 |
}); |
81 |
firstEntry = 0; |
|
82 |
} |
|
83 |
} |
|
84 |
else { |
|
85 |
append(obj_infos, {text: 'NO FP LOADED', type: 'normal|end-of-line'}); |
|
86 |
} |
|
87 |
var windowId = 'ACTIVE FLIGTH PLAN'; |
|
88 |
me.device.windows.draw( windowId, obj_infos, {lines: 6, columns: 1} ); |
|
89 |
me.device.buttons.CLR = func { |
|
90 |
me.device.windows.del(windowId); |
|
91 |
me.device.buttons.ENT = func; |
|
92 |
me.device.buttons.CLR = func; |
|
93 |
me.device.knobs.FmsInner = func; |
|
94 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
95 |
} |
|
96 |
me.device.knobs.FmsInner = me.device.knobs.NavigateMenu; |
|
97 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
98 |
}, |
|
adds flight plan catalog loa...
|
99 |
'FLIGHT PLAN CATALOG': func { |
100 |
var obj_infos = []; |
|
101 |
var departure = getprop('/sim/airport/closest-airport-id'); |
|
102 |
append(obj_infos, {text: departure ~ ' STORED FLIGHT PLANS', type: 'title'}); |
|
103 |
append(obj_infos, {type: 'separator'}); |
|
104 |
var idx = 0; |
|
105 |
foreach (var file; directory(data.flightplans)) { |
|
106 |
var stat = io.stat(data.flightplans ~ '/' ~ file); |
|
107 |
if (stat[11] == 'reg' or stat[11] == 'lnk') { |
|
108 |
var xml = call(func (path) io.readxml(path), [ data.flightplans ~ '/' ~ file ], me, {}, var errors = []); |
|
109 |
if (size(errors)) |
|
110 |
continue; |
|
remove unused properties in ...
|
111 |
if (xml.getNode('/PropertyList/departure/airport') != nil |
adds flight plan catalog loa...
|
112 |
and xml.getNode('/PropertyList/destination/airport') != nil |
113 |
and xml.getNode('/PropertyList/departure').getValue('airport') == departure) { |
|
114 |
append(obj_infos, { |
|
115 |
text: sprintf('RWY %s to %s%s', |
|
116 |
xml.getNode('/PropertyList/departure').getValue('runway'), |
|
117 |
xml.getNode('/PropertyList/destination').getValue('airport'), |
|
118 |
xml.getNode('/PropertyList/destination').getValue('runway') != nil ? |
|
119 |
'-' ~ xml.getNode('/PropertyList/destination').getValue('runway') : ''), |
|
120 |
type: (idx ? 'editable' : 'selected') ~ '|end-of-line', |
|
121 |
scrollgroup: idx, |
|
122 |
_file: data.flightplans ~ '/' ~ file |
|
123 |
}); |
|
124 |
var first_wp = last_wp = 0; |
|
125 |
forindex (var wp; xml.getNode('/PropertyList/route').getChildren('wp')) { |
|
126 |
var ident = xml.getNode('/PropertyList/route').getChild('wp', wp).getValue('ident'); |
|
127 |
if (string.match(ident, 'DEP-[0-9]*') |
|
128 |
or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/departure').getValue('runway'))) |
|
129 |
or string.match(ident, sprintf('%s-[0-9]*', xml.getNode('/PropertyList/departure').getValue('runway')))) { |
|
130 |
continue; |
|
131 |
} |
|
132 |
if (!first_wp) { |
|
133 |
first_wp = wp; |
|
134 |
continue; |
|
135 |
} |
|
136 |
if (string.match(ident, 'APP-[0-9]*') |
|
137 |
or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/destination').getValue('runway'))) |
|
138 |
or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/destination').getValue('airport'))) |
|
139 |
or string.match(ident, sprintf('%s-[0-9]*', xml.getNode('/PropertyList/destination').getValue('runway')))) { |
|
140 |
last_wp = wp - 1; |
|
141 |
break; |
|
142 |
} |
|
143 |
} |
|
144 |
if (last_wp - first_wp > 2) |
|
145 |
append(obj_infos, { |
|
146 |
text: sprintf(' %s via %s and %s', |
|
147 |
utf8.chstr(9658), |
|
148 |
xml.getNode('/PropertyList/route').getChild('wp', first_wp + int((last_wp - first_wp)/3)).getValue('ident'), |
|
149 |
xml.getNode('/PropertyList/route').getChild('wp', last_wp - int((last_wp - first_wp)/3)).getValue('ident')), |
|
150 |
type: 'normal|end-of-line', |
|
151 |
scrollgroup: idx |
|
152 |
}); |
|
153 |
else |
|
154 |
append(obj_infos, { |
|
155 |
text: sprintf(' %s direct', utf8.chstr(9658)), |
|
156 |
type: 'normal|end-of-line', |
|
157 |
scrollgroup: idx |
|
158 |
}); |
|
159 |
idx += 1; |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
if (!idx) |
|
164 |
append(obj_infos, { text: 'no flightplan found', type: 'normal|end-of-line'}); |
|
165 | ||
166 |
var windowId = 'FLIGTH PLAN CATALOG'; |
|
167 |
me.device.windows.draw( windowId, obj_infos, {lines: 6, columns: 1, rows: 2} ); |
|
168 |
me.device.knobs.FmsInner = me.device.knobs.NavigateMenu; |
|
169 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
170 |
me.device.buttons.CLR = func { |
|
171 |
me.device.windows.del(windowId); |
|
172 |
me.device.buttons.ENT = func; |
|
173 |
me.device.buttons.CLR = func; |
|
174 |
me.device.knobs.FmsInner = func; |
|
175 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
176 |
} |
|
177 |
me.device.buttons.ENT = func (a = 0) { |
|
display route only when load...
|
178 |
if (a) return; |
adds flight plan catalog loa...
|
179 |
var (id, selected) = split('-', me.device.windows.selected); |
180 |
var file = me.device.windows.state[id].objects[selected]._file; |
|
181 |
me.device.buttons.CLR(); |
|
182 |
data.flightplan = flightplan(file); |
|
183 |
data.flightplan.activate(); |
|
fix FP not activated from ca...
|
184 |
fgcommand("activate-flightplan", props.Node.new({"activate": 1})); |
display route only when load...
|
185 |
foreach (var d; keys(zkv1000.flightdeck)) { |
186 |
if (zkv1000.flightdeck[d].role == 'MFD') |
|
187 |
zkv1000.flightdeck[d].softkeys.colored.MAPROUTE = 1; |
|
188 |
if (zkv1000.flightdeck[d].role == 'PFD') |
|
189 |
zkv1000.flightdeck[d].softkeys.colored.INSETROUTE = 1; |
|
190 |
} |
|
adds flight plan catalog loa...
|
191 |
} |
192 |
}, |
|
add flightplan display
|
193 |
}, |
add MFD pages for nearest ai...
|
194 |
NRST : { |
195 |
'NEAREST AIRPORTS': func { |
|
196 |
var airports = findAirportsWithinRange(99.99); |
|
197 |
var obj_infos = [ |
|
198 |
{text: size(airports) ~ ' NEAREST AIRPORTS', type: 'title'}, |
|
199 |
{type: 'separator'}, |
|
200 |
]; |
|
201 |
var name_max_length = 0; |
|
202 |
forindex (var idx; airports) { |
|
203 |
var info = airportinfo(airports[idx].id); |
|
204 |
var (course, distance) = courseAndDistance(info); |
|
205 |
var name = sprintf('%s (%s)', airports[idx].id, airports[idx].name); |
|
206 |
if (size(name) > name_max_length) |
|
207 |
name_max_length = size(name); |
|
208 | ||
209 |
append(obj_infos, { |
|
210 |
text: name, |
|
211 |
type: (idx ? 'editable' : 'selected') ~ '|immediate|end-of-line', |
|
212 |
scrollgroup: idx, |
|
213 |
} |
|
214 |
); |
|
215 |
append(obj_infos, { |
|
small display improvement
|
216 |
text: sprintf(' %s DST %2dNM CRS %03d°', utf8.chstr(9658), distance, course), |
add MFD pages for nearest ai...
|
217 |
type: 'normal|end-of-line', |
218 |
scrollgroup: idx |
|
219 |
} |
|
220 |
); |
|
221 |
} |
|
222 |
var windowId = 'NEAREST AIRPORTS'; |
|
apply scrolling fix
|
223 |
me.device.windows.draw( windowId, obj_infos, {lines: 4, columns: 1, rows: 2} ); |
add MFD pages for nearest ai...
|
224 |
me.device.buttons.CLR = func { |
225 |
me.device.windows.del(windowId); |
|
226 |
me.device.buttons.ENT = func; |
|
227 |
me.device.buttons.CLR = func; |
|
228 |
me.device.knobs.FmsInner = func; |
|
229 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
230 |
} |
|
231 |
me.device.knobs.FmsInner = me.device.knobs.NavigateMenu; |
|
232 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
233 |
me.device.buttons.ENT = func (a = 0) { |
|
234 |
if (a) return; |
|
fix an old hidden bug
|
235 |
var (id, selected) = split('-', me.device.windows.selected); |
236 |
var state = me.device.windows.state[id]; |
|
237 |
var (airport_id, _) = split(" ", obj_infos[selected + state.scroll.offset].text); |
|
add MFD pages for nearest ai...
|
238 |
me.device.windows.del(windowId); |
239 |
call(me.device.display.MFD._ShowAirportInfo, [airport_id], me); |
|
240 |
}; |
|
241 |
}, |
|
242 |
'NEAREST INTERSECTIONS': func { |
|
243 |
call(me.device.display.MFD._NearestNavaids, ['fix'], me); |
|
244 |
}, |
|
245 |
'NEAREST NDB': func { |
|
246 |
call(me.device.display.MFD._NearestNavaids, ['ndb'], me); |
|
247 |
}, |
|
248 |
'NEAREST VOR': func { |
|
249 |
call(me.device.display.MFD._NearestNavaids, ['vor'], me); |
|
250 |
}, |
|
251 |
}, |
|
252 |
_NearestNavaids: func (navaid_type) { |
|
253 |
var navaids = findNavaidsWithinRange(99.99, navaid_type); |
|
254 |
var obj_infos = [ |
|
255 |
{text: size(navaids) ~ ' NEAREST ' ~ string.uc(navaid_type), type: 'title'}, |
|
256 |
{type: 'separator'}, |
|
257 |
]; |
|
258 |
var idx = 0; |
|
259 |
foreach (var navaid; navaids) { |
|
260 |
var (course, distance) = courseAndDistance(navaid); |
|
261 |
var name = navaid.id ~ ' (' ~ navaid.name ~ ')'; |
|
262 | ||
263 |
append(obj_infos, { |
|
264 |
text: navaid.id ~ ' (' ~ navaid.name ~ ')', |
|
265 |
type: (idx ? 'editable' : 'selected') ~ '|immediate|end-of-line', |
|
266 |
scrollgroup: idx, |
|
267 |
} |
|
268 |
); |
|
269 |
append(obj_infos, { |
|
small display improvement
|
270 |
text: sprintf(' %s DST %2dNM CRS %03d°', utf8.chstr(9658), distance, course), |
add MFD pages for nearest ai...
|
271 |
type: 'normal|end-of-line', |
272 |
scrollgroup: idx |
|
273 |
} |
|
274 |
); |
|
275 |
idx += 1; |
|
276 |
} |
|
277 |
append(obj_infos, {type: 'separator'}); |
|
278 |
var windowId = obj_infos[0].text; |
|
apply scrolling fix
|
279 |
me.device.windows.draw( windowId, obj_infos, {lines: 4, columns: 1, rows: 2} ); |
add MFD pages for nearest ai...
|
280 |
me.device.buttons.CLR = func { |
281 |
me.device.windows.del(windowId); |
|
282 |
me.device.buttons.ENT = func; |
|
283 |
me.device.buttons.CLR = func; |
|
284 |
me.device.knobs.FmsInner = func; |
|
285 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
286 |
} |
|
287 |
me.device.knobs.FmsInner = me.device.knobs.NavigateMenu; |
|
288 |
me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu; |
|
289 |
me.device.buttons.ENT = func (a = 0) { |
|
290 |
if (a) return; |
|
fix an old hidden bug
|
291 |
var (id, selected) = split('-', me.device.windows.selected); |
292 |
var state = me.device.windows.state[id]; |
|
293 |
var (navaid_id, _) = split(" ", obj_infos[selected + state.scroll.offset].text); |
|
add MFD pages for nearest ai...
|
294 |
me.device.windows.del(windowId); |
295 |
if (navaid_type == 'airport') |
|
296 |
call(me.device.display.MFD._ShowAirportInfo, [navaid_id], me); |
|
297 |
else |
|
298 |
call(me.device.display.MFD._ShowNavaidInfo, [navaid_id, navaid_type], me); |
|
299 |
}; |
|
300 |
}, |
|
301 |
_ShowNavaidInfo: func (navaid_id, navaid_type) { |
|
302 |
var info = findNavaidsByID(navaid_id, navaid_type); |
|
303 |
if (size(info) == 0) return; |
|
304 |
me.device.knobs.FmsInner = func; |
|
305 |
me.device.knobs.FmsOuter = func; |
|
306 |
me.device.buttons.ENT = func; |
|
307 |
var obj_infos = [ |
|
308 |
{text: info[0].id ~ ' INFORMATION', type: 'title'}, |
|
309 |
{type: 'separator'}, |
|
310 |
{text: 'ID ' ~ info[0].id, type: 'normal|end-of-line'}, |
|
311 |
{text: 'NAME ' ~ info[0].name, type: 'normal|end-of-line'}, |
|
312 |
{text: 'TYPE ' ~ info[0].type, type: 'normal|end-of-line'}, |
|
313 |
{text: sprintf('LON %.3f %s', abs(info[0].lon), info[0].lon > 0 ? 'E' : 'W'), type: 'normal|end-of-line'}, |
|
314 |
{text: sprintf('LAT %.3f %s', abs(info[0].lat), info[0].lat > 0 ? 'N' : 'S'), type: 'normal|end-of-line'}, |
|
315 |
]; |
|
316 |
call(func {return info[0].range }, [], nil, nil, var errors = []); |
|
317 |
if (!size(errors)) |
|
318 |
append(obj_infos, {text: sprintf('RANGE %i NM', info[0].range * 1.852), type: 'normal|end-of-line'}); |
|
319 |
call(func {return info[0].frequency }, [], nil, nil, var errors = []); |
|
320 |
if (!size(errors)) |
|
321 |
append(obj_infos, {text: sprintf('FREQ %.2f kHz', info[0].frequency / 100), type: 'normal|end-of-line'}); |
|
322 |
var lines = size(obj_infos); |
|
323 |
var windowId = 'NAVAID INFORMATIONS'; |
|
make use of new window drawi...
|
324 |
me.device.windows.draw( windowId, obj_infos ); |
add MFD pages for nearest ai...
|
325 |
me.device.buttons.CLR = func { |
326 |
me.device.windows.del(windowId); |
|
327 |
me.device.buttons.ENT = func; |
|
328 |
me.device.buttons.CLR = func; |
|
329 |
me.device.knobs.FmsInner = func; |
|
330 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
331 |
} |
|
332 |
}, |
|
333 |
_ShowAirportInfo: func (airport_id) { |
|
334 |
me.device.knobs.FmsInner = func; |
|
335 |
me.device.knobs.FmsOuter = func; |
|
336 |
me.device.buttons.ENT = func; |
|
337 |
var info = airportinfo(airport_id); |
|
338 |
var obj_infos = [ |
|
339 |
{text: airport_id ~ ' INFORMATION', type: 'title'}, |
|
340 |
{type: 'separator'}, |
|
341 |
{text: sprintf('ELEVATION %.0d FT', info.elevation * 3.28), type: 'normal|end-of-line'}, |
|
342 |
{text: sprintf('LON: %.3f %s', abs(info.lon), info.lon > 0 ? 'E' : 'W'), type: 'normal|end-of-line'}, |
|
343 |
{text: sprintf('LAT: %.3f %s', abs(info.lat), info.lat > 0 ? 'N' : 'S'), type: 'normal|end-of-line'}, |
|
344 |
{type: 'separator'}, |
|
345 |
{text: 'RUNWAYS', type: 'title'}, |
|
346 |
]; |
|
347 |
foreach (var rwy; sort(keys(info.runways), string.icmp)) { |
|
348 |
var rwyInfo = sprintf("%-3s %4.0dm %3.0d°", |
|
349 |
rwy, |
|
350 |
info.runways[rwy].length, |
|
351 |
info.runways[rwy].heading); |
|
352 |
if (info.runways[rwy].ils != nil) { |
|
353 |
rwyInfo = sprintf("%s %3.3f Mhz", rwyInfo, info.runways[rwy].ils.frequency / 100); |
|
354 |
} |
|
355 |
append(obj_infos, {text: rwyInfo, type: 'normal|end-of-line'}); |
|
356 |
} |
|
357 |
var sep = 2; # to count separators, already two printed |
|
358 |
if (size(info.comms()) > 0) { |
|
359 |
# TODO: find nearby freqs if none found for airport |
|
360 |
append(obj_infos, {type: 'separator'}); sep += 1; |
|
make use of new window drawi...
|
361 |
append(obj_infos, {text: 'COMMS FREQUENCIES', type: 'title'}); |
add MFD pages for nearest ai...
|
362 |
var freqs = {}; |
363 |
var comms = info.comms(); |
|
364 |
foreach (var c; comms) |
|
365 |
freqs[c.ident] = sprintf("%.3f", c.frequency); |
|
366 | ||
367 |
foreach (var f; sort(keys(freqs), string.icmp)) |
|
368 |
append(obj_infos, {text: sprintf('%-15s %.3f', f, freqs[f]), type: 'normal|end-of-line'}); |
|
369 |
} |
|
370 |
var lines = size(obj_infos) - sep; # minus the separators |
|
371 |
var windowId = 'AIRPORT INFORMATIONS'; |
|
make use of new window drawi...
|
372 |
me.device.windows.draw( windowId, obj_infos ); |
add MFD pages for nearest ai...
|
373 |
me.device.buttons.CLR = func { |
374 |
me.device.windows.del(windowId); |
|
375 |
me.device.buttons.ENT = func; |
|
376 |
me.device.buttons.CLR = func; |
|
377 |
me.device.knobs.FmsInner = func; |
|
378 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
379 |
} |
|
380 |
}, |
|
fix MFD page selection syste...
|
381 |
}; |
382 | ||
383 |
displayClass.setMFDPages = func { |
|
just moves some code in more...
|
384 |
me.device.data['page selection'] = [ |
385 |
# list of pages, by group {{{ |
|
386 |
{ |
|
387 |
name: 'MAP', |
|
388 |
objects: [ |
|
389 |
{text: 'NAVIGATION MAP'}, |
|
390 |
{text: 'TRAFFIC MAP'}, |
|
391 |
{text: 'STORMSCOPE'}, |
|
392 |
{text: 'WEATHER DATA LINK'}, |
|
393 |
{text: 'TAWS-B'}, |
|
394 |
], |
|
395 |
}, |
|
396 |
{ |
|
397 |
name: 'WPT', |
|
398 |
objects: [ |
|
399 |
{text: 'AIRPORT INFORMATION'}, |
|
400 |
{text: 'AIRPORT DIRECTORY'}, |
|
401 |
{text: 'DEPARTURE INFORMATION'}, |
|
402 |
{text: 'ARRIVAL INFORMATION'}, |
|
403 |
{text: 'APPROACH INFORMATION'}, |
|
404 |
{text: 'WEATHER INFORMATION'}, |
|
405 |
{text: 'INTERSECTION INFORMATION'}, |
|
406 |
{text: 'NDB INFORMATION'}, |
|
407 |
{text: 'VOR INFORMATION'}, |
|
408 |
{text: 'USER WAYPOINT INFORMATION'}, |
|
409 |
], |
|
410 |
}, |
|
411 |
{ |
|
412 |
name: 'AUX', |
|
413 |
objects: [ |
|
414 |
{text: 'TRIP PLANNING'}, |
|
415 |
{text: 'UTILITY'}, |
|
416 |
{text: 'GPS STATUS'}, |
|
adapt menu entry to the cont...
|
417 |
{text: 'NAVBOX ITEMS SELECTION'}, |
just moves some code in more...
|
418 |
], |
419 |
}, |
|
420 |
{ |
|
421 |
name: 'FPL', |
|
422 |
objects: [ |
|
423 |
{text: 'ACTIVE FLIGHT PLAN'}, |
|
424 |
{text: 'WIDE VIEW, NARROW VIEW'}, |
|
425 |
{text: 'FLIGHT PLAN CATALOG'}, |
|
426 |
], |
|
427 |
}, |
|
428 |
{ |
|
429 |
name: 'PROC', |
|
430 |
objects: [ |
|
431 |
{text: 'DEPARTURE LOADING'}, |
|
432 |
{text: 'ARRIVAL LOADING'}, |
|
433 |
{text: 'APPROACH LOADING'}, |
|
434 |
], |
|
435 |
}, |
|
436 |
{ |
|
437 |
name: 'NRST', |
|
438 |
objects: [ |
|
439 |
{text: 'NEAREST AIRPORTS'}, |
|
440 |
{text: 'NEAREST INTERSECTIONS'}, |
|
441 |
{text: 'NEAREST NDB'}, |
|
442 |
{text: 'NEAREST VOR'}, |
|
443 |
{text: 'NEAREST USER WAYPOINTS'}, |
|
444 |
{text: 'NEAREST FREQUENCIES'}, |
|
445 |
{text: 'NEAREST AIRSPACES'}, |
|
446 |
], |
|
447 |
}, |
|
448 |
# }}} |
|
449 |
]; |
|
450 | ||
fix MFD page selection syste...
|
451 |
foreach (var g; me.device.data['page selection']) { |
452 |
var obj_s = size(g.objects); |
|
453 |
# build specific geometry per page, depending of number of sub-pages |
|
454 |
g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1}; |
|
455 |
# complete the hash with reccurrent elements type and callback |
|
allows only implemented MFD ...
|
456 |
var firstEntry = 1; |
fix MFD page selection syste...
|
457 |
foreach (var o; g.objects) { |
allows only implemented MFD ...
|
458 |
if (contains(me.MFD, g.name) and contains(me.MFD[g.name], o.text)) { |
459 |
o.type = firstEntry ? 'selected' : 'editable'; |
|
460 |
o.type ~= '|end-of-line'; |
|
461 |
o.callback = me.device.buttons.MFD_page_wrapper; |
|
make first menu item selecte...
|
462 |
firstEntry = 0; |
allows only implemented MFD ...
|
463 |
} |
464 |
else |
|
465 |
o.type = 'normal|end-of-line'; |
|
fix MFD page selection syste...
|
466 |
} |
467 |
} |
|
468 |
# build the available groups line, at the bottom |
|
469 |
forindex (var g; me.device.data['page selection']) { |
|
470 |
append(me.device.data['page selection'][g].objects, {type: 'separator'}); |
|
471 |
for (var i = 0; i < g; i+=1) |
|
472 |
append(me.device.data['page selection'][g].objects, |
|
473 |
{text: me.device.data['page selection'][i].name, type: 'normal'}); |
|
474 |
append(me.device.data['page selection'][g].objects, |
|
475 |
{text: me.device.data['page selection'][i].name, type: 'highlighted'}); |
|
476 |
for (var i = g+1; i < size(me.device.data['page selection']); i+=1) |
|
477 |
append(me.device.data['page selection'][g].objects, |
|
478 |
{text: me.device.data['page selection'][i].name, type: 'normal'}); |
|
479 |
} |
|
480 |
me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group; |
|
481 |
}; |