zkv1000 / Nasal / MFD.pages.nas /
Newer Older
474 lines | 23.136kb
just moves some code in more...
Sébastien MARQUE authored on 2017-07-17
1
# vim: set foldmethod=marker foldmarker={{{,}}} :
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
2
displayClass.MFD = {
adds MFD menu for Aux/System...
Sébastien MARQUE authored on 2017-06-02
3
    AUX: {
add flight planning menu
Sébastien MARQUE authored on 2020-05-04
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...
Sébastien MARQUE authored on 2020-05-20
13
        'NAVBOX ITEMS SELECTION' : func {
adds MFD menu for Aux/System...
Sébastien MARQUE authored on 2017-06-02
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
Sébastien MARQUE authored on 2020-05-12
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...
Sébastien MARQUE authored on 2017-06-02
23
                append(obj_infos, {
navigation box content
Sébastien MARQUE authored on 2020-05-12
24
                    text: sprintf('%-3s ', item),
25
                    type: 'editable',
adds MFD menu for Aux/System...
Sébastien MARQUE authored on 2017-06-02
26
                    callback: func (id, selected) {
improve MFD system settings ...
Sébastien MARQUE authored on 2020-05-03
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...
Sébastien MARQUE authored on 2017-06-02
30
                        me.device.display.screenElements['DATA-FIELD' ~ field ~ '-ID-text']
improve MFD system settings ...
Sébastien MARQUE authored on 2020-05-03
31
                            .setText(string.trim(me.device.windows.state[id].objects[selected].text, 1));
adds MFD menu for Aux/System...
Sébastien MARQUE authored on 2017-06-02
32
                    }
33
                });
navigation box content
Sébastien MARQUE authored on 2020-05-12
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...
Sébastien MARQUE authored on 2017-06-02
38
            }
39
            var windowId = 'SYSTEM SETUP';
make use of new window drawi...
Sébastien MARQUE authored on 2020-05-03
40
            me.device.windows.draw( windowId, obj_infos );
adds MFD menu for Aux/System...
Sébastien MARQUE authored on 2017-06-02
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...
Sébastien MARQUE authored on 2017-04-13
51
        },
52
    },
add flightplan display
Sébastien MARQUE authored on 2020-05-04
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 ...
Sébastien MARQUE authored on 2020-06-10
79
                                       scrollgroup: n - 1
add flightplan display
Sébastien MARQUE authored on 2020-05-04
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...
Sébastien MARQUE authored on 2020-06-08
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;
111
                    if (xml.getNode('/PropertyList/flight-rules')        != nil
112
                    and xml.getNode('/PropertyList/flight-type')         != nil
113
                    and xml.getNode('/PropertyList/departure/airport')   != nil
114
                    and xml.getNode('/PropertyList/destination/airport') != nil
115
                    and xml.getNode('/PropertyList/departure').getValue('airport') == departure) {
116
                        append(obj_infos, {
117
                            text: sprintf('RWY %s to %s%s',
118
                                xml.getNode('/PropertyList/departure').getValue('runway'),
119
                                xml.getNode('/PropertyList/destination').getValue('airport'),
120
                                xml.getNode('/PropertyList/destination').getValue('runway') != nil ?
121
                                '-' ~ xml.getNode('/PropertyList/destination').getValue('runway') : ''),
122
                            type: (idx ? 'editable' : 'selected') ~ '|end-of-line',
123
                            scrollgroup: idx,
124
                            _file: data.flightplans ~ '/' ~ file
125
                        });
126
                        var first_wp = last_wp = 0;
127
                        forindex (var wp; xml.getNode('/PropertyList/route').getChildren('wp')) {
128
                            var ident = xml.getNode('/PropertyList/route').getChild('wp', wp).getValue('ident');
129
                            if (string.match(ident, 'DEP-[0-9]*')
130
                            or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/departure').getValue('runway')))
131
                            or string.match(ident, sprintf('%s-[0-9]*', xml.getNode('/PropertyList/departure').getValue('runway')))) {
132
                                continue;
133
                            }
134
                            if (!first_wp) {
135
                                first_wp = wp;
136
                                continue;
137
                            }
138
                            if (string.match(ident, 'APP-[0-9]*')
139
                            or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/destination').getValue('runway')))
140
                            or string.match(ident, sprintf('%s', xml.getNode('/PropertyList/destination').getValue('airport')))
141
                            or string.match(ident, sprintf('%s-[0-9]*', xml.getNode('/PropertyList/destination').getValue('runway')))) {
142
                                last_wp = wp - 1;
143
                                break;
144
                            }
145
                        }
146
                        if (last_wp - first_wp > 2)
147
                            append(obj_infos, {
148
                                text: sprintf(' %s via %s and %s',
149
                                    utf8.chstr(9658),
150
                                    xml.getNode('/PropertyList/route').getChild('wp', first_wp + int((last_wp - first_wp)/3)).getValue('ident'),
151
                                    xml.getNode('/PropertyList/route').getChild('wp', last_wp  - int((last_wp - first_wp)/3)).getValue('ident')),
152
                                type: 'normal|end-of-line',
153
                                scrollgroup: idx
154
                            });
155
                        else
156
                            append(obj_infos, {
157
                                text: sprintf(' %s direct', utf8.chstr(9658)),
158
                                type: 'normal|end-of-line',
159
                                scrollgroup: idx
160
                            });
161
                        idx += 1;
162
                    }
