[chronojump] Fixed sensitivity of save-1RM when no 1RM test has been done



commit 920ba7bf87489a3543d1f8070b3b9a9357df079f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 13 15:54:57 2015 +0100

    Fixed sensitivity of save-1RM when no 1RM test has been done

 src/gui/encoder.cs |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 8d7dc29..f7182bc 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3231,6 +3231,13 @@ public partial class ChronoJumpWindow
        void on_button_encoder_analyze_1RM_save_clicked (object o, EventArgs args)
        {
                string contents = Util.ReadFile(UtilEncoder.GetEncoderSpecialDataTempFileName(), true);
+               //if 1RM button is sensitive and there's no 1RM data 
+               //(because a not-1RM test have been done and software has a sensitivity bug), return
+               if(contents != null && contents != "") {
+                       new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Not enough 
data."));
+                       return;
+               }
+
                string [] load1RMStr = contents.Split(new char[] {';'});
                double load1RM = Convert.ToDouble(Util.ChangeDecimalSeparator(load1RMStr[1]));
 
@@ -5371,7 +5378,8 @@ LogB.Debug("D");
                        string crossName = 
Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_cross),
                                                encoderAnalyzeCrossTranslation);
                        button_encoder_analyze_1RM_save.Sensitive = 
-                               (crossName == "1RM Bench Press" || crossName == "1RM Any exercise");
+                               (radiobutton_encoder_analyze_cross.Active &&
+                               (crossName == "1RM Bench Press" || crossName == "1RM Any exercise") );
                }
 
                treeview_encoder_capture_curves.Sensitive = true;


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