[chronojump] New config option: encoderUpdateTreeViewWhileCapturing



commit d2ef770f13348fb339cc787df017a2e212d34e19
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Aug 4 10:28:55 2015 +0200

    New config option: encoderUpdateTreeViewWhileCapturing

 chronojump_config.txt       |    5 +++++
 src/config.cs               |    6 ++++++
 src/gui/encoderTreeviews.cs |   24 ++++++++++++++++++++++--
 src/gui/networks.cs         |    3 +++
 4 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/chronojump_config.txt b/chronojump_config.txt
index 0d81e7f..78f85ca 100644
--- a/chronojump_config.txt
+++ b/chronojump_config.txt
@@ -49,6 +49,11 @@ OnlyEncoder=TRUE
 #default: EncoderCaptureShowOnlyBars=FALSE
 EncoderCaptureShowOnlyBars=FALSE
 
+#If EncoderCaptureShowOnlyBars is TRUE then TreeView is in notebook 2nd page. Don't need to update it at 
each repetition during capture
+#Just update it at the end. In this case it's good to be FALSE. In the rest of cases: TRUE
+#default: EncoderUpdateTreeViewWhileCapturing=TRUE
+EncoderUpdateTreeViewWhileCapturing=FALSE
+
 #Hide left person box. Select person by a label and button on the top
 #default: PersonWinHide=FALSE
 PersonWinHide=TRUE
diff --git a/src/config.cs b/src/config.cs
index bc990a7..5b478ef 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -33,6 +33,8 @@ public class Config
        public AutodetectPortEnum AutodetectPort;
        public bool OnlyEncoder;
        public bool EncoderCaptureShowOnlyBars;
+       public bool EncoderUpdateTreeViewWhileCapturing; //recomended: false. Make it false if 
EncoderCaptureShowOnlyBars == true
+                                                       //because treeview will be in 2n page of notebook
        public bool PersonWinHide;
        public bool EncoderAnalyzeHide;
        public EncoderConfiguration Econf;
@@ -47,6 +49,7 @@ public class Config
                AutodetectPort = AutodetectPortEnum.ACTIVE;
                OnlyEncoder = false;
                EncoderCaptureShowOnlyBars = false;
+               EncoderUpdateTreeViewWhileCapturing = true;
                PersonWinHide = false;
                EncoderAnalyzeHide = false;
                Econf = null; 
@@ -86,6 +89,8 @@ public class Config
                                                OnlyEncoder = true;
                                        else if(parts[0] == "EncoderCaptureShowOnlyBars" && 
Util.StringToBool(parts[1]))
                                                EncoderCaptureShowOnlyBars = true;
+                                       else if(parts[0] == "EncoderUpdateTreeViewWhileCapturing" && ! 
Util.StringToBool(parts[1]))
+                                               EncoderUpdateTreeViewWhileCapturing = false;
                                        else if(parts[0] == "PersonWinHide" && Util.StringToBool(parts[1]))
                                                PersonWinHide = true;
                                        else if(parts[0] == "EncoderAnalyzeHide" && 
Util.StringToBool(parts[1]))
@@ -154,6 +159,7 @@ public class Config
                                "AutodetectPort = " + AutodetectPort.ToString() + "\n" +
                                "OnlyEncoder = " + OnlyEncoder.ToString() + "\n" +
                                "EncoderCaptureShowOnlyBars = " + EncoderCaptureShowOnlyBars.ToString() + 
"\n" +
+                               "EncoderUpdateTreeViewWhileCapturing = " + 
EncoderUpdateTreeViewWhileCapturing.ToString() + "\n" +
                                "PersonWinHide = " + PersonWinHide.ToString() + "\n" +
                                "EncoderAnalyzeHide = " + EncoderAnalyzeHide.ToString() + "\n" +
                                "Econf = " + econfStr + "\n" +
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index fe39f11..ba64608 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -36,8 +36,29 @@ public partial class ChronoJumpWindow
 
        //returns curves num
        //capture has single and multiple selection in order to save curves... Analyze only shows data.
+       //TODO: do not create this for every repetition while we are executing. Just add the new row
        private int createTreeViewEncoderCapture(List<string> contents) 
        {
+               int curvesCount = 0;
+               bool headers = true;
+               if(! encoderUpdateTreeViewWhileCapturing && capturingCsharp == 
encoderCaptureProcess.CAPTURING) {
+                       //just count how much curves and return
+                       foreach(string line in contents)
+                       {
+                               if(headers) {
+                                       headers = false;
+                                       continue;
+                               }
+                       
+                               if (line == null)
+                                       break;
+                       
+                               curvesCount ++;
+                       }
+                       return curvesCount;
+               }
+
+
                LogB.Debug("At createTreeViewEncoderCapture");
 
                bool showStartAndDuration = encoderCaptureOptionsWin.check_show_start_and_duration.Active;
@@ -61,8 +82,7 @@ public partial class ChronoJumpWindow
 
                encoderCaptureCurves = new ArrayList ();
 
-               int curvesCount = 0;
-               bool headers = true;
+               headers = true;
                foreach(string line in contents)
                {
                        /*
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index b2c1376..679861c 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -62,6 +62,7 @@ public partial class ChronoJumpWindow
        private enum linuxTypeEnum { NOTLINUX, LINUX, RASPBERRY, NETWORKS }
        private linuxTypeEnum linuxType;
        private bool encoderConfigurationDefinedFromFile = false;
+       private bool encoderUpdateTreeViewWhileCapturing = true;
 
 
        private void configInit() 
@@ -133,6 +134,8 @@ public partial class ChronoJumpWindow
                        */
                }
                
+               encoderUpdateTreeViewWhileCapturing = config.EncoderUpdateTreeViewWhileCapturing;
+               
                if(config.PersonWinHide) {
                        //vbox_persons.Visible = false;
                        notebook_session_person.Visible = false;



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