163
                }
164
            }
165
            if (!idx)
166
                append(obj_infos, { text: 'no flightplan found', type: 'normal|end-of-line'});
167

            
168
            var windowId = 'FLIGTH PLAN CATALOG';
169
            me.device.windows.draw( windowId, obj_infos, {lines: 6, columns: 1, rows: 2} );
170
            me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
171
            me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
172
            me.device.buttons.CLR = func {
173
                me.device.windows.del(windowId);
174
                me.device.buttons.ENT = func;
175
                me.device.buttons.CLR = func;
176
                me.device.knobs.FmsInner = func;
177
                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
178
            }
179
            me.device.buttons.ENT = func (a = 0) {
180
                a or return;
181
                var (id, selected) = split('-', me.device.windows.selected);
182
                var file = me.device.windows.state[id].objects[selected]._file;
183
                me.device.buttons.CLR();
184
                data.flightplan = flightplan(file);
185
                data.flightplan.activate();
186
            }
187
        },
add flightplan display
Sébastien MARQUE authored on 2020-05-04
188
    },
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
189
    NRST : {
190
        'NEAREST AIRPORTS': func {
191
            var airports = findAirportsWithinRange(99.99);
192
            var obj_infos = [
193
                {text: size(airports) ~ ' NEAREST AIRPORTS', type: 'title'},
194
                {type: 'separator'},
195
            ];
196
            var name_max_length = 0;
197
            forindex (var idx; airports) {
198
                var info = airportinfo(airports[idx].id);
199
                var (course, distance) = courseAndDistance(info);
200
                var name = sprintf('%s (%s)', airports[idx].id, airports[idx].name);
201
                if (size(name) > name_max_length)
202
                    name_max_length = size(name);
203

            
204
                append(obj_infos, {
205
                        text: name,
206
                        type: (idx ? 'editable' : 'selected') ~ '|immediate|end-of-line',
207
                        scrollgroup: idx,
208
                    }
209
                );
210
                append(obj_infos, {
small display improvement
Sébastien MARQUE authored on 2020-06-11
211
                        text: sprintf(' %s DST %2dNM CRS %03d°', utf8.chstr(9658), distance, course),
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
212
                        type: 'normal|end-of-line',
213
                        scrollgroup: idx
214
                    }
215
                );
216
            }
217
            var windowId = 'NEAREST AIRPORTS';
apply scrolling fix
Sébastien MARQUE authored on 2020-05-22
218
            me.device.windows.draw( windowId, obj_infos, {lines: 4, columns: 1, rows: 2} );
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
219
            me.device.buttons.CLR = func {
220
                me.device.windows.del(windowId);
221
                me.device.buttons.ENT = func;
222
                me.device.buttons.CLR = func;
223
                me.device.knobs.FmsInner = func;
224
                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
225
            }
226
            me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
227
            me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
228
            me.device.buttons.ENT = func (a = 0) {
229
                if (a) return;
230
                me.device.windows.del(windowId);
231
                var (_, selected) = split('-', me.device.windows.selected);
232
                var (airport_id, _) = split(" ", obj_infos[selected].text);
233
                call(me.device.display.MFD._ShowAirportInfo, [airport_id], me);
234
            };
235
        },
236
        'NEAREST INTERSECTIONS': func {
237
            call(me.device.display.MFD._NearestNavaids, ['fix'], me);
238
        },
239
        'NEAREST NDB': func {
240
            call(me.device.display.MFD._NearestNavaids, ['ndb'], me);
241
        },
242
        'NEAREST VOR': func {
243
            call(me.device.display.MFD._NearestNavaids, ['vor'], me);
244
        },
245
    },
