[chronojump] New feature: selecting a jumpRj on treeview, displays it on top cairo realtime graph



commit 1d913bbdf758c84090229784bfb0f9e2793ac7f1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 7 12:45:11 2022 +0100

    New feature: selecting a jumpRj on treeview, displays it on top cairo realtime graph

 src/gui/app1/chronojump.cs | 32 ++++++++++++++++++++++++--------
 src/gui/eventExecute.cs    | 17 +++++++----------
 src/jump.cs                | 19 +++++++++++++++++++
 3 files changed, 50 insertions(+), 18 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 0fa614b44..ee9d75ea7 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -427,7 +427,10 @@ public partial class ChronoJumpWindow
        private static ReactionTime currentReactionTime;
        private static Pulse currentPulse;
        private static MultiChronopic currentMultiChronopic;
-       
+
+       //to be able to resize cairo jumpRj graph without needing to check sql all the time
+       private static JumpRj selectedJumpRj;
+
        private static EventExecute currentEventExecute;
 
        //Used by Cancel and Finish
@@ -1659,12 +1662,22 @@ public partial class ChronoJumpWindow
                if (myTreeViewJumpsRj.EventSelectedID == 0) {
                        myTreeViewJumpsRj.Unselect();
                        showHideActionEventButtons(false, "JumpRj");
-               } else if (myTreeViewJumpsRj.EventSelectedID == -1) {
-                       myTreeViewJumpsRj.SelectHeaderLine();
-                       showHideActionEventButtons(true, "JumpRj");
-               } else {
-                       showHideActionEventButtons(true, "JumpRj");
+                       return;
                }
+
+               if (myTreeViewJumpsRj.EventSelectedID == -1)
+                       myTreeViewJumpsRj.SelectHeaderLine();
+
+               showHideActionEventButtons(true, "JumpRj");
+
+               //graph the jump on realtime cairo graph. Using selectedJumpRj to avoid SQL select 
continuously
+               if(selectedJumpRj == null || selectedJumpRj.UniqueID != myTreeViewJumpsRj.EventSelectedID)
+                       selectedJumpRj = SqliteJumpRj.SelectJumpData("jumpRj", 
myTreeViewJumpsRj.EventSelectedID, false);
+
+               blankJumpReactiveRealtimeCaptureGraph ();
+               PrepareJumpReactiveRealtimeCaptureGraph (selectedJumpRj.tvLast, selectedJumpRj.tcLast,
+                               selectedJumpRj.TvString, selectedJumpRj.TcString, selectedJumpRj.Type,
+                               preferences.volumeOn, preferences.gstreamer, repetitiveConditionsWin);
        }
 
        private void treeviewJumpsRjContextMenu(JumpRj myJump) {
@@ -5238,9 +5251,11 @@ public partial class ChronoJumpWindow
                //test can be deleted if not cancelled
                sensitiveLastTestButtons(! currentEventExecute.Cancel);
 
-               if ( ! currentEventExecute.Cancel ) {
+               if ( ! currentEventExecute.Cancel )
+               {
                        currentJumpRj = (JumpRj) currentEventExecute.EventDone;
-                       
+                       selectedJumpRj = currentJumpRj;
+
                        //if user clicked in finish earlier
                        if(currentEventExecute.Finish) {
                                currentJumpRj.Jumps = Util.GetNumberOfJumps(currentJumpRj.TvString, false);
@@ -6682,6 +6697,7 @@ LogB.Debug("mc finished 5");
                Sqlite.Delete(false, Constants.JumpRjTable, id);
                
                myTreeViewJumpsRj.DelEvent(id);
+               selectedJumpRj = null;
                showHideActionEventButtons(false, "JumpRj");
 
                if(createdStatsWin) {
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index a0b04b286..9cafa11a1 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -488,16 +488,13 @@ public partial class ChronoJumpWindow
 
                if(current_mode == Constants.Modes.JUMPSREACTIVE)
                {
-                       if(currentEventExecute == null || 
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject == null)
-                               return;
-
-                       PrepareJumpReactiveRealtimeCaptureGraph (
-                                       
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTv,
-                                       
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.lastTc,
-                                       
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.tvString,
-                                       
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.tcString,
-                                       
currentEventExecute.PrepareEventGraphJumpReactiveRealtimeCaptureObject.type,
-                                       preferences.volumeOn, preferences.gstreamer, repetitiveConditionsWin);
+                       if(selectedJumpRj != null)
+                       {
+                               blankJumpReactiveRealtimeCaptureGraph ();
+                               PrepareJumpReactiveRealtimeCaptureGraph (selectedJumpRj.tvLast, 
selectedJumpRj.tcLast,
+                                               selectedJumpRj.TvString, selectedJumpRj.TcString, 
selectedJumpRj.Type,
+                                               preferences.volumeOn, preferences.gstreamer, 
repetitiveConditionsWin);
+                       }
                } else if (current_mode == Constants.Modes.RUNSINTERVALLIC)
                {
                        if(currentEventExecute == null || 
currentEventExecute.PrepareEventGraphRunIntervalRealtimeCaptureObject == null)
diff --git a/src/jump.cs b/src/jump.cs
index 6e8cef236..fa3def159 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -390,6 +390,25 @@ public class JumpRj : Jump
                }
        }
 
+       public double tvLast
+       {
+               get {
+                       if(tvList == null || tvList.Count == 0)
+                               return 0;
+                       else
+                               return tvList[tvList.Count -1];
+               }
+       }
+       public double tcLast
+       {
+               get {
+                       if(tcList == null || tcList.Count == 0)
+                               return 0;
+                       else
+                               return tcList[tcList.Count -1];
+               }
+       }
+
        public List<double> HeightList
        {
                get {


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