1 contributor
var softkeysClass = {
new : func (node, role) {
var m = { parents: [ softkeysClass ] };
m.node = node;
m.role = role;
m.rootmenu = m.role == 'MFD' ? 16 : 0;
m.goto(m.rootmenu);
return m;
},
SoftKey : func (n, a) {
printf("%s softkey %i (%s)", me.role, n, a == 1 ? "pushed" : "released");
# me._SoftKey[me.rootlevel + me.level][n](a);
},
goto: func (l) {
me.level = l;
},
GPS: func {
nyi('GPS softkey');
me.goto(me.rootmenu);
},
CDIOFF: func {
cdi.getNode('visible').setBoolValue(0);
radios.getNode('nav1-selected').setIntValue(0);
radios.getNode('nav2-selected').setIntValue(0);
cdi.getNode('in-range').unalias();
cdi.getNode('course').unalias();
cdi.getNode('course-deflection').unalias();
cdi.getNode('pointer-type').setIntValue(0);
cdi.getNode('from-flag').unalias();
var mode = nil;
mode = getprop('/autopilot/locks/roll');
if (mode == 'NAV' or mode == 'APR')
AFCS.ROLL();
mode = getprop('/autopilot/locks/pitch');
if (mode == 'GS' or mode == 'APR')
AFCS.PIT();
me.goto(me.rootmenu);
},
VOR: func (n) {
radios.getNode('nav' ~ (2-n) ~ '-selected').setIntValue(0);
radios.getNode('nav' ~ (1+n) ~ '-selected').setIntValue(1);
CDIfromNAV(n);
me.goto(me.rootmenu);
},
NRST: func {
var title = me.mud.node.getNode('title').getValue();
if (substr(title, 0, 8) == 'NEAREST ') {
me.mud.close();
me.largeFMSknob = void;
me.smallFMSknob = void;
}
else {
lockSearches();
searchNearestNavaid('airport', 10);
showSearchResults(me.mud, 'NEAREST AIRPORTS', 'mag-bearing-deg',
func { msg('set HDG to ' ~ arg[0][0]);
setprop('/instrumentation/zkv1000/afcs/heading-bug-deg', arg[0][0])
}
);
unlockSearches();
me.smallFMSknob = func (dir) { selectSearchType(me.mud, dir) };
me.largeFMSknob = func (dir) { me.mud.select(dir) };
}
},
INSETOFF: func {
me.newstatus(1);
},
TRAFFIC: func {
if (props.globals.getNode('/instrumentation/radar/serviceable') != nil
and props.globals.getNode('/instrumentation/radar/display-controls/tcas') != nil) {
if (getprop('/instrumentation/radar/serviceable')
and getprop('/instrumentation/radar/display-controls/tcas')) {
me.newstatus(5);
}
}
else {
msg('unable to find TCAS config, no radar');
me.goto(me.rootmenu);
}
},
TOPO: func {
me.newstatus(2);
me.node.getNode('mfd-title').setValue('TOPO');
setprop(me.map_path ~ '/longitude-deg', getprop('/position/longitude-deg'));
setprop(me.map_path ~ '/latitude-deg', getprop('/position/latitude-deg'));
me.map.getNode('latitude-deg').alias('/position/latitude-deg');
me.map.getNode('longitude-deg').alias('/position/longitude-deg');
},
TERRAIN: func {
me.newstatus(3);
me.node.getNode('mfd-title').setValue('TERR ' ~ mapRanges[getprop(me.map_path ~ '/range-index')]);
me.map.getNode('latitude-deg').unalias();
me.map.getNode('longitude-deg').unalias();
setprop(me.map_path ~ '/longitude-deg', getprop('/position/longitude-deg'));
setprop(me.map_path ~ '/latitude-deg', getprop('/position/latitude-deg'));
},
STRMSCP: func {
nyi('STRMSCP softkey');
me.goto(me.rootmenu);
},
NEXRAD: func {
nyi('NEXRAD softkey');
me.goto(me.rootmenu);
},
XMLTNG: func {
nyi('XMLTNG softkey');
me.goto(me.rootmenu);
},
DCLTROFF: func {
nyi('DCLTROFF softkey');
me.goto(me.rootmenu);
},
DCLTR: func (x) {
nyi('DCLTR' ~ x ~ ' softkey');
me.goto(me.rootmenu);
},
DFLTS: func {
nyi('DEFAULTS softkey');
me.goto(me.rootmenu);
},
DME: func {
nyi('DME softkey');
me.goto(me.rootmenu);
},
STDBARO: func {
setprop('/instrumentation/altimeter/setting-inhg', 29.92);
me.goto(me.rootmenu);
},
BRG1: func (x) {
nyi('BRG1' ~ x ~ ' softkey');
me.goto(me.rootmenu);
},
BRG2: func (x) {
nyi('BRG2' ~ x ~ ' softkey');
me.goto(me.rootmenu);
},
BRGOFF: func (x) {
nyi('BRGOFF' ~ x ~ ' softkey');
me.goto(me.rootmenu);
},
HSI360: func {
me.node.getNode('hsi-360').setBoolValue(1);
me.goto(me.rootmenu);
},
HSIARC: func {
me.node.getNode('hsi-360').setBoolValue(0);
me.goto(me.rootmenu);
},
OPTN: func (x) {
me.node.getNode('wind-data').setBoolValue(1);
wind_infos = zkv1000['wind_opt' ~ x];
me.goto(me.rootmenu);
},
WINDOFF: func {
wind_infos = void;
me.node.getNode('wind-data').setBoolValue(1);
setprop('/instrumentation/zkv1000/infos/wind-line', '');
setprop('/instrumentation/zkv1000/infos/wind-line[1]', '');
me.goto(me.rootmenu);
},
METERS: func {
nyi('METERS softkey');
me.goto(me.rootmenu);
},
IN: func {
nyi('IN softkey');
me.goto(me.rootmenu);
},
HPA: func {
nyi('HPA softkey');
me.goto(me.rootmenu);
},
ON: func {
setprop('/instrumentation/zkv1000/radios/xpdr-mode', 'ON');
setprop('/instrumentation/transponder/serviceable', 1);
me.goto(me.rootmenu);
},
ALT: func {
setprop('/instrumentation/zkv1000/radios/xpdr-mode', 'ALT');
setprop('/instrumentation/transponder/serviceable', 1);
me.goto(me.rootmenu);
},
GND: func {
setprop('/instrumentation/zkv1000/radios/xpdr-mode', 'GND');
setprop('/instrumentation/transponder/serviceable', 1);
me.goto(me.rootmenu);
},
VFR: func {
XPDR_old = getprop('/instrumentation/transponder/id-code');
setprop('/instrumentation/zkv1000/radios/xpdr-mode', 'VFR');
setprop('/instrumentation/transponder/serviceable', 0);
me.goto(me.rootmenu);
},
XPDR: func (x) {
if (x <= 7) {
if (XPDR_n == 3) {
XPDR_old = getprop('/instrumentation/transponder/id-code');
}
elsif (XPDR_n < 0) {
me.goto(10);
XPDR_n = 3;
return;
}
else {
setprop('/instrumentation/transponder/id-code', x * math.pow(10, XPDR_n));
XPDR_n -= 1;
}
}
else {
if (x == 9) setprop('/instrumentation/transponder/id-code', XPDR_old);
XPDR_n = 3;
me.goto(me.rootmenu);
}
},
CODE: func {
getprop('/instrumentation/zkv1000/radios/xpdr-mode') == 'STBY' or return;
me.largeFMSknob = func (x) {
XPDR_change_cursor_position(x);
settimer(func { me.ENTsoftkey(1) }, 10);
}
me.smallFMSknob = func (x) {
XPDR_enter_digits(x);
settimer(func { me.ENTsoftkey(1) }, 10);
}
me.goto(11);
},
TMRREF: func (ref) {
time = zkv1000['time' ~ ref];
me.goto(me.rootmenu);
},
CHRON: func {
fgcommand('dialog-show', props.Node.new({
'dialog-name': 'stopwatch-dialog',
}));
me.goto(me.rootmenu);
},
set_softkeyActionTable: func {
me.softkeyActionTable = [
[void, func{me.goto(2)},void, func{me.goto(4)}, void, func{me.goto(1)}, ADFDME, func{me.goto(10)},IDENT, func{me.goto(17)}, func{me.NRST()}],
[void, func{me.VOR(0)}, func{me.VOR(1)}, func{me.GPS()}, void, void, func{me.CDIOFF()}, void, void, void, func{me.goto(me.rootmenu)}],
[func{me.INSETOFF()},func{me.goto(3)},void, func{me.TRAFFIC()},func{me.TOPO()}, func{me.TERRAIN()},func{me.STRMSCP()},func{me.NEXRAD()},func{me.XMLTNG()},void, func{me.goto(me.rootmenu)}],
[func{me.DCLTROFF()},void, func{me.DCLTR(1)},func{me.DCLTR(2)}, func{me.DCLTR(3)}, void, void, void, void, void, func{me.goto(2)}],
[LIGHT, func{me.DFLTS()},func{me.goto(8)}, func{me.DME()}, func{me.goto(5)}, func{me.goto(7)}, func{me.goto(6)}, void, func{me.goto(9)}, func{me.STDBARO()},func{me.goto(me.rootmenu)}],
[func{me.BRG1(1)}, func{me.BRG1(2)},func{me.BRG1(3)}, void, func{me.BRGOFF(1)},void, void, void, void, void, func{me.goto(4)}],
[func{me.BRG2(1)}, func{me.BRG2(2)},func{me.BRG2(3)}, void, func{me.BRGOFF(2)},void, void, void, void, void, func{me.goto(4)}],
[void, void, void, void, void, func{me.HSI360()}, func{me.HSIARC()}, void, void, void, func{me.goto(4)}],
[void, void, func{me.OPTN(1)}, func{me.OPTN(2)}, func{me.OPTN(3)}, void, func{me.WINDOFF()},void, void, void, func{me.goto(4)}],
[void, void, void, void, void, func{me.METERS()}, void, func{me.IN()}, func{me.HPA()}, void, func{me.goto(4)}],
[void, void, STDBY, func{me.ON()}, func{me.ALT()}, func{me.GND()}, func{me.VFR()}, func{me.CODE()}, IDENT, void, func{me.goto(me.rootmenu)}],
[func{me.XPDR(0)}, func{me.XPDR(1)},func{me.XPDR(2)}, func{me.XPDR(3)}, func{me.XPDR(4)}, func{me.XPDR(5)}, func{me.XPDR(6)}, func{me.XPDR(7)}, func{me.XPDR(8)}, BKSP, func{me.XPDR(9)}],
[func{me.newstatus(1)},func{me.goto(15)},void, func{me.goto(14)}, void, func{me.goto(13)}, void, CHECKLIST, void, void, void],
[void, void, func{me.DCLTR(1)},void, func{me.DCLTR(2)}, void, func{me.DCLTR(3)}, void, void, void, func{me.goto(me.rootmenu)}],
[void, void, void, func{me.TRAFFIC()},func{me.TOPO()}, func{me.TERRAIN()},func{me.STRMSCP()},func{me.NEXRAD()},func{me.XMLTNG()},void, func{me.goto(me.rootmenu)}],
[func{me.goto(me.rootmenu)},void, LEAN, void, void, void, func{FUEL(1)}, func{FUEL(2)}, func{FUEL(3)}, void, void],
[func{me.newstatus(2)},func{me.goto(2)},void, func{me.goto(4)}, void, func{me.goto(1)}, ADFDME, func{me.goto(10)},IDENT, func{me.goto(17)}, func{me.NRST()}],
[func{me.TMRREF('LCL')},func{me.TMRREF('UTC')},void, func{me.TMRREF('RL')},void, func{me.CHRON()}, void, void, void, void, func{me.goto(me.rootmenu)}],
];
},
};