[chronojump] new cairo graphs only have save button sensitive when all ok



commit 37c5c1fb4abbc806dc617fd2d3f934ace6f72a98
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 7 18:43:58 2020 +0100

    new cairo graphs only have save button sensitive when all ok

 src/gui/app1/jumpsDjOptimalFall.cs   | 11 ++++++++++-
 src/gui/app1/jumpsProfile.cs         |  9 ++++++++-
 src/gui/app1/jumpsWeightFVProfile.cs |  5 +++++
 3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/jumpsDjOptimalFall.cs b/src/gui/app1/jumpsDjOptimalFall.cs
index 0c28a019..cb07aeb4 100644
--- a/src/gui/app1/jumpsDjOptimalFall.cs
+++ b/src/gui/app1/jumpsDjOptimalFall.cs
@@ -31,6 +31,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_jumps_dj_optimal_fall_save;
        [Widget] Gtk.HBox hbox_combo_select_jumps_dj_optimal_fall;
        [Widget] Gtk.ComboBox combo_select_jumps_dj_optimal_fall;
+       [Widget] Gtk.Button button_jumps_dj_optimal_fall_save_image;
 
        JumpsDjOptimalFall jumpsDjOptimalFall;
        CjComboSelectJumps comboSelectJumpsDjOptimalFall;
@@ -62,8 +63,11 @@ public partial class ChronoJumpWindow
        private void jumpsDjOptimalFallDo (bool calculateData)
        {
                if(currentPerson == null || currentSession == null)
+               {
+                       button_jumps_dj_optimal_fall_save_image.Sensitive = false;
                        return;
-               
+               }
+
                if(jumpsDjOptimalFall == null) {
                        jumpsDjOptimalFall = new JumpsDjOptimalFall();
                        calculateData = true;
@@ -79,6 +83,9 @@ public partial class ChronoJumpWindow
                        //constructor for showing blank screen with a message
                        new JumpsDjOptimalFallGraph(drawingarea_jumps_dj_optimal_fall, jumpType);
                                        //currentPerson.Name, jumpType, currentSession.DateShort);
+
+                       button_jumps_dj_optimal_fall_save_image.Sensitive = false;
+
                } else {
                        //regular constructor
                        JumpsDjOptimalFallGraph jdofg = new JumpsDjOptimalFallGraph(
@@ -90,6 +97,8 @@ public partial class ChronoJumpWindow
                                        drawingarea_jumps_dj_optimal_fall,
                                        currentPerson.Name, jumpType, currentSession.DateShort);
                        jdofg.Do();
+
+                       button_jumps_dj_optimal_fall_save_image.Sensitive = true;
                }
        }
        private void on_drawingarea_jumps_dj_optimal_fall_expose_event (object o, ExposeEventArgs args) 
diff --git a/src/gui/app1/jumpsProfile.cs b/src/gui/app1/jumpsProfile.cs
index 9cec24ad..1f4f9b4f 100644
--- a/src/gui/app1/jumpsProfile.cs
+++ b/src/gui/app1/jumpsProfile.cs
@@ -30,6 +30,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.DrawingArea drawingarea_jumps_profile;
        [Widget] Gtk.Image image_tab_jumps_profile;
        [Widget] Gtk.Image image_jumps_profile_save;
+       [Widget] Gtk.Button button_jumps_profile_save_image;
 
        [Widget] Gtk.HBox hbox_jumps_profile_jumps_done;
        [Widget] Gtk.Image image_jumps_profile_sj_yes;
@@ -50,7 +51,10 @@ public partial class ChronoJumpWindow
        {
                if(currentPerson == null || currentSession == null ||
                                drawingarea_jumps_profile == null || drawingarea_jumps_profile.GdkWindow == 
null) //it happens at start on click on analyze
+               {
+                       button_jumps_profile_save_image.Sensitive = false;
                        return;
+               }
                
                if(jumpsProfile == null) {
                        jumpsProfile = new JumpsProfile();
@@ -62,8 +66,10 @@ public partial class ChronoJumpWindow
                        jumpsProfile.Calculate(currentPerson.UniqueID, currentSession.UniqueID);
 
                        if(jumpsProfile.AllJumpsDone)
+                       {
                                hbox_jumps_profile_jumps_done.Visible = false;
-                       else {
+                               button_jumps_profile_save_image.Sensitive = true;
+                       } else {
                                hbox_jumps_profile_jumps_done.Visible = true;
                                JumpsProfileGraph.ShowDoneJumps(jumpsProfile.JumpsDone,
                                                image_jumps_profile_sj_yes, image_jumps_profile_sj_no,
@@ -72,6 +78,7 @@ public partial class ChronoJumpWindow
                                                image_jumps_profile_abk_yes, image_jumps_profile_abk_no,
                                                image_jumps_profile_dja_yes, image_jumps_profile_dja_no
                                                );
+                               button_jumps_profile_save_image.Sensitive = false;
                        }
                }
 
diff --git a/src/gui/app1/jumpsWeightFVProfile.cs b/src/gui/app1/jumpsWeightFVProfile.cs
index 972d3534..cae7a4b2 100644
--- a/src/gui/app1/jumpsWeightFVProfile.cs
+++ b/src/gui/app1/jumpsWeightFVProfile.cs
@@ -31,6 +31,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_jumps_weight_fv_profile_save;
        [Widget] Gtk.HBox hbox_combo_select_jumps_weight_fv_profile;
        [Widget] Gtk.ComboBox combo_select_jumps_weight_fv_profile;
+       [Widget] Gtk.Button button_jumps_weight_fv_profile_save_image;
 
        JumpsWeightFVProfile jumpsWeightFVProfile;
        CjComboSelectJumps comboSelectJumpsWeightFVProfile;
@@ -65,6 +66,8 @@ public partial class ChronoJumpWindow
 
        private void jumpsWeightFVProfileDo (bool calculateData)
        {
+               button_jumps_weight_fv_profile_save_image.Sensitive = false;
+
                if(currentPerson == null || currentPersonSession == null || currentSession == null)
                        return;
                
@@ -112,6 +115,8 @@ public partial class ChronoJumpWindow
                                        currentPerson.Name, //jumpType,
                                        currentSession.DateShort);
                        jwfv.Do();
+
+                       button_jumps_weight_fv_profile_save_image.Sensitive = true;
                }
        }
        private void on_drawingarea_jumps_weight_fv_profile_expose_event (object o, ExposeEventArgs args) 


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