commit initial
|
1 |
var softkeysClass = { |
softkeys are available now
|
2 |
new : func (device, node, role) { |
commit initial
|
3 |
var m = { parents: [ softkeysClass ] }; |
4 |
m.node = node; |
|
softkeys are available now
|
5 |
m.device = device; |
commit initial
|
6 |
m.role = role; |
softkeys are available now
|
7 |
m.path = []; |
commit initial
|
8 |
return m; |
9 |
}, |
|
10 | ||
softkeys are available now
|
11 |
clean : func { |
12 |
# deletes unsed bindings |
|
13 |
foreach (var b; me.bindings) |
|
14 |
if (b != role) |
|
15 |
delete(bindings, b); |
|
commit initial
|
16 |
}, |
17 | ||
softkeys are available now
|
18 |
SoftKey : func (n, a) { |
19 |
# released key not yet managed |
|
20 |
if (a == 1) |
|
21 |
return; |
|
22 | ||
23 |
var key = me.device.display.screenElements[sprintf("SoftKey%02i-text",n)].get('text'); |
|
24 |
if (key == '' or key == nil) |
|
25 |
return; |
|
26 | ||
27 |
var path = keyMap[me.role]; |
|
28 |
foreach(var p; me.path) { |
|
29 |
if (contains(path, p)) |
|
30 |
path = path[p]; |
|
31 |
else |
|
32 |
break; |
|
commit initial
|
33 |
} |
34 | ||
softkeys are available now
|
35 |
var bindings = me.bindings[me.role]; |
36 |
foreach(var p; me.path) { |
|
37 |
if (contains(bindings, p)) |
|
38 |
bindings = bindings[p]; |
|
39 |
else |
|
40 |
break; |
|
commit initial
|
41 |
} |
42 | ||
softkeys are available now
|
43 |
if (contains(path, key)) { |
44 |
append(me.path, key); |
|
45 |
me.device.display.updateSoftKeys(); |
|
commit initial
|
46 |
} |
softkeys are available now
|
47 |
elsif (contains(bindings, key)) { |
48 |
call(bindings[key], [], me); |
|
commit initial
|
49 |
} |
softkeys are available now
|
50 |
elsif (key == 'BACK') { |
51 |
pop(me.path); |
|
52 |
me.device.display.updateSoftKeys(); |
|
commit initial
|
53 |
} |
softkeys are available now
|
54 |
else |
55 |
print(me.device.role ~ '/' ~ key ~ ' : not yet implemented'); |
|
56 |
}, |
|
57 | ||
58 |
bindings : { |
|
59 |
PFD : { |
|
60 |
INSET: { |
|
61 |
OFF: func { |
|
62 |
pop(me.path); |
|
63 |
me.device.display.updateSoftKeys(); |
|
64 |
}, |
|
65 |
}, |
|
66 |
PFD: { |
|
67 |
'STD BARO': func { |
|
68 |
pop(me.path); |
|
69 |
me.device.display.updateSoftKeys(); |
|
70 |
}, |
|
71 |
}, |
|
72 |
XPDR: { |
|
73 |
CODE: { |
|
74 |
IDENT: func { |
|
75 |
me.path = []; |
|
76 |
me.device.display.updateSoftKeys(); |
|
77 |
}, |
|
78 |
BACK: func { |
|
79 |
me.path = []; |
|
80 |
me.device.display.updateSoftKeys(); |
|
81 |
}, |
|
82 |
}, |
|
83 |
}, |
|
84 |
}, |
|
85 |
MFD : { |
|
86 |
ENGINE: { |
|
87 |
FUEL: { |
|
88 |
UNDO: func { |
|
89 |
pop(me.path); |
|
90 |
me.device.display.updateSoftKeys(); |
|
91 |
}, |
|
92 |
ENTER: func { |
|
93 |
pop(me.path); |
|
94 |
me.device.display.updateSoftKeys(); |
|
95 |
}, |
|
96 |
}, |
|
97 |
ENGINE: func { |
|
98 |
me.path = []; |
|
99 |
me.device.display.updateSoftKeys(); |
|
100 |
}, |
|
101 |
}, |
|
102 |
}, |
|
commit initial
|
103 |
}, |
104 |
}; |