[chronojump] change person or jump type updates jump simple graph



commit 9663e725461c61e78a0a2eeeb9772b5b0dfdfa6e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 22 19:25:14 2016 +0200

    change person or jump type updates jump simple graph

 howto_new_version.txt   |    2 +-
 src/gui/chronojump.cs   |   21 +++++++++++++++------
 src/gui/eventExecute.cs |   25 +++++++++++++------------
 src/gui/jump.cs         |   33 +++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+), 19 deletions(-)
---
diff --git a/howto_new_version.txt b/howto_new_version.txt
index de5c778..7203420 100644
--- a/howto_new_version.txt
+++ b/howto_new_version.txt
@@ -91,7 +91,7 @@ debian/control needs to change: python-wxgtk2.8 to python-wxgtk3.0
 BUT this does not work for Ubuntu Launchpad, so continue with python-wxgtk-2.8
 
 And upload like this:
-dput chronojump-ppa build-deb/chronojump..._source.changes
+dput chronojump-ppa build-deb/chronojump_..._source.changes
 
 
 DEB.C.b ) On raspbian
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 9b3a9d1..9b4f1ba 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1149,11 +1149,20 @@ public partial class ChronoJumpWindow
                        currentPerson = SqlitePerson.Select(Convert.ToInt32(selectedID));
                        currentPersonSession = SqlitePersonSession.Select(Convert.ToInt32(selectedID), 
currentSession.UniqueID);
                        label_person_change();
-               
-                       encoderPersonChanged();
+       
+                       personChanged();        
                }
        }
 
+       private void personChanged() {
+               //1) change on jumps, runs, pulse capture graph
+               if(radio_mode_jumps_small.Active) 
+                       updateGraphJumpsSimple();
+               
+               //2) change on encoder
+               encoderPersonChanged();
+       }
+
        private void treeviewPersonsContextMenu(Person myPerson) {
                Menu myMenu = new Menu ();
                Gtk.MenuItem myItem;
@@ -2909,7 +2918,7 @@ public partial class ChronoJumpWindow
                currentPersonSession = SqlitePersonSession.Select(currentPerson.UniqueID, 
currentSession.UniqueID);
                label_person_change();
 
-               encoderPersonChanged();
+               personChanged();
        }
 
 
@@ -5139,7 +5148,7 @@ LogB.Debug("X");
                        switch (currentEventType.Type) {
                                case EventType.Types.JUMP:
                                        if(lastJumpIsSimple)  
-                                               
PrepareJumpSimpleGraph(currentEventExecute.PrepareEventGraphJumpSimpleObject);
+                                               
PrepareJumpSimpleGraph(currentEventExecute.PrepareEventGraphJumpSimpleObject, false);
                                        else
                                                PrepareJumpReactiveGraph(
                                                                Util.GetLast(currentJumpRj.TvString), 
Util.GetLast(currentJumpRj.TcString),
@@ -6547,7 +6556,7 @@ LogB.Debug("X");
                button_execute_test.Sensitive = false;
                
                encoderButtonsSensitive(encoderSensEnum.NOPERSON);
-               encoderPersonChanged();
+               personChanged();
                
                notebook_execute.Sensitive = false;
                //hbox_chronopics.Sensitive = false;
@@ -6568,7 +6577,7 @@ LogB.Debug("X");
                button_execute_test.Sensitive = true;
 
                encoderButtonsSensitive(encoderSensEnum.YESPERSON);
-               encoderPersonChanged();
+               personChanged();
                
                notebook_execute.Sensitive = true;
                //hbox_chronopics.Sensitive = true;
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index b79c531..63dc658 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -495,7 +495,7 @@ public partial class ChronoJumpWindow
        
 
        // simple and DJ jump   
-       public void PrepareJumpSimpleGraph(PrepareEventGraphJumpSimple eventGraph)
+       public void PrepareJumpSimpleGraph(PrepareEventGraphJumpSimple eventGraph, bool animate)
        {
                //check graph properties window is not null (propably user has closed it with the DeleteEvent
                //then create it, but not show it
@@ -546,7 +546,7 @@ public partial class ChronoJumpWindow
                
                //paint graph
                paintJumpSimple (event_execute_drawingarea, eventGraph, 
-                               maxValue, minValue, topMargin, bottomMargin);
+                               maxValue, minValue, topMargin, bottomMargin, animate);
 
                // -- refresh
                event_execute_drawingarea.QueueDraw();
@@ -887,7 +887,7 @@ public partial class ChronoJumpWindow
        }
        
        private void paintJumpSimple (Gtk.DrawingArea drawingarea, PrepareEventGraphJumpSimple eventGraph, 
-                       double maxValue, double minValue, int topMargin, int bottomMargin)
+                       double maxValue, double minValue, int topMargin, int bottomMargin, bool animate)
        {
                int ancho=drawingarea.Allocation.Width;
                int alto=drawingarea.Allocation.Height;
@@ -915,14 +915,15 @@ public partial class ChronoJumpWindow
                drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
                drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
 
-               bool animate;
+               bool animateBar = animate;
                int x = 0;
                int y = 0;
                int count = eventGraph.jumpsAtSQL.Length;
                foreach(string myStr in eventGraph.jumpsAtSQL) 
                {
                        string [] jump = myStr.Split(new char[] {':'});
-               
+       
+                       //if tc, maybe also tv  
                        if(eventGraph.tc > 0) {
                                //small layout when tc and tv and there are more than 4 jumps
                                Pango.Layout layout = layoutMid;
@@ -930,30 +931,30 @@ public partial class ChronoJumpWindow
                                        layout = layoutSmall;
                                
                                //do not animate last tc, if tv is animated because then tc is not shown
-                               animate = true;
                                if(eventGraph.tv >0)
-                                       animate = false;
+                                       animateBar = false;
 
                                x = 
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/eventGraph.jumpsAtSQL.Length)-barDesplLeft;
                                y = calculatePaintHeight(Convert.ToDouble(jump[6]), alto, maxValue, minValue, 
topMargin, bottomMargin);
                                
                                drawBar(x, y, barWidth, alto, pen_rojo, count == eventGraph.jumpsAtSQL.Length,
-                                               jump[11] == "-1", Convert.ToDouble(jump[6]), layout, animate);
+                                               jump[11] == "-1", Convert.ToDouble(jump[6]), layout, 
animateBar);
                        
+                               //tv    
                                if(eventGraph.tv > 0) {
                                        x = 
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/eventGraph.jumpsAtSQL.Length)-barDesplLeft 
+tctfSep;
                                        y = calculatePaintHeight(Convert.ToDouble(jump[5]), alto, maxValue, 
minValue, topMargin, bottomMargin);
                                        
                                        drawBar(x, y, barWidth, alto, pen_azul_claro, count == 
eventGraph.jumpsAtSQL.Length,
-                                                       jump[11] == "-1", Convert.ToDouble(jump[5]), layout, 
true);
+                                                       jump[11] == "-1", Convert.ToDouble(jump[5]), layout, 
animateBar);
                                }
