From 7370dc93c19c51a565efc0098a07b6c3bac79a20 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 1 Oct 2011 23:27:54 +0200 Subject: [PATCH] Replay upgrade, part IV: new GUI, config settings, keyboard bindings --- gui/dialogs/replay.xml | 682 ++++++++++++++++++++++++++++++----------- gui/menubar.xml | 3 + keyboard.xml | 17 + preferences.xml | 16 + 4 files changed, 545 insertions(+), 173 deletions(-) diff --git a/gui/dialogs/replay.xml b/gui/dialogs/replay.xml index 493173d82..6d192f821 100644 --- a/gui/dialogs/replay.xml +++ b/gui/dialogs/replay.xml @@ -1,205 +1,541 @@ + - replay - false - vbox + replay + vbox + false + 1 + 5 + + 0.2 + 0.2 + 0.2 + 0.7 + - - hbox - 1 + + - - + new : func( dlgRoot ) { + var obj = { parents: [ReplayDialogController] }; + obj.dlgRoot = dlgRoot; + return obj; + }, - 1 + open : func { + var replaySlider = me.findElementByName( me.dlgRoot, "replay-time-slider" ); + me.maxProp = replaySlider.getChild("max"); + me.minProp = replaySlider.getChild("min"); + me.maxListenerId = setlistener( "/sim/speed-up", func(n) { me.updateListener(n); }, 1, 1 ); + if (getprop("/sim/replay/end-time")!=nil) + { + # update max/min range of replay-time slider + me.maxProp.setValue(getprop("/sim/replay/end-time")); + me.minProp.setValue(getprop("/sim/replay/start-time")); + } + me.updateListener(1); + }, - - + updateListener : func( n ) { + var SpeedUp = getprop("/sim/speed-up"); + if (SpeedUp<0.9) + { + SpeedUp=1/SpeedUp; + SpeedUp = "1/" ~ SpeedUp; + } + setprop("/sim/gui/dialogs/replay/time-factor","" ~ SpeedUp ~ "x"); + }, - + close : func { + #removelistener( me.maxListenerId ); + }, - - - # Populate the view combo box with a list of the available views - var combo = cmdarg().getChildren("group")[1].getNode("combo"); - combo.removeChildren("value"); + findElementByName : func(base,name) { + foreach( var child; base.getChildren() ) { + var n = child.getNode( "name" ); + if( n != nil and n.getValue() == name ) + return child; + var f = me.findElementByName(child,name); + if( f != nil ) return f; + } + return nil; + }, - var current_view = getprop("/sim/current-view/view-number"); - var i = 0; - foreach (var v; view.views) { + }; - var name = "Unnamed view " ~ v.getIndex(); + var controller = ReplayDialogController.new( cmdarg() ); + controller.open(); + ]]> - if (v.getNode("name") != nil) { - name = v.getNode("name").getValue(); - } + + - # Pre-populate the combo box selected value - if (v.getIndex() == current_view) { - setprop("/sim/replay/view-name", name); - } + + hbox + fill + 28 - combo.getNode("value[" ~ i ~ "]", 1).setValue(name); - i = i + 1; - } - - + + + SANS_12B + + + + 0.9 + 0.9 + 0.9 + 1 + + 70 + - - table + + + + 0.7 + 0.7 + 0.7 + 1 + + - - 00 - right - - + + replay-looped + left + + 0.6 + 0.6 + 0.6 + 0.8 + + /sim/replay/looped + + dialog-apply + replay-looped + + + + replay-duration + 40 + + 0.5 + 0.5 + 0.5 + 0.8 + + /sim/replay/duration + + dialog-apply + replay-duration + + - - 01 - 40 - left - /sim/replay/duration - + 40 - - 10 - right - - + + + Time: %s + + 0.7 + 0.7 + 0.7 + 1 + + true + /sim/replay/time-str + - - 11 - left - 200 - /sim/replay/view-name - - dialog-apply - - + 10 - - 21 - left - /sim/replay/looped - - - dialog-apply - - - + + + Size: %.1fMB + + 0.7 + 0.7 + 0.7 + 1 + + /sim/replay/buffer-size-mbyte + - + 40 - - left - - + + + + 0.7 + 0.7 + 0.7 + 1 + + + + + + 28 + %s + + 0.7 + 0.7 + 0.7 + 1 + + true + /sim/gui/dialogs/replay/time-factor + + - - table + 1 + + + - - 10 - center - - + + hbox + center - - 11 - left - - + - - 20 - center - - + - - 21 - left - - + + + + 0.7 + 0.7 + 0.7 + 1 + + %8s + right + true + /sim/replay/start-time-str + - - 30 - center - - + + replay-time-slider + 0 + + 0.4 + 0.4 + 0.4 + 1 + + left + 350 + 0 + 1.0 + /sim/replay/time + true + + dialog-apply + replay-time-slider + + - - 31 - left - - - + + + + 0.7 + 0.7 + 0.7 + 1 + + %s + left + true + /sim/replay/end-time-str + - + - - hbox - true - - true - - true - - true - + + + + hbox + center + false + 3 + + + + + + + diff --git a/gui/menubar.xml b/gui/menubar.xml index e75a0715d..834c0c71b 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -190,6 +190,9 @@ + + replay + dialog-show replay diff --git a/keyboard.xml b/keyboard.xml index aabb75488..ce8a214ed 100644 --- a/keyboard.xml +++ b/keyboard.xml @@ -168,6 +168,10 @@ top down before the key bindings are parsed. replay + + dialog-show + replay + @@ -268,9 +272,22 @@ top down before the key bindings are parsed. ESC Prompt and quit FlightGear + + + /sim/freeze/replay-state + + dialog-show exit + + + /sim/freeze/replay-state + + property-assign + /sim/replay/disable + true + Reset FlightGear diff --git a/preferences.xml b/preferences.xml index a714cb827..f5831610b 100644 --- a/preferences.xml +++ b/preferences.xml @@ -677,6 +677,17 @@ Started September 2000 by David Megginson, david@megginson.com 90 1 true + + + 60.0 + + + 0.5 + 600.0 + + 5.0 + 3600.0 + @@ -768,6 +779,11 @@ Started September 2000 by David Megginson, david@megginson.com svn + + + /Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml + +