[chronojump] ForceSensor capture graph widthInSeconds configurable



commit b5789fd1754e1132f2962d7a4d5dcb8626093c42
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 24 23:29:14 2019 +0200

    ForceSensor capture graph widthInSeconds configurable

 glade/app1.glade       | 92 +++++++++++++++++++++++++++++++++++++++++---------
 src/forceSensor.cs     | 15 +++++---
 src/gui/chronojump.cs  |  4 +--
 src/gui/forceSensor.cs | 12 ++++---
 4 files changed, 96 insertions(+), 27 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index efc9b7aa..52e2ed62 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -11421,13 +11421,13 @@ Inverted values</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkVBox" id="vbox138">
+                                                            <widget class="GtkVBox" 
id="vbox_force_sensor_capture_options">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
                                                             <child>
                                                             <widget class="GtkCheckButton" 
id="check_force_sensor_scroll">
-                                                            <property name="label">Auto-scroll X
-on capture</property>
+                                                            <property name="label">Auto-scroll X on 
capture</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
@@ -11440,7 +11440,61 @@ on capture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <placeholder/>
+                                                            <widget class="GtkHBox" 
id="hbox_force_sensor_width_in_seconds">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_force_sensor_capture_width_graph_seconds">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">Display on 
graph</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_force_sensor_capture_width_graph_seconds">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property 
name="invisible_char_set">True</property>
+                                                            <property 
name="primary_icon_activatable">False</property>
+                                                            <property 
name="secondary_icon_activatable">False</property>
+                                                            <property 
name="primary_icon_sensitive">True</property>
+                                                            <property 
name="secondary_icon_sensitive">True</property>
+                                                            <property name="adjustment">10 1 100 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="numeric">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label384">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label">s</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
@@ -21924,6 +21978,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -23872,6 +23929,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -23908,18 +23977,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -30815,6 +30872,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index c4982d36..b3d66c4e 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -339,7 +339,7 @@ public class ForceSensorCapturePoints
        private int marginBottom = 30; //px
 
        //initialize
-       public ForceSensorCapturePoints(int widthG, int heightG)
+       public ForceSensorCapturePoints(int widthG, int heightG, int widthInSeconds)
        {
                Points = new List<Gdk.Point>();
                NumCaptured = 0;
@@ -350,15 +350,20 @@ public class ForceSensorCapturePoints
                forceMin = 10000;
                scrollStartedAtCount = -1;
 
-               InitRealWidthHeight();
+               InitRealWidthHeight(widthInSeconds);
 
                this.widthG = widthG;
                this.heightG = heightG;
        }
 
-       public void InitRealWidthHeight()
+       public void InitRealWidthHeight(int widthInSeconds)
        {
-               RealWidthG = 10000000; //width of graph in microseconds (will be upgraded if needed)
+               //width of graph in microseconds (will be upgraded if needed)
+               if(widthInSeconds == -1)
+                       RealWidthG = 10000000; //default 10 seconds
+               else
+                       RealWidthG = 1000000 * widthInSeconds;
+
                RealHeightG = DefaultRealHeightG; //Newtons (will be upgraded when needed) (nice to see the 
+25 -25 marks)
                RealHeightGNeg = DefaultRealHeightGNeg; //Newtons (will be upgraded when needed) (nice to see 
the +25 -25 marks)
        }
@@ -995,7 +1000,7 @@ public class ForceSensorAnalyzeInstant
 
        private void readFile(string file, double start, double end, int exercisePercentBW, double 
personWeight, ForceSensor.CaptureOptions fsco)
        {
-               fscAIPoints = new ForceSensorCapturePoints(graphWidth, graphHeight);
+               fscAIPoints = new ForceSensorCapturePoints(graphWidth, graphHeight, -1);
 
                List<string> contents = Util.ReadFileAsStringList(file);
                bool headersRow = true;
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 1170f46c..1ed1ccd7 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3209,7 +3209,7 @@ public partial class ChronoJumpWindow
                notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.STATISTICS);
                button_inspect_last_test.Visible = false;
                vbox_force_capture_feedback.Visible = false;
-               check_force_sensor_scroll.Visible = false;
+               vbox_force_sensor_capture_options.Visible = false;
                button_force_sensor_adjust.Visible = false;
                hbox_race_analyzer_device.Visible = false;
 
@@ -3412,7 +3412,7 @@ public partial class ChronoJumpWindow
                        notebook_capture_graph_table.ShowTabs = false;
 
                        vbox_force_capture_feedback.Visible = true;
-                       check_force_sensor_scroll.Visible = true;
+                       vbox_force_sensor_capture_options.Visible = true;
                }
                else if(m == Constants.Menuitem_modes.RUNSENCODER)
                {
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 4fe4efb6..95dfa79e 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -94,6 +94,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.SpinButton spin_force_sensor_capture_feedback_at;
        [Widget] Gtk.SpinButton spin_force_sensor_capture_feedback_range;
        [Widget] Gtk.CheckButton check_force_sensor_scroll;
+       [Widget] Gtk.VBox vbox_force_sensor_capture_options;
+       [Widget] Gtk.SpinButton spin_force_sensor_capture_width_graph_seconds;
 
        Gdk.Pixmap force_capture_pixmap = null;
 
@@ -411,7 +413,7 @@ public partial class ChronoJumpWindow
                button_execute_test.Sensitive = sensitive;
                button_force_sensor_analyze_load.Sensitive = sensitive;
                vbox_force_capture_feedback.Sensitive = sensitive;
-               check_force_sensor_scroll.Sensitive = sensitive;
+               vbox_force_sensor_capture_options.Sensitive = sensitive;
 
                vbox_contacts_camera.Sensitive = sensitive;
 
@@ -720,7 +722,8 @@ public partial class ChronoJumpWindow
                UtilGtk.ErasePaint(force_capture_drawingarea, force_capture_pixmap);
                fscPoints = new ForceSensorCapturePoints(
                                force_capture_drawingarea.Allocation.Width,
-                               force_capture_drawingarea.Allocation.Height
+                               force_capture_drawingarea.Allocation.Height,
+                               Convert.ToInt32(spin_force_sensor_capture_width_graph_seconds.Value)
                                );
 
                setForceSensorTopAtOperationStart();
@@ -1036,7 +1039,7 @@ LogB.Information(" fs C ");
                                        Thread.Sleep (250); //Wait a bit to ensure is copied
                                        sensitiveLastTestButtons(true);
 
-                                       fscPoints.InitRealWidthHeight();
+                                       
fscPoints.InitRealWidthHeight(Convert.ToInt32(spin_force_sensor_capture_width_graph_seconds.Value));
 
                                        forceSensorDoSignalGraphPlot();
                                        forceSensorDoRFDGraph();
@@ -1725,7 +1728,8 @@ LogB.Information(" fs R ");
        {
                fscPoints = new ForceSensorCapturePoints(
                                force_capture_drawingarea.Allocation.Width,
-                               force_capture_drawingarea.Allocation.Height
+                               force_capture_drawingarea.Allocation.Height,
+                               Convert.ToInt32(spin_force_sensor_capture_width_graph_seconds.Value)
                                );
 
                List<string> contents = Util.ReadFileAsStringList(UtilEncoder.GetmifCSVFileName());


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]