[chronojump] Jumps interval exercise options with weight -10, -1, 1, 10 buttons



commit 9b9a8f2cd15241720a94da5a722bc08499cc8d41
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 26 12:33:22 2022 +0200

    Jumps interval exercise options with weight -10,-1,1,10 buttons

 glade/app1.glade     | 231 ++++++++++++++++++++++++++++++++++++++-------------
 src/gui/app1/jump.cs |  61 +++++++++-----
 2 files changed, 215 insertions(+), 77 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index fcac71cf9..b16305f6a 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -12249,18 +12249,6 @@ EncoderInertialCapture</property>
                                                             <placeholder/>
                                                             </child>
                                                             <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" id="hbox564">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -12401,7 +12389,7 @@ EncoderInertialCapture</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="relief">half</property>
-                                                            <signal name="clicked" 
handler="on_button_jumps_extra_weight_accelerators_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12419,7 +12407,7 @@ EncoderInertialCapture</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="relief">half</property>
-                                                            <signal name="clicked" 
handler="on_button_jumps_extra_weight_accelerators_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12437,7 +12425,7 @@ EncoderInertialCapture</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="relief">half</property>
-                                                            <signal name="clicked" 
handler="on_button_jumps_extra_weight_accelerators_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12455,7 +12443,7 @@ EncoderInertialCapture</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="relief">half</property>
-                                                            <signal name="clicked" 
handler="on_button_jumps_extra_weight_accelerators_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -13097,10 +13085,16 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkHBox" 
id="hbox_extra_window_jumps_rj_weight">
+                                                            <widget class="GtkTable" 
id="table_extra_window_jumps_rj_weight">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="n_rows">2</property>
+                                                            <property name="n_columns">2</property>
+                                                            <property name="column_spacing">10</property>
+                                                            <property name="row_spacing">6</property>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox565">
                                                             <property name="visible">True</property>
@@ -13134,13 +13128,77 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox171">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_rj_radiobutton_weight">
+                                                            <property name="label" translatable="yes">% body 
weight</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="use_underline">True</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <property 
name="group">extra_window_jumps_rj_radiobutton_kg</property>
+                                                            <signal name="toggled" 
handler="on_extra_window_jumps_rj_radiobutton_weight_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox69">
+                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_rj_radiobutton_kg">
+                                                            <property name="label">Kg</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="use_underline">True</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <signal name="toggled" 
handler="on_extra_window_jumps_rj_radiobutton_kg_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkAlignment" id="alignment31">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="left_padding">20</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="top_attach">1</property>
+                                                            <property name="bottom_attach">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox570">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
@@ -13167,54 +13225,79 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_rj_radiobutton_weight">
-                                                            <property name="label" translatable="yes">% body 
weight</property>
+                                                            <widget class="GtkHBox" id="hbox69">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_rj_extra_weight_minus_10">
+                                                            <property name="label">-10</property>
+                                                            <property name="width_request">50</property>
+                                                            <property name="height_request">40</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="use_underline">True</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            <property 
name="group">extra_window_jumps_rj_radiobutton_kg</property>
-                                                            <signal name="toggled" 
handler="on_extra_window_jumps_rj_radiobutton_weight_toggled" swapped="no"/>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_rj_radiobutton_kg">
-                                                            <property name="label">Kg</property>
+                                                            <widget class="GtkButton" 
id="button_jumps_rj_extra_weight_minus_1">
+                                                            <property name="label"> -1 </property>
+                                                            <property name="width_request">40</property>
+                                                            <property name="height_request">40</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="use_underline">True</property>
-                                                            <property name="active">True</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            <signal name="toggled" 
handler="on_extra_window_jumps_rj_radiobutton_kg_toggled" swapped="no"/>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">2</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkAlignment" id="alignment31">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="left_padding">20</property>
-                                                            <child>
-                                                            <widget class="GtkLabel" 
id="label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg">
+                                                            <widget class="GtkButton" 
id="button_jumps_rj_extra_weight_plus_1">
+                                                            <property name="label"> +1 </property>
+                                                            <property name="width_request">40</property>
+                                                            <property name="height_request">40</property>
                                                             <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_rj_extra_weight_plus_10">
+                                                            <property name="label">+10</property>
+                                                            <property name="width_request">50</property>
+                                                            <property name="height_request">40</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="relief">half</property>
+                                                            <signal name="clicked" 
handler="on_button_jumps_all_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">3</property>
                                                             </packing>
                                                             </child>