-                       } else { //if only tv show height
+                       } else { //as not tc. Show only height
                                x = 
Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/eventGraph.jumpsAtSQL.Length)-barDesplLeft 
+tctfSep;
                                y = 
calculatePaintHeight(Convert.ToDouble(Util.GetHeightInCentimeters(jump[5])), 
                                                alto, maxValue, minValue, topMargin, bottomMargin);
 
                                drawBar(x, y, barWidth, alto, pen_azul_claro, count == 
eventGraph.jumpsAtSQL.Length,
-                                               jump[11] == "-1", 
Convert.ToDouble(Util.GetHeightInCentimeters(jump[5])), layoutMid, true);
+                                               jump[11] == "-1", 
Convert.ToDouble(Util.GetHeightInCentimeters(jump[5])), layoutMid, animateBar);
                        }
                        count --;
                }
@@ -1866,7 +1867,7 @@ public partial class ChronoJumpWindow
                switch (currentEventType.Type) {
                        case EventType.Types.JUMP:
                                if(thisJumpIsSimple) 
-                                       
PrepareJumpSimpleGraph(currentEventExecute.PrepareEventGraphJumpSimpleObject);
+                                       
PrepareJumpSimpleGraph(currentEventExecute.PrepareEventGraphJumpSimpleObject, true);
                                else {
                                        PrepareJumpReactiveGraph(
                                                        
currentEventExecute.PrepareEventGraphJumpReactiveObject.lastTv, 
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index 76025ce..afb0f8d 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -1169,7 +1169,40 @@ partial class ChronoJumpWindow
                        extra_window_jumps_spin_single_leg_distance.Value = 0;
                        extra_window_jumps_spin_single_leg_angle.Value = 90;
                }
+
+               updateGraphJumpsSimple();
        }
+       private void updateGraphJumpsSimple () 
+       {
+               if(currentPerson == null || currentSession == null)
+                       return;
+
+               double tc = 0.0;
+               if(! currentJumpType.StartIn)
+                       tc = 1; //just a mark meaning that tc has to be shown
+
+               double tv = 1;
+               //special cases where there's no tv
+               if(currentEventType.Name == Constants.TakeOffName || currentEventType.Name == 
Constants.TakeOffWeightName)
+                       tv = 0.0;
+               
+               //intializeVariables if not done before
+               ExecutingGraphData egd = event_execute_initializeVariables(
+                       ! chronopicWin.Connected,       //is simulated
+                       currentPerson.UniqueID, 
+                       currentPerson.Name, 
+                       Catalog.GetString("Phases"),      //name of the different moments
+                       Constants.JumpTable, //tableName
+                       currentJumpType.Name 
+                       );
+
+               PrepareEventGraphJumpSimple eventGraph = new PrepareEventGraphJumpSimple(
+                               tv, tc, currentSession.UniqueID, currentPerson.UniqueID, Constants.JumpTable, 
currentEventType.Name);
+               
+               if(eventGraph.jumpsAtSQL.Length > 0)
+                       PrepareJumpSimpleGraph(eventGraph, false); //don't animate
+       }
+
        
        private void extra_window_jumps_rj_initialize(JumpType myJumpType) 
        {


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