246
    _NearestNavaids: func (navaid_type) {
247
        var navaids = findNavaidsWithinRange(99.99, navaid_type);
248
        var obj_infos = [
249
            {text: size(navaids) ~ ' NEAREST ' ~ string.uc(navaid_type), type: 'title'},
250
            {type: 'separator'},
251
        ];
252
        var idx = 0;
253
        foreach (var navaid; navaids) {
254
            var (course, distance) = courseAndDistance(navaid);
255
            var name = navaid.id ~ ' (' ~ navaid.name ~ ')';
256

            
257
            append(obj_infos, {
258
                    text: navaid.id ~ ' (' ~ navaid.name ~ ')',
259
                    type: (idx ? 'editable' : 'selected') ~ '|immediate|end-of-line',
260
                    scrollgroup: idx,
261
                }
262
            );
263
            append(obj_infos, {
small display improvement
Sébastien MARQUE authored on 2020-06-11
264
                    text: sprintf(' %s DST %2dNM CRS %03d°', utf8.chstr(9658), distance, course),
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
265
                    type: 'normal|end-of-line',
266
                    scrollgroup: idx
267
                }
268
            );
269
            idx += 1;
270
        }
271
        append(obj_infos, {type: 'separator'});
272
        var windowId = obj_infos[0].text;
apply scrolling fix
Sébastien MARQUE authored on 2020-05-22
273
        me.device.windows.draw( windowId, obj_infos, {lines: 4, columns: 1, rows: 2} );
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
274
        me.device.buttons.CLR = func {
275
            me.device.windows.del(windowId);
276
            me.device.buttons.ENT = func;
277
            me.device.buttons.CLR = func;
278
            me.device.knobs.FmsInner = func;
279
            me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
280
        }
281
        me.device.knobs.FmsInner = me.device.knobs.NavigateMenu;
282
        me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
283
        me.device.buttons.ENT = func (a = 0) {
284
            if (a) return;
285
            me.device.windows.del(windowId);
286
            var (_, selected) = split('-', me.device.windows.selected);
287
            var (navaid_id, _) = split(" ", obj_infos[selected].text);
288
            if (navaid_type == 'airport')
289
                call(me.device.display.MFD._ShowAirportInfo, [navaid_id], me);
290
            else
291
                call(me.device.display.MFD._ShowNavaidInfo, [navaid_id, navaid_type], me);
292
        };
293
    },