@@ -13227,9 +13310,16 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            <property name="y_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="padding">5</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
@@ -26468,6 +26558,15 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -33267,6 +33366,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>
@@ -33303,18 +33414,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>
@@ -42765,6 +42864,15 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -50847,6 +50955,15 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             </widget>
diff --git a/src/gui/app1/jump.cs b/src/gui/app1/jump.cs
index aa403b62d..eea0d1d38 100644
--- a/src/gui/app1/jump.cs
+++ b/src/gui/app1/jump.cs
@@ -77,7 +77,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.SpinButton extra_window_jumps_rj_spinbutton_fall;
        [Widget] Gtk.RadioButton extra_window_jumps_rj_radiobutton_kg;
        [Widget] Gtk.RadioButton extra_window_jumps_rj_radiobutton_weight;
-       [Widget] Gtk.HBox hbox_extra_window_jumps_rj_weight;
+       [Widget] Gtk.Table table_extra_window_jumps_rj_weight;
        [Widget] Gtk.Image extra_window_jumps_rj_image_fall;
        [Widget] Gtk.Image extra_window_jumps_rj_image_weight;
        //[Widget] Gtk.Label extra_window_jumps_rj_label_weight;
@@ -552,7 +552,7 @@ public partial class ChronoJumpWindow
        
        private void extra_window_showWeightData (JumpType myJumpType, bool show) {
                if(myJumpType.IsRepetitive) {
-                       hbox_extra_window_jumps_rj_weight.Visible = show;
+                       table_extra_window_jumps_rj_weight.Visible = show;
                        update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(show);
                } else {
                        table_extra_window_jumps_weight.Visible = show;
@@ -630,29 +630,50 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_jumps_extra_weight_minus_1;
        [Widget] Gtk.Button button_jumps_extra_weight_plus_1;
        [Widget] Gtk.Button button_jumps_extra_weight_plus_10;
-       private void on_button_jumps_extra_weight_accelerators_clicked (object o, EventArgs args)
-       {
-               if(o == (object) button_jumps_extra_weight_minus_10)
-                       button_jumps_extra_weight_accelerators_do (-10);
-               else if(o == (object) button_jumps_extra_weight_minus_1)
-                       button_jumps_extra_weight_accelerators_do (-1);
-               else if(o == (object) button_jumps_extra_weight_plus_1)
-                       button_jumps_extra_weight_accelerators_do (1);
-               else if(o == (object) button_jumps_extra_weight_plus_10)
-                       button_jumps_extra_weight_accelerators_do (10);
-       }
-       private void button_jumps_extra_weight_accelerators_do (int change)
-       {
-               double newValue = extra_window_jumps_spinbutton_weight.Value + change;
+       [Widget] Gtk.Button button_jumps_rj_extra_weight_minus_10;
+       [Widget] Gtk.Button button_jumps_rj_extra_weight_minus_1;
+       [Widget] Gtk.Button button_jumps_rj_extra_weight_plus_1;
+       [Widget] Gtk.Button button_jumps_rj_extra_weight_plus_10;
+
+       private void on_button_jumps_all_extra_weight_accelerators_clicked (object o, EventArgs args)
+       {
+               if (o == (object) button_jumps_extra_weight_minus_10)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_spinbutton_weight, -10);
+               else if (o == (object) button_jumps_extra_weight_minus_1)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_spinbutton_weight, -1);
+               else if (o == (object) button_jumps_extra_weight_plus_1)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_spinbutton_weight, 1);
+               else if (o == (object) button_jumps_extra_weight_plus_10)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_spinbutton_weight, 10);
+               else if (o == (object) button_jumps_rj_extra_weight_minus_10)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_rj_spinbutton_weight, -10);
+               else if (o == (object) button_jumps_rj_extra_weight_minus_1)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_rj_spinbutton_weight, -1);
+               else if (o == (object) button_jumps_rj_extra_weight_plus_1)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_rj_spinbutton_weight, 1);
+               else if (o == (object) button_jumps_rj_extra_weight_plus_10)
+                       button_jumps_all_extra_weight_accelerators_do
+                               (extra_window_jumps_rj_spinbutton_weight, 10);
+       }
+       private void button_jumps_all_extra_weight_accelerators_do (Gtk.SpinButton spin, int change)
+       {
+               double newValue = spin.Value + change;
 
                double min, max;
-               extra_window_jumps_spinbutton_weight.GetRange (out min, out max);
+               spin.GetRange (out min, out max);
                if(newValue < min)
-                       extra_window_jumps_spinbutton_weight.Value = min;
+                       spin.Value = min;
                else if(newValue > max)
-                       extra_window_jumps_spinbutton_weight.Value = max;
+                       spin.Value = max;
                else
-                       extra_window_jumps_spinbutton_weight.Value = newValue;
+                       spin.Value = newValue;
        }
 
        private void on_extra_window_jumps_spinbutton_weight_value_changed (object o, EventArgs args)


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