[chronojump] Fixed GUI error on jumpType selection on new GUI since 1.4.2



commit c2edc7c79d622493876b1bf8bb3b08c35e285481
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun May 25 09:02:29 2014 +0200

    Fixed GUI error on jumpType selection on new GUI since 1.4.2

 src/gui/chronojump.cs |   10 ++++------
 src/gui/jump.cs       |   42 ++++++++++++++++++++++++++++++++++--------
 src/jumpType.cs       |   21 +++++++++++++++++++--
 3 files changed, 57 insertions(+), 16 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index e352478..5129be3 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3508,9 +3508,9 @@ Console.WriteLine("X");
                if(execute_auto_doing)
                        sensitiveGuiAutoExecuteOrWait (true);
                
-                       
-               string jumpEnglishName = Util.FindOnArray(':',2,1, 
UtilGtk.ComboGetActive(combo_select_jumps), selectJumpsString);
-               currentJumpType = new JumpType(jumpEnglishName);
+               //currentJumpType is already defined in selecting name from combo or from jumpsMoreWin
+               //string jumpEnglishName = Util.FindOnArray(':',2,1, 
UtilGtk.ComboGetActive(combo_select_jumps), selectJumpsString);
+               //currentJumpType = new JumpType(jumpEnglishName);
 
                double jumpWeight = 0;
                if(currentJumpType.HasWeight) {
@@ -3522,9 +3522,7 @@ Console.WriteLine("X");
                                                currentPersonSession.Weight);
                }
                double myFall = 0;
-               if(currentJumpType.Name == Constants.TakeOffName || currentJumpType.Name == 
Constants.TakeOffWeightName)
-                       myFall = 0;
-               else if( ! currentJumpType.StartIn) {
+               if(currentJumpType.HasFall) {
                        myFall = (double) extra_window_jumps_spinbutton_fall.Value;
                }
 
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index bd9f01c..24759a6 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -1064,8 +1064,25 @@ partial class ChronoJumpWindow
        private void on_extra_window_jumps_test_changed(object o, EventArgs args)
        {
                string jumpEnglishName = Util.FindOnArray(':',2,1, 
UtilGtk.ComboGetActive(combo_select_jumps), selectJumpsString);
-               currentJumpType = new JumpType(jumpEnglishName);
-               
+       
+               //note some tests are predefined and some other are user created and SQL database has to be 
checked
+               //to check fall and height create first a jump type and see it  
+               JumpType jType = new JumpType(jumpEnglishName);
+
+               //then create jumptype with all options
+               currentJumpType = new JumpType(
+                               jumpEnglishName,                //type of jump
+                                                               //SelectedEventType would be: jump, or run, 
...
+                               ! jType.HasFall,
+                               jType.HasWeight,
+                               false,                          //isRepetitive
+                               false,                          //jumpsLimited (false, because is not 
repetitive)
+                               0,                              //limitValue
+                               false,                          //unlimited
+                               "",                             //description
+                               SqliteEvent.GraphLinkSelectFileName("jump", jumpEnglishName)
+                               );
+       
                extra_window_jumps_initialize(currentJumpType);
        }
        
@@ -1110,13 +1127,11 @@ partial class ChronoJumpWindow
                } else 
                        extra_window_showWeightData(myJumpType, false); 
 
-               if(myJumpType.StartIn || myJumpType.Name == Constants.TakeOffName || 
-                               myJumpType.Name == Constants.TakeOffWeightName) 
-                       extra_window_showFallData(myJumpType, false);   
-               else {
+               if(myJumpType.HasFall) {
                        hasOptions = true;
                        extra_window_showFallData(myJumpType, true);
-               }
+               } else
+                       extra_window_showFallData(myJumpType, false);   
                
                if(myJumpType.Name == "DJa" || myJumpType.Name == "DJna") { 
                        //on DJa and DJna (coming from More jumps) need to show technique data but not change
@@ -1246,7 +1261,18 @@ partial class ChronoJumpWindow
        {
                jumpsMoreWin.Button_accept.Clicked -= new EventHandler(on_more_jumps_accepted);
                
-               currentJumpType = new JumpType(jumpsMoreWin.SelectedEventName);
+               currentJumpType = new JumpType(
+                               jumpsMoreWin.SelectedEventName, //type of jump
+                                                               //SelectedEventType would be: jump, or run, 
...
+                               jumpsMoreWin.SelectedStartIn,
+                               jumpsMoreWin.SelectedExtraWeight,
+                               false,                          //isRepetitive
+                               false,                          //jumpsLimited (false, because is not 
repetitive)
+                               0,                              //limitValue
+                               false,                          //unlimited
+                               jumpsMoreWin.SelectedDescription,
+                               SqliteEvent.GraphLinkSelectFileName("jump", jumpsMoreWin.SelectedEventName)
+                               );
 
                extra_window_jumps_initialize(currentJumpType);
                
diff --git a/src/jumpType.cs b/src/jumpType.cs
index 72e371a..2c94408 100644
--- a/src/jumpType.cs
+++ b/src/jumpType.cs
@@ -234,7 +234,7 @@ public class JumpType : EventType
                this.description = description;
                this.imageFileName = imageFileName;
 
-               //we can obtain values like has Weight
+               //we can obtain values like has Weight and has Fall
                isPredefined = FindIfIsPredefined();
        }
 
@@ -243,7 +243,7 @@ public class JumpType : EventType
                get { return startIn; }
                set { startIn = value; }
        }
-       
+
        public bool HasWeight
        {
                get { 
@@ -259,6 +259,23 @@ public class JumpType : EventType
                set { hasWeight = value; }
        }
        
+       public bool HasFall
+       {
+               get { 
+                       if(name == Constants.TakeOffName || name == Constants.TakeOffWeightName)
+                               return false;
+
+                       if(isPredefined) {
+                               return ! startIn; 
+                       } else {
+                               if(isRepetitive)
+                                       return SqliteJumpType.HasFall("jumpRjType", name);
+                               else
+                                       return SqliteJumpType.HasFall("jumpType", name);
+                       }
+               }
+       }
+       
        public bool IsRepetitive
        {
                get { return isRepetitive; }


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