[chronojump] Doing encoder inertial



commit 7c8526de685c14cd0d07d9909d866be40da9aa43
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jul 17 01:28:19 2013 +0200

    Doing encoder inertial

 encoder/graph.R        |  102 +++++-
 glade/chronojump.glade |  917 +++++++++++++++++++++++++++---------------------
 src/constants.cs       |    1 +
 src/encoder.cs         |   13 +-
 src/gui/encoder.cs     |   51 ++-
 src/sqlite/encoder.cs  |    4 +-
 src/sqlite/main.cs     |   42 +++-
 7 files changed, 695 insertions(+), 435 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index adee8d2..943c5a4 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -84,7 +84,7 @@ write("(1/5) Starting R", OutputData2)
 
 
 #this will replace below methods: findPics1ByMinindex, findPics2BySpeed
-findCurves <- function(rawdata, eccon, min_height, draw, title) {
+findCurves <- function(rawdata, eccon, min_height, draw, title, analysis) {
        a=cumsum(rawdata)
        b=extrema(a)
        print("at findCurves")
@@ -177,11 +177,18 @@ findCurves <- function(rawdata, eccon, min_height, draw, title) {
                }
        }
        if(draw) {
+               lty=1
+               col="black"
+               if(analysis == "curvesRI") {
+                       lty=2
+                       col="gray"
+               }
                plot((1:length(a))/1000                 #ms -> s
                     ,a/10,                             #mm -> cm
                     type="l",
                     xlim=c(1,length(a))/1000,          #ms -> s
-                    xlab="",ylab="",axes=T) 
+                    xlab="",ylab="",axes=T,
+                    lty=lty,col=col) 
                
                title(title, cex.main=1, font.main=1)
                mtext("time (s) ",side=1,adj=1,line=-1)
@@ -189,12 +196,53 @@ findCurves <- function(rawdata, eccon, min_height, draw, title) {
                abline(v=b$maxindex/1000,lty=3); abline(v=b$minindex/1000,lty=3)        #ms -> s
        
                #plot speed (currently disabled)        
-               #speed <- smooth.spline( 1:length(rawdata), rawdata, spar=smoothingAll)
-               #abline(h=0,lty=2,col="yellow")
-               #lines((1:length(rawdata))/1000, speed$y*10, col="green")
-               #print("SPEEEDYYYY")
-               #print(max(speed$y))    
-               #print(min(speed$y))    
+               #if(analysis == "curvesRI") {
+               #       speed <- smooth.spline( 1:length(rawdata), rawdata, spar=smoothingAll)
+               #       abline(h=0,lty=2,col="green")
+               #       lines((1:length(rawdata))/1000, speed$y*50, col="green")
+               #}
+       }
+       return(as.data.frame(cbind(start,end,startH)))
+}
+
+#all rawdata will be negative because we start on the top
+fixRawdataRIByKnowingHeight <- function(rawdata) {
+       #do not do this:
+       #rawdata[which(rawdata.c >= 0)] = rawdata[which(rawdata.c >= 0)]*-1
+       
+       #do this: work with cumsum, do ABS on cumsum, then *-1
+       #then to obtain rawdata again just do diff (and add first number)
+
+       rawdata.c = abs(cumsum(rawdata))*-1
+
+       lines((1:length(rawdata.c))/1000, rawdata.c/10, col="black", lwd=1)
+
+       #this is to make "inverted cumsum"
+       rawdata = c(0,diff(rawdata.c))
+
+       return(rawdata)
+}
+fixCurvesRIByKnowingHeight <- function(rawdata, curves) {
+       start=0; end=0; startH=0
+       count=0
+       n=length(curves[,1]) #rows
+       for(i in 1:n) {
+               a=rawdata[curves[i,1]:curves[i,2]]
+               a.cumsum=cumsum(a)
+               b.cumsum=extrema(a.cumsum)
+               changeAt = b.cumsum$maxindex[1,1]
+
+               #abline(v=(curves[i,1] + changeAt)/1000, col="green")
+               
+               count = count +1
+               start[count]=curves[i,1]
+               end[count]= curves[i,1] + changeAt
+               startH[count]=0
+               
+               count = count +1
+               start[count]= curves[i,1] + changeAt +1
+               end[count]=curves[i,2]
+               startH[count]=cumsum(rawdata)[curves[i,2]] #stored but incorrect because rawdata need to be 
corrected
        }
        return(as.data.frame(cbind(start,end,startH)))
 }
@@ -207,6 +255,7 @@ reduceCurveBySpeed <- function(eccon, row, startT, rawdata, smoothingOneEC, smoo
        a=rawdata
        
        #debug
+       print("at reduceCurveBySpeed")
        #print("startT and aaaaaaaaaaaaaaaaaaaaaaa")
        #print(startT)
        #print(a)
@@ -236,13 +285,14 @@ reduceCurveBySpeed <- function(eccon, row, startT, rawdata, smoothingOneEC, smoo
        bcrossLen = length(b$cross[,2])
        if(bcrossLen == 0)
                x.ini = 0
-       else if(bcrossLen == 1)
+       else if(bcrossLen == 1) {
                if(b$cross[,2] < maxSpeedT) 
                        x.ini = b$cross[,2]
-       else 
+       } else { 
                for(i in b$cross[,2]) 
                        if(i < maxSpeedT) 
                                x.ini = i
+       }
 
        #debug
        #print(b)
@@ -1277,7 +1327,7 @@ doProcess <- function(options) {
        #       titleType="jump"
 
        curvesPlot = FALSE
-       if(Analysis=="curves") {
+       if(Analysis == "curves" || Analysis == "curvesRI") {
                curvesPlot = TRUE
                par(mar=c(2,2.5,2,1))
        }
@@ -1420,16 +1470,32 @@ doProcess <- function(options) {
                        quit()
                }
 
+               if(Analysis == "curvesRI") 
+                       Eccon = "ecS"
+               
+               curves=findCurves(rawdata, Eccon, MinHeight, curvesPlot, Title, Analysis)
+
+               print("curves PRE")
+               print(curves)
+
+               if(Analysis == "curvesRI") {
+                       rawdata = fixRawdataRIByKnowingHeight(rawdata)
+                       curves = fixCurvesRIByKnowingHeight(rawdata, curves)
+
+               }
                rawdata.cumsum=cumsum(rawdata)
 
-               curves=findCurves(rawdata, Eccon, MinHeight, curvesPlot, Title)
+               print("curves POST")
                print(curves)
+
                n=length(curves[,1])
                quitIfNoData(n, curves, OutputData1)
 
-               for(i in 1:n) { 
-                       curves[i,1]=reduceCurveBySpeed(Eccon, i, curves[i,1], 
rawdata[curves[i,1]:curves[i,2]], 
-                                                      SmoothingOneEC, SmoothingOneC)
+               if(Analysis != "curvesRI") {
+                       for(i in 1:n) { 
+                               curves[i,1]=reduceCurveBySpeed(Eccon, i, curves[i,1], 
rawdata[curves[i,1]:curves[i,2]], 
+                                                              SmoothingOneEC, SmoothingOneC)
+                       }
                }
                if(curvesPlot) {
                        #/10 mm -> cm
@@ -1439,6 +1505,8 @@ doProcess <- function(options) {
                                adjVert = 0
                                if(Eccon=="ecS") {
                                        myEc=c("c","e")
+                                       if(Analysis == "curvesRI")
+                                               myEc=c("e","c")
                                        myLabel = paste(trunc((i+1)/2),myEc[((i%%2)+1)],sep="")
                                        myY = rawdata.cumsum[curves[i,1]]/10
                                        if(i%%2 == 1) {
@@ -1578,7 +1646,7 @@ doProcess <- function(options) {
        if(
           Analysis == "powerBars" || analysisCross[1] == "cross" || 
           Analysis == "1RMBadillo2010" || analysisCross[1] == "1RMAnyExercise" || 
-          Analysis == "curves" || writeCurves) 
+          Analysis == "curves" || Analysis == "curvesRI" || writeCurves) 
        {
                paf = data.frame()
                discardedCurves = NULL
@@ -1682,7 +1750,7 @@ doProcess <- function(options) {
                        paint1RMBadillo2010(paf, Title, OutputData1)
                } 
                
-               if(Analysis == "curves" || writeCurves) {
+               if(Analysis == "curves" || Analysis == "curvesRI" || writeCurves) {
                        if(singleFile)
                                paf=cbind(
                                          "1",                  #seriesName
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index b069da3..3eae7e7 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -11986,27 +11986,209 @@ on current Chronojump version.</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">4</property>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox58">
+                                          <widget class="GtkHBox" id="hbox96">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
+                                            <property name="spacing">12</property>
                                             <child>
-                                              <widget class="GtkFrame" id="frame18">
+                                              <widget class="GtkAlignment" id="alignment21">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label_xalign">0</property>
-                                                <property name="label_yalign">0.69999998807907104</property>
-                                                <property name="shadow_type">out</property>
+                                                <property name="top_padding">2</property>
                                                 <child>
-                                                  <widget class="GtkAlignment" id="alignment22">
+                                                  <widget class="GtkNotebook" id="notebook2">
                                                     <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
-                                                    <property name="left_padding">6</property>
-                                                    <property name="right_padding">6</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="tab_hborder">10</property>
+                                                    <child>
+                                                      <widget class="GtkVBox" id="vbox92">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="border_width">8</property>
+                                                        <property name="spacing">8</property>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox58">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label119">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">Type</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox90">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">8</property>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_linear">
+                                                            <property name="label" translatable="yes">Linear 
(default)</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_linear_inverted">
+                                                            <property name="label" 
translatable="yes">Inverted</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Linear Encoder upside down</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <property 
name="group">radiobutton_encoder_capture_linear</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_rotary_inertial">
+                                                            <property name="label" translatable="yes">Rotary 
/ inertial</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Rotary encoder on inertial machine</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <property 
name="group">radiobutton_encoder_capture_linear</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox76">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label84">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">Capture</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox75">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_safe">
+                                                            <property name="label" 
translatable="yes">Safe</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_external">
+                                                            <property name="label" 
translatable="yes">External</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">External</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="image_position">right</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <property 
name="group">radiobutton_encoder_capture_safe</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">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>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="tab_fill">False</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label90">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label" 
translatable="yes">Encoder</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="tab_fill">False</property>
+                                                        <property name="type">tab</property>
+                                                      </packing>
+                                                    </child>
                                                     <child>
                                                       <widget class="GtkHBox" id="hbox79">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
-                                                        <property name="spacing">12</property>
+                                                        <property name="border_width">8</property>
+                                                        <property name="spacing">8</property>
                                                         <child>
                                                           <widget class="GtkVBox" id="vbox2">
                                                             <property name="visible">True</property>
@@ -12154,6 +12336,7 @@ on current Chronojump version.</property>
                                                             <widget class="GtkLabel" id="label88">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="has_tooltip">True</property>
                                                             <property name="tooltip" 
translatable="yes">Extra weight in Kg</property>
                                                             <property name="xalign">1</property>
                                                             <property name="label" translatable="yes">Extra 
weight</property>
@@ -12164,6 +12347,7 @@ on current Chronojump version.</property>
                                                             <widget class="GtkLabel" id="label78">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="has_tooltip">True</property>
                                                             <property name="tooltip" 
translatable="yes">Displaced weight in Kg</property>
                                                             <property name="xalign">1</property>
                                                             <property name="label" 
translatable="yes">Displaced</property>
@@ -12184,6 +12368,7 @@ on current Chronojump version.</property>
                                                             <widget class="GtkLabel" id="label86">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="has_tooltip">True</property>
                                                             <property name="tooltip">1 RM (%)</property>
                                                             <property name="xalign">0</property>
                                                             <property name="label">1RM</property>
@@ -12308,17 +12493,29 @@ on current Chronojump version.</property>
                                                             <property name="position">2</property>
                                                           </packing>
                                                         </child>
-                                                        <child>
-                                                          <widget class="GtkVSeparator" id="vseparator5">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">3</property>
-                                                          </packing>
-                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label108">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label" 
translatable="yes">Exercise</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">1</property>
+                                                        <property name="tab_fill">False</property>
+                                                        <property name="type">tab</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox102">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="border_width">8</property>
+                                                        <property name="spacing">20</property>
                                                         <child>
                                                           <widget class="GtkVBox" id="vbox19">
                                                             <property name="visible">True</property>
@@ -12328,13 +12525,23 @@ on current Chronojump version.</property>
                                                             <widget class="GtkHBox" id="hbox114">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
+                                                            <property name="spacing">8</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label113">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Recording time</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_time">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Recording time</property>
                                                             <property name="invisible_char">●</property>
                                                             <property name="width_chars">3</property>
                                                             <property 
name="invisible_char_set">True</property>
@@ -12350,7 +12557,7 @@ on current Chronojump version.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -12364,7 +12571,7 @@ on current Chronojump version.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -12378,13 +12585,23 @@ on current Chronojump version.</property>
                                                             <widget class="GtkHBox" id="hbox115">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
+                                                            <property name="spacing">8</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label118">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Minimal height</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_min_height">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Minimal height</property>
                                                             <property name="invisible_char">●</property>
                                                             <property name="width_chars">3</property>
                                                             <property 
name="invisible_char_set">True</property>
@@ -12400,7 +12617,7 @@ on current Chronojump version.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -12414,7 +12631,7 @@ on current Chronojump version.</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -12426,49 +12643,15 @@ on current Chronojump version.</property>
                                                             </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">4</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkVSeparator" id="vseparator6">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                          </widget>
-                                                          <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">5</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkVBox" id="vbox87">
+                                                          <widget class="GtkVBox" id="vbox88">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">8</property>
-                                                            <child>
-                                                            <widget class="GtkCheckButton" 
id="check_encoder_inverted">
-                                                            <property name="label" 
translatable="yes">Inverted</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Encoder is upside down</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox96">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_encoder_bells">
                                                             <property name="visible">True</property>
@@ -12488,70 +12671,43 @@ on current Chronojump version.</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
-                                                            <property name="fill">True</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_recalculate">
-                                                            <property name="width_request">40</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="can_default">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Recalculate signal with changed parameters</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="use_underline">True</property>
-                                                            <signal name="clicked" 
handler="on_button_encoder_recalculate_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" id="image23">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="stock">gtk-refresh</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="pack_type">end</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>
+                                                            <placeholder/>
                                                             </child>
                                                           </widget>
                                                           <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">6</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
                                                           </packing>
                                                         </child>
                                                       </widget>
+                                                      <packing>
+                                                        <property name="position">2</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label111">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label" 
translatable="yes">Other</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">2</property>
+                                                        <property name="tab_fill">False</property>
+                                                        <property name="type">tab</property>
+                                                      </packing>
                                                     </child>
                                                   </widget>
                                                 </child>
-                                                <child>
-                                                  <widget class="GtkLabel" id="label84">
-                                                    <property name="visible">True</property>
-                                                    <property name="can_focus">False</property>
-                                                    <property name="label" 
translatable="yes">Exercise</property>
-                                                    <property name="use_markup">True</property>
-                                                  </widget>
-                                                  <packing>
-                                                    <property name="type">label_item</property>
-                                                  </packing>
-                                                </child>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
-                                                <property name="fill">True</property>
+                                                <property name="fill">False</property>
                                                 <property name="position">0</property>
                                               </packing>
                                             </child>
@@ -12563,6 +12719,7 @@ on current Chronojump version.</property>
                                                   <widget class="GtkHBox" id="hbox95">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
+                                                    <property name="spacing">4</property>
                                                     <child>
                                                       <widget class="GtkLabel" 
id="label_video_feedback_encoder">
                                                         <property name="visible">True</property>
@@ -12630,6 +12787,32 @@ on current Chronojump version.</property>
                                                         <property name="position">1</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkButton" 
id="button_video_play_this_test_encoder">
+                                                        <property name="visible">True</property>
+                                                        <property name="sensitive">False</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="has_tooltip">True</property>
+                                                        <property name="tooltip" translatable="yes">Play 
Video (v)</property>
+                                                        <property 
name="use_action_appearance">False</property>
+                                                        <signal name="clicked" 
handler="on_video_play_this_test_encoder_clicked" swapped="no"/>
+                                                        <accelerator key="v" signal="clicked"/>
+                                                        <child>
+                                                          <widget class="GtkImage" id="image2">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-media-play</property>
+                                                            <property name="icon-size">1</property>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">2</property>
+                                                      </packing>
+                                                    </child>
                                                   </widget>
                                                   <packing>
                                                     <property name="expand">False</property>
@@ -12639,7 +12822,7 @@ on current Chronojump version.</property>
                                                 </child>
                                                 <child>
                                                   <widget class="GtkHBox" id="hbox_video_capture_encoder">
-                                                    <property name="width_request">75</property>
+                                                    <property name="width_request">150</property>
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
                                                     <child>
@@ -12661,147 +12844,62 @@ on current Chronojump version.</property>
                                                 <property name="position">1</property>
                                               </packing>
                                             </child>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <widget class="GtkVBox" id="vbox48">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="spacing">4</property>
-                                            <property name="homogeneous">True</property>
                                             <child>
-                                              <widget class="GtkFrame" id="frame16">
+                                              <widget class="GtkVBox" id="vbox87">
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
-                                                <property name="label_xalign">0</property>
-                                                <property name="label_yalign">0.69999998807907104</property>
-                                                <property name="shadow_type">out</property>
                                                 <child>
-                                                  <widget class="GtkAlignment" id="alignment19">
+                                                  <widget class="GtkHBox" id="hbox77">
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
-                                                    <property name="left_padding">6</property>
-                                                    <property name="right_padding">6</property>
+                                                    <property name="spacing">10</property>
                                                     <child>
-                                                      <widget class="GtkVBox" id="vbox4">
+                                                      <widget class="GtkButton" 
id="button_encoder_load_signal">
                                                         <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="spacing">2</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="has_tooltip">True</property>
+                                                        <property name="tooltip" translatable="yes">Load 
signal</property>
+                                                        <property 
name="use_action_appearance">False</property>
+                                                        <signal name="clicked" 
handler="on_button_encoder_load_signal_clicked" swapped="no"/>
                                                         <child>
-                                                          <widget class="GtkHBox" id="hbox76">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">20</property>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox77">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox75">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
-                                                            <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_safe">
-                                                            <property name="label" 
translatable="yes">Safe</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="active">True</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_external">
-                                                            <property name="label" 
translatable="yes">External</property>
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="tooltip" 
translatable="yes">External</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="image_position">right</property>
-                                                            <property name="active">True</property>
-                                                            <property name="draw_indicator">True</property>
-                                                            <property 
name="group">radiobutton_encoder_capture_safe</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">True</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_capture">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="can_default">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="use_underline">True</property>
-                                                            <property name="xalign">0</property>
-                                                            <signal name="clicked" 
handler="on_button_encoder_capture_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkLabel" id="label93">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label">Capture</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">True</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox82">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
-                                                            <child>
-                                                            <widget class="GtkProgressBar" 
id="encoder_pulsebar_capture">
-                                                            <property name="width_request">150</property>
+                                                          <widget class="GtkImage" id="image24">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="activity_mode">True</property>
-                                                            <property name="show_text">True</property>
-                                                            <property 
name="pulse_step">0.10000000149</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_capture_cancel">
+                                                            <property name="stock">gtk-open</property>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkButton" id="button_encoder_capture">
+                                                        <property name="label" 
translatable="yes">Capture</property>
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="can_default">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property 
name="use_action_appearance">False</property>
+                                                        <property name="use_underline">True</property>
+                                                        <signal name="clicked" 
handler="on_button_encoder_capture_clicked" swapped="no"/>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox107">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">4</property>
+                                                        <child>
+                                                          <widget class="GtkButton" 
id="button_encoder_capture_cancel">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
@@ -12819,15 +12917,15 @@ on current Chronojump version.</property>
                                                             <property name="stock">gtk-cancel</property>
                                                             </widget>
                                                             </child>
-                                                            </widget>
-                                                            <packing>
+                                                          </widget>
+                                                          <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_capture_finish">
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkButton" 
id="button_encoder_capture_finish">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
@@ -12845,92 +12943,92 @@ on current Chronojump version.</property>
                                                             <property name="stock">gtk-goto-last</property>
                                                             </widget>
                                                             </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</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>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox87">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_load_signal">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" translatable="yes">Load 
signal</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <signal name="clicked" 
handler="on_button_encoder_load_signal_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" id="image24">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="stock">gtk-open</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_video_play_this_test_encoder">
-                                                            <property name="visible">True</property>
-                                                            <property name="sensitive">False</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" translatable="yes">Play 
Video (v)</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <signal name="clicked" 
handler="on_video_play_this_test_encoder_clicked" swapped="no"/>
-                                                            <accelerator key="v" signal="clicked"/>
-                                                            <child>
-                                                            <widget class="GtkImage" id="image2">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="stock">gtk-media-play</property>
-                                                            <property name="icon-size">1</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
+                                                          </widget>
+                                                          <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkVSeparator" id="vseparator2">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">2</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox85">
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="pack_type">end</property>
+                                                        <property name="position">2</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkHBox" id="hbox82">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="spacing">10</property>
+                                                    <child>
+                                                      <widget class="GtkProgressBar" 
id="encoder_pulsebar_capture">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="activity_mode">True</property>
+                                                        <property name="show_text">True</property>
+                                                        <property name="pulse_step">0.10000000149</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkButton" 
id="button_encoder_recalculate">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="can_default">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="has_tooltip">True</property>
+                                                        <property name="tooltip" 
translatable="yes">Recalculate signal with changed parameters</property>
+                                                        <property 
name="use_action_appearance">False</property>
+                                                        <property name="use_underline">True</property>
+                                                        <signal name="clicked" 
handler="on_button_encoder_recalculate_clicked" swapped="no"/>
+                                                        <child>
+                                                          <widget class="GtkImage" id="image23">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <child>
-                                                            <widget class="GtkEntry" 
id="entry_encoder_signal_comment">
-                                                            <property name="width_request">125</property>
+                                                            <property name="stock">gtk-refresh</property>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="pack_type">end</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkHBox" id="hbox87">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="spacing">10</property>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox85">
+                                                        <property name="width_request">150</property>
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <child>
+                                                          <widget class="GtkEntry" 
id="entry_encoder_signal_comment">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="has_tooltip">True</property>
@@ -12941,15 +13039,15 @@ on current Chronojump version.</property>
                                                             <property 
name="secondary_icon_activatable">False</property>
                                                             <property 
name="primary_icon_sensitive">True</property>
                                                             <property 
name="secondary_icon_sensitive">True</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_update_signal">
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkButton" 
id="button_encoder_update_signal">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
@@ -12964,70 +13062,89 @@ on current Chronojump version.</property>
                                                             <property name="stock">gtk-save</property>
                                                             </widget>
                                                             </child>
-                                                            </widget>
-                                                            <packing>
+                                                          </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="position">3</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkVSeparator" id="vseparator3">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">4</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_delete_signal">
-                                                            <property name="visible">True</property>
-                                                            <property name="sensitive">False</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Delete signal</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <signal name="clicked" 
handler="on_button_encoder_delete_signal_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" 
id="image_encoder_signal_delete">
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkButton" 
id="button_encoder_delete_signal">
+                                                        <property name="visible">True</property>
+                                                        <property name="sensitive">False</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">True</property>
+                                                        <property name="has_tooltip">True</property>
+                                                        <property name="tooltip" translatable="yes">Delete 
signal</property>
+                                                        <property 
name="use_action_appearance">False</property>
+                                                        <signal name="clicked" 
handler="on_button_encoder_delete_signal_clicked" swapped="no"/>
+                                                        <child>
+                                                          <widget class="GtkImage" 
id="image_encoder_signal_delete">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="stock">gtk-delete</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">5</property>
-                                                            </packing>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">2</property>
-                                                            </packing>
-                                                            </child>
                                                           </widget>
-                                                          <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                          </packing>
                                                         </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">True</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">2</property>
+                                                  </packing>
+                                                </child>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">2</property>
+                                              </packing>
+                                            </child>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkVBox" id="vbox48">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="spacing">4</property>
+                                            <property name="homogeneous">True</property>
+                                            <child>
+                                              <widget class="GtkFrame" id="frame16">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label_xalign">0</property>
+                                                <property name="label_yalign">0.69999998807907104</property>
+                                                <property name="shadow_type">out</property>
+                                                <child>
+                                                  <widget class="GtkAlignment" id="alignment19">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="left_padding">6</property>
+                                                    <property name="right_padding">6</property>
+                                                    <child>
+                                                      <widget class="GtkVBox" id="vbox4">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="spacing">2</property>
                                                         <child>
                                                           <widget class="GtkHBox" id="hbox74">
                                                             <property name="visible">True</property>
@@ -13133,7 +13250,7 @@ on current Chronojump version.</property>
                                                           <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">0</property>
                                                           </packing>
                                                         </child>
                                                       </widget>
diff --git a/src/constants.cs b/src/constants.cs
index a8c8722..4e77a22 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -602,6 +602,7 @@ public class Constants
        public static string EncoderGraphInputMulti = "chronojump-encoder-graph-input-multi.csv"; 
 
        public enum EncoderCheckFileOp { ANALYZE_EXPORT_ALL_CURVES, ANALYZE_SAVE_IMAGE, ANALYZE_SAVE_TABLE}
+       public enum EncoderSignalMode { LINEAR, LINEARINVERTED, ROTARYINERTIAL }
        public enum Encoder1RMMethod { NONWEIGHTED, WEIGHTED, WEIGHTED2, WEIGHTED3 }
        public enum ContextMenu { NONE, EDITDELETE, DELETE }
 
diff --git a/src/encoder.cs b/src/encoder.cs
index d9e87a0..e71707d 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -267,7 +267,18 @@ public class EncoderSQL
        public string description;
        public string future1;  //active or inactive curves
        public string future2;  //URL of video of signals
-       public string future3;  //inverted
+       public string future3;  //Constants.EncoderSignalMode (only on signals)
+
+//TODO: 
+//convertir signal future3 inverted de "1" a "inverted" FET
+//convertir "0" i "" en "linear"                       FET
+//pq potser sera "linear" or "linearinverted" or "rotaryinertial"      FET
+//fer que al capturar es gravi el future3 amb rotaryinertial o el que sigui (provar-ho amb el darrer 
capturat)
+//gui/encoder.cs quan es capturi amb RI (click a capture) es desactiva el inverted i es posi ecc-con
+//en un futur posar con-ecc
+//linear, linear inverted i rotaryinertial com a radiobutton FET
+//que findCurves trobi be totes les curves basant-se en el fixed i no en l'original pq llavors no troba les 
darreres
+
        public string exerciseName;
        
        public string ecconLong;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 2288d1f..69aad4c 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -35,10 +35,13 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.SpinButton spin_encoder_displaced_weight;
        [Widget] Gtk.SpinButton spin_encoder_1RM_percent;
        
+       [Widget] Gtk.RadioButton radiobutton_encoder_capture_linear;
+       [Widget] Gtk.RadioButton radiobutton_encoder_capture_linear_inverted;
+       [Widget] Gtk.RadioButton radiobutton_encoder_capture_rotary_inertial;
+
        [Widget] Gtk.Button button_encoder_capture;
        [Widget] Gtk.RadioButton radiobutton_encoder_capture_safe;
        [Widget] Gtk.RadioButton radiobutton_encoder_capture_external;
-       [Widget] Gtk.CheckButton check_encoder_inverted;
        [Widget] Gtk.Button button_encoder_bells;
        [Widget] Gtk.Button button_encoder_capture_cancel;
        [Widget] Gtk.Button button_encoder_capture_finish;
@@ -144,6 +147,7 @@ public partial class ChronoJumpWindow
        double encoderSmoothCon;
 
        bool lastRecalculateWasInverted;
+       //bool capturingRotaryInertial;
 
        /* 
         * this contains last EncoderSQL captured, recalculated or loaded
@@ -263,7 +267,7 @@ public partial class ChronoJumpWindow
                                powerHigherCondition, powerLowerCondition,
                                peakPowerHigherCondition, peakPowerLowerCondition,
                                repetitiveConditionsWin.EncoderMainVariable,
-                               check_encoder_inverted.Active
+                               radiobutton_encoder_capture_linear_inverted.Active
                                ); 
 
                EncoderStruct es = new EncoderStruct(
@@ -274,7 +278,7 @@ public partial class ChronoJumpWindow
                                "",                                     //SpecialData
                                ep);                            
                                
-               lastRecalculateWasInverted = check_encoder_inverted.Active;
+               lastRecalculateWasInverted = radiobutton_encoder_capture_linear_inverted.Active;
 
                if (radiobutton_encoder_capture_external.Active) {
                        encoderStartVideoRecord();
@@ -419,11 +423,11 @@ public partial class ChronoJumpWindow
        void on_button_encoder_recalculate_clicked (object o, EventArgs args) 
        {
                if (File.Exists(Util.GetEncoderDataTempFileName())) {
-                       //change sign on signal file if check_encoder_inverted changed
+                       //change sign on signal file if radiobutton_encoder_capture_linear_inverted.Active 
changed
        
-                       if(lastRecalculateWasInverted != check_encoder_inverted.Active) {
+                       if(lastRecalculateWasInverted != radiobutton_encoder_capture_linear_inverted.Active) {
                                Util.ChangeSign(Util.GetEncoderDataTempFileName());
-                               lastRecalculateWasInverted = check_encoder_inverted.Active;
+                               lastRecalculateWasInverted = 
radiobutton_encoder_capture_linear_inverted.Active;
                        }
                        
                        encoderThreadStart(encoderModes.RECALCULATE_OR_LOAD);
@@ -483,11 +487,21 @@ public partial class ChronoJumpWindow
        //called on calculatecurves, recalculate and load
        private void encoderCreateCurvesGraphR() 
        {
+               string analysis = "curves";
+               //if(capturingRotaryInertial)
+               if(radiobutton_encoder_capture_rotary_inertial.Active)
+                       analysis = "curvesRI";
+
                string analysisOptions = "-";
                if(encoderPropulsive)
                        analysisOptions = "p";
 
-               string future3 = Util.BoolToInt(check_encoder_inverted.Active).ToString();
+               string future3 = Constants.EncoderSignalMode.LINEAR.ToString();
+               if(radiobutton_encoder_capture_linear_inverted.Active)
+                       future3 = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
+               //if(capturingRotaryInertial)
+               if(radiobutton_encoder_capture_rotary_inertial.Active)
+                       future3 = Constants.EncoderSignalMode.ROTARYINERTIAL.ToString();
                
                //see explanation on the top of this file
                lastEncoderSQL = new EncoderSQL(
@@ -517,14 +531,16 @@ public partial class ChronoJumpWindow
                                getExercisePercentBodyWeightFromCombo (),
                                Util.ConvertToPoint(findMassFromCombo(true)),
                                findEccon(true),                                        //force ecS (ecc-conc 
separated)
-                               "curves",
+                               analysis,
                                analysisOptions,
                                Util.ConvertToPoint(encoderSmoothEccCon),               //R decimal: '.'
                                Util.ConvertToPoint(encoderSmoothCon),                  //R decimal: '.'
                                0,                      //curve is not used here
                                image_encoder_width, image_encoder_height,
                                Util.GetDecimalSeparator()
-                               ); 
+                               );
+
+               //capturingRotaryInertial = false;
 
                EncoderStruct es = new EncoderStruct(
                                Util.GetEncoderDataTempFileName(), 
@@ -995,8 +1011,11 @@ public partial class ChronoJumpWindow
                                encoderTimeStamp = es.GetDate(false); 
                                encoderSignalUniqueID = es.uniqueID;
                                button_video_play_this_test_encoder.Sensitive = (es.future2 != "");
-                               check_encoder_inverted.Active = (es.future3 == "1");
-                               lastRecalculateWasInverted = check_encoder_inverted.Active;
+                               radiobutton_encoder_capture_linear_inverted.Active = 
+                                       (es.future3 == Constants.EncoderSignalMode.LINEARINVERTED.ToString());
+                               lastRecalculateWasInverted = 
radiobutton_encoder_capture_linear_inverted.Active;
+                               radiobutton_encoder_capture_rotary_inertial.Active = 
+                                       (es.future3 == Constants.EncoderSignalMode.ROTARYINERTIAL.ToString());
                        }
                }
 
@@ -1413,7 +1432,8 @@ public partial class ChronoJumpWindow
                string future3 = ""; //unused on curve  
                if(mode == "signal") {
                        myID = encoderSignalUniqueID;
-                       future3 = Util.BoolToInt(check_encoder_inverted.Active).ToString();
+                       if(radiobutton_encoder_capture_linear_inverted.Active)
+                               future3 = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
                }
 
                //assign values from lastEncoderSQL (last calculate curves or reload), and change new things
@@ -1527,8 +1547,11 @@ public partial class ChronoJumpWindow
                Thread.Sleep(500);      
 
                //will start calcule curves thread
-               if(capturedOk)
+               if(capturedOk) {
+                       //capturingRotaryInertial = radiobutton_encoder_capture_rotary_inertial.Active;
+                       
                        calculeCurves();
+               }
        }
        
        private bool runEncoderCaptureCsharpCheckPort(string port) {
@@ -1584,7 +1607,7 @@ public partial class ChronoJumpWindow
                                byteReaded = byteReaded - 256;
 
                        //invert sign if inverted is selected
-                       if(check_encoder_inverted.Active)
+                       if(radiobutton_encoder_capture_linear_inverted.Active)
                                byteReaded *= -1;
 
                        i=i+1;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 24bb97c..c4356ad 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -56,7 +56,7 @@ class SqliteEncoder : Sqlite
                        "description TEXT, " +
                        "future1 TEXT, " +      //works as status: "active", "inactive"
                        "future2 TEXT, " +      //URL of video of signals
-                       "future3 TEXT )";       //Inverted (encoder is upside down) only on signals
+                       "future3 TEXT )";       //Constants.EncoderSignalMode (only on signals)
                dbcmd.ExecuteNonQuery();
        }
        
@@ -82,7 +82,7 @@ class SqliteEncoder : Sqlite
                                es.url + "', " + es.time + ", " + es.minHeight + ", " +
                                Util.ConvertToPoint(es.smooth) + ", '" + es.description + "', 'active', " + 
                                "'','" +                //future2 url (this is stored later)
-                               es.future3 + "')" ;     //future3 inverted?
+                               es.future3 + "')" ;     //future3 (Constants.EncoderSignalMode)
                Log.WriteLine(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 9bab50c..e538110 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -72,7 +72,7 @@ class Sqlite
         * Important, change this if there's any update to database
         * Important2: if database version get numbers higher than 1, check if the comparisons with 
currentVersion works ok
         */
-       static string lastChronojumpDatabaseVersion = "0.95";
+       static string lastChronojumpDatabaseVersion = "0.96";
 
        public Sqlite() {
        }
@@ -1286,6 +1286,23 @@ class Sqlite
 
                                currentVersion = "0.95";
                        }
+                       if(currentVersion == "0.95") {
+                               dbcon.Open();
+                               
+                               Update(true, Constants.EncoderTable, "future3", "", 
Constants.EncoderSignalMode.LINEAR.ToString(), 
+                                               "signalOrCurve", "signal");
+                               Update(true, Constants.EncoderTable, "future3", "0", 
Constants.EncoderSignalMode.LINEAR.ToString(), 
+                                               "signalOrCurve", "signal");
+                               Update(true, Constants.EncoderTable, "future3", "1", 
Constants.EncoderSignalMode.LINEARINVERTED.ToString(),
+                                               "signalOrCurve", "signal");
+
+                               Log.WriteLine("Encoder signal future3 three modes");
+                               
+                               SqlitePreferences.Update ("databaseVersion", "0.96", true); 
+                               dbcon.Close();
+
+                               currentVersion = "0.96";
+                       }
                }
 
                //if changes are made here, remember to change also in CreateTables()
@@ -1425,6 +1442,7 @@ class Sqlite
                SqliteCountry.initialize();
                
                //changes [from - to - desc]
+               //0.95 - 0.96 Converted DB to 0.96 Encoder signal future3 three modes
                //0.94 - 0.95 Converted DB to 0.95 Added encoder1RMMethod
                //0.93 - 0.94 Converted DB to 0.94 Added encoder1RM table
                //0.92 - 0.93 Converted DB to 0.93 Added speed1RM on encoder exercise
@@ -2189,6 +2207,28 @@ Console.WriteLine("5" + tableName);
                return myReturn;
        }
 
+       public static void Update(bool dbconOpened, string tableName, string columnName, string searchValue, 
string newValue, 
+                       string columnNameCondition2, string searchValueCondition2)
+       {
+               if( ! dbconOpened)
+                       dbcon.Open();
+               
+               string andStr = "";
+               if(columnNameCondition2 != "" && searchValueCondition2 != "")
+                       andStr = " AND " + columnNameCondition2 + " == '" + searchValueCondition2 + "'"; 
+
+               dbcmd.CommandText = "Update " + tableName +
+                       " SET " + columnName + " = '" + newValue + "'" +  
+                       " WHERE " + columnName + " == '" + searchValue + "'" + 
+                       andStr
+                       ;
+               Log.WriteLine(dbcmd.CommandText.ToString());
+               dbcmd.ExecuteNonQuery();
+               
+               if( ! dbconOpened)
+                       dbcon.Close();
+       }
+
        public static void Delete(bool dbconOpened, string tableName, int uniqueID)
        {
                if( ! dbconOpened)


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