zkv1000 / Nasal / MFD.pages.nas /
Newer Older
477 lines | 23.375kb
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();
fix FP not activated from ca...
Sébastien MARQUE authored on 2020-06-12
186
                fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
adds flight plan catalog loa...
Sébastien MARQUE authored on 2020-06-08
187
            }
188
        },
add flightplan display
Sébastien MARQUE authored on 2020-05-04
189
    },
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
190
    NRST : {
191
        'NEAREST AIRPORTS': func {
192
            var airports = findAirportsWithinRange(99.99);
193
            var obj_infos = [
194
                {text: size(airports) ~ ' NEAREST AIRPORTS', type: 'title'},
195
                {type: 'separator'},
196
            ];
197
            var name_max_length = 0;
198
            forindex (var idx; airports) {
199
                var info = airportinfo(airports[idx].id);
200
                var (course, distance) = courseAndDistance(info);
201
                var name = sprintf('%s (%s)', airports[idx].id, airports[idx].name);
202
                if (size(name) > name_max_length)
203
                    name_max_length = size(name);
204

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

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

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

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

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