zkv1000 / Nasal / MFD.pages.nas /
Newer Older
35 lines | 1.584kb
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
16
        foreach (var o; g.objects) {
17
            o.type = 'editable|end-of-line';
18
            o.callback = me.device.buttons.MFD_page_wrapper;
19
        }
20
        g.objects[0].type = 'selected|end-of-line';
21
    }
22
    # build the available groups line, at the bottom
23
    forindex (var g; me.device.data['page selection']) {
24
        append(me.device.data['page selection'][g].objects, {type: 'separator'});
25
        for (var i = 0; i < g; i+=1)
26
            append(me.device.data['page selection'][g].objects,
27
                {text: me.device.data['page selection'][i].name, type: 'normal'});
28
        append(me.device.data['page selection'][g].objects,
29
            {text: me.device.data['page selection'][i].name, type: 'highlighted'});
30
        for (var i = g+1; i < size(me.device.data['page selection']); i+=1)
31
            append(me.device.data['page selection'][g].objects,
32
                {text: me.device.data['page selection'][i].name, type: 'normal'});
33
    }
34
    me.device.knobs.FmsOuter = me.device.knobs.MFD_select_page_group;
35
};