Debian Codegraph @

gui/dialogs/autopilot.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2 <PropertyList>
3 <name>autopilot</name>
4 <layout>vbox</layout>
5 <!--
6 /autopilot/locks/altitude
7 /autopilot/locks/heading
8 /autopilot/locks/speed
9 /autopilot/settings/heading-bug-deg
10 /autopilot/settings/target-roll-deg
11 /autopilot/settings/target-agl-ft
12 /autopilot/settings/target-altitude-ft
13 /autopilot/settings/target-fpa-deg
14 /autopilot/settings/target-pitch-deg
15 /autopilot/settings/target-speed-kt
16 /autopilot/settings/target-speed-mach
17 /autopilot/settings/true-heading-deg
18 /autopilot/settings/vertical-speed-fpm
19 -->
20
21 <group>
22 <layout>hbox</layout>
23
24 <text>
25 <label>Autopilot Settings</label>
26 </text>
27
28 <empty><stretch>1</stretch></empty>
29
30 <button>
31 <legend>X</legend>
32 <key>Esc</key>
33 <pref-width>20</pref-width>
34 <pref-height>20</pref-height>
35 <binding>
36 <command>dialog-close</command>
37 </binding>
38 <binding>
39 <command>dialog-apply</command>
40 </binding>
41 </button>
42 </group>
43 <hrule/>
44 <nasal>
45 <open>
46 ## manage one AP property group with checkbox and radio buttons
47 #
48 Group = {
49 new : func(name, options) {
50 var m = { parents: [Group] };
51 m.name = name;
52 m.enabled = 0;
53 m.mode = options[0];
54 m.options = [];
55
56 var locks = props.globals.getNode("/autopilot/locks", 1);
57 if (locks.getNode(name) == nil or locks.getNode(name, 1).getValue() == nil) {
58 locks.getNode(name, 1).setValue("");
59 }
60 m.lock = locks.getNode(name);
61 m.active = dlg.getNode(name ~ "-active", 1);
62
63 foreach (var o; options) {
64 var node = dlg.getNode(o);
65 if (node == nil) {
66 node = dlg.getNode(o, 1);
67 node.setBoolValue(0);
68 }
69 append(m.options, node);
70 if (m.lock.getValue() == o) {
71 m.mode = o;
72 }
73 }
74 m.listener = setlistener(m.lock, func(n) { m.update(n.getValue()) }, 1);
75 return m;
76 },
77 del : func {
78 removelistener(me.listener);
79 },
80
81 ## handle checkbox
82 #
83 enable : func {
84 me.enabled = me.active.getBoolValue();
85 me.lock.setValue(me.enabled ? me.mode : "");
86 },
87
88 ## handle radiobuttons
89 #
90 set : func(mode) {
91 me.mode = mode;
92 foreach (var o; me.options) {
93 o.setBoolValue(o.getName() == mode);
94 }
95 if (me.enabled) {
96 me.lock.setValue(mode);
97 }
98 },
99
100 ## update checkboxes/radiobuttons state from the AP (listener callback)
101 #
102 update : func(mode) {
103 me.enabled = (mode != "");
104 me.active.setBoolValue(me.enabled);
105 if (mode == "") {
106 mode = me.mode;
107 }
108 foreach (var o; me.options) {
109 o.setBoolValue(o.getName() == mode);
110 }
111 },
112 };
113
114
115 ## create and initialize input field properties if necessary
116 #
117 var apset = props.globals.getNode("/autopilot/settings", 1);
118 foreach (var p; ["heading-bug-deg", "target-roll-deg", "true-heading-deg", "vertical-speed-fpm",
119 "target-pitch-deg", "target-fpa-deg", "target-altitude-ft",
120 "target-agl-ft", "target-speed-kt", "target-speed-mach"]) {
121
122 if ((var n = apset.getNode(p)) == nil or n.getType() == "NONE") {
123 apset.getNode(p, 1).setDoubleValue(0);
124 }
125 }
126
127 var dlg = props.globals.getNode("/sim/gui/dialogs/autopilot", 1);
128
129 # - first entry ("heading" etc.) is the target property in /autopilot/locks/ *and*
130 # the checkbox state property name (with "-active" appended);
131 # - second entry is a list of available options for the /autopilot/locks/* property
132 # and used as radio button state property; the first list entry is used as default
133 #
134 var hdg = Group.new("heading", ["dg-heading-hold", "wing-leveler", "true-heading-hold", "nav1-hold"]);
135 var vel = Group.new("speed", ["speed-with-throttle", "speed-with-pitch-trim"]);
136 var alt = Group.new("altitude", ["altitude-hold", "vertical-speed-hold", "pitch-hold",
137 "fpa-hold", "agl-hold", "gs1-hold"]);
138 </open>
139 <close>
140 hdg.del();
141 vel.del();
142 alt.del();
143 </close>
144 </nasal>
145 <group>
146 <layout>hbox</layout>
147 <default-padding>8</default-padding>
148 <group>
149 <!-- Heading -->
150 <layout>vbox</layout>
151 <group>
152 <layout>hbox</layout>
153 <checkbox>
154 <label>Heading Control</label>
155 <halign>fill</halign>
156 <property>/sim/gui/dialogs/autopilot/heading-active</property>
157 <live>true</live>
158 <binding>
159 <command>dialog-apply</command>
160 </binding>
161 <binding>
162 <command>nasal</command>
163 <script>hdg.enable()</script>
164 </binding>
165 </checkbox>
166 </group>
167 <group>
168 <layout>table</layout>
169 <text>
170 <label>Wings Level</label>
171 <halign>right</halign>
172 <row>0</row>
173 <col>0</col>
174 </text>
175 <radio>
176 <row>0</row>
177 <col>1</col>
178 <property>/sim/gui/dialogs/autopilot/wing-leveler</property>
179 <live>true</live>
180 <binding>
181 <command>nasal</command>
182 <script>hdg.set("wing-leveler")</script>
183 </binding>
184 </radio>
185 <input>
186 <row>0</row>
187 <col>2</col>
188 <property>/autopilot/settings/target-roll-deg</property>
189 <live>true</live>
190 <binding>
191 <command>dialog-apply</command>
192 </binding>
193 </input>
194 <text>
195 <label>Heading Bug</label>
196 <halign>right</halign>
197 <row>1</row>
198 <col>0</col>
199 </text>
200 <radio>
201 <row>1</row>
202 <col>1</col>
203 <property>/sim/gui/dialogs/autopilot/dg-heading-hold</property>
204 <live>true</live>
205 <binding>
206 <command>nasal</command>
207 <script>hdg.set("dg-heading-hold")</script>
208 </binding>
209 </radio>
210 <input>
211 <row>1</row>
212 <col>2</col>
213 <property>/autopilot/settings/heading-bug-deg</property>
214 <live>true</live>
215 <binding>
216 <command>dialog-apply</command>
217 </binding>
218 </input>
219 <text>
220 <label>True Heading</label>
221 <halign>right</halign>
222 <row>2</row>
223 <col>0</col>
224 <visible>
225 <not>
226 <property>/autopilot/settings/gps-driving-true-heading</property>
227 </not>
228 </visible>
229 </text>
230 <!-- alternate UI for above, when GPS is controlling -->
231 <text>
232 <visible>
233 <property>/autopilot/settings/gps-driving-true-heading</property>
234 </visible>
235 <label>GPS/FMS Heading</label>
236 <halign>right</halign>
237 <row>2</row>
238 <col>0</col>
239 </text>
240 <radio>
241 <row>2</row>
242 <col>1</col>
243 <property>/sim/gui/dialogs/autopilot/true-heading-hold</property>
244 <live>true</live>
245 <binding>
246 <command>nasal</command>
247 <script>hdg.set("true-heading-hold")</script>
248 </binding>
249 </radio>
250 <input>
251 <visible>
252 <not>
253 <property>/autopilot/settings/gps-driving-true-heading</property>
254 </not>
255 </visible>
256 <row>2</row>
257 <col>2</col>
258 <property>/autopilot/settings/true-heading-deg</property>
259 <live>true</live>
260 <binding>
261 <command>dialog-apply</command>
262 </binding>
263 </input>
264 <!-- alternate UI for above, when GPS is controlling -->
265 <text>
266 <visible>
267 <property>/autopilot/settings/gps-driving-true-heading</property>
268 </visible>
269 <halign>right</halign>
270 <row>2</row>
271 <col>2</col>
272 <label>MMMM</label>
273 <format>%3.0f*</format>
274 <property>/autopilot/settings/true-heading-deg</property>
275 <live>true</live>
276 </text>
277 <text>
278 <label>NAV1 CDI Course</label>
279 <halign>right</halign>
280 <row>3</row>
281 <col>0</col>
282 </text>
283 <radio>
284 <row>3</row>
285 <col>1</col>
286 <property>/sim/gui/dialogs/autopilot/nav1-hold</property>
287 <live>true</live>
288 <binding>
289 <command>nasal</command>
290 <script>hdg.set("nav1-hold")</script>
291 </binding>
292 </radio>
293 </group>
294 <hrule/>
295 <group>
296 <layout>hbox</layout>
297 <checkbox>
298 <label>Velocity Control</label>
299 <halign>fill</halign>
300 <property>/sim/gui/dialogs/autopilot/speed-active</property>
301 <live>true</live>
302 <binding>
303 <command>dialog-apply</command>
304 </binding>
305 <binding>
306 <command>nasal</command>
307 <script>vel.enable()</script>
308 </binding>
309 </checkbox>
310 </group>
311 <group>
312 <layout>table</layout>
313 <text>
314 <label>Speed with Throttle</label>
315 <halign>right</halign>
316 <row>0</row>
317 <col>0</col>
318 </text>
319 <radio>
320 <row>0</row>
321 <col>1</col>
322 <property>/sim/gui/dialogs/autopilot/speed-with-throttle</property>
323 <live>true</live>
324 <binding>
325 <command>nasal</command>
326 <script>vel.set("speed-with-throttle")</script>
327 </binding>
328 </radio>
329 <input>
330 <row>0</row>
331 <col>2</col>
332 <rowspan>2</rowspan>
333 <property>/autopilot/settings/target-speed-kt</property>
334 <live>true</live>
335 <binding>
336 <command>dialog-apply</command>
337 </binding>
338 </input>
339 <text>
340 <label>Speed with Pitch</label>
341 <halign>right</halign>
342 <row>1</row>
343 <col>0</col>
344 </text>
345 <radio>
346 <row>1</row>
347 <col>1</col>
348 <property>/sim/gui/dialogs/autopilot/speed-with-pitch-trim</property>
349 <live>true</live>
350 <binding>
351 <command>nasal</command>
352 <script>vel.set("speed-with-pitch-trim")</script>
353 </binding>
354 </radio>
355 </group>
356 </group>
357 <!-- End of Heading/Speed -->
358 <vrule/>
359 <group>
360 <!-- Pitch/Altitude -->
361 <layout>vbox</layout>
362 <group>
363 <layout>hbox</layout>
364 <checkbox>
365 <label>Pitch/Altitude Control</label>
366 <halign>fill</halign>
367 <property>/sim/gui/dialogs/autopilot/altitude-active</property>
368 <live>true</live>
369 <binding>
370 <command>dialog-apply</command>
371 </binding>
372 <binding>
373 <command>nasal</command>
374 <script>alt.enable()</script>
375 </binding>
376 </checkbox>
377 </group>
378 <group>
379 <layout>table</layout>
380 <text>
381 <label>Vertical Speed</label>
382 <halign>right</halign>
383 <row>0</row>
384 <col>0</col>
385 </text>
386 <radio>
387 <row>0</row>
388 <col>1</col>
389 <property>/sim/gui/dialogs/autopilot/vertical-speed-hold</property>
390 <live>true</live>
391 <binding>
392 <command>nasal</command>
393 <script>alt.set("vertical-speed-hold")</script>
394 </binding>
395 </radio>
396 <input>
397 <row>0</row>
398 <col>2</col>
399 <property>/autopilot/settings/vertical-speed-fpm</property>
400 <live>true</live>
401 <binding>
402 <command>dialog-apply</command>
403 </binding>
404 </input>
405 <text>
406 <label>Pitch Hold</label>
407 <halign>right</halign>
408 <row>1</row>
409 <col>0</col>
410 </text>
411 <radio>
412 <row>1</row>
413 <col>1</col>
414 <property>/sim/gui/dialogs/autopilot/pitch-hold</property>
415 <live>true</live>
416 <binding>
417 <command>nasal</command>
418 <script>alt.set("pitch-hold")</script>
419 </binding>
420 </radio>
421 <input>
422 <row>1</row>
423 <col>2</col>
424 <property>/autopilot/settings/target-pitch-deg</property>
425 <live>true</live>
426 <binding>
427 <command>dialog-apply</command>
428 </binding>
429 </input>
430 <text>
431 <label>FPA Hold</label>
432 <halign>right</halign>
433 <row>2</row>
434 <col>0</col>
435 </text>
436 <radio>
437 <row>2</row>
438 <col>1</col>
439 <property>/sim/gui/dialogs/autopilot/fpa-hold</property>
440 <live>true</live>
441 <binding>
442 <command>nasal</command>
443 <script>alt.set("fpa-hold")</script>
444 </binding>
445 </radio>
446 <input>
447 <row>2</row>
448 <col>2</col>
449 <property>/autopilot/settings/target-fpa-deg</property>
450 <live>true</live>
451 <binding>
452 <command>dialog-apply</command>
453 </binding>
454 </input>
455 <text>
456 <label>Altitude Hold</label>
457 <halign>right</halign>
458 <row>3</row>
459 <col>0</col>
460 </text>
461 <radio>
462 <row>3</row>
463 <col>1</col>
464 <property>/sim/gui/dialogs/autopilot/altitude-hold</property>
465 <live>true</live>
466 <binding>
467 <command>nasal</command>
468 <script>alt.set("altitude-hold")</script>
469 </binding>
470 </radio>
471 <input>
472 <row>3</row>
473 <col>2</col>
474 <property>/autopilot/settings/target-altitude-ft</property>
475 <live>true</live>
476 <binding>
477 <command>dialog-apply</command>
478 </binding>
479 </input>
480 <text>
481 <label>AGL Hold</label>
482 <halign>right</halign>
483 <row>4</row>
484 <col>0</col>
485 </text>
486 <radio>
487 <row>4</row>
488 <col>1</col>
489 <property>/sim/gui/dialogs/autopilot/agl-hold</property>
490 <live>true</live>
491 <binding>
492 <command>nasal</command>
493 <script>alt.set("agl-hold")</script>
494 </binding>
495 </radio>
496 <input>
497 <row>4</row>
498 <col>2</col>
499 <property>/autopilot/settings/target-agl-ft</property>
500 <live>true</live>
501 <binding>
502 <command>dialog-apply</command>
503 </binding>
504 </input>
505 <text>
506 <label>NAV1 Glideslope</label>
507 <halign>right</halign>
508 <row>5</row>
509 <col>0</col>
510 </text>
511 <radio>
512 <row>5</row>
513 <col>1</col>
514 <property>/sim/gui/dialogs/autopilot/gs1-hold</property>
515 <live>true</live>
516 <binding>
517 <command>nasal</command>
518 <script>alt.set("gs1-hold")</script>
519 </binding>
520 </radio>
521 </group>
522 <empty>
523 <stretch>true</stretch>
524 </empty>
525 </group>
526 <!-- End of Pitch/Altitude VBox -->
527 </group>
528
529 <hrule/>
530
531 <button>
532 <legend>Close</legend>
533 <default>true</default>
534 <key>Esc</key>
535 <binding>
536 <command>dialog-close</command>
537 </binding>
538 </button>
539
540 </PropertyList>