[chronojump] Encoder min height grav/inertial on encoder test config



commit c6fb8d6ecf461812799a5355e300a7e9482f30ea
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 3 12:44:21 2022 +0100

    Encoder min height grav/inertial on encoder test config

 glade/app1.glade           | 177 ++++++++++++++++++++++++++++++++++++++++++++-
 src/gui/app1/chronojump.cs |  11 ++-
 src/gui/app1/encoder.cs    |  27 +++++++
 3 files changed, 211 insertions(+), 4 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 28ff4c158..8f398b1b1 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -34676,7 +34676,7 @@ then click this button.</property>
                                                             <widget class="GtkTable" id="table1">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="n_rows">2</property>
+                                                            <property name="n_rows">3</property>
                                                             <property name="n_columns">2</property>
                                                             <property name="column_spacing">20</property>
                                                             <property name="row_spacing">16</property>
@@ -35358,7 +35358,6 @@ then click this button.</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkHBox" 
id="hbox_encoder_exercise_inertia">
-                                                            <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">20</property>
                                                             <child>
@@ -35616,6 +35615,180 @@ then click this button.</property>
                                                             <property name="y_options"/>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label300">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">Repetition</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="top_attach">2</property>
+                                                            <property name="bottom_attach">3</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox231">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_exercise_gravitatory_min_mov">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label371">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">Minimal range of movement</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_height_gravitatory">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_min_height_gravitatory">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Minimal height</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property name="width_chars">3</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">20 1 300 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label440">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">1</property>
+                                                            <property name="label" 
translatable="yes">cm</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_exercise_inertial_min_mov">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">16</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label444">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">Minimal length</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_height_inertial">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_min_height_inertial">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property name="width_chars">3</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">5 1 300 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label446">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">1</property>
+                                                            <property name="label" 
translatable="yes">cm</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="top_attach">2</property>
+                                                            <property name="bottom_attach">3</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 01e8c8322..f9a4e039b 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -24,7 +24,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 
@@ -3728,6 +3728,8 @@ public partial class ChronoJumpWindow
                                hbox_encoder_exercise_mass.Visible = true;
                                label_encoder_exercise_inertia.Visible = false;
                                hbox_encoder_exercise_inertia.Visible = false;
+                               hbox_encoder_exercise_gravitatory_min_mov.Visible = true;
+                               hbox_encoder_exercise_inertial_min_mov.Visible = false;
                                pixbufModeCurrent = new Pixbuf (null, Util.GetImagePath(false) + 
"image_weight.png");
 
                                if(radio_encoder_analyze_individual_current_set.Active || 
radio_encoder_analyze_individual_current_session.Active)
@@ -3742,7 +3744,9 @@ public partial class ChronoJumpWindow
                                label_gravitatory_vpf_propulsive.Visible = preferences.encoderPropulsive;
 
                                notebook_encoder_top.Page = 0;
