ufo-adjust vbox -20 -20 hbox 1 1 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(); } foreach (var v; values) { v.del(); } hbox 0 longitudinal /models/adjust/longitudinal/slider near/far 250 1 -1 1 1.0 0.6 0.6 1 dialog-apply longitudinal hbox 0 transversal /models/adjust/transversal/slider left/right 250 1 -1 1 0.6 1.0 0.6 1.0 dialog-apply transversal hbox 0 altitude /models/adjust/altitude/slider altitude 250 1 -1 1 0.6 0.6 1.0 1.0 dialog-apply altitude hbox 0 heading /models/adjust/heading/slider heading 250 1 -1 1 1.0 1.0 0.6 1.0 dialog-apply heading hbox 0 pitch /models/adjust/pitch/slider pitch 250 1 -1 1 1.0 0.6 1.0 1.0 dialog-apply pitch hbox 0 roll /models/adjust/roll/slider roll 250 1 -1 1 0.6 1.0 1.0 1.0 dialog-apply roll hbox left center right hbox 2 1 1