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



commit e0927cb588bcfe670565a5ee28f24ee41b7c8057
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jun 23 04:59:16 2016 +0200

    change person or run type updates run simple graph

 src/gui/chronojump.cs   |    4 +++-
 src/gui/eventExecute.cs |   10 +++++-----
 src/gui/run.cs          |   24 +++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 2f6dcb4..765b47e 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1158,6 +1158,8 @@ public partial class ChronoJumpWindow
                //1) change on jumps, runs, pulse capture graph
                if(radio_mode_jumps_small.Active) 
                        updateGraphJumpsSimple();
+               else if(radio_mode_runs_small.Active) 
+                       updateGraphRunsSimple();
                
                //2) change on encoder
                encoderPersonChanged();
@@ -5163,7 +5165,7 @@ LogB.Debug("X");
                                        break;
                                case EventType.Types.RUN:
                                        if(lastRunIsSimple) 
-                                               
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject);
+                                               
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject, false);
                                        else {
                                                RunType runType = 
SqliteRunIntervalType.SelectAndReturnRunIntervalType(currentRunInterval.Type, false);
                                                double distanceTotal = 
Util.GetRunITotalDistance(currentRunInterval.DistanceInterval, 
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 3d4d9ff..9f538ad 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -635,7 +635,7 @@ public partial class ChronoJumpWindow
                        
 
        // run simple
-       public void PrepareRunSimpleGraph(PrepareEventGraphRunSimple eventGraph)
+       public void PrepareRunSimpleGraph(PrepareEventGraphRunSimple 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
@@ -673,7 +673,7 @@ public partial class ChronoJumpWindow
                //}
                        
                        paintRunSimple (event_execute_drawingarea, eventGraph,
-                                       maxValue, minValue, topMargin, bottomMargin);
+                                       maxValue, minValue, topMargin, bottomMargin, animate);
                
                
                // -- refresh
@@ -1066,7 +1066,7 @@ public partial class ChronoJumpWindow
        }
 
        private void paintRunSimple (Gtk.DrawingArea drawingarea, PrepareEventGraphRunSimple 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;
@@ -1108,7 +1108,7 @@ public partial class ChronoJumpWindow
                                                topMargin, bottomMargin);
 
                                drawBar(x, y, barWidth, alto, pen_azul_claro, count == 
eventGraph.runsAtSQL.Length,
-                                               run[8] == "-1", 
Convert.ToDouble(run[5])/Convert.ToDouble(run[6]), layoutMid, true);
+                                               run[8] == "-1", 
Convert.ToDouble(run[5])/Convert.ToDouble(run[6]), layoutMid, animate);
                        }
 
                        count --;
@@ -1881,7 +1881,7 @@ public partial class ChronoJumpWindow
                                break;
                        case EventType.Types.RUN:
                                if(thisRunIsSimple)
-                                       
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject);
+                                       
PrepareRunSimpleGraph(currentEventExecute.PrepareEventGraphRunSimpleObject, true);
                                else {
                                        bool volumeOnHere = preferences.volumeOn;
                                        //do not play good or bad sounds at RSA because we need to hear the 
GO sound
diff --git a/src/gui/run.cs b/src/gui/run.cs
index c38926b..ff10ab0 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -984,9 +984,31 @@ partial class ChronoJumpWindow
                                extra_window_runs_spinbutton_distance.Value = extra_window_runs_distance; 
                        }
                        extra_window_showDistanceData(myRunType, true, true);   //visible, sensitive
-
                }
 
+               updateGraphRunsSimple();
+       }
+       private void updateGraphRunsSimple () 
+       {
+               if(currentPerson == null || currentSession == null)
+                       return;
+
+               //intializeVariables if not done before
+               event_execute_initializeVariables(
+                       ! chronopicWin.Connected,       //is simulated
+                       currentPerson.UniqueID, 
+                       currentPerson.Name, 
+                       Catalog.GetString("Phases"),      //name of the different moments
+                       Constants.RunTable, //tableName
+                       currentRunType.Name 
+                       );
+
+               PrepareEventGraphRunSimple eventGraph = new PrepareEventGraphRunSimple(
+                               1, 1, //both unused
+                               currentSession.UniqueID, currentPerson.UniqueID, Constants.RunTable, 
currentEventType.Name);
+               
+               if(eventGraph.runsAtSQL.Length > 0)
+                       PrepareRunSimpleGraph(eventGraph, false); //don't animate
        }
        
        private void extra_window_runs_interval_initialize(RunType myRunType) 


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