-                       } else {
+                       }
+                       else //(m == Constants.Modes.POWERINERTIAL)
+                       {
                                //change encoderConfigurationCurrent if needed
                                if(! encoderConfigurationCurrent.has_inertia)
                                {
@@ -3765,6 +3769,8 @@ public partial class ChronoJumpWindow
                                hbox_encoder_exercise_mass.Visible = false;
                                label_encoder_exercise_inertia.Visible = true;
                                hbox_encoder_exercise_inertia.Visible = true;
+                               hbox_encoder_exercise_gravitatory_min_mov.Visible = false;
+                               hbox_encoder_exercise_inertial_min_mov.Visible = true;
 
                                radiobutton_encoder_analyze_1RM.Visible = false;
                                hbox_combo_encoder_analyze_1RM.Visible=false;
@@ -3776,6 +3782,7 @@ public partial class ChronoJumpWindow
                                notebook_encoder_top.Page = 1;
                                pixbufModeCurrent = new Pixbuf (null, Util.GetImagePath(false) + 
"image_inertia.png");
                        }
+                       encoderConfigurationGUIUpdate();
                        encoderGuiChangesAfterEncoderConfigurationWin(true);
                        if(changed) {
                                prepareAnalyzeRepetitions ();
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 1b663c608..fc10c9d87 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -37,6 +37,10 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.HBox hbox_encoder_exercise_mass;
        [Widget] Gtk.Label label_encoder_exercise_inertia;
        [Widget] Gtk.HBox hbox_encoder_exercise_inertia;
+       [Widget] Gtk.HBox hbox_encoder_exercise_gravitatory_min_mov;
+       [Widget] Gtk.HBox hbox_encoder_exercise_inertial_min_mov;
+       [Widget] Gtk.SpinButton spin_encoder_capture_min_height_gravitatory;
+       [Widget] Gtk.SpinButton spin_encoder_capture_min_height_inertial;
 
        [Widget] Gtk.Button button_encoder_select;
        [Widget] Gtk.SpinButton spin_encoder_extra_weight;
@@ -1993,6 +1997,8 @@ public partial class ChronoJumpWindow
                        hbox_encoder_exercise_mass.Visible = false;
                        label_encoder_exercise_inertia.Visible = true;
                        hbox_encoder_exercise_inertia.Visible = true;
+                       hbox_encoder_exercise_gravitatory_min_mov.Visible = false;
+                       hbox_encoder_exercise_inertial_min_mov.Visible = true;
                        
                        if(! encoderConfigurationCurrent.list_d.IsEmpty())
                        {
@@ -2008,6 +2014,8 @@ public partial class ChronoJumpWindow
 
                        label_encoder_im_total.Text = encoderConfigurationCurrent.inertiaTotal.ToString();
                        label_encoder_top_im.Text = Catalog.GetString("Inertia M.") + ": " + 
label_encoder_im_total.Text;
+
+                       spin_encoder_capture_min_height_inertial.Value = 
preferences.EncoderCaptureMinHeight(true);
                }
                else { //(current_mode == Constants.Modes.POWERGRAVITATORY)
                        notebook_encoder_top.Page = 0;
@@ -2016,6 +2024,9 @@ public partial class ChronoJumpWindow
                        hbox_encoder_exercise_mass.Visible = true;
                        label_encoder_exercise_inertia.Visible = false;
                        hbox_encoder_exercise_inertia.Visible = false;
+                       hbox_encoder_exercise_gravitatory_min_mov.Visible = true;
+                       hbox_encoder_exercise_inertial_min_mov.Visible = false;
+                       spin_encoder_capture_min_height_gravitatory.Value = 
preferences.EncoderCaptureMinHeight(false);
                }
        }
 
@@ -5231,6 +5242,7 @@ public partial class ChronoJumpWindow
        void on_button_encoder_exercise_close_clicked (object o, EventArgs args)
        {
                encoder_exercise_show_hide (false);
+               checkIfEncoderMinHeightChanged ();
        }
        private void encoder_exercise_show_hide (bool show)
        {
@@ -5253,14 +5265,29 @@ public partial class ChronoJumpWindow
        void on_button_encoder_exercise_close_and_capture_clicked (object o, EventArgs args)
        {
                encoder_exercise_show_hide (false);
+               checkIfEncoderMinHeightChanged ();
+
                on_button_encoder_capture_clicked (o, args);
        }
        void on_button_encoder_exercise_close_and_recalculate_clicked (object o, EventArgs args)
        {
                encoder_exercise_show_hide (false);
+               checkIfEncoderMinHeightChanged ();
+
                on_button_encoder_recalculate_clicked (o, args);
        }
 
+       private void checkIfEncoderMinHeightChanged ()
+       {
+               if(current_mode == Constants.Modes.POWERGRAVITATORY) {
+                       preferences.EncoderChangeMinHeight(false,
+                                       Convert.ToInt32(spin_encoder_capture_min_height_gravitatory.Value));
+
+               } else { // (current_mode == Constants.Modes.POWERINERTIAL)
+                       preferences.EncoderChangeMinHeight(true,
+                                       Convert.ToInt32(spin_encoder_capture_min_height_inertial.Value));
+               }
+       }
 
        //useful when there are no exercises (have been removed from database)
        bool selectedEncoderExerciseExists ()


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