From 602ae34af4108e801c2c316ae0f2e1537c422b56 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Tue, 18 Sep 2012 11:29:17 +0100 Subject: [PATCH] Add support for a Aircraft Checklists GUI item. --- Aircraft/c172p/c172-help.xml | 28 +----- Aircraft/c172p/c172p-set.xml | 2 + Nasal/gui.nas | 1 + Translations/en/menu.xml | 1 + gui/dialogs/checklist.xml | 186 +++++++++++++++++++++++++++++++++++ gui/menubar.xml | 8 ++ 6 files changed, 201 insertions(+), 25 deletions(-) create mode 100644 gui/dialogs/checklist.xml diff --git a/Aircraft/c172p/c172-help.xml b/Aircraft/c172p/c172-help.xml index 0429466be..e210fcb59 100644 --- a/Aircraft/c172p/c172-help.xml +++ b/Aircraft/c172p/c172-help.xml @@ -13,33 +13,11 @@ Increase/decrease panel lighting - _________Engine Start Checklist_________ - Mixture: Rich - Throttle: Open 1/8" - Parking Brake: Applied (Shift-B) - Prop Area: Clear - Magnetos: Both ( } three times ) - Ignition: Start (s) - Throttle: 800-1000rpm - - _________Pre-Takeoff Checklist_________ - Parking Brake: Applied (Shift-B) - Flight Controls: Free and Correct - Elevator Trim: Takeoff - Mixture: Rich - Throttle: 1700rpm - Suction gauge: Check - Engine Instruments: Check - Ammeter: Check - Magnetos: Check (125rpm max drop, 50rpm max diff - Throttle: Closed (check idle) - Throttle: 800-1000rpm - Mixture: As required - - _________Procedures_________ + For checklists, see under Help->Aircraft Checklists + Takeoff: no flaps, full throttle, rotate at 55 KIAS Climbout: no flaps, full throttle, 80 KIAS - Cruise: Throttle 65%, Mixture rich of peak, + Cruise: Throttle 65%, Mixture rich of peak Landing: full flaps, 65 KIAS _________V Speeds_________ diff --git a/Aircraft/c172p/c172p-set.xml b/Aircraft/c172p/c172p-set.xml index bacf17e12..5cdedc57e 100644 --- a/Aircraft/c172p/c172p-set.xml +++ b/Aircraft/c172p/c172p-set.xml @@ -96,6 +96,8 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net + + diff --git a/Nasal/gui.nas b/Nasal/gui.nas index de1f97c29..6c4c7e95f 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -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 ) diff --git a/Translations/en/menu.xml b/Translations/en/menu.xml index 940d1dd5c..51c6e8e8d 100644 --- a/Translations/en/menu.xml +++ b/Translations/en/menu.xml @@ -109,6 +109,7 @@ Help Help (opens in browser) Aircraft Help + Aircraft Checklists Common Aircraft Keys Basic Simulator Keys Joystick Configuration diff --git a/gui/dialogs/checklist.xml b/gui/dialogs/checklist.xml new file mode 100644 index 000000000..b459abb65 --- /dev/null +++ b/gui/dialogs/checklist.xml @@ -0,0 +1,186 @@ + + + + checklist + vbox + 1 + + + 0.41 + 0.4 + 0.42 + 1.0 + 1.0 + + + + + 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); + + + + + + hbox + 1 + + + + + + 1 + + + + + + + + hbox + + + right + + + + + checklist-combo + /sim/gui/dialogs/checklist/selected-checklist + false + 200 + fill + + dialog-apply + checklist-combo + + + + true + + + + 100 + /sim/gui/dialogs/checklist/transparent + true + right + + dialog-apply + + + property-toggle + + + nasal + + + + + + + + + 4 + fill + table + checklist-table-group + + diff --git a/gui/menubar.xml b/gui/menubar.xml index c6bdf4a69..aadd572fb 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -711,6 +711,14 @@ + + + aircraft-checklists + + dialog-show + checklist + + common-keys