[chronojump] Race analyzer: width/height of graph can be selected



commit 2555d6ed18e038f7df67cf3c82b3297705d50aee
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jun 11 17:25:21 2019 +0200

    Race analyzer: width/height of graph can be selected

 glade/app1.glade      | 131 ++++++++++++++++++++++++++++++++++++++++++++++++--
 src/gui/runEncoder.cs |  21 ++++++--
 2 files changed, 142 insertions(+), 10 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index fc689ad4..4ec1a30c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1947,6 +1947,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -9706,12 +9709,12 @@ EncoderInertialCapture</property>
                                                             <widget class="GtkHBox" id="hbox288_run_encoder">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">30</property>
+                                                            <property name="spacing">20</property>
                                                             <child>
                                                             <widget class="GtkHBox" 
id="hbox_race_analyzer_distance">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">4</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label70">
                                                             <property name="visible">True</property>
@@ -9768,7 +9771,7 @@ EncoderInertialCapture</property>
                                                             <widget class="GtkHBox" 
id="hbox_race_analyzer_temperature">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">4</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label138">
                                                             <property name="visible">True</property>
@@ -9822,6 +9825,118 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkHBox" id="hbox168">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label51">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Width</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="race_analyzer_spinbutton_graph_width">
+                                                            <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">400 200 16000 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="label401">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">px</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">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox288">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label399">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Height</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="race_analyzer_spinbutton_graph_height">
+                                                            <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">400 200 8000 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="label400">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">px</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">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">3</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkButton" 
id="button_run_encoder_recalculate">
                                                             <property name="width_request">60</property>
                                                             <property name="visible">True</property>
@@ -9843,9 +9958,9 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
+                                                            <property name="expand">True</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">2</property>
+                                                            <property name="position">4</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -21005,6 +21120,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -29721,6 +29839,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index a2afec75..41b937ba 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -35,10 +35,14 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.MenuItem menuitem_race_analyzer_open_folder;
        [Widget] Gtk.SpinButton race_analyzer_spinbutton_distance;
        [Widget] Gtk.SpinButton race_analyzer_spinbutton_temperature;
+       [Widget] Gtk.SpinButton race_analyzer_spinbutton_graph_width;
+       [Widget] Gtk.SpinButton race_analyzer_spinbutton_graph_height;
        [Widget] Gtk.Image image_race_encoder_graph;
 
        int race_analyzer_distance;
        int race_analyzer_temperature;
+       int race_analyzer_graph_width;
+       int race_analyzer_graph_height;
 
        Thread runEncoderCaptureThread;
        static bool runEncoderProcessFinish;
@@ -189,8 +193,7 @@ public partial class ChronoJumpWindow
                        return;
                }
 
-               race_analyzer_distance = Convert.ToInt32(race_analyzer_spinbutton_distance.Value);
-               race_analyzer_temperature = Convert.ToInt32(race_analyzer_spinbutton_temperature.Value);
+               forceSensorReadWidgets();
 
                runEncoderButtonsSensitive(false);
                bool connected = runEncoderCapturePre();
@@ -198,6 +201,14 @@ public partial class ChronoJumpWindow
                        runEncoderButtonsSensitive(true);
        }
 
+       private void forceSensorReadWidgets()
+       {
+               race_analyzer_distance = Convert.ToInt32(race_analyzer_spinbutton_distance.Value);
+               race_analyzer_temperature = Convert.ToInt32(race_analyzer_spinbutton_temperature.Value);
+               race_analyzer_graph_width = Convert.ToInt32(race_analyzer_spinbutton_graph_width.Value);
+               race_analyzer_graph_height = Convert.ToInt32(race_analyzer_spinbutton_graph_height.Value);
+       }
+
        //TODO: do all this with an "other" thread like in force sensor to allow connecting messages to be 
displayed
        private bool runEncoderCapturePre()
        {
@@ -396,8 +407,7 @@ public partial class ChronoJumpWindow
 
        private void on_button_run_encoder_recalculate_clicked (object o, EventArgs args)
        {
-               race_analyzer_distance = Convert.ToInt32(race_analyzer_spinbutton_distance.Value);
-               race_analyzer_temperature = Convert.ToInt32(race_analyzer_spinbutton_temperature.Value);
+               forceSensorReadWidgets();
 
                forceSensorCaptureGraphDo();
 
@@ -417,7 +427,8 @@ public partial class ChronoJumpWindow
                                currentPersonSession.Weight,    //TODO: can be more if extra weight
                                currentPersonSession.Height,
                                race_analyzer_temperature);
-               reg.CallR(1699, 768);                           //TODO: hardcoded
+
+               reg.CallR(race_analyzer_graph_width, race_analyzer_graph_height);
 
                DateTime runEncoderGraphStarted = DateTime.Now;
                //TODO: check better if png is saved and have a cancel button


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