294
    _ShowNavaidInfo: func (navaid_id, navaid_type) {
295
        var info = findNavaidsByID(navaid_id, navaid_type);
296
        if (size(info) == 0) return;
297
        me.device.knobs.FmsInner = func;
298
        me.device.knobs.FmsOuter = func;
299
        me.device.buttons.ENT    = func;
300
        var obj_infos = [
301
            {text: info[0].id ~ ' INFORMATION', type: 'title'},
302
            {type: 'separator'},
303
            {text: 'ID    ' ~ info[0].id, type: 'normal|end-of-line'},
304
            {text: 'NAME  ' ~ info[0].name, type: 'normal|end-of-line'},
305
            {text: 'TYPE  ' ~ info[0].type, type: 'normal|end-of-line'},
306
            {text: sprintf('LON   %.3f %s', abs(info[0].lon), info[0].lon > 0 ? 'E' : 'W'), type: 'normal|end-of-line'},
307
            {text: sprintf('LAT   %.3f %s', abs(info[0].lat), info[0].lat > 0 ? 'N' : 'S'), type: 'normal|end-of-line'},
308
        ];
309
        call(func {return info[0].range }, [], nil, nil, var errors = []);
310
        if (!size(errors))
311
            append(obj_infos, {text: sprintf('RANGE %i NM', info[0].range * 1.852), type: 'normal|end-of-line'});
312
        call(func {return info[0].frequency }, [], nil, nil, var errors = []);
313
        if (!size(errors))
314
            append(obj_infos, {text: sprintf('FREQ  %.2f kHz', info[0].frequency / 100), type: 'normal|end-of-line'});
315
        var lines = size(obj_infos);
316
        var windowId = 'NAVAID INFORMATIONS';
make use of new window drawi...
Sébastien MARQUE authored on 2020-05-03
317
        me.device.windows.draw( windowId, obj_infos );
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
318
        me.device.buttons.CLR = func {
319
            me.device.windows.del(windowId);
320
            me.device.buttons.ENT = func;
321
            me.device.buttons.CLR = func;
322
            me.device.knobs.FmsInner = func;
323
            me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
324
        }
325
    },
