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



commit a3b33ccb3094de3949d3b295eb5dc2191a82b8ec
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Aug 25 18:15:45 2022 +0200

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

 glade/app1.glade     | 198 ++++++++++++++++++++++++++++++++++++++++-----------
 src/gui/app1/jump.cs |  33 ++++++++-
 2 files changed, 188 insertions(+), 43 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 28d6b2a8c..fcac71cf9 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -12238,17 +12238,96 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkHBox" 
id="hbox_extra_window_jumps_weight">
+                                                            <widget class="GtkTable" 
id="table_extra_window_jumps_weight">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">20</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>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox171">
+                                                            <widget class="GtkHBox" id="hbox564">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">10</property>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox564">
+                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_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_radiobutton_kg</property>
+                                                            <signal name="toggled" 
handler="on_extra_window_jumps_radiobutton_weight_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_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_radiobutton_kg_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkAlignment" id="alignment30">
+                                                            <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_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="hbox569">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">2</property>
@@ -12279,11 +12358,6 @@ EncoderInertialCapture</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="hbox24">
@@ -12313,54 +12387,79 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_radiobutton_weight">
-                                                            <property name="label" translatable="yes">% body 
weight</property>
+                                                            <widget class="GtkHBox" id="hbox568">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_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_radiobutton_kg</property>
-                                                            <signal name="toggled" 
handler="on_extra_window_jumps_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_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">1</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="extra_window_jumps_radiobutton_kg">
-                                                            <property name="label">Kg</property>
+                                                            <widget class="GtkButton" 
id="button_jumps_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_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_extra_weight_accelerators_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">2</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkAlignment" id="alignment30">
-                                                            <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_radiobutton_weight_percent_as_kg">
+                                                            <widget class="GtkButton" 
id="button_jumps_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_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_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_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>
@@ -12373,16 +12472,15 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="y_options"/>
                                                             </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="padding">5</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
@@ -26364,6 +26462,12 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -42655,6 +42759,12 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -50731,6 +50841,12 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <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 9f73ed585..aa403b62d 100644
--- a/src/gui/app1/jump.cs
+++ b/src/gui/app1/jump.cs
@@ -45,7 +45,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image extra_window_jumps_image_fall;
        [Widget] Gtk.Image extra_window_jumps_image_weight;
        [Widget] Gtk.SpinButton extra_window_jumps_spinbutton_fall;
-       [Widget] Gtk.HBox hbox_extra_window_jumps_weight;
+       [Widget] Gtk.Table table_extra_window_jumps_weight;
        [Widget] Gtk.RadioButton extra_window_jumps_radiobutton_kg;
        [Widget] Gtk.RadioButton extra_window_jumps_radiobutton_weight;
        //[Widget] Gtk.Label extra_window_jumps_label_weight;
@@ -555,7 +555,7 @@ public partial class ChronoJumpWindow
                        hbox_extra_window_jumps_rj_weight.Visible = show;
                        update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(show);
                } else {
-                       hbox_extra_window_jumps_weight.Visible = show;
+                       table_extra_window_jumps_weight.Visible = show;
                        update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(show);
                }
        }
@@ -626,6 +626,35 @@ public partial class ChronoJumpWindow
                label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg.Visible = true;
        }
 
+       [Widget] Gtk.Button button_jumps_extra_weight_minus_10;
+       [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;
+
+               double min, max;
+               extra_window_jumps_spinbutton_weight.GetRange (out min, out max);
+               if(newValue < min)
+                       extra_window_jumps_spinbutton_weight.Value = min;
+               else if(newValue > max)
+                       extra_window_jumps_spinbutton_weight.Value = max;
+               else
+                       extra_window_jumps_spinbutton_weight.Value = newValue;
+       }
+
        private void on_extra_window_jumps_spinbutton_weight_value_changed (object o, EventArgs args)
        {
                update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(true);


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