zkv1000 / Nasal / MFD.pages.nas /
Newer Older
475 lines | 23.215kb
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;
remove unused properties in ...
Sébastien MARQUE authored on 2021-03-22
111
                    if (xml.getNode('/PropertyList/departure/airport')   != nil
adds flight plan catalog loa...
Sébastien MARQUE authored on 2020-06-08
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) {
178
                a or return;
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...
Sébastien MARQUE authored on 2020-06-12
184
                fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
adds flight plan catalog loa...
Sébastien MARQUE authored on 2020-06-08
185
            }
186
        },
add flightplan display
Sébastien MARQUE authored on 2020-05-04
187
    },
add MFD pages for nearest ai...
Sébastien MARQUE authored on 2020-04-27
188
    NRST : {
189
        'NEAREST AIRPORTS': func {
190
            var airports = findAirportsWithinRange(99.99);
191
            var obj_infos = [
192
                {text: size(airports) ~ ' NEAREST AIRPORTS', type: 'title'},
193
                {type: 'separator'},
194
            ];
195
            var name_max_length = 0;
196
            forindex (var idx; airports) {
197
                var info = airportinfo(airports[idx].id);
198
                var (course, distance) = courseAndDistance(info);
199
                var name = sprintf('%s (%s)', airports[idx].id, airports[idx].name);
200
                if (size(name) > name_max_length)
201
                    name_max_length = size(name);
202

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

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

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

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