326
    _ShowAirportInfo: func (airport_id) {
327
        me.device.knobs.FmsInner = func;
328
        me.device.knobs.FmsOuter = func;
329
        me.device.buttons.ENT    = func;
330
        var info = airportinfo(airport_id);
331
        var obj_infos = [
332
            {text: airport_id ~ ' INFORMATION', type: 'title'},
333
            {type: 'separator'},
334
            {text: sprintf('ELEVATION %.0d FT', info.elevation * 3.28), type: 'normal|end-of-line'},
335
            {text: sprintf('LON: %.3f %s', abs(info.lon), info.lon > 0 ? 'E' : 'W'), type: 'normal|end-of-line'},
336
            {text: sprintf('LAT: %.3f %s', abs(info.lat), info.lat > 0 ? 'N' : 'S'), type: 'normal|end-of-line'},
337
            {type: 'separator'},
338
            {text: 'RUNWAYS', type: 'title'},
339
        ];
340
        foreach (var rwy; sort(keys(info.runways), string.icmp)) {
341
            var rwyInfo = sprintf("%-3s %4.0dm %3.0d°",
342
                                  rwy,
343
                                  info.runways[rwy].length,
344
                                  info.runways[rwy].heading);
345
            if (info.runways[rwy].ils != nil) {
346
                rwyInfo = sprintf("%s %3.3f Mhz", rwyInfo, info.runways[rwy].ils.frequency / 100);
347
            }
348
            append(obj_infos, {text: rwyInfo, type: 'normal|end-of-line'});
349
        }
350
        var sep = 2; # to count separators, already two printed
351
        if (size(info.comms()) > 0) {
352
# TODO: find nearby freqs if none found for airport
353
            append(obj_infos, {type: 'separator'}); sep += 1;
make use of new window drawi...
Sébastien MARQUE authored on 2020-05-03
354
            append(obj_infos, {text: 'COMMS FREQUENCIES', type: 'title'});
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
355
            var freqs = {};
356
            var comms = info.comms();
357
            foreach (var c; comms)
358
                freqs[c.ident] = sprintf("%.3f", c.frequency);
359

            
360
            foreach (var f; sort(keys(freqs), string.icmp))
361
                append(obj_infos, {text: sprintf('%-15s %.3f', f, freqs[f]), type: 'normal|end-of-line'});
362
        }
363
        var lines = size(obj_infos) - sep; # minus the separators
364
        var windowId = 'AIRPORT INFORMATIONS';
make use of new window drawi...
Sébastien MARQUE authored on 2020-05-03
365
        me.device.windows.draw( windowId, obj_infos );
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
366
        me.device.buttons.CLR = func {
367
            me.device.windows.del(windowId);
368
            me.device.buttons.ENT = func;
369
            me.device.buttons.CLR = func;
370
            me.device.knobs.FmsInner = func;
371
            me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
372
        }
373
    },
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
374
};
375

            
376
displayClass.setMFDPages = func {
just moves some code in more...
Sébastien MARQUE authored on 2017-07-17
377
    me.device.data['page selection'] = [
378
# list of pages, by group {{{
379
        {
380
            name: 'MAP',
381
            objects: [
382
                {text: 'NAVIGATION MAP'},
383
                {text: 'TRAFFIC MAP'},
384
                {text: 'STORMSCOPE'},
385
                {text: 'WEATHER DATA LINK'},
386
                {text: 'TAWS-B'},
387
            ],
388
        },
389
        {
390
            name: 'WPT',
391
            objects: [
392
                {text: 'AIRPORT INFORMATION'},
393
                {text: 'AIRPORT DIRECTORY'},
394
                {text: 'DEPARTURE INFORMATION'},
395
                {text: 'ARRIVAL INFORMATION'},
396
                {text: 'APPROACH INFORMATION'},
397
                {text: 'WEATHER INFORMATION'},
398
                {text: 'INTERSECTION INFORMATION'},
399
                {text: 'NDB INFORMATION'},
400
                {text: 'VOR INFORMATION'},
401
                {text: 'USER WAYPOINT INFORMATION'},
402
            ],
403
        },
404
        {
405
            name: 'AUX',
406
            objects: [
407
                {text: 'TRIP PLANNING'},
408
                {text: 'UTILITY'},
409
                {text: 'GPS STATUS'},
adapt menu entry to the cont...
Sébastien MARQUE authored on 2020-05-20
410
                {text: 'NAVBOX ITEMS SELECTION'},
just moves some code in more...
Sébastien MARQUE authored on 2017-07-17
411
            ],
412
        },
413
        {
414
            name: 'FPL',
415
            objects: [
416
                {text: 'ACTIVE FLIGHT PLAN'},
417
                {text: 'WIDE VIEW, NARROW VIEW'},
418
                {text: 'FLIGHT PLAN CATALOG'},
419
            ],
420
        },
421
        {
422
            name: 'PROC',
423
            objects: [
424
                {text: 'DEPARTURE LOADING'},
425
                {text: 'ARRIVAL LOADING'},
426
                {text: 'APPROACH LOADING'},
427
            ],
428
        },
429
        {
430
            name: 'NRST',
431
            objects: [
432
                {text: 'NEAREST AIRPORTS'},
433
                {text: 'NEAREST INTERSECTIONS'},
434
                {text: 'NEAREST NDB'},
435
                {text: 'NEAREST VOR'},
436
                {text: 'NEAREST USER WAYPOINTS'},
437
                {text: 'NEAREST FREQUENCIES'},
438
                {text: 'NEAREST AIRSPACES'},
439
            ],
440
        },
441
# }}}
442
    ];
443

            
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
444
    foreach (var g; me.device.data['page selection']) {
445
        var obj_s = size(g.objects);
446
        # build specific geometry per page, depending of number of sub-pages
447
        g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
448
        # complete the hash with reccurrent elements type and callback
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
449
        var firstEntry = 1;
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
450
        foreach (var o; g.objects) {
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
451
            if (contains(me.MFD, g.name) and contains(me.MFD[g.name], o.text)) {
452
                o.type = firstEntry ? 'selected' : 'editable';
453
                o.type ~= '|end-of-line';
454
                o.callback = me.device.buttons.MFD_page_wrapper;
make first menu item selecte...
Sébastien MARQUE authored on 2020-04-27
455
                firstEntry = 0;
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
456
            }
457
            else
458
                o.type = 'normal|end-of-line';
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
459
        }
460
    }
461
    # build the available groups line, at the bottom
462
    forindex (var g; me.device.data['page selection']) {
463
        append(me.device.data['page selection'][g].objects, {type: 'separator'});
464
        for (var i = 0; i < g; i+=1)
465
            append(me.device.data['page selection'][g].objects,
466
                {text: me.device.data['page selection'][i].name, type: 'normal'});
467
        append(me.device.data['page selection'][g].objects,
468
            {text: me.device.data['page selection'][i].name, type: 'highlighted'});
469
        for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
470
            append(me.device.data['page selection'][g].objects,
471
                {text: me.device.data['page selection'][i].name, type: 'normal'});
472
    }
473
    me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
474
};