[chronojump] at jumps (simple reactive) % weight is shown a label with weight in Kg



commit 36400000624a73efb74db2defe81b1d01e6987ae
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Nov 13 14:48:46 2017 +0100

    at jumps (simple reactive) % weight is shown a label with weight in Kg

 glade/app1.glade      |   52 +++++++++++++++++++++++++++++++++++++++----
 src/gui/chronojump.cs |   10 +++++++-
 src/gui/jump.cs       |   58 ++++++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 111 insertions(+), 9 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 8de4796..a7e4ed0 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1472,6 +1472,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -5728,6 +5731,7 @@ EncoderInertialCapture</property>
                                                             <property name="climb_rate">1</property>
                                                             <property name="digits">2</property>
                                                             <property name="numeric">True</property>
+                                                            <signal name="value_changed" 
handler="on_extra_window_jumps_spinbutton_weight_value_changed" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -5767,6 +5771,24 @@ EncoderInertialCapture</property>
                                                             <property name="position">2</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">3</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -6278,10 +6300,11 @@ EncoderInertialCapture</property>
                                                             <property 
name="secondary_icon_activatable">False</property>
                                                             <property 
name="primary_icon_sensitive">True</property>
                                                             <property 
name="secondary_icon_sensitive">True</property>
-                                                            <property name="adjustment">10 0 200 1 10 
0</property>
+                                                            <property name="adjustment">0 0 200 1 10 
0</property>
                                                             <property name="climb_rate">1</property>
                                                             <property name="digits">1</property>
                                                             <property name="numeric">True</property>
+                                                            <signal name="value_changed" 
handler="on_extra_window_jumps_rj_spinbutton_weight_value_changed" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -6291,8 +6314,7 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkRadioButton" 
id="extra_window_jumps_rj_radiobutton_weight">
-                                                            <property name="label" translatable="yes">% body
-weight</property>
+                                                            <property name="label" translatable="yes">% body 
weight</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
                                                             <property name="use_underline">True</property>
@@ -6322,6 +6344,24 @@ weight</property>
                                                             <property name="position">2</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">3</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -6338,8 +6378,7 @@ weight</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkCheckButton" 
id="checkbutton_allow_finish_rj_after_time">
-                                                            <property name="label" translatable="yes">Allow 
finish
-after time</property>
+                                                            <property name="label" translatable="yes">Allow 
finish after time</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
                                                             <property name="has_tooltip">True</property>
@@ -22128,6 +22167,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index ee4bc9e..061b799 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1035,11 +1035,19 @@ public partial class ChronoJumpWindow
                {
                        updateGraphJumpsSimple();
 
+                       update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(
+                                       (currentJumpType.HasWeight && 
extra_window_jumps_radiobutton_weight.Active));
+
                        if(notebook_analyze.CurrentPage == 1) //Jumps Profile
                                jumpsProfileDo(true); //calculate data
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSREACTIVE)
+               {
                        updateGraphJumpsReactive();
+
+                       update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(
+                                       (currentJumpRjType.HasWeight && 
extra_window_jumps_rj_radiobutton_weight.Active));
+               }
                else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSSIMPLE)
                        updateGraphRunsSimple();
                else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
@@ -2463,7 +2471,7 @@ public partial class ChronoJumpWindow
        }
 
        private void on_export_session_activate(object o, EventArgs args) {
-               ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Encoder data will not be 
exported."), "", "");
+               ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Only persons, jumps and 
races will be exported."), "", "");
                confirmWin.Button_accept.Clicked += new EventHandler(on_export_session_accepted);
        }
 
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index ca7f3a2..02843f9 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -982,6 +982,10 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label extra_window_jumps_label_weight;
        [Widget] Gtk.CheckButton extra_window_jumps_check_dj_arms;
 
+       //show weight on kg when percent is selected (SJl, CMJl, ABKl)
+       [Widget] Gtk.Label label_extra_window_jumps_radiobutton_weight_percent_as_kg;
+       [Widget] Gtk.Label label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg;
+
        //slCMJ 
        [Widget] Gtk.Box hbox_extra_window_jumps_single_leg_radios;
        [Widget] Gtk.Notebook notebook_options_after_execute;
@@ -1329,11 +1333,15 @@ public partial class ChronoJumpWindow
                        extra_window_jumps_rj_spinbutton_weight.Visible = show;
                        extra_window_jumps_rj_radiobutton_kg.Visible = show;
                        extra_window_jumps_rj_radiobutton_weight.Visible = show;
+
+                       update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(show);
                } else {
                        extra_window_jumps_label_weight.Visible = show;
                        extra_window_jumps_spinbutton_weight.Visible = show;
                        extra_window_jumps_radiobutton_kg.Visible = show;
                        extra_window_jumps_radiobutton_weight.Visible = show;
+
+                       update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(show);
                }
        }
        
@@ -1367,24 +1375,68 @@ public partial class ChronoJumpWindow
        private void on_extra_window_jumps_radiobutton_kg_toggled (object o, EventArgs args)
        {
                extra_window_jumps_option = "Kg";
+               label_extra_window_jumps_radiobutton_weight_percent_as_kg.Visible = false;
        }
        
        private void on_extra_window_jumps_radiobutton_weight_toggled (object o, EventArgs args)
        {
                extra_window_jumps_option = "%";
+
+               update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(true);
+               label_extra_window_jumps_radiobutton_weight_percent_as_kg.Visible = true;
        }
        
        private void on_extra_window_jumps_rj_radiobutton_kg_toggled (object o, EventArgs args)
        {
                extra_window_jumps_rj_option = "Kg";
+               label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg.Visible = false;
        }
        
        private void on_extra_window_jumps_rj_radiobutton_weight_toggled (object o, EventArgs args)
        {
                extra_window_jumps_rj_option = "%";
+
+               update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(true);
+               label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg.Visible = true;
        }
-       
-       
+
+       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);
+       }
+       private void update_label_extra_window_jumps_radiobutton_weight_percent_as_kg(bool show)
+       {
+               if(! show || currentPersonSession == null || currentPersonSession.Weight == 0)
+               {
+                       label_extra_window_jumps_radiobutton_weight_percent_as_kg.Text = "";
+                       return;
+               }
+
+               label_extra_window_jumps_radiobutton_weight_percent_as_kg.Text =
+                       Util.TrimDecimals(Util.WeightFromPercentToKg (
+                                               (double) extra_window_jumps_spinbutton_weight.Value,
+                                               currentPersonSession.Weight), 1) + " Kg";
+       }
+
+       private void on_extra_window_jumps_rj_spinbutton_weight_value_changed (object o, EventArgs args)
+       {
+               update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(true);
+       }
+       private void update_label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg(bool show)
+       {
+               if(! show || currentPersonSession == null || currentPersonSession.Weight == 0)
+               {
+                       label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg.Text = "";
+                       return;
+               }
+
+               label_extra_window_jumps_rj_radiobutton_weight_percent_as_kg.Text =
+                       Util.TrimDecimals(Util.WeightFromPercentToKg (
+                                               (double) extra_window_jumps_rj_spinbutton_weight.Value,
+                                               currentPersonSession.Weight), 1) + " Kg";
+       }
+
+
        private string limitString()
        {
                if(extra_window_jumps_rj_jumpsLimited) 
@@ -1392,7 +1444,7 @@ public partial class ChronoJumpWindow
                else 
                        return extra_window_jumps_rj_limited.ToString() + "T";
        }
-       
+
        //do not translate this
        private string slCMJString()
        {


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