zkv1000 / Nasal / MFD.pages.nas /
Newer Older
41 lines | 1.826kb
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
1
displayClass.MFD = {
2
    NRST: {
3
        'NEAREST VOR' : func {
4
            # just a POC
5
            print('here there will be a page for searching nearest VORs');
6
        },
7
    },
8
};
9

            
10
displayClass.setMFDPages = func {
11
    foreach (var g; me.device.data['page selection']) {
12
        var obj_s = size(g.objects);
13
        # build specific geometry per page, depending of number of sub-pages
14
        g.geometry = {x: 720, y: 758 - ((obj_s + 3) * 24), w: 300, l: obj_s + 1, sep: 1};
15
        # complete the hash with reccurrent elements type and callback
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
16
        var firstEntry = 1;
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
17
        foreach (var o; g.objects) {
allows only implemented MFD ...
Sébastien MARQUE authored on 2017-06-02
18
            if (contains(me.MFD, g.name) and contains(me.MFD[g.name], o.text)) {
19
                o.type = firstEntry ? 'selected' : 'editable';
20
                o.type ~= '|end-of-line';
21
                o.callback = me.device.buttons.MFD_page_wrapper;
22
                firstEntry = ! firstEntry;
23
            }
24
            else
25
                o.type = 'normal|end-of-line';
fix MFD page selection syste...
Sébastien MARQUE authored on 2017-04-13
26
        }
27
    }
28
    # build the available groups line, at the bottom
29
    forindex (var g; me.device.data['page selection']) {
30
        append(me.device.data['page selection'][g].objects, {type: 'separator'});
31
        for (var i = 0; i < g; i+=1)
32
            append(me.device.data['page selection'][g].objects,
33
                {text: me.device.data['page selection'][i].name, type: 'normal'});
34
        append(me.device.data['page selection'][g].objects,
35
            {text: me.device.data['page selection'][i].name, type: 'highlighted'});
36
        for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
37
            append(me.device.data['page selection'][g].objects,
38
                {text: me.device.data['page selection'][i].name, type: 'normal'});
39
    }
40
    me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
41
};