zkv1000 / Nasal / MFD.pages.nas /
Newer Older
152 lines | 5.893kb
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: {
4
        'SYSTEM SETUP' : func {
5
            var obj_infos = [
6
                {text: 'NAV BOX DATA FIELDS', type: 'title'},
7
                {type: 'separator'},
8
                {text: 'DATA FIELD NUMBER', type: 'normal'},
9
                {text: '  1 >', type: 'selected|end-of-line', choices: ['  1 >', '< 2 >', '< 3 >', '< 4  ']},
10
            ];
11
            var lines = 2;
12
            var column = 0;
13
            var colmax = 5;
14
            foreach (var text; me.device.display.updateNavigationBox(1)) {
15
                append(obj_infos, {
16
                    text: text,
17
                    type: column == colmax ? 'editable|end-of-line' : 'editable',
18
                    callback: func (id, selected) {
19
                        var field = me.device.windows.state[id].objects[3].text;
20
                        field = substr(field, 2);
21
                        field = substr(field, 0, size(field) - 2);
22
                        field = string.trim(field);
23
                        me.device.display.screenElements['DATA-FIELD' ~ field ~ '-ID-text']
24
                            .setText(me.device.windows.state[id].objects[selected].text);
25
                    }
26
                });
27
                if (column < colmax) column += 1;
28
                else {
29
                    column = 0;
30
                    lines += 1;
31
                }
32
            }
33
            var windowId = 'SYSTEM SETUP';
34
            var obj_s = size(obj_infos);
35
            me.device.windows.draw(
36
                windowId,
37
                {x: 720, y: 758 - ((lines + 3) * 24), w: 300, l: lines, sep: 1},
38
                obj_infos
39
            );
40
            me.device.buttons.CLR = func {
41
                me.device.windows.del(windowId);
42
                me.device.buttons.ENT = func;
43
                me.device.buttons.CLR = func;
44
                me.device.knobs.FmsInner = func;
45
                me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
46
            }
47
            me.device.knobs.FmsInner = me.device.knobs.MenuSettings;
48
            me.device.knobs.FmsOuter = me.device.knobs.NavigateMenu;
49
            me.device.buttons.ENT = me.device.buttons.ValidateTMRREF;
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
50
        },
51
    },
52
};
53

            
54
displayClass.setMFDPages = func {
just moves some code in more...
Sébastien MARQUE authored on 2017-07-17
55
    me.device.data['page selection'] = [
56
# list of pages, by group {{{
57
        {
58
            name: 'MAP',
59
            objects: [
60
                {text: 'NAVIGATION MAP'},
61
                {text: 'TRAFFIC MAP'},
62
                {text: 'STORMSCOPE'},
63
                {text: 'WEATHER DATA LINK'},
64
                {text: 'TAWS-B'},
65
            ],
66
        },
67
        {
68
            name: 'WPT',
69
            objects: [
70
                {text: 'AIRPORT INFORMATION'},
71
                {text: 'AIRPORT DIRECTORY'},
72
                {text: 'DEPARTURE INFORMATION'},
73
                {text: 'ARRIVAL INFORMATION'},
74
                {text: 'APPROACH INFORMATION'},
75
                {text: 'WEATHER INFORMATION'},
76
                {text: 'INTERSECTION INFORMATION'},
77
                {text: 'NDB INFORMATION'},
78
                {text: 'VOR INFORMATION'},
79
                {text: 'USER WAYPOINT INFORMATION'},
80
            ],
81
        },
82
        {
83
            name: 'AUX',
84
            objects: [
85
                {text: 'TRIP PLANNING'},
86
                {text: 'UTILITY'},
87
                {text: 'GPS STATUS'},
88
                {text: 'SYSTEM SETUP'},
89
            ],
90
        },
91
        {
92
            name: 'FPL',
93
            objects: [
94
                {text: 'ACTIVE FLIGHT PLAN'},
95
                {text: 'WIDE VIEW, NARROW VIEW'},
96
                {text: 'FLIGHT PLAN CATALOG'},
97
            ],
98
        },
99
        {
100
            name: 'PROC',
101
            objects: [
102
                {text: 'DEPARTURE LOADING'},
103
                {text: 'ARRIVAL LOADING'},
104
                {text: 'APPROACH LOADING'},
105
            ],
106
        },
107
        {
108
            name: 'NRST',
109
            objects: [
110
                {text: 'NEAREST AIRPORTS'},
111
                {text: 'NEAREST INTERSECTIONS'},
112
                {text: 'NEAREST NDB'},
113
                {text: 'NEAREST VOR'},
114
                {text: 'NEAREST USER WAYPOINTS'},
115
                {text: 'NEAREST FREQUENCIES'},
116
                {text: 'NEAREST AIRSPACES'},
117
            ],
118
        },
119
# }}}
120
    ];
121

            
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
122
    foreach (var g; me.device.data['page selection']) {
123
        var obj_s = size(g.objects);
124
        # build specific geometry per page, depending of number of sub-pages
125
        g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
126
        # complete the hash with reccurrent elements type and callback
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
127
        var firstEntry = 1;
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
128
        foreach (var o; g.objects) {
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
129
            if (contains(me.MFD, g.name) and contains(me.MFD[g.name], o.text)) {
130
                o.type = firstEntry ? 'selected' : 'editable';
131
                o.type ~= '|end-of-line';
132
                o.callback = me.device.buttons.MFD_page_wrapper;
make first menu item selecte...
Sébastien MARQUE authored on 2020-04-27
133
                firstEntry = 0;
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
134
            }
135
            else
136
                o.type = 'normal|end-of-line';
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
137
        }
138
    }
139
    # build the available groups line, at the bottom
140
    forindex (var g; me.device.data['page selection']) {
141
        append(me.device.data['page selection'][g].objects, {type: 'separator'});
142
        for (var i = 0; i < g; i+=1)
143
            append(me.device.data['page selection'][g].objects,
144
                {text: me.device.data['page selection'][i].name, type: 'normal'});
145
        append(me.device.data['page selection'][g].objects,
146
            {text: me.device.data['page selection'][i].name, type: 'highlighted'});
147
        for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
148
            append(me.device.data['page selection'][g].objects,
149
                {text: me.device.data['page selection'][i].name, type: 'normal'});
150
    }
151
    me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
152
};