1
0
Fork 0

Add support for a Aircraft Checklists GUI item.

This commit is contained in:
Stuart Buchanan 2012-09-18 11:29:17 +01:00
parent a870d8c4a3
commit 602ae34af4
6 changed files with 201 additions and 25 deletions

View file

@ -13,33 +13,11 @@
<desc>Increase/decrease panel lighting</desc>
</key>
<line/>
<line>_________Engine Start Checklist_________</line>
<line>Mixture: Rich</line>
<line>Throttle: Open 1/8"</line>
<line>Parking Brake: Applied (Shift-B)</line>
<line>Prop Area: Clear</line>
<line>Magnetos: Both ( } three times )</line>
<line>Ignition: Start (s)</line>
<line>Throttle: 800-1000rpm</line>
<line>For checklists, see under Help->Aircraft Checklists</line>
<line/>
<line>_________Pre-Takeoff Checklist_________</line>
<line>Parking Brake: Applied (Shift-B)</line>
<line>Flight Controls: Free and Correct</line>
<line>Elevator Trim: Takeoff</line>
<line>Mixture: Rich</line>
<line>Throttle: 1700rpm</line>
<line>Suction gauge: Check</line>
<line>Engine Instruments: Check</line>
<line>Ammeter: Check</line>
<line>Magnetos: Check (125rpm max drop, 50rpm max diff</line>
<line>Throttle: Closed (check idle)</line>
<line>Throttle: 800-1000rpm</line>
<line>Mixture: As required</line>
<line/>
<line>_________Procedures_________</line>
<line>Takeoff: no flaps, full throttle, rotate at 55 KIAS</line>
<line>Climbout: no flaps, full throttle, 80 KIAS</line>
<line>Cruise: Throttle 65%, Mixture rich of peak,</line>
<line>Cruise: Throttle 65%, Mixture rich of peak</line>
<line>Landing: full flaps, 65 KIAS</line>
<line/>
<line>_________V Speeds_________</line>

View file

@ -97,6 +97,8 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net
<help include="c172-help.xml"/>
<checklists include="c172-checklists.xml"/>
<tutorials include="Tutorials/c172-tutorials.xml"/>
<dimensions>

View file

@ -146,6 +146,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
# enable/disable menu entries
menuEnable("fuel-and-payload", fdm == "yasim" or fdm == "jsb");
menuEnable("aircraft-checklists", props.globals.getNode("/sim/checklists") != nil);
var isAutopilotMenuEnabled = func {
foreach( var apdp; autopilotDisableProps ) {
if( props.globals.getNode( apdp ) != nil )

View file

@ -109,6 +109,7 @@
<help>Help</help>
<help-browser>Help (opens in browser)</help-browser>
<aircraft-keys>Aircraft Help</aircraft-keys>
<aircraft-checklists>Aircraft Checklists</aircraft-checklists>
<common-keys>Common Aircraft Keys</common-keys>
<basic-keys>Basic Simulator Keys</basic-keys>
<joystick-config>Joystick Configuration</joystick-config>

186
gui/dialogs/checklist.xml Normal file
View file

@ -0,0 +1,186 @@
<?xml version="1.0"?>
<PropertyList>
<name>checklist</name>
<layout>vbox</layout>
<default-padding>1</default-padding>
<color>
<red type="float">0.41</red>
<green type="float">0.4</green>
<blue type="float">0.42</blue>
<alpha type="float">1.0</alpha>
<alpha type="float">1.0</alpha>
</color>
<nasal>
<open>
var dlgRoot = cmdarg();
var checklists = props.globals.getNode("/sim/checklists", 1).getChildren("checklist");
if (size(checklists) > 0) {
var combo = gui.findElementByName(dlgRoot, "checklist-combo");
var group = gui.findElementByName(dlgRoot, "checklist-table-group");
forindex (var idx; checklists) {
combo.getChild("value", idx, 1).setValue(checklists[idx].getNode("title", 1).getValue());
var c = checklists[idx];
var row = 0;
# Set up a new table, only visible when this checklist is selected.
var table = group.getChild("group", idx, 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");
var vis = table.getNode("visible", 1).getNode("equals", 1);
vis.getNode("property", 1).setValue("sim/gui/dialogs/checklist/selected-checklist");
vis.getNode("value", 1).setValue(c.getNode("title").getValue());
var items = c.getChildren("item");
var txtcount = 0;
forindex (var i; items) {
var item = items[i];
var t = table.getChild("text", txtcount, 1);
txtcount += 1;
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());
var values = item.getChildren("value");
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
# first column if required - helps keep the
# 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);
}
t.getNode("label", 1).setValue(values[v].getValue());
row = row + 1;
}
}
}
setprop("sim/gui/dialogs/checklist/selected-checklist",
checklists[0].getNode("title").getValue());
} else {
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");
table.getNode("label", 1).setValue("No checklists exist for this aircraft");
}
var setTransparency = func(updateDialog){
var alpha = (getprop("/sim/gui/dialogs/checklist/transparent") or 0);
dlgRoot.getNode("color/alpha").setValue(1-alpha*0.3);
dlgRoot.getNode("color/red").setValue(0.41-alpha*0.2);
dlgRoot.getNode("color/green").setValue(0.4-alpha*0.2);
dlgRoot.getNode("color/blue").setValue(0.42-alpha*0.2);
var n = props.Node.new({ "dialog-name": "checklist" });
if (updateDialog)
{
fgcommand("dialog-close", n);
fgcommand("dialog-show", n);
}
}
setTransparency(0);
</open>
</nasal>
<group>
<layout>hbox</layout>
<empty><stretch>1</stretch></empty>
<text>
<label>Aircraft Checklists</label>
</text>
<empty><stretch>1</stretch></empty>
<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>
<text>
<halign>right</halign>
<label>Checklist:</label>
</text>
<combo>
<name>checklist-combo</name>
<property>/sim/gui/dialogs/checklist/selected-checklist</property>
<editable>false</editable>
<pref-width>200</pref-width>
<halign>fill</halign>
<binding>
<command>dialog-apply</command>
<object-name>checklist-combo</object-name>
</binding>
</combo>
<empty><stretch>true</stretch></empty>
<checkbox>
<label>Transparent</label>
<pref-width>100</pref-width>
<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>
</checkbox>
</group>
<hrule/>
<group>
<default-padding>4</default-padding>
<halign>fill</halign>
<layout>table</layout>
<name>checklist-table-group</name>
</group>
</PropertyList>

View file

@ -712,6 +712,14 @@
</binding>
</item>
<item>
<name>aircraft-checklists</name>
<binding>
<command>dialog-show</command>
<dialog-name>checklist</dialog-name>
</binding>
</item>
<item>
<name>common-keys</name>
<binding>