Debian Codegraph @

Aircraft/ufo/Dialogs/adjust.xml

raw symbols SCIP
1 <?xml version="1.0"?>
2
3 <PropertyList>
4 <name>ufo-adjust</name>
5 <layout>vbox</layout>
6 <x>-20</x>
7 <y>-20</y>
8
9 <group>
10 <layout>hbox</layout>
11 <empty><stretch>1</stretch></empty>
12
13 <text>
14 <label>Adjust model</label>
15 </text>
16
17 <empty><stretch>1</stretch></empty>
18
19 <button>
20 <pref-width>16</pref-width>
21 <pref-height>16</pref-height>
22 <legend></legend>
23 <default>1</default>
24 <keynum>27</keynum>
25 <border>2</border>
26
27 <binding>
28 <command>nasal</command>
29 <script>ufo.adjust_dialog.close()</script>
30 </binding>
31 </button>
32 </group>
33
34 <hrule/>
35
36 <nasal>
37 <open>
38 var self = cmdarg();
39 var dlgname = self.getNode("name").getValue();
40 var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
41 var kbdshift = props.globals.getNode("/devices/status/keyboard/shift");
42
43 var Value = {
44 new : func(name) {
45 var m = { parents: [Value] };
46 m.name = name;
47 var n = props.globals.getNode("/models/adjust/" ~ m.name, 1);
48 m.sliderN = n.getNode("slider", 1);
49 m.offsetN = n.getNode("offset", 1);
50 m.offsetN.setDoubleValue(0);
51 m.sliderN.setDoubleValue(0);
52 m.last_slider = 0;
53 m.center();
54 m.sliderL = setlistener(m.sliderN, func { m.update() });
55 return m;
56 },
57 del : func {
58 removelistener(me.sliderL);
59 },
60 update : func {
61 var offset = me.sliderN.getValue();
62 var value = me.offsetN.getValue() + me.sliderN.getValue() - me.last_slider;
63 var factor = kbdctrl.getValue() ? 10 : kbdshift.getValue() ? 0.1 : 1;
64 ufo.modelmgr.adjust(me.name, value * factor, 1); # 1 -> scale with distance
65 me.offsetN.setDoubleValue(0);
66 me.last_slider = offset;
67 },
68 center : func {
69 me.offsetN.setValue(me.offsetN.getValue() + me.sliderN.getValue());
70 me.sliderN.setDoubleValue(0);
71 },
72 };
73
74 var values = [
75 Value.new("longitudinal"),
76 Value.new("transversal"),
77 Value.new("altitude"),
78 Value.new("heading"),
79 Value.new("pitch"),
80 Value.new("roll"),
81 ];
82
83 var center = func {
84 foreach (var v; values) {
85 v.center();
86 }
87 }
88
89 var update = func(w) {
90 self.setValues({"dialog-name": dlgname, "object-name": w});
91 fgcommand("dialog-update", self);
92 center();
93 }
94 </open>
95
96 <close>
97 foreach (var v; values) {
98 v.del();
99 }
100 </close>
101 </nasal>
102
103 <group>
104 <layout>hbox</layout>
105 <default-padding>0</default-padding>
106
107 <button>
108 <legend>&lt;&lt;</legend>
109 <pref-width>22</pref-width>
110 <pref-height>22</pref-height>
111
112 <binding>
113 <command>property-adjust</command>
114 <property>/models/adjust/longitudinal/offset</property>
115 <step>-10</step>
116 </binding>
117 <binding>
118 <command>nasal</command>
119 <script>update("longitudinal")</script>
120 </binding>
121 </button>
122
123 <button>
124 <legend>&lt;</legend>
125 <pref-width>22</pref-width>
126 <pref-height>22</pref-height>
127
128 <binding>
129 <command>property-adjust</command>
130 <property>/models/adjust/longitudinal/offset</property>
131 <step>-1</step>
132 </binding>
133 <binding>
134 <command>nasal</command>
135 <script>update("longitudinal")</script>
136 </binding>
137 </button>
138
139 <slider>
140 <name>longitudinal</name>
141 <property>/models/adjust/longitudinal/slider</property>
142 <legend>near/far</legend>
143 <pref-width>250</pref-width>
144 <live>1</live>
145 <min>-1</min>
146 <max>1</max>
147
148 <color>
149 <red>1.0</red>
150 <green>0.6</green>
151 <blue>0.6</blue>
152 <alpha>1</alpha>
153 </color>
154
155 <binding>
156 <command>dialog-apply</command>
157 <object-name>longitudinal</object-name>
158 </binding>
159 </slider>
160
161 <button>
162 <legend>&gt;</legend>
163 <pref-width>22</pref-width>
164 <pref-height>22</pref-height>
165
166 <binding>
167 <command>property-adjust</command>
168 <property>/models/adjust/longitudinal/offset</property>
169 <step>1</step>
170 </binding>
171 <binding>
172 <command>nasal</command>
173 <script>update("longitudinal")</script>
174 </binding>
175 </button>
176
177 <button>
178 <legend>&gt;&gt;</legend>
179 <pref-width>22</pref-width>
180 <pref-height>22</pref-height>
181
182 <binding>
183 <command>property-adjust</command>
184 <property>/models/adjust/longitudinal/offset</property>
185 <step>10</step>
186 </binding>
187 <binding>
188 <command>nasal</command>
189 <script>update("longitudinal")</script>
190 </binding>
191 </button>
192 </group>
193
194 <group>
195 <layout>hbox</layout>
196 <default-padding>0</default-padding>
197
198 <button>
199 <legend>&lt;&lt;</legend>
200 <pref-width>22</pref-width>
201 <pref-height>22</pref-height>
202
203 <binding>
204 <command>property-adjust</command>
205 <property>/models/adjust/transversal/offset</property>
206 <step>-10</step>
207 </binding>
208 <binding>
209 <command>nasal</command>
210 <script>update("transversal")</script>
211 </binding>
212 </button>
213
214 <button>
215 <legend>&lt;</legend>
216 <pref-width>22</pref-width>
217 <pref-height>22</pref-height>
218
219 <binding>
220 <command>property-adjust</command>
221 <property>/models/adjust/transversal/offset</property>
222 <step>-1</step>
223 </binding>
224 <binding>
225 <command>nasal</command>
226 <script>update("transversal")</script>
227 </binding>
228 </button>
229
230 <slider>
231 <name>transversal</name>
232 <property>/models/adjust/transversal/slider</property>
233 <legend>left/right</legend>
234 <pref-width>250</pref-width>
235 <live>1</live>
236 <min>-1</min>
237 <max>1</max>
238
239 <color>
240 <red>0.6</red>
241 <green>1.0</green>
242 <blue>0.6</blue>
243 <alpha>1.0</alpha>
244 </color>
245
246 <binding>
247 <command>dialog-apply</command>
248 <object-name>transversal</object-name>
249 </binding>
250 </slider>
251
252 <button>
253 <legend>&gt;</legend>
254 <pref-width>22</pref-width>
255 <pref-height>22</pref-height>
256
257 <binding>
258 <command>property-adjust</command>
259 <property>/models/adjust/transversal/offset</property>
260 <step>1</step>
261 </binding>
262 <binding>
263 <command>nasal</command>
264 <script>update("transversal")</script>
265 </binding>
266 </button>
267
268 <button>
269 <legend>&gt;&gt;</legend>
270 <pref-width>22</pref-width>
271 <pref-height>22</pref-height>
272
273 <binding>
274 <command>property-adjust</command>
275 <property>/models/adjust/transversal/offset</property>
276 <step>10</step>
277 </binding>
278 <binding>
279 <command>nasal</command>
280 <script>update("transversal")</script>
281 </binding>
282 </button>
283 </group>
284
285 <group>
286 <layout>hbox</layout>
287 <default-padding>0</default-padding>
288
289 <button>
290 <legend>&lt;&lt;</legend>
291 <pref-width>22</pref-width>
292 <pref-height>22</pref-height>
293
294 <binding>
295 <command>property-adjust</command>
296 <property>/models/adjust/altitude/offset</property>
297 <step>-10</step>
298 </binding>
299 <binding>
300 <command>nasal</command>
301 <script>update("altitude")</script>
302 </binding>
303 </button>
304
305 <button>
306 <legend>&lt;</legend>
307 <pref-width>22</pref-width>
308 <pref-height>22</pref-height>
309
310 <binding>
311 <command>property-adjust</command>
312 <property>/models/adjust/altitude/offset</property>
313 <step>-1</step>
314 </binding>
315 <binding>
316 <command>nasal</command>
317 <script>update("altitude")</script>
318 </binding>
319 </button>
320
321 <slider>
322 <name>altitude</name>
323 <property>/models/adjust/altitude/slider</property>
324 <legend>altitude</legend>
325 <pref-width>250</pref-width>
326 <live>1</live>
327 <min>-1</min>
328 <max>1</max>
329
330 <color>
331 <red>0.6</red>
332 <green>0.6</green>
333 <blue>1.0</blue>
334 <alpha>1.0</alpha>
335 </color>
336
337 <binding>
338 <command>dialog-apply</command>
339 <object-name>altitude</object-name>
340 </binding>
341 </slider>
342
343 <button>
344 <legend>&gt;</legend>
345 <pref-width>22</pref-width>
346 <pref-height>22</pref-height>
347
348 <binding>
349 <command>property-adjust</command>
350 <property>/models/adjust/altitude/offset</property>
351 <step>1</step>
352 </binding>
353 <binding>
354 <command>nasal</command>
355 <script>update("altitude")</script>
356 </binding>
357 </button>
358
359 <button>
360 <legend>&gt;&gt;</legend>
361 <pref-width>22</pref-width>
362 <pref-height>22</pref-height>
363
364 <binding>
365 <command>property-adjust</command>
366 <property>/models/adjust/altitude/offset</property>
367 <step>10</step>
368 </binding>
369 <binding>
370 <command>nasal</command>
371 <script>update("altitude")</script>
372 </binding>
373 </button>
374 </group>
375
376 <group>
377 <layout>hbox</layout>
378 <default-padding>0</default-padding>
379
380 <button>
381 <legend>&lt;&lt;</legend>
382 <pref-width>22</pref-width>
383 <pref-height>22</pref-height>
384
385 <binding>
386 <command>property-adjust</command>
387 <property>/models/adjust/heading/offset</property>
388 <step>-6</step>
389 </binding>
390 <binding>
391 <command>nasal</command>
392 <script>update("heading")</script>
393 </binding>
394 </button>
395
396 <button>
397 <legend>&lt;</legend>
398 <pref-width>22</pref-width>
399 <pref-height>22</pref-height>
400
401 <binding>
402 <command>property-adjust</command>
403 <property>/models/adjust/heading/offset</property>
404 <step>-1</step>
405 </binding>
406 <binding>
407 <command>nasal</command>
408 <script>update("heading")</script>
409 </binding>
410 </button>
411
412 <slider>
413 <name>heading</name>
414 <property>/models/adjust/heading/slider</property>
415 <legend>heading</legend>
416 <pref-width>250</pref-width>
417 <live>1</live>
418 <min>-1</min>
419 <max>1</max>
420
421 <color>
422 <red>1.0</red>
423 <green>1.0</green>
424 <blue>0.6</blue>
425 <alpha>1.0</alpha>
426 </color>
427
428 <binding>
429 <command>dialog-apply</command>
430 <object-name>heading</object-name>
431 </binding>
432 </slider>
433
434 <button>
435 <legend>&gt;</legend>
436 <pref-width>22</pref-width>
437 <pref-height>22</pref-height>
438
439 <binding>
440 <command>property-adjust</command>
441 <property>/models/adjust/heading/offset</property>
442 <step>1</step>
443 </binding>
444 <binding>
445 <command>nasal</command>
446 <script>update("heading")</script>
447 </binding>
448 </button>
449
450 <button>
451 <legend>&gt;&gt;</legend>
452 <pref-width>22</pref-width>
453 <pref-height>22</pref-height>
454
455 <binding>
456 <command>property-adjust</command>
457 <property>/models/adjust/heading/offset</property>
458 <step>6</step>
459 </binding>
460 <binding>
461 <command>nasal</command>
462 <script>update("heading")</script>
463 </binding>
464 </button>
465 </group>
466
467 <group>
468 <layout>hbox</layout>
469 <default-padding>0</default-padding>
470
471 <button>
472 <legend>&lt;&lt;</legend>
473 <pref-width>22</pref-width>
474 <pref-height>22</pref-height>
475 <live>1</live>
476
477 <binding>
478 <command>property-adjust</command>
479 <property>/models/adjust/pitch/offset</property>
480 <step>-6</step>
481 </binding>
482 <binding>
483 <command>nasal</command>
484 <script>update("pitch")</script>
485 </binding>
486 </button>
487
488 <button>
489 <legend>&lt;</legend>
490 <pref-width>22</pref-width>
491 <pref-height>22</pref-height>
492 <live>1</live>
493
494 <binding>
495 <command>property-adjust</command>
496 <property>/models/adjust/pitch/offset</property>
497 <step>-1</step>
498 </binding>
499 <binding>
500 <command>nasal</command>
501 <script>update("pitch")</script>
502 </binding>
503 </button>
504
505 <slider>
506 <name>pitch</name>
507 <property>/models/adjust/pitch/slider</property>
508 <legend>pitch</legend>
509 <pref-width>250</pref-width>
510 <live>1</live>
511 <min>-1</min>
512 <max>1</max>
513
514 <color>
515 <red>1.0</red>
516 <green>0.6</green>
517 <blue>1.0</blue>
518 <alpha>1.0</alpha>
519 </color>
520
521 <binding>
522 <command>dialog-apply</command>
523 <object-name>pitch</object-name>
524 </binding>
525 </slider>
526
527 <button>
528 <legend>&gt;</legend>
529 <pref-width>22</pref-width>
530 <pref-height>22</pref-height>
531 <live>1</live>
532
533 <binding>
534 <command>property-adjust</command>
535 <property>/models/adjust/pitch/offset</property>
536 <step>1</step>
537 </binding>
538 <binding>
539 <command>nasal</command>
540 <script>update("pitch")</script>
541 </binding>
542 </button>
543
544 <button>
545 <legend>&gt;&gt;</legend>
546 <pref-width>22</pref-width>
547 <pref-height>22</pref-height>
548 <live>1</live>
549
550 <binding>
551 <command>property-adjust</command>
552 <property>/models/adjust/pitch/offset</property>
553 <step>6</step>
554 </binding>
555 <binding>
556 <command>nasal</command>
557 <script>update("pitch")</script>
558 </binding>
559 </button>
560 </group>
561
562 <group>
563 <layout>hbox</layout>
564 <default-padding>0</default-padding>
565
566 <button>
567 <legend>&lt;&lt;</legend>
568 <pref-width>22</pref-width>
569 <pref-height>22</pref-height>
570 <live>1</live>
571
572 <binding>
573 <command>property-adjust</command>
574 <property>/models/adjust/roll/offset</property>
575 <step>-6</step>
576 </binding>
577 <binding>
578 <command>nasal</command>
579 <script>update("roll")</script>
580 </binding>
581 </button>
582
583 <button>
584 <legend>&lt;</legend>
585 <pref-width>22</pref-width>
586 <pref-height>22</pref-height>
587 <live>1</live>
588
589 <binding>
590 <command>property-adjust</command>
591 <property>/models/adjust/roll/offset</property>
592 <step>-1</step>
593 </binding>
594 <binding>
595 <command>nasal</command>
596 <script>update("roll")</script>
597 </binding>
598 </button>
599
600 <slider>
601 <name>roll</name>
602 <property>/models/adjust/roll/slider</property>
603 <legend>roll</legend>
604 <pref-width>250</pref-width>
605 <live>1</live>
606 <min>-1</min>
607 <max>1</max>
608
609 <color>
610 <red>0.6</red>
611 <green>1.0</green>
612 <blue>1.0</blue>
613 <alpha>1.0</alpha>
614 </color>
615
616 <binding>
617 <command>dialog-apply</command>
618 <object-name>roll</object-name>
619 </binding>
620 </slider>
621
622 <button>
623 <legend>&gt;</legend>
624 <pref-width>22</pref-width>
625 <pref-height>22</pref-height>
626 <live>1</live>
627
628 <binding>
629 <command>property-adjust</command>
630 <property>/models/adjust/roll/offset</property>
631 <step>1</step>
632 </binding>
633 <binding>
634 <command>nasal</command>
635 <script>update("roll")</script>
636 </binding>
637 </button>
638
639 <button>
640 <legend>&gt;&gt;</legend>
641 <pref-width>22</pref-width>
642 <pref-height>22</pref-height>
643 <live>1</live>
644
645 <binding>
646 <command>property-adjust</command>
647 <property>/models/adjust/roll/offset</property>
648 <step>6</step>
649 </binding>
650 <binding>
651 <command>nasal</command>
652 <script>update("roll")</script>
653 </binding>
654 </button>
655 </group>
656
657 <group>
658 <layout>hbox</layout>
659
660 <text>
661 <halign>left</halign>
662 <label>Heading </label>
663 </text>
664
665 <text>
666 <halign>center</halign>
667 <label>Sliders</label>
668 </text>
669
670 <text>
671 <halign>right</halign>
672 <label>Orientation</label>
673 </text>
674 </group>
675
676 <group>
677 <layout>hbox</layout>
678 <default-padding>2</default-padding>
679
680 <button>
681 <halign>right</halign>
682 <legend>Reset</legend>
683 <pref-height>22</pref-height>
684 <pref-width>60</pref-width>
685 <binding>
686 <command>nasal</command>
687 <script>ufo.modelmgr.reset_heading()</script>
688 </binding>
689 </button>
690
691 <button>
692 <name>sticky-heading</name>
693 <legend>Sticky</legend>
694 <one-shot>0</one-shot>
695 <pref-height>22</pref-height>
696 <pref-width>55</pref-width>
697 <live>1</live>
698 <property>/models/adjust/sticky-heading</property>
699 <binding>
700 <command>dialog-apply</command>
701 <object-name>sticky-heading</object-name>
702 </binding>
703 </button>
704
705 <empty><stretch>1</stretch></empty>
706
707 <button>
708 <halign>center</halign>
709 <legend>Center</legend>
710 <pref-height>22</pref-height>
711 <pref-width>60</pref-width>
712 <binding>
713 <command>nasal</command>
714 <script>center()</script>
715 </binding>
716 </button>
717
718 <empty><stretch>1</stretch></empty>
719
720 <button>
721 <name>sticky-orientation</name>
722 <legend>Sticky</legend>
723 <one-shot>0</one-shot>
724 <pref-height>22</pref-height>
725 <pref-width>55</pref-width>
726 <live>1</live>
727 <property>/models/adjust/sticky-orientation</property>
728 <binding>
729 <command>dialog-apply</command>
730 <object-name>sticky-orientation</object-name>
731 </binding>
732 </button>
733
734 <button>
735 <halign>left</halign>
736 <legend>Reset</legend>
737 <pref-height>22</pref-height>
738 <pref-width>60</pref-width>
739 <binding>
740 <command>nasal</command>
741 <script>ufo.modelmgr.reset_orientation()</script>
742 </binding>
743 </button>
744 </group>
745 </PropertyList>