[chronojump] DB 1.31 check string fully extended on preferences



commit 126f1f2c53913d41942ea646a087a2095078f8c4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Aug 8 10:10:46 2016 +0200

    DB 1.31 check string fully extended on preferences

 encoder/call_graph.R      |    6 +-
 encoder/graph.R           |    7 +-
 encoder/util.R            |   46 +++++----
 glade/chronojump.glade    |  239 +++++++++++++++++++++++++++++++++++++++++++--
 src/encoder.cs            |   10 ++
 src/gui/encoder.cs        |   10 ++
 src/gui/preferences.cs    |   26 +++++
 src/preferences.cs        |    2 +
 src/sqlite/main.cs        |   13 +++-
 src/sqlite/preferences.cs |    6 +
 10 files changed, 325 insertions(+), 40 deletions(-)
---
diff --git a/encoder/call_graph.R b/encoder/call_graph.R
index 13756eb..ee31aab 100644
--- a/encoder/call_graph.R
+++ b/encoder/call_graph.R
@@ -21,12 +21,12 @@ options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
 
 FeedbackFileBase <- paste(options[5], "/chronojump-encoder-status-", sep="")
 SpecialData <- paste(options[5], "/chronojump-special-data.txt", sep="")
-OperatingSystem <- options[27]
+OperatingSystem <- options[28]
 
 EncoderConfigurationName <- ""
 
-English = unlist(strsplit(options[28], "\\;"))
-Translated = unlist(strsplit(options[29], "\\;"))
+English = unlist(strsplit(options[29], "\\;"))
+Translated = unlist(strsplit(options[30], "\\;"))
 
 DEBUG <- FALSE
 DebugFileName <- paste(options[5], "/chronojump-debug.txt", sep="")
diff --git a/encoder/graph.R b/encoder/graph.R
index eb3ed78..e1088b5 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2168,10 +2168,6 @@ doProcess <- function(options)
        op$Title=parse(text = paste0("'", op$Title, "'"))
        print(c("1 Title=",op$Title))
        
-       #options 29 and 30 is assigned on the top of the file to be available in all functions
-       #print(options[29])
-       #print(options[30])
-
        #--- include files ---
        if(op$Analysis == "neuromuscularProfile")
                source(paste(op$EncoderRScriptsPath, "/neuromuscularProfile.R", sep=""))
@@ -2445,8 +2441,9 @@ doProcess <- function(options)
                if(isInertial(op$EncoderConfigurationName)) 
                {
                        #This process is only done on the curves after capture (not on recalculate or load)
-                       if(op$Analysis == "curvesAC")
+                       if(op$Analysis == "curvesAC" && op$CheckFullyExtended > 0)
                                displacement <- fixInertialSignalIfNotFullyExtended(displacement, 
+                                                                                   op$CheckFullyExtended,
                                                                                    paste(op$EncoderTempPath,
                                                                                          
"/chronojump-last-encoder-data.txt",
                                                                                          sep=""),
diff --git a/encoder/util.R b/encoder/util.R
index d59d4b1..0939ef4 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -60,27 +60,28 @@ assignOptions <- function(options) {
                    Analysis            = options[11],  
                    AnalysisVariables   = unlist(strsplit(options[12], "\\;")),
                    AnalysisOptions     = options[13],
-                   EncoderConfigurationName =  options[14],    #just the name of the EncoderConfiguration    
  
-                   diameter            = as.numeric(unlist(strsplit(options[15], "\\;"))), #comes in cm, 
will be converted to m. Since 1.5.1 can be different diameters separated by ;
+                   CheckFullyExtended  = as.numeric(options[14]),
+                   EncoderConfigurationName =  options[15],    #just the name of the EncoderConfiguration    
  
+                   diameter            = as.numeric(unlist(strsplit(options[16], "\\;"))), #comes in cm, 
will be converted to m. Since 1.5.1 can be different diameters separated by ;
                    #diameter    = getInertialDiametersPerTick(as.numeric(unlist(strsplit("1.5; 1.75; 2.65; 
3.32; 3.95; 4.07; 4.28; 4.46; 4.54; 4.77; 4.96; 5.13; 5.3; 5.55", "\\;")))),
-                   diameterExt         = as.numeric(options[16]),      #comes in cm, will be converted to m
-                   anglePush           = as.numeric(options[17]),
-                   angleWeight         = as.numeric(options[18]),
-                   inertiaMomentum     = (as.numeric(options[19])/10000.0),    #comes in Kg*cm^2 eg: 100; 
convert it to Kg*m^2 eg: 0.010
-                   gearedDown          = readFromFile.gearedDown(as.numeric(options[20])),
-
-                   SmoothingOneC       = as.numeric(options[21]),
-                   Jump                = options[22],
-                   Width               = as.numeric(options[23]),
-                   Height              = as.numeric(options[24]),
-                   DecimalSeparator    = options[25],
-                   Title               = options[26],
-                   OperatingSystem     = options[27],  #if this changes, change it also at start of this R 
file
-                   Debug               = options[30],
-                   CrossValidate       = options[31]
+                   diameterExt         = as.numeric(options[17]),      #comes in cm, will be converted to m
+                   anglePush           = as.numeric(options[18]),
+                   angleWeight         = as.numeric(options[19]),
+                   inertiaMomentum     = (as.numeric(options[20])/10000.0),    #comes in Kg*cm^2 eg: 100; 
convert it to Kg*m^2 eg: 0.010
+                   gearedDown          = readFromFile.gearedDown(as.numeric(options[21])),
+
+                   SmoothingOneC       = as.numeric(options[22]),
+                   Jump                = options[23],
+                   Width               = as.numeric(options[24]),
+                   Height              = as.numeric(options[25]),
+                   DecimalSeparator    = options[26],
+                   Title               = options[27],
+                   OperatingSystem     = options[28],  #if this changes, change it also at call_graph.R
+                   Debug               = options[31],
+                   CrossValidate       = options[32]
                    #Unassigned here:
-                   #   englishWords [28]
-                   #   translatedWords [29]
+                   #   englishWords [29]
+                   #   translatedWords [30]
                    ))
 }
 
@@ -1103,7 +1104,7 @@ getDisplacementInertialBody <- function(positionStart, displacement, draw, title
 #used when user captures without string fully extended
 #signal is the information coming from the encoder, graph is to debug
 #see codeExplained/image detect-and-fix-inertial-string-not-fully-extended.png
-fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, specialDataFile, graph)
+fixInertialSignalIfNotFullyExtended <- function(signal, checkRevolutions, saveFile, specialDataFile, graph)
 {
        write("at fixInertialSignalIfNotFullyExtended", stderr())
        angle <- cumsum(signal) #360 degrees every 200 ticks
@@ -1195,8 +1196,9 @@ fixInertialSignalIfNotFullyExtended <- function(signal, saveFile, specialDataFil
                par(mfrow=c(1,1))
        }
 
-       #define new signal only if the error in extended string is more than 5 revolutions
-       if(abs(meanByExtrema) > 1000) {
+       #define new signal only if the error in extended string is more than 4 revolutions 
+       #(this value can be changed from gui)
+       if( abs(meanByExtrema) > (checkRevolutions * 200) ) {
                #write(signal, file="/tmp/old.txt", ncolumns=length(signal), sep=", ")
                signal <- signal[angleCorrectedCrossZero:length(signal)]
 
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 9da9b58..33b3c52 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -18032,6 +18032,12 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22814,6 +22820,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24077,6 +24089,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -25832,6 +25850,12 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -26644,6 +26668,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -40174,6 +40204,42 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -43189,6 +43255,30 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -44348,12 +44438,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -45616,6 +45700,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -47131,6 +47221,119 @@ It starts before and arrives there with some speed.</property>
                           </packing>
                         </child>
                         <child>
+                          <widget class="GtkVBox" id="vbox21">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">8</property>
+                            <child>
+                              <widget class="GtkCheckButton" id="checkbutton_encoder_capture_fully_extended">
+                                <property name="label" translatable="yes">Check if string is fully extended 
at start of inertial capture.</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <signal name="toggled" 
handler="on_checkbutton_encoder_capture_fully_extended_toggled" swapped="no"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox_encoder_capture_fully_extended">
+                                <property name="can_focus">False</property>
+                                <property name="tooltip" translatable="yes">Is string is not extended by 
this value or more, signal will be corrected.</property>
+                                <property name="spacing">10</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label56">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="xpad">12</property>
+                                    <property name="label" translatable="yes">Turns</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkSpinButton" id="spin_encoder_capture_fully_extended">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">●</property>
+                                    <property name="width_chars">2</property>
+                                    <property name="invisible_char_set">True</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
+                                    <property name="adjustment">4 1 20 1 1 0</property>
+                                    <property name="climb_rate">1</property>
+                                    <property name="snap_to_ticks">True</property>
+                                    <property name="numeric">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox20">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">8</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label57">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label" translatable="yes">Recommended:</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkLabel" id="label58">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label">4</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="padding">20</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
                           <widget class="GtkFrame" id="frame6">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
@@ -47372,7 +47575,7 @@ It starts before and arrives there with some speed.</property>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
@@ -47506,7 +47709,7 @@ It starts before and arrives there with some speed.</property>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">2</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
@@ -47631,7 +47834,7 @@ It starts before and arrives there with some speed.</property>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">3</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                       </widget>
@@ -49846,6 +50049,12 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -50773,6 +50982,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -51715,6 +51930,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/encoder.cs b/src/encoder.cs
index 3214dd1..832006b 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -42,6 +42,8 @@ public class EncoderParams
        private string analysis;
        private string analysisVariables;
        private string analysisOptions;         //p: propulsive
+       private bool captureCheckFullyExtended;
+       private int captureCheckFullyExtendedValue;
                                        
        //encoderConfiguration conversions
        //in signals and curves, need to do conversions (invert, inertiaMomentum, diameter)
@@ -73,6 +75,7 @@ public class EncoderParams
        //to graph.R    
        public EncoderParams(int minHeight, int exercisePercentBodyWeight, string massBody, string massExtra, 
                        string eccon, string analysis, string analysisVariables, string analysisOptions, 
+                       bool captureCheckFullyExtended, int captureCheckFullyExtendedValue,
                        EncoderConfiguration encoderConfiguration,
                        string smoothCon, int curve, int width, int height, string decimalSeparator)
        {
@@ -84,6 +87,8 @@ public class EncoderParams
                this.analysis = analysis;
                this.analysisVariables = analysisVariables;
                this.analysisOptions = analysisOptions;
+               this.captureCheckFullyExtended = captureCheckFullyExtended;
+               this.captureCheckFullyExtendedValue = captureCheckFullyExtendedValue;
                this.encoderConfiguration = encoderConfiguration;
                this.smoothCon = smoothCon;
                this.curve = curve;
@@ -94,6 +99,10 @@ public class EncoderParams
        
        public string ToStringROptions () 
        {
+               string capFullyExtendedStr = "-1";
+               if(captureCheckFullyExtended)
+                       capFullyExtendedStr = captureCheckFullyExtendedValue.ToString(); 
+               
                return 
                        "#minHeight\n" +        minHeight + "\n" + 
                        "#exercisePercentBodyWeight\n" + exercisePercentBodyWeight + "\n" + 
@@ -103,6 +112,7 @@ public class EncoderParams
                        "#analysis\n" +         analysis + "\n" + 
                        "#analysisVariables\n" + analysisVariables + "\n" + 
                        "#analysisOptions\n" + analysisOptions + "\n" + 
+                       "#captureCheckFullyExtended\n" + capFullyExtendedStr + "\n" + 
                        encoderConfiguration.ToStringOutput(EncoderConfiguration.Outputs.ROPTIONS) + "\n" +
                        "#smoothCon\n" +        smoothCon + "\n" + 
                        "#curve\n" +            curve + "\n" + 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4fe48f9..d04b6d3 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -999,6 +999,8 @@ public partial class ChronoJumpWindow
                                analysis,
                                "none",                         //analysisVariables (not needed in create 
curves). Cannot be blank
                                analysisOptions,
+                               preferences.encoderCaptureCheckFullyExtended,
+                               preferences.encoderCaptureCheckFullyExtendedValue,
                                encoderConfigurationCurrent,
                                Util.ConvertToPoint(preferences.encoderSmoothCon),      //R decimal: '.'
                                0,                      //curve is not used here
@@ -1492,6 +1494,8 @@ public partial class ChronoJumpWindow
                                "exportCSV",
                                "none",                                         //analysisVariables (not 
needed in create curves). Cannot be blank
                                analysisOptions,
+                               preferences.encoderCaptureCheckFullyExtended,
+                               preferences.encoderCaptureCheckFullyExtendedValue,
                                encoderConfigurationCurrent,
                                Util.ConvertToPoint(preferences.encoderSmoothCon),      //R decimal: '.'
                                -1,
@@ -2326,6 +2330,8 @@ public partial class ChronoJumpWindow
                                        sendAnalysis,
                                        analysisVariables,
                                        analysisOptions,
+                                       preferences.encoderCaptureCheckFullyExtended,
+                                       preferences.encoderCaptureCheckFullyExtendedValue,
                                        new EncoderConfiguration(),
                                        Util.ConvertToPoint(preferences.encoderSmoothCon),      //R decimal: 
'.'
                                        myCurveNum,
@@ -2455,6 +2461,8 @@ public partial class ChronoJumpWindow
                                        sendAnalysis,
                                        analysisVariables, 
                                        analysisOptions,
+                                       preferences.encoderCaptureCheckFullyExtended,
+                                       preferences.encoderCaptureCheckFullyExtendedValue,
                                        encoderConfigurationCurrent,
                                        Util.ConvertToPoint(preferences.encoderSmoothCon),      //R decimal: 
'.'
                                        curveNum,
@@ -4729,6 +4737,8 @@ public partial class ChronoJumpWindow
                                "-",            //analysis
                                "none",         //analysisVariables (not needed in create curves). Cannot be 
blank
                                getEncoderAnalysisOptions(),    //used on capture for pass the 'p' of 
propulsive
+                               preferences.encoderCaptureCheckFullyExtended,
+                               preferences.encoderCaptureCheckFullyExtendedValue,
                                encoderConfigurationCurrent,
                                Util.ConvertToPoint(preferences.encoderSmoothCon),      //R decimal: '.'
                                0,                      //curve is not used here
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 74e78f9..633428c 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -91,6 +91,9 @@ public class PreferencesWindow {
        
        //encoder tab   
        [Widget] Gtk.CheckButton checkbutton_encoder_propulsive;
+       [Widget] Gtk.CheckButton checkbutton_encoder_capture_fully_extended;
+       [Widget] Gtk.HBox hbox_encoder_capture_fully_extended;
+       [Widget] Gtk.SpinButton spin_encoder_capture_fully_extended;
        [Widget] Gtk.SpinButton spin_encoder_smooth_con;
        [Widget] Gtk.Label label_encoder_con;
        [Widget] Gtk.RadioButton radio_encoder_1RM_nonweighted;
@@ -282,6 +285,11 @@ public class PreferencesWindow {
        
                //encoder       
                PreferencesWindowBox.checkbutton_encoder_propulsive.Active = preferences.encoderPropulsive;
+
+               PreferencesWindowBox.checkbutton_encoder_capture_fully_extended.Active = 
preferences.encoderCaptureCheckFullyExtended;
+               PreferencesWindowBox.spin_encoder_capture_fully_extended.Value = 
preferences.encoderCaptureCheckFullyExtendedValue;
+               PreferencesWindowBox.hbox_encoder_capture_fully_extended.Visible = 
preferences.encoderCaptureCheckFullyExtended;
+               
                PreferencesWindowBox.spin_encoder_smooth_con.Value = preferences.encoderSmoothCon;
 
                if(preferences.encoder1RMMethod == Constants.Encoder1RMMethod.NONWEIGHTED)
@@ -345,6 +353,12 @@ public class PreferencesWindow {
                
                combo_camera.Active = UtilGtk.ComboMakeActive(devices, devices[current]);
        }
+               
+       
+       private void on_checkbutton_encoder_capture_fully_extended_toggled(object obj, EventArgs args) {
+               hbox_encoder_capture_fully_extended.Visible = 
checkbutton_encoder_capture_fully_extended.Active;
+       }
+
 
        // ---- Language stuff
        
@@ -972,6 +986,18 @@ public class PreferencesWindow {
                                        
PreferencesWindowBox.checkbutton_encoder_propulsive.Active.ToString(), true);
                        preferences.encoderPropulsive = 
PreferencesWindowBox.checkbutton_encoder_propulsive.Active;
                }
+               
+               if( preferences.encoderCaptureCheckFullyExtended != 
PreferencesWindowBox.checkbutton_encoder_capture_fully_extended.Active ) {
+                       SqlitePreferences.Update("encoderCaptureCheckFullyExtended", 
+                                       
PreferencesWindowBox.checkbutton_encoder_capture_fully_extended.Active.ToString(), true);
+                       preferences.encoderCaptureCheckFullyExtended = 
PreferencesWindowBox.checkbutton_encoder_capture_fully_extended.Active;
+               }
+               
+               if( preferences.encoderCaptureCheckFullyExtendedValue != (int) 
PreferencesWindowBox.spin_encoder_capture_fully_extended.Value ) {
+                       SqlitePreferences.Update("encoderCaptureCheckFullyExtendedValue", 
+                                       
PreferencesWindowBox.spin_encoder_capture_fully_extended.Value.ToString(), true);
+                       preferences.encoderCaptureCheckFullyExtendedValue = (int) 
PreferencesWindowBox.spin_encoder_capture_fully_extended.Value;
+               }
 
                if( preferences.encoderSmoothCon != (double) 
PreferencesWindowBox.spin_encoder_smooth_con.Value ) {
                        SqlitePreferences.Update("encoderSmoothCon", Util.ConvertToPoint( 
diff --git a/src/preferences.cs b/src/preferences.cs
index 192ddb2..8bcbda4 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -46,6 +46,8 @@ public class Preferences
        public int runIDoubleContactsMS; //milliseconds
        
        public bool encoderPropulsive;
+       public bool encoderCaptureCheckFullyExtended;
+       public int encoderCaptureCheckFullyExtendedValue;
        public double encoderSmoothCon;
        public int videoDeviceNum;              //AKA videoDevice
        public Constants.Encoder1RMMethod encoder1RMMethod;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index a6260ea..45c5dbc 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -78,7 +78,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "1.30";
+       static string lastChronojumpDatabaseVersion = "1.31";
 
        public Sqlite() {
        }
@@ -1892,6 +1892,16 @@ class Sqlite
                                SqlitePreferences.Update ("databaseVersion", newVersion, true); 
                                currentVersion = newVersion;
                        }
+                       if(currentVersion == "1.30") {
+                               LogB.SQL("Insert encoderCaptureCheckFullyExtended and ...Value at 
preferences");
+
+                               SqlitePreferences.Insert ("encoderCaptureCheckFullyExtended", "True");
+                               SqlitePreferences.Insert ("encoderCaptureCheckFullyExtendedValue", "4");
+
+                               newVersion = "1.31";
+                               SqlitePreferences.Update ("databaseVersion", newVersion, true); 
+                               currentVersion = newVersion;
+                       }
 
 
 
@@ -2052,6 +2062,7 @@ class Sqlite
                SqliteExecuteAuto.addChronojumpProfileAndBilateral();
                
                //changes [from - to - desc]
+               //1.30 - 1.31 Converted DB to 1.31 Insert encoderCaptureCheckFullyExtended and ...Value at 
preferences
                //1.29 - 1.30 Converted DB to 1.30 Added SIMULATED session
                //1.28 - 1.29 Converted DB to 1.29 Changed reaction time rows have reactionTime as default 
value
                //1.27 - 1.28 Converted DB to 1.28 Changed encoderAutoSaveCurve BESTMEANPOWER to BEST
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index 6173030..80c51b4 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -84,6 +84,8 @@ class SqlitePreferences : Sqlite
                                Insert ("multimediaStorage", 
Constants.MultimediaStorage.BYSESSION.ToString(), dbcmdTr);
 
                                Insert ("encoderPropulsive", "True", dbcmdTr);
+                               Insert ("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
+                               Insert ("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
                                Insert ("encoderSmoothEccCon", "0.6", dbcmdTr);
                                Insert ("encoderSmoothCon", "0.7", dbcmdTr);
                                Insert ("videoDevice", "0", dbcmdTr); //first
@@ -209,6 +211,10 @@ class SqlitePreferences : Sqlite
                                preferences.metersSecondsPreferred = reader[1].ToString() == "True";
                        else if(reader[0].ToString() == "encoderPropulsive")
                                preferences.encoderPropulsive = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == "encoderCaptureCheckFullyExtended")
+                               preferences.encoderCaptureCheckFullyExtended = reader[1].ToString() == "True";
+                       else if(reader[0].ToString() == "encoderCaptureCheckFullyExtendedValue")
+                               preferences.encoderCaptureCheckFullyExtendedValue = 
Convert.ToInt32(reader[1].ToString());
                        else if(reader[0].ToString() == "encoderSmoothCon")
                                preferences.encoderSmoothCon = Convert.ToDouble(
                                                Util.ChangeDecimalSeparator(reader[1].ToString()));


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