<?xml version="1.0"?> <PropertyList> <name>ufo-adjust</name> <layout>vbox</layout> <x>-20</x> <y>-20</y> <group> <layout>hbox</layout> <empty><stretch>1</stretch></empty> <text> <label>Adjust model</label> </text> <empty><stretch>1</stretch></empty> <button> <pref-width>16</pref-width> <pref-height>16</pref-height> <legend></legend> <default>1</default> <keynum>27</keynum> <border>2</border> <binding> <command>nasal</command> <script>ufo.adjust_dialog.close()</script> </binding> </button> </group> <hrule/> <nasal> <open> var self = cmdarg(); var dlgname = self.getNode("name").getValue(); var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl"); var kbdshift = props.globals.getNode("/devices/status/keyboard/shift"); var Value = { new : func(name) { var m = { parents: [Value] }; m.name = name; var n = props.globals.getNode("/models/adjust/" ~ m.name, 1); m.sliderN = n.getNode("slider", 1); m.offsetN = n.getNode("offset", 1); m.offsetN.setDoubleValue(0); m.sliderN.setDoubleValue(0); m.last_slider = 0; m.center(); m.sliderL = setlistener(m.sliderN, func { m.update() }); return m; }, del : func { removelistener(me.sliderL); }, update : func { var offset = me.sliderN.getValue(); var value = me.offsetN.getValue() + me.sliderN.getValue() - me.last_slider; var factor = kbdctrl.getValue() ? 10 : kbdshift.getValue() ? 0.1 : 1; ufo.modelmgr.adjust(me.name, value * factor, 1); # 1 -> scale with distance me.offsetN.setDoubleValue(0); me.last_slider = offset; }, center : func { me.offsetN.setValue(me.offsetN.getValue() + me.sliderN.getValue()); me.sliderN.setDoubleValue(0); }, }; var values = [ Value.new("longitudinal"), Value.new("transversal"), Value.new("altitude"), Value.new("heading"), Value.new("pitch"), Value.new("roll"), ]; var center = func { foreach (var v; values) { v.center(); } } var update = func(w) { self.setValues({"dialog-name": dlgname, "object-name": w}); fgcommand("dialog-update", self); center(); } </open> <close> foreach (var v; values) { v.del(); } </close> </nasal> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/longitudinal/offset</property> <step>-10</step> </binding> <binding> <command>nasal</command> <script>update("longitudinal")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/longitudinal/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("longitudinal")</script> </binding> </button> <slider> <name>longitudinal</name> <property>/models/adjust/longitudinal/slider</property> <legend>near/far</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>1.0</red> <green>0.6</green> <blue>0.6</blue> <alpha>1</alpha> </color> <binding> <command>dialog-apply</command> <object-name>longitudinal</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/longitudinal/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("longitudinal")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/longitudinal/offset</property> <step>10</step> </binding> <binding> <command>nasal</command> <script>update("longitudinal")</script> </binding> </button> </group> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/transversal/offset</property> <step>-10</step> </binding> <binding> <command>nasal</command> <script>update("transversal")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/transversal/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("transversal")</script> </binding> </button> <slider> <name>transversal</name> <property>/models/adjust/transversal/slider</property> <legend>left/right</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>0.6</red> <green>1.0</green> <blue>0.6</blue> <alpha>1.0</alpha> </color> <binding> <command>dialog-apply</command> <object-name>transversal</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/transversal/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("transversal")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/transversal/offset</property> <step>10</step> </binding> <binding> <command>nasal</command> <script>update("transversal")</script> </binding> </button> </group> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/altitude/offset</property> <step>-10</step> </binding> <binding> <command>nasal</command> <script>update("altitude")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/altitude/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("altitude")</script> </binding> </button> <slider> <name>altitude</name> <property>/models/adjust/altitude/slider</property> <legend>altitude</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>0.6</red> <green>0.6</green> <blue>1.0</blue> <alpha>1.0</alpha> </color> <binding> <command>dialog-apply</command> <object-name>altitude</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/altitude/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("altitude")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/altitude/offset</property> <step>10</step> </binding> <binding> <command>nasal</command> <script>update("altitude")</script> </binding> </button> </group> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/heading/offset</property> <step>-6</step> </binding> <binding> <command>nasal</command> <script>update("heading")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/heading/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("heading")</script> </binding> </button> <slider> <name>heading</name> <property>/models/adjust/heading/slider</property> <legend>heading</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>1.0</red> <green>1.0</green> <blue>0.6</blue> <alpha>1.0</alpha> </color> <binding> <command>dialog-apply</command> <object-name>heading</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/heading/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("heading")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <binding> <command>property-adjust</command> <property>/models/adjust/heading/offset</property> <step>6</step> </binding> <binding> <command>nasal</command> <script>update("heading")</script> </binding> </button> </group> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/pitch/offset</property> <step>-6</step> </binding> <binding> <command>nasal</command> <script>update("pitch")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/pitch/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("pitch")</script> </binding> </button> <slider> <name>pitch</name> <property>/models/adjust/pitch/slider</property> <legend>pitch</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>1.0</red> <green>0.6</green> <blue>1.0</blue> <alpha>1.0</alpha> </color> <binding> <command>dialog-apply</command> <object-name>pitch</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/pitch/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("pitch")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/pitch/offset</property> <step>6</step> </binding> <binding> <command>nasal</command> <script>update("pitch")</script> </binding> </button> </group> <group> <layout>hbox</layout> <default-padding>0</default-padding> <button> <legend><<</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/roll/offset</property> <step>-6</step> </binding> <binding> <command>nasal</command> <script>update("roll")</script> </binding> </button> <button> <legend><</legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/roll/offset</property> <step>-1</step> </binding> <binding> <command>nasal</command> <script>update("roll")</script> </binding> </button> <slider> <name>roll</name> <property>/models/adjust/roll/slider</property> <legend>roll</legend> <pref-width>250</pref-width> <live>1</live> <min>-1</min> <max>1</max> <color> <red>0.6</red> <green>1.0</green> <blue>1.0</blue> <alpha>1.0</alpha> </color> <binding> <command>dialog-apply</command> <object-name>roll</object-name> </binding> </slider> <button> <legend>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/roll/offset</property> <step>1</step> </binding> <binding> <command>nasal</command> <script>update("roll")</script> </binding> </button> <button> <legend>>></legend> <pref-width>22</pref-width> <pref-height>22</pref-height> <live>1</live> <binding> <command>property-adjust</command> <property>/models/adjust/roll/offset</property> <step>6</step> </binding> <binding> <command>nasal</command> <script>update("roll")</script> </binding> </button> </group> <group> <layout>hbox</layout> <text> <halign>left</halign> <label>Heading </label> </text> <text> <halign>center</halign> <label>Sliders</label> </text> <text> <halign>right</halign> <label>Orientation</label> </text> </group> <group> <layout>hbox</layout> <default-padding>2</default-padding> <button> <halign>right</halign> <legend>Reset</legend> <pref-height>22</pref-height> <pref-width>60</pref-width> <binding> <command>nasal</command> <script>ufo.modelmgr.reset_heading()</script> </binding> </button> <button> <name>sticky-heading</name> <legend>Sticky</legend> <one-shot>0</one-shot> <pref-height>22</pref-height> <pref-width>55</pref-width> <live>1</live> <property>/models/adjust/sticky-heading</property> <binding> <command>dialog-apply</command> <object-name>sticky-heading</object-name> </binding> </button> <empty><stretch>1</stretch></empty> <button> <halign>center</halign> <legend>Center</legend> <pref-height>22</pref-height> <pref-width>60</pref-width> <binding> <command>nasal</command> <script>center()</script> </binding> </button> <empty><stretch>1</stretch></empty> <button> <name>sticky-orientation</name> <legend>Sticky</legend> <one-shot>0</one-shot> <pref-height>22</pref-height> <pref-width>55</pref-width> <live>1</live> <property>/models/adjust/sticky-orientation</property> <binding> <command>dialog-apply</command> <object-name>sticky-orientation</object-name> </binding> </button> <button> <halign>left</halign> <legend>Reset</legend> <pref-height>22</pref-height> <pref-width>60</pref-width> <binding> <command>nasal</command> <script>ufo.modelmgr.reset_orientation()</script> </binding> </button> </group> </PropertyList>