| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <PropertyList> |
| 4 | <name>tutorial</name> |
| 5 | <layout>vbox</layout> |
| 6 | <resizable>true</resizable> |
| 7 | <default-padding>3</default-padding> |
| 8 | |
| 9 | <group> |
| 10 | <layout>hbox</layout> |
| 11 | <default-padding>1</default-padding> |
| 12 | |
| 13 | <text> |
| 14 | <label>Select Tutorial</label> |
| 15 | </text> |
| 16 | |
| 17 | <empty><stretch>true</stretch></empty> |
| 18 | |
| 19 | <button> |
| 20 | <legend>X</legend> |
| 21 | <key>Esc</key> |
| 22 | <pref-width>20</pref-width> |
| 23 | <pref-height>20</pref-height> |
| 24 | <binding> |
| 25 | <command>dialog-close</command> |
| 26 | </binding> |
| 27 | </button> |
| 28 | </group> |
| 29 | |
| 30 | <hrule/> |
| 31 | |
| 32 | <nasal> |
| 33 | <open> |
| 34 | var list = cmdarg().getNode("group[2]/group/list"); |
| 35 | var node = props.globals.getNode("/sim/tutorials", 1); |
| 36 | var tut = node.getChildren("tutorial"); |
| 37 | var current = node.getNode("current-tutorial", 1); |
| 38 | |
| 39 | # fill listbox |
| 40 | list.removeChildren("value"); |
| 41 | forindex (var i; tut) { |
| 42 | var name = tut[i].getNode("name"); |
| 43 | if (name == nil) { |
| 44 | die("tutorial #" ~ i ~ " has no <name>"); |
| 45 | } |
| 46 | name = name.getValue(); |
| 47 | list.getChild("value", i, 1).setValue(name); |
| 48 | } |
| 49 | |
| 50 | var select = func { |
| 51 | var name = current.getValue(); |
| 52 | foreach (var t; tut) { |
| 53 | if (t.getNode("name").getValue() == name) { |
| 54 | setprop("/sim/tutorials/current-description", |
| 55 | string.trim(t.getNode("description").getValue())); |
| 56 | break; |
| 57 | } |
| 58 | } |
| 59 | fgcommand("dialog-update", props.Node.new({"object-name": "textbox", |
| 60 | "dialog-name": "tutorial"})); |
| 61 | } |
| 62 | |
| 63 | if (current.getType() == "NONE" or current.getValue() == "") { |
| 64 | current.setValue(tut[0].getNode("name").getValue()); |
| 65 | select(); |
| 66 | } |
| 67 | </open> |
| 68 | </nasal> |
| 69 | |
| 70 | <group> |
| 71 | <layout>hbox</layout> |
| 72 | <default-padding>0</default-padding> |
| 73 | <empty><pref-width>7</pref-width></empty> |
| 74 | |
| 75 | <text> |
| 76 | <halign>left</halign> |
| 77 | <label></label> |
| 78 | <property>/sim/tutorials/current-tutorial</property> |
| 79 | <live>1</live> |
| 80 | </text> |
| 81 | |
| 82 | <empty><stretch>true</stretch></empty> |
| 83 | </group> |
| 84 | |
| 85 | <group> |
| 86 | <layout>hbox</layout> |
| 87 | <valign>fill</valign> |
| 88 | <stretch>true</stretch> |
| 89 | |
| 90 | <textbox> |
| 91 | <name>textbox</name> |
| 92 | <halign>fill</halign> |
| 93 | <valign>fill</valign> |
| 94 | <stretch>true</stretch> |
| 95 | <pref-width>600</pref-width> |
| 96 | <pref-height>480</pref-height> |
| 97 | <slider>20</slider> |
| 98 | <wrap>true</wrap> |
| 99 | <editable>false</editable> |
| 100 | <live>1</live> |
| 101 | <property>/sim/tutorials/current-description</property> |
| 102 | </textbox> |
| 103 | |
| 104 | <group> |
| 105 | <layout>vbox</layout> |
| 106 | |
| 107 | <list> |
| 108 | <name>list</name> |
| 109 | <halign>fill</halign> |
| 110 | <valign>fill</valign> |
| 111 | <stretch>true</stretch> |
| 112 | <pref-width>170</pref-width> |
| 113 | <pref-height>400</pref-height> |
| 114 | <property>/sim/tutorials/current-tutorial</property> |
| 115 | <binding> |
| 116 | <command>dialog-apply</command> |
| 117 | <object-name>list</object-name> |
| 118 | </binding> |
| 119 | <binding> |
| 120 | <command>nasal</command> |
| 121 | <script>select()</script> |
| 122 | </binding> |
| 123 | </list> |
| 124 | |
| 125 | <button> |
| 126 | <legend>Start Tutorial</legend> |
| 127 | <equal>true</equal> |
| 128 | <default>true</default> |
| 129 | <binding> |
| 130 | <command>nasal</command> |
| 131 | <script> |
| 132 | setprop("/nasal/tutorial/enabled",1); # load module on demand |
| 133 | tutorial.startTutorial(); |
| 134 | </script> |
| 135 | </binding> |
| 136 | <binding> |
| 137 | <command>dialog-close</command> |
| 138 | </binding> |
| 139 | </button> |
| 140 | |
| 141 | <button> |
| 142 | <legend>Stop Tutorial</legend> |
| 143 | <equal>true</equal> |
| 144 | <binding> |
| 145 | <command>nasal</command> |
| 146 | <script>tutorial.stopTutorial()</script> |
| 147 | </binding> |
| 148 | <enable> |
| 149 | <property>/sim/tutorials/running</property> |
| 150 | </enable> |
| 151 | </button> |
| 152 | |
| 153 | <button> |
| 154 | <legend>Cancel</legend> |
| 155 | <equal>true</equal> |
| 156 | <binding> |
| 157 | <command>dialog-close</command> |
| 158 | </binding> |
| 159 | </button> |
| 160 | |
| 161 | </group> |
| 162 | </group> |
| 163 | </PropertyList> |