2012-09-18 10:29:17 +00:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
<PropertyList>
|
|
|
|
<name>checklist</name>
|
|
|
|
<layout>vbox</layout>
|
2013-02-27 22:28:44 +00:00
|
|
|
<x>-5</x>
|
|
|
|
<y>5</y>
|
2012-09-18 10:29:17 +00:00
|
|
|
<default-padding>1</default-padding>
|
|
|
|
|
|
|
|
<color>
|
|
|
|
<alpha type="float">1.0</alpha>
|
|
|
|
</color>
|
|
|
|
|
|
|
|
<nasal>
|
2013-02-27 22:28:44 +00:00
|
|
|
<open><![CDATA[
|
2012-09-18 10:29:17 +00:00
|
|
|
var dlgRoot = cmdarg();
|
2018-04-12 21:24:57 +00:00
|
|
|
var dlgname = dlgRoot.getNode("name").getValue();
|
|
|
|
|
|
|
|
|
|
|
|
# Update the checklist-combo with appropriate set of checklists for
|
|
|
|
# the user to select from
|
|
|
|
var setChecklistGroup = func(group_name) {
|
|
|
|
var combo = gui.findElementByName(dlgRoot, "checklist-combo");
|
|
|
|
combo.removeChildren("value");
|
|
|
|
var idx = 0;
|
|
|
|
|
|
|
|
foreach (var name; checklist_group[group_name]) {
|
|
|
|
combo.getChild("value", idx, 1).setValue(name);
|
|
|
|
idx = idx + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
var checklist_name = checklist_group[group_name][0];
|
|
|
|
|
|
|
|
var pgs = checklist_size[checklist_name];
|
|
|
|
if (pgs == nil) pgs = 1;
|
|
|
|
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-checklist-group", group_name);
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-checklist-max-pages", pgs);
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", "1 / " ~ pgs);
|
|
|
|
setprop("sim/gui/dialogs/checklist/selected-checklist", checklist_name);
|
|
|
|
gui.dialog_update("checklist", "checklist-combo", "checklist-table-group");
|
|
|
|
};
|
|
|
|
|
|
|
|
var groups = props.globals.getNode("/sim/checklists", 1).getChildren("group");
|
2012-09-18 10:29:17 +00:00
|
|
|
var checklists = props.globals.getNode("/sim/checklists", 1).getChildren("checklist");
|
2013-02-27 22:28:44 +00:00
|
|
|
var checklist_size = {};
|
2018-04-12 21:24:57 +00:00
|
|
|
var checklist_group = {};
|
|
|
|
var current_group = nil;
|
|
|
|
|
|
|
|
# Set up the list of groups so the user can select a group and then
|
|
|
|
# a checklist.
|
|
|
|
var groups = props.globals.getNode("/sim/checklists").getChildren("group");
|
|
|
|
|
|
|
|
if (size(groups) > 0) {
|
|
|
|
foreach (var grp; groups) {
|
|
|
|
var name = grp.getNode("name", 1).getValue();
|
|
|
|
var checks = grp.getChildren("checklist");
|
|
|
|
foreach (var chk; checks) {
|
|
|
|
var title = chk.getNode("title", 1).getValue();
|
|
|
|
if (current_group == nil) current_group = name;
|
|
|
|
append(checklists, chk);
|
|
|
|
if (checklist_group[name] == nil) checklist_group[name] = [];
|
|
|
|
append(checklist_group[name], title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
checklists = props.globals.getNode("/sim/checklists").getChildren("checklist");
|
|
|
|
foreach (var chk; checklists) {
|
|
|
|
var title = chk.getNode("title", 1).getValue();
|
|
|
|
var grp = "Standard";
|
|
|
|
var items = [];
|
|
|
|
if (find("emergency", string.lc(title)) != -1) {
|
|
|
|
grp = "EMERGENCY";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_group == nil) current_group = grp;
|
|
|
|
|
|
|
|
if (checklist_group[grp] == nil) checklist_group[grp] = [];
|
|
|
|
append(checklist_group[grp], title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
if (size(checklists) > 0) {
|
2013-02-27 22:28:44 +00:00
|
|
|
|
2018-04-12 21:24:57 +00:00
|
|
|
var current_checklist = getprop("sim/gui/dialogs/checklist/selected-checklist");
|
|
|
|
if (current_checklist == nil) {
|
|
|
|
current_checklist = checklists[0].getNode("title", 1).getValue();
|
|
|
|
setprop("sim/gui/dialogs/checklist/selected-checklist", current_checklist);
|
|
|
|
setprop("sim/gui/dialogs/checklist/selected-page", 0);
|
2015-03-20 10:56:40 +00:00
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
foreach (var grp; keys(checklist_group)) {
|
|
|
|
foreach (chklist; checklist_group[grp]) {
|
|
|
|
if (chklist == current_checklist) {
|
|
|
|
setChecklistGroup(grp);
|
2020-10-08 18:01:15 +00:00
|
|
|
setprop("sim/gui/dialogs/checklist/selected-checklist", current_checklist);
|
2018-04-12 21:24:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var combo = gui.findElementByName(dlgRoot, "checklist-group-combo");
|
|
|
|
var idx = 0;
|
|
|
|
|
2020-10-11 18:58:44 +00:00
|
|
|
foreach (var grp_name; sort(keys(checklist_group), func(a,b){string.icmp(a,b)})) {
|
2018-04-12 21:24:57 +00:00
|
|
|
combo.getChild("value", idx, 1).setValue(grp_name);
|
|
|
|
idx = idx + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
dlgRoot.setValues({"dialog-name": dlgname, "object-name": "checklist-group-combo"});
|
|
|
|
fgcommand("dialog-update", dlgRoot);
|
|
|
|
|
|
|
|
var group = gui.findElementByName(dlgRoot, "checklist-table-group");
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var table_count = 0;
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
forindex (var idx; checklists) {
|
2013-02-27 22:28:44 +00:00
|
|
|
var checklist_name = checklists[idx].getNode("title", 1).getValue();
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
# Checklist may consist of one or more pages.
|
|
|
|
var pages = checklists[idx].getChildren("page");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if (size(pages) == 0) {
|
|
|
|
# Or no pages at all, in which case we need to create a checklist of one page
|
|
|
|
append(pages, checklists[idx]);
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
checklist_size[checklist_name] = size(pages);
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if (idx == 0) {
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/next-available", 1);
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-checklist-max-pages", checklist_size[checklist_name]);
|
2018-04-12 21:24:57 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", "1 / " ~ checklist_size[checklist_name]);
|
2013-02-27 22:28:44 +00:00
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
forindex (var p; pages) {
|
|
|
|
var c = pages[p];
|
2013-02-27 22:28:44 +00:00
|
|
|
var row = 0;
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
# Set up a new table, only visible when this checklist is selected.
|
|
|
|
var table = group.getChild("group", table_count, 1);
|
|
|
|
table.getNode("row", 1).setValue(0);
|
|
|
|
table.getNode("col", 1).setValue(0);
|
|
|
|
table.getNode("default-padding", 1).setValue(4);
|
|
|
|
table.getNode("layout", 1).setValue("table");
|
|
|
|
table.getNode("valign", 1).setValue("top");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
# Set up conditional to only display when the checklist is selected
|
|
|
|
# and the page is correct.
|
2018-04-12 21:24:57 +00:00
|
|
|
var vis = table.getNode("visible", 1).getNode("and", 1);
|
2013-02-27 22:28:44 +00:00
|
|
|
var e = vis.getChild("equals", 0, 1);
|
|
|
|
e.getNode("property", 1).setValue("sim/gui/dialogs/checklist/selected-checklist");
|
|
|
|
e.getNode("value", 1).setValue(checklists[idx].getNode("title").getValue());
|
|
|
|
e = vis.getChild("equals", 1, 1);
|
|
|
|
e.getNode("property", 1).setValue("sim/gui/dialogs/checklist/selected-page");
|
|
|
|
e.getNode("value", 1).setValue(p);
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var items = c.getChildren("item");
|
|
|
|
var txtcount = 0;
|
|
|
|
var btncount = 0;
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
forindex (var i; items) {
|
2013-02-27 22:28:44 +00:00
|
|
|
var item = items[i];
|
2012-09-18 10:29:17 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var t = table.getChild("text", txtcount, 1);
|
2018-04-12 21:24:57 +00:00
|
|
|
txtcount += 1;
|
2013-01-29 22:38:39 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var values = item.getChildren("value");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2020-10-31 20:35:33 +00:00
|
|
|
if ((size(values) == 0) or (values[0].getValue() == "")) {
|
2013-02-27 22:28:44 +00:00
|
|
|
# Single name element with no values. Used as title
|
|
|
|
t.getNode("halign", 1).setValue("center");
|
|
|
|
t.getNode("row", 1).setValue(row);
|
|
|
|
t.getNode("col", 1).setValue(0);
|
|
|
|
t.getNode("colspan", 1).setValue(2);
|
|
|
|
t.getNode("label", 1).setValue(item.getNode("name", 1).getValue());
|
|
|
|
row = row + 1;
|
|
|
|
} else {
|
|
|
|
t.getNode("halign", 1).setValue("left");
|
|
|
|
t.getNode("row", 1).setValue(row);
|
|
|
|
t.getNode("col", 1).setValue(0);
|
|
|
|
t.getNode("label", 1).setValue(item.getNode("name", 1).getValue());
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
forindex (var v; values) {
|
|
|
|
var t = table.getChild("text", txtcount, 1);
|
|
|
|
txtcount += 1;
|
|
|
|
t.getNode("halign", 1).setValue("right");
|
|
|
|
t.getNode("row", 1).setValue(row);
|
|
|
|
if (v > 0) {
|
|
|
|
# The second row of values can overlap with the
|
2018-04-12 21:24:57 +00:00
|
|
|
# first column if required - helps keep the
|
2013-02-27 22:28:44 +00:00
|
|
|
# checklist dialog as compact as possible
|
|
|
|
t.getNode("col", 1).setValue(0);
|
|
|
|
t.getNode("colspan", 1).setValue(2);
|
|
|
|
} else {
|
|
|
|
t.getNode("col", 1).setValue(1);
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2020-10-31 20:35:33 +00:00
|
|
|
if (isscalar(values[v].getValue())) {
|
|
|
|
t.getNode("label", 1).setValue(values[v].getValue());
|
|
|
|
} else {
|
|
|
|
t.getNode("label", 1).setValue("");
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
# If there's a complete node, it contains a condition
|
|
|
|
# that can be checked to ensure the checklist item is
|
2018-04-12 21:24:57 +00:00
|
|
|
# complete. We display this item in yellow while the
|
2013-02-27 22:28:44 +00:00
|
|
|
# condition is not met, and green once it is complete.
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var condition = item.getNode("condition");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if (condition != nil) {
|
2020-11-29 19:39:20 +00:00
|
|
|
var vis = t.getNode("visible", 1).getNode("and", 1);
|
2013-02-27 22:28:44 +00:00
|
|
|
props.copy(condition, vis);
|
|
|
|
var c = t.getNode("color", 1);
|
|
|
|
c.getNode("red", 1).setValue(0.2);
|
|
|
|
c.getNode("green", 1).setValue(1.0);
|
|
|
|
c.getNode("blue", 1).setValue(0.2);
|
2015-03-14 22:33:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Now create an amber version for when the condition
|
2013-02-27 22:28:44 +00:00
|
|
|
# is not met.
|
|
|
|
t = table.getChild("text", txtcount, 1);
|
2018-04-12 21:24:57 +00:00
|
|
|
txtcount += 1;
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
t.getNode("halign", 1).setValue("right");
|
|
|
|
t.getNode("row", 1).setValue(row);
|
|
|
|
if (v > 0) {
|
|
|
|
# The second row of values can overlap with the
|
2018-04-12 21:24:57 +00:00
|
|
|
# first column if required - helps keep the
|
2013-02-27 22:28:44 +00:00
|
|
|
# checklist dialog as compact as possible
|
|
|
|
t.getNode("col", 1).setValue(0);
|
|
|
|
t.getNode("colspan", 1).setValue(2);
|
|
|
|
} else {
|
|
|
|
t.getNode("col", 1).setValue(1);
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
t.getNode("label", 1).setValue(values[v].getValue());
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
c = t.getNode("color", 1);
|
|
|
|
c.getNode("red", 1).setValue(1.0);
|
2015-03-14 22:33:05 +00:00
|
|
|
c.getNode("green", 1).setValue(0.7);
|
|
|
|
c.getNode("blue", 1).setValue(0.2);
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2020-11-29 19:39:20 +00:00
|
|
|
vis = t.getNode("visible", 1).getNode("not", 1).getNode("and", 1);
|
2018-04-12 21:24:57 +00:00
|
|
|
props.copy(condition, vis);
|
2013-02-27 22:28:44 +00:00
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
# If there is a marker node we display a small
|
|
|
|
# button that enables the marker.
|
|
|
|
var marker = item.getNode("marker");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if ((v == 0) and (marker != nil)) {
|
|
|
|
var s = marker.getNode("scale");
|
|
|
|
var scale = s != nil ? s.getValue() : 1;
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var btn = table.getChild("button", btncount, 1);
|
|
|
|
btncount += 1;
|
|
|
|
btn.getNode("row", 1).setValue(row);
|
|
|
|
btn.getNode("col", 1).setValue(2);
|
|
|
|
btn.getNode("pref-width", 1).setValue(20);
|
|
|
|
btn.getNode("pref-height", 1).setValue(20);
|
|
|
|
btn.getNode("padding", 1).setValue(0);
|
|
|
|
btn.getNode("legend", 1).setValue("?");
|
|
|
|
var binding = btn.getNode("binding", 1);
|
|
|
|
binding.getNode("command", 1).setValue("nasal");
|
|
|
|
binding.getNode("script", 1).setValue(
|
|
|
|
"placeMarker(" ~ marker.getNode("x-m", 1).getValue() ~ ", " ~
|
|
|
|
marker.getNode("y-m", 1).getValue() ~ ", " ~
|
|
|
|
marker.getNode("z-m", 1).getValue() ~ ", " ~
|
|
|
|
scale ~ ");");
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-05-01 21:41:15 +00:00
|
|
|
# If there's one or more binding nodes we display a
|
2018-04-12 21:24:57 +00:00
|
|
|
# small button that executes the binding. Used to
|
2013-05-01 21:41:15 +00:00
|
|
|
# demonstrate the checklist item
|
|
|
|
var bindings = item.getChildren("binding");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-05-01 21:41:15 +00:00
|
|
|
if ((v == 0) and (size(bindings) > 0)) {
|
|
|
|
var btn = table.getChild("button", btncount, 1);
|
|
|
|
btncount += 1;
|
|
|
|
btn.getNode("row", 1).setValue(row);
|
|
|
|
btn.getNode("col", 1).setValue(3);
|
|
|
|
btn.getNode("pref-width", 1).setValue(20);
|
|
|
|
btn.getNode("pref-height", 1).setValue(20);
|
|
|
|
btn.getNode("padding", 1).setValue(1);
|
|
|
|
btn.getNode("legend", 1).setValue(">");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-05-01 21:41:15 +00:00
|
|
|
forindex (var bdg; bindings) {
|
|
|
|
var binding = btn.getChild("binding", bdg, 1);
|
|
|
|
props.copy(bindings[bdg], binding);
|
|
|
|
}
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
row = row + 1;
|
2013-02-27 22:28:44 +00:00
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
table_count = table_count + 1;
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
}
|
2012-09-18 10:29:17 +00:00
|
|
|
}
|
|
|
|
}
|
2015-04-24 14:17:27 +00:00
|
|
|
|
|
|
|
var s = getprop("/sim/gui/dialogs/checklist/selected-checklist");
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-checklist-max-pages", checklist_size[s]);
|
2020-10-28 22:34:43 +00:00
|
|
|
var currentPage = getprop("/sim/gui/dialogs/checklist/selected-page");
|
2015-04-24 14:17:27 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/next-available", 1);
|
2020-10-28 22:34:43 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", (currentPage + 1) ~ " / " ~ checklist_size[s]);
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
} else {
|
2013-02-27 22:28:44 +00:00
|
|
|
var group = gui.findElementByName(dlgRoot, "checklist-table-group");
|
|
|
|
var table = group.getNode("text", 1);
|
|
|
|
table.getNode("row", 1).setValue(0);
|
|
|
|
table.getNode("col", 1).setValue(0);
|
|
|
|
table.getNode("default-padding", 1).setValue(4);
|
|
|
|
table.getNode("layout", 1).setValue("table");
|
|
|
|
table.getNode("valign", 1).setValue("top");
|
|
|
|
table.getNode("halign", 1).setValue("center");
|
2018-04-12 21:24:57 +00:00
|
|
|
table.getNode("label", 1).setValue("No checklists exist for this aircraft");
|
2013-02-27 22:28:44 +00:00
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var placeMarker = func(x,y,z,scale) {
|
|
|
|
var markerN = props.globals.getNode("/sim/model/marker", 1);
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
markerN.setValues({
|
|
|
|
"x/value": x,
|
|
|
|
"y/value": y,
|
|
|
|
"z/value": z,
|
|
|
|
"scale/value": scale,
|
|
|
|
"arrow-enabled": 1,
|
|
|
|
});
|
2020-10-31 16:00:51 +00:00
|
|
|
|
|
|
|
# Determine offset to the marker.
|
|
|
|
var vx = getprop("/sim/current-view/x-offset-m"); # Left/right (+ve right)
|
|
|
|
var vy = getprop("/sim/current-view/y-offset-m"); # Up/Down (+ve up)
|
|
|
|
var vz = getprop("/sim/current-view/z-offset-m"); # Forward/backwards (+ve aft)
|
|
|
|
|
|
|
|
# BUT the marker has a different coordinate system!
|
|
|
|
# x = fore/aft (+ve aft)
|
|
|
|
# y = left/right (+ve right)
|
|
|
|
# z = up/down (+ve up)
|
|
|
|
|
|
|
|
# So we need to do a coordinate transformation as we calculate the angles
|
|
|
|
var hdg = math.atan2(y-vx, x-vz) * R2D + 180;
|
|
|
|
var pitch = math.atan2((z-vy), math.sqrt((x-vz)*(x-vz) + (y-vx)*(y-vx))) * R2D;
|
|
|
|
|
|
|
|
if (! ((hdg > 160) and (hdg < 200))) {
|
|
|
|
# Making the assumption we're in the cockpit, there are limits to where we can look
|
|
|
|
# that are enforced by the view system. So we can't look into the region of heading
|
|
|
|
# 160-200.
|
|
|
|
var v = props.Node.new();
|
|
|
|
v.setValues({
|
|
|
|
"heading-offset-deg" : hdg,
|
|
|
|
"pitch-offset-deg": pitch,
|
|
|
|
});
|
|
|
|
view.point.move(v);
|
|
|
|
}
|
|
|
|
|
2018-04-12 21:24:57 +00:00
|
|
|
};
|
|
|
|
|
2020-10-31 16:00:51 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var nextPage = func() {
|
|
|
|
var currentPage = getprop("/sim/gui/dialogs/checklist/selected-page");
|
|
|
|
var s = getprop("/sim/gui/dialogs/checklist/selected-checklist");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if (currentPage < (checklist_size[s] - 1)) {
|
2018-04-12 21:24:57 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page", currentPage + 1);
|
|
|
|
}
|
2013-02-27 22:28:44 +00:00
|
|
|
|
|
|
|
if (currentPage == (checklist_size[s] - 2)) {
|
|
|
|
setprop("/sim/gui/dialogs/checklist/next-available", 0);
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", (currentPage + 2) ~ " / " ~ checklist_size[s]);
|
|
|
|
};
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
var previousPage = func() {
|
|
|
|
var currentPage = getprop("/sim/gui/dialogs/checklist/selected-page");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
if (currentPage > 0) {
|
2018-04-12 21:24:57 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page", currentPage - 1);
|
|
|
|
}
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/next-available", 1);
|
2018-04-12 21:24:57 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", currentPage ~ " / " ~ checklist_size[s]);
|
|
|
|
};
|
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
var setTransparency = func(updateDialog){
|
|
|
|
var alpha = (getprop("/sim/gui/dialogs/checklist/transparent") or 0);
|
|
|
|
dlgRoot.getNode("color/alpha").setValue(1-alpha*0.3);
|
|
|
|
var n = props.Node.new({ "dialog-name": "checklist" });
|
|
|
|
if (updateDialog)
|
|
|
|
{
|
|
|
|
fgcommand("dialog-close", n);
|
|
|
|
fgcommand("dialog-show", n);
|
|
|
|
}
|
2018-04-12 21:24:57 +00:00
|
|
|
};
|
2012-09-18 10:29:17 +00:00
|
|
|
setTransparency(0);
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
]]></open>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<close><![CDATA[
|
|
|
|
# Hide the marker.
|
|
|
|
setprop("/sim/model/marker/arrow-enabled", 0);
|
|
|
|
]]></close>
|
2012-09-18 10:29:17 +00:00
|
|
|
</nasal>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<empty><stretch>1</stretch></empty>
|
|
|
|
|
|
|
|
<text>
|
|
|
|
<label>Aircraft Checklists</label>
|
|
|
|
</text>
|
|
|
|
|
2015-03-14 22:33:05 +00:00
|
|
|
<empty><stretch>true</stretch></empty>
|
2012-09-18 10:29:17 +00:00
|
|
|
|
|
|
|
<button>
|
|
|
|
<pref-width>16</pref-width>
|
|
|
|
<pref-height>16</pref-height>
|
|
|
|
<legend></legend>
|
|
|
|
<keynum>27</keynum>
|
|
|
|
<border>2</border>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
|
2015-03-14 22:33:05 +00:00
|
|
|
<!-- gap to left border -->
|
2020-03-03 11:45:17 +00:00
|
|
|
<!--text>
|
2015-03-14 22:33:05 +00:00
|
|
|
<halign>right</halign>
|
|
|
|
<label> </label>
|
2020-03-03 11:45:17 +00:00
|
|
|
</text-->
|
2015-03-14 22:33:05 +00:00
|
|
|
|
2018-04-12 21:24:57 +00:00
|
|
|
<text>
|
|
|
|
<halign>right</halign>
|
|
|
|
<label>Group:</label>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<combo>
|
|
|
|
<name>checklist-group-combo</name>
|
|
|
|
<property>/sim/gui/dialogs/checklist/selected-checklist-group</property>
|
|
|
|
<editable>false</editable>
|
2020-03-03 11:45:17 +00:00
|
|
|
<pref-width>130</pref-width>
|
2018-04-12 21:24:57 +00:00
|
|
|
<halign>fill</halign>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>checklist-group-combo</object-name>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>
|
|
|
|
var s = getprop("/sim/gui/dialogs/checklist/selected-checklist-group");
|
|
|
|
setChecklistGroup(s);
|
|
|
|
</script>
|
|
|
|
</binding>
|
|
|
|
</combo>
|
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
<text>
|
|
|
|
<halign>right</halign>
|
|
|
|
<label>Checklist:</label>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<combo>
|
|
|
|
<name>checklist-combo</name>
|
|
|
|
<property>/sim/gui/dialogs/checklist/selected-checklist</property>
|
|
|
|
<editable>false</editable>
|
2020-03-03 11:45:17 +00:00
|
|
|
<pref-width>180</pref-width>
|
2012-09-18 10:29:17 +00:00
|
|
|
<halign>fill</halign>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>checklist-combo</object-name>
|
|
|
|
</binding>
|
2013-02-27 22:28:44 +00:00
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>
|
|
|
|
var s = getprop("/sim/gui/dialogs/checklist/selected-checklist");
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-checklist-max-pages", checklist_size[s]);
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page", 0);
|
2018-04-12 21:24:57 +00:00
|
|
|
setprop("/sim/gui/dialogs/checklist/next-available", 1);
|
|
|
|
setprop("/sim/gui/dialogs/checklist/selected-page-text", "1 / " ~ checklist_size[s]);
|
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
</script>
|
|
|
|
</binding>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
</combo>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2020-03-03 11:45:17 +00:00
|
|
|
<!--empty><stretch>true</stretch></empty-->
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2015-03-14 22:33:05 +00:00
|
|
|
<!-- gap to next element -->
|
2020-03-03 11:45:17 +00:00
|
|
|
<!--text>
|
2015-03-14 22:33:05 +00:00
|
|
|
<halign>right</halign>
|
|
|
|
<label> </label>
|
2020-03-03 11:45:17 +00:00
|
|
|
</text-->
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<pref-width>90</pref-width>
|
|
|
|
<legend>Toggle marker</legend>
|
|
|
|
<binding>
|
|
|
|
<command>property-toggle</command>
|
|
|
|
<property>/sim/model/marker/arrow-enabled</property>
|
|
|
|
</binding>
|
|
|
|
</button>
|
2015-03-14 22:33:05 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
<checkbox>
|
2020-03-03 11:45:17 +00:00
|
|
|
<label>Transparent</label>
|
2012-09-18 10:29:17 +00:00
|
|
|
<property>/sim/gui/dialogs/checklist/transparent</property>
|
|
|
|
<live>true</live>
|
|
|
|
<halign>right</halign>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>property-toggle</command>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>setTransparency(1);</script>
|
|
|
|
</binding>
|
2015-03-14 22:33:05 +00:00
|
|
|
<halign>right</halign>
|
2012-09-18 10:29:17 +00:00
|
|
|
</checkbox>
|
|
|
|
</group>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
<hrule/>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
<group>
|
|
|
|
<default-padding>4</default-padding>
|
|
|
|
<halign>fill</halign>
|
|
|
|
<layout>table</layout>
|
|
|
|
<name>checklist-table-group</name>
|
|
|
|
</group>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<group>
|
2015-03-14 22:33:05 +00:00
|
|
|
<default-padding>5</default-padding>
|
2013-02-27 22:28:44 +00:00
|
|
|
<halign>fill</halign>
|
|
|
|
<layout>hbox</layout>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<visible>
|
|
|
|
<greater-than>
|
|
|
|
<property>/sim/gui/dialogs/checklist/selected-checklist-max-pages</property>
|
|
|
|
<value>1</value>
|
|
|
|
</greater-than>
|
|
|
|
</visible>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<empty>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</empty>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<button>
|
|
|
|
<legend>Previous page</legend>
|
|
|
|
<pref-height>24</pref-height>
|
|
|
|
<equal>true</equal>
|
|
|
|
<enable>
|
|
|
|
<greater-than>
|
|
|
|
<property>/sim/gui/dialogs/checklist/selected-page</property>
|
|
|
|
<value>0</value>
|
|
|
|
</greater-than>
|
|
|
|
</enable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>previousPage();</script>
|
|
|
|
</binding>
|
|
|
|
</button>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<empty>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</empty>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
<text>
|
|
|
|
<halign>center</halign>
|
|
|
|
<label>XX/XX</label>
|
|
|
|
<property>/sim/gui/dialogs/checklist/selected-page-text</property>
|
|
|
|
<live>true</live>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<empty>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</empty>
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<legend>Next page</legend>
|
|
|
|
<equal>true</equal>
|
|
|
|
<pref-height>24</pref-height>
|
|
|
|
<enable>
|
|
|
|
<property>/sim/gui/dialogs/checklist/next-available</property>
|
|
|
|
<value>1</value>
|
|
|
|
</enable>
|
|
|
|
<binding>
|
|
|
|
<command>nasal</command>
|
|
|
|
<script>nextPage();</script>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<empty>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
</empty>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2013-02-27 22:28:44 +00:00
|
|
|
</group>
|
2018-04-12 21:24:57 +00:00
|
|
|
|
2012-09-18 10:29:17 +00:00
|
|
|
</PropertyList>
|