4 <name>flight-recorder-load</name>
6 <resizable>true</resizable>
7 <default-padding>3</default-padding>
11 var DialogController = {
12 new : func( dlgRoot ) {
13 var obj = { parents: [DialogController] };
14 obj.dlgRoot = dlgRoot;
19 fgcommand("load-tape", props.Node.new({"tape": "",
20 "same-aircraft": getprop("/sim/gui/dialogs/flightrecorder/show-matching-aircraft-only")}));
22 var combo = gui.findElementByName( me.dlgRoot, "selected-tape" );
23 combo.removeChildren("value");
29 var name = getprop("/sim/replay/tape-list/tape[" ~ i ~ "]");
32 combo.getNode("value[" ~ i ~ "]", 1).setValue(name);
35 setprop("/sim/gui/dialogs/flightrecorder/selected-tape", name);
42 setprop("/sim/gui/dialogs/flightrecorder/selected-tape", "No tapes in selected directory!");
52 var tape = getprop("/sim/gui/dialogs/flightrecorder/selected-tape");
53 setprop("/sim/gui/dialogs/flightrecorder/preview/aircraft-description", "");
54 setprop("/sim/gui/dialogs/flightrecorder/preview/version/flightgear", "");
55 setprop("/sim/gui/dialogs/flightrecorder/preview/user-data/description", "");
56 setprop("/sim/gui/dialogs/flightrecorder/preview/tape-duration-str", "");
57 setprop("/sim/gui/dialogs/flightrecorder/preview/aircraft-version", "");
58 setprop("/sim/gui/dialogs/flightrecorder/preview/aircraft-type", "");
59 setprop("/sim/gui/dialogs/flightrecorder/preview/closest-airport-id", "");
60 setprop("/sim/gui/dialogs/flightrecorder/preview/author-name", "");
61 setprop("/sim/gui/dialogs/flightrecorder/warning", "");
64 fgcommand("load-tape", props.Node.new({"tape": tape, "preview": 1} ) );
65 var actype = getprop("/sim/gui/dialogs/flightrecorder/preview/aircraft-type");
66 if ((actype != "")and(actype != getprop("/sim/aircraft")))
68 setprop("/sim/gui/dialogs/flightrecorder/warning",
69 "Tape was recorded for another aircraft (" ~ actype ~ "). It may not work (properly). Good luck! :)");
73 redraw: func{gui.dialog_update("flight-recorder-load", "selected-tape");},
75 var setdefault = func (prop, value) { if (getprop(prop) == nil) setprop(prop, value);}
76 setdefault("/sim/gui/dialogs/flightrecorder/show-matching-aircraft-only", 1);
77 var controller = DialogController.new( cmdarg() );
87 <empty><stretch>1</stretch></empty>
90 <label>Load Flight Recorder Tape</label>
93 <empty><stretch>1</stretch></empty>
96 <pref-width>16</pref-width>
97 <pref-height>16</pref-height>
102 <command>dialog-close</command>
108 <!-- main dialog area -->
111 <layout>table</layout>
114 <row>0</row><col>0</col>
115 <label>Tape Directory:</label>
116 <halign>left</halign>
120 <row>0</row><col>1</col>
121 <halign>left</halign>
123 <label>MMMMMMMMMMMMMMMMM</label>
126 <property>/sim/replay/tape-directory</property>
137 <row>0</row><col>2</col>
138 <legend>Change</legend>
139 <halign>left</halign>
142 <command>nasal</command>
144 var set_tapedir_sel = gui.DirSelector.new(
145 func(result) { setprop("/sim/replay/tape-directory", result.getValue());
146 controller.updateCombo();controller.redraw();
148 "Select Tape Directory", "Ok", getprop("/sim/replay/tape-directory"));
149 set_tapedir_sel.open();
155 <row>1</row><col>0</col>
156 <label>Hide Mismatching Tapes:</label>
157 <halign>left</halign>
160 <row>1</row><col>1</col>
161 <name>matching-aircraft</name>
162 <halign>left</halign>
163 <property>/sim/gui/dialogs/flightrecorder/show-matching-aircraft-only</property>
166 <command>dialog-apply</command>
167 <object-name>matching-aircraft</object-name>
170 <command>nasal</command>
171 <script>controller.updateCombo();controller.redraw();</script>
173 <label>(Don't show tapes from other aircraft)</label>
177 <row>2</row><col>0</col>
178 <label>Selected Tape:</label>
179 <halign>left</halign>
182 <name>selected-tape</name>
183 <halign>left</halign>
184 <row>2</row><col>1</col>
185 <pref-width>300</pref-width>
186 <property>/sim/gui/dialogs/flightrecorder/selected-tape</property>
187 <editable>false</editable>
190 <command>dialog-apply</command>
191 <object-name>selected-tape</object-name>
194 <command>nasal</command>
195 <script>controller.preview();controller.redraw();</script>
199 <hrule><row>3</row><col>0</col><colspan>3</colspan></hrule>
202 <row>5</row><col>0</col><colspan>3</colspan>
203 <label>Tape Recording Details</label>
204 <halign>center</halign>
208 <row>6</row><col>0</col>
209 <label>Author/Pilot:</label>
210 <halign>left</halign>
213 <row>6</row><col>1</col>
215 <property>/sim/gui/dialogs/flightrecorder/preview/user-data/author-name</property>
217 <halign>left</halign>
227 <row>8</row><col>0</col>
228 <label>Aircraft:</label>
229 <halign>left</halign>
232 <row>8</row><col>1</col>
234 <property>/sim/gui/dialogs/flightrecorder/preview/aircraft-description</property>
236 <halign>left</halign>
246 <row>10</row><col>0</col>
247 <label>Aircraft Version:</label>
248 <halign>left</halign>
251 <row>10</row><col>1</col>
253 <property>/sim/gui/dialogs/flightrecorder/preview/aircraft-version</property>
255 <halign>left</halign>
265 <row>14</row><col>0</col>
266 <label>Airport (nearby):</label>
267 <halign>left</halign>
270 <row>14</row><col>1</col>
272 <property>/sim/gui/dialogs/flightrecorder/preview/closest-airport-id</property>
274 <halign>left</halign>
284 <row>18</row><col>0</col>
285 <label>Tape Duration:</label>
286 <halign>left</halign>
289 <row>18</row><col>1</col>
290 <property>/sim/gui/dialogs/flightrecorder/preview/tape-duration-str</property>
291 <halign>left</halign>
302 <row>22</row><col>0</col>
303 <label>FG Version (recorder):</label>
304 <halign>left</halign>
307 <row>22</row><col>1</col>
308 <property>/sim/gui/dialogs/flightrecorder/preview/version/flightgear</property>
309 <halign>left</halign>
323 <label>Description:</label>
324 <halign>left</halign>
330 <layout>vbox</layout>
331 <stretch>10</stretch>
332 <halign>fill</halign>
333 <valign>fill</valign>
337 <name>description-string</name>
338 <halign>fill</halign>
339 <valign>fill</valign>
341 <pref-width>550</pref-width>
342 <pref-height>150</pref-height>
343 <editable>false</editable>
344 <top-line>1</top-line>
345 <property>/sim/gui/dialogs/flightrecorder/preview/user-data/description</property>
347 <command>dialog-apply</command>
348 <object-name>description-string</object-name>
353 <stretch>true</stretch>
354 <property>/sim/gui/dialogs/flightrecorder/warning</property>
355 <halign>left</halign>
369 <layout>hbox</layout>
370 <default-padding>10</default-padding>
371 <empty><stretch>true</stretch></empty>
374 <legend>Load</legend>
377 <command>dialog-apply</command>
380 <command>nasal</command>
382 # close old replay dialog and delay loading - until current replay was properly stopped
383 fgcommand("dialog-close", props.Node.new({ "dialog-name": "replay" }));
384 setprop("/sim/replay/disable", 0);
386 var Config = props.Node.new({
387 "tape": getprop("/sim/gui/dialogs/flightrecorder/selected-tape", ""),
390 if (fgcommand("load-tape", Config))
391 gui.showDialog("replay");
396 <command>dialog-close</command>
401 <legend>Cancel</legend>
402 <default>true</default>
405 <command>dialog-close</command>
409 <empty><stretch>true</stretch></empty>