[chronojump] encoder show loss can be deactivated



commit 90c4c37a08f0299ffe19eaaf037cc6e64f9dbfc8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Dec 31 13:28:31 2020 +0100

    encoder show loss can be deactivated

 glade/repetitive_conditions.glade | 29 +++++++++++++++++++++++++++--
 src/gui/app1/chronojump.cs        |  6 +++++-
 src/gui/app1/encoder.cs           |  6 +++---
 src/gui/encoderGraphObjects.cs    | 20 +++++++++++++-------
 src/gui/repetitiveConditions.cs   |  8 ++++++++
 5 files changed, 56 insertions(+), 13 deletions(-)
---
diff --git a/glade/repetitive_conditions.glade b/glade/repetitive_conditions.glade
index a15be048..f9ecd189 100644
--- a/glade/repetitive_conditions.glade
+++ b/glade/repetitive_conditions.glade
@@ -14,7 +14,7 @@
       <widget class="GtkVBox" id="vbox95">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">14</property>
+        <property name="spacing">10</property>
         <child>
           <widget class="GtkFrame" id="frame1">
             <property name="visible">True</property>
@@ -1713,7 +1713,7 @@
                                   <widget class="GtkHBox" id="hbox16">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">20</property>
+                                    <property name="spacing">25</property>
                                     <child>
                                       <widget class="GtkVSeparator" id="vseparator2">
                                         <property name="visible">True</property>
@@ -2262,6 +2262,31 @@
                                             <property name="position">3</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <widget class="GtkHBox" id="hbox37">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <child>
+                                              <widget class="GtkCheckButton" id="check_encoder_show_loss">
+                                                <property name="label" translatable="yes" comments="Loss 
means:&#10;while capturing, person will experiment fatigue and the repetitions will start being worse in 
terms of speed or power or whatever is configured as Main variable. So if repetitions are getting worse in 
speed, is shown as &quot;loss&quot; of speed.">Show loss</property>
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="receives_default">False</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>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">True</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">4</property>
+                                          </packing>
+                                        </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">True</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index b838480a..181307d0 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -7063,6 +7063,10 @@ LogB.Debug("mc finished 5");
                                preferences.encoderCaptureMainVariableLowerValue,
                                repetitiveConditionsWin.EncoderAutomaticLowerValue);
 
+                       preferences.encoderCaptureShowLoss = Preferences.PreferencesChange(
+                               SqlitePreferences.EncoderCaptureShowLoss,
+                               preferences.encoderCaptureShowLoss,
+                               repetitiveConditionsWin.EncoderCaptureShowLoss);
 
                        Sqlite.Close();
 
@@ -7085,7 +7089,7 @@ LogB.Debug("mc finished 5");
                                        encoderGraphDoPlot.NewPreferences(preferences);
                                        encoderGraphDoPlot.Start(
                                                        mainVariableStr, mainVariableHigher, 
mainVariableLower,
-                                                       secondaryVariableStr,
+                                                       secondaryVariableStr, 
preferences.encoderCaptureShowLoss,
                                                        false,
                                                        findEccon(true),
                                                        repetitiveConditionsWin,
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 9db98548..87a4273d 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -5451,7 +5451,7 @@ public partial class ChronoJumpWindow
                        double mainVariableLower = repetitiveConditionsWin.GetMainVariableLower(mainVariable);
                        encoderGraphDoPlot.Start(
                                        mainVariable, mainVariableHigher, mainVariableLower,
-                                       secondaryVariable,
+                                       secondaryVariable, preferences.encoderCaptureShowLoss,
                                        false, //not capturing
                                        findEccon(true),
                                        repetitiveConditionsWin,
@@ -6322,7 +6322,7 @@ public partial class ChronoJumpWindow
                                encoderGraphDoPlot.NewPreferences(preferences);
                                encoderGraphDoPlot.Start(
                                                mainVariable, mainVariableHigher, mainVariableLower,
-                                               secondaryVariable,
+                                               secondaryVariable, preferences.encoderCaptureShowLoss,
                                                true, //capturing
                                                findEccon(true),
                                                repetitiveConditionsWin,
@@ -6825,7 +6825,7 @@ public partial class ChronoJumpWindow
                                encoderGraphDoPlot.NewPreferences(preferences);
                                encoderGraphDoPlot.Start(
                                                mainVariable, mainVariableHigher, mainVariableLower,
-                                               secondaryVariable,
+                                               secondaryVariable, preferences.encoderCaptureShowLoss,
                                                false, //not capturing
                                                findEccon(true),
                                                repetitiveConditionsWin,
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index fe6c84c6..8e280874 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -38,6 +38,7 @@ public class EncoderGraphDoPlot
        private double mainVariableHigher;
        private double mainVariableLower;
        private string secondaryVariable;
+       private bool showLoss;
        private bool capturing;
        private string eccon;
        private RepetitiveConditionsWindow repetitiveConditionsWin;
@@ -144,7 +145,8 @@ public class EncoderGraphDoPlot
 
        public void Start (
                        string mainVariable, double mainVariableHigher, double mainVariableLower,
-                       string secondaryVariable, bool capturing, string eccon,
+                       string secondaryVariable, bool showLoss,
+                       bool capturing, string eccon,
                        RepetitiveConditionsWindow repetitiveConditionsWin,
                        bool hasInertia, bool playSoundsFromFile,
                        ArrayList data9Variables, Gtk.ListStore encoderCaptureListStore,
@@ -155,6 +157,7 @@ public class EncoderGraphDoPlot
                this.mainVariableHigher = mainVariableHigher;
                this.mainVariableLower = mainVariableLower;
                this.secondaryVariable = secondaryVariable;
+               this.showLoss = showLoss;
                this.capturing = capturing;
                this.eccon = eccon;
                this.repetitiveConditionsWin = repetitiveConditionsWin;
@@ -936,7 +939,7 @@ public class EncoderGraphDoPlot
                string lossString = "";
 
                //do not show lossString on Preferences.EncoderPhasesEnum.ECC
-               if(eccon == "c" || preferences.encoderCaptureFeedbackEccon != 
Preferences.EncoderPhasesEnum.ECC)
+               if( showLoss && (eccon == "c" || preferences.encoderCaptureFeedbackEccon != 
Preferences.EncoderPhasesEnum.ECC) )
                {
                        title += "; ";
                        lossString = "Loss: ";
@@ -1016,10 +1019,13 @@ public class EncoderGraphDoPlot
                                layout_encoder_capture_curves_bars_text);
 
                // 4) paint loss string
-               layout_encoder_capture_curves_bars_text.SetMarkup(lossString);
-               pixmap.DrawLayout (pen_gray, //darker than pen_gray_loss
-                               Convert.ToInt32( (graphWidth/2) - titleFullWidth/2 + titleWidth), 0, //x, y
-                               layout_encoder_capture_curves_bars_text);
+               if(showLoss)
+               {
+                       layout_encoder_capture_curves_bars_text.SetMarkup(lossString);
+                       pixmap.DrawLayout (pen_gray, //darker than pen_gray_loss
+                                       Convert.ToInt32( (graphWidth/2) - titleFullWidth/2 + titleWidth), 0, 
//x, y
+                                       layout_encoder_capture_curves_bars_text);
+               }
 
                // 5) paint workString && impulse string;
                layout_encoder_capture_curves_bars_text.SetMarkup(workString);
@@ -1039,7 +1045,7 @@ public class EncoderGraphDoPlot
                // <------ end plot title
 
                // paint loss arrow
-               if(eccon == "c" || preferences.encoderCaptureFeedbackEccon != 
Preferences.EncoderPhasesEnum.ECC)
+               if( showLoss && (eccon == "c" || preferences.encoderCaptureFeedbackEccon != 
Preferences.EncoderPhasesEnum.ECC) )
                {
                        if(maxThisSetValidAndCon > 0 && maxThisSetValidAndConPos < minThisSetValidAndConPos)
                        {
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 39979ead..83f89267 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -84,6 +84,7 @@ public class RepetitiveConditionsWindow
        [Widget] Gtk.RadioButton radio_encoder_eccon_con;
        [Widget] Gtk.CheckButton check_encoder_inertial_ecc_overload;
        [Widget] Gtk.CheckButton check_encoder_inertial_ecc_overload_percent;
+       [Widget] Gtk.CheckButton check_encoder_show_loss;
 
        [Widget] Gtk.Notebook notebook_encoder_conditions;
        [Widget] Gtk.CheckButton checkbutton_encoder_height_higher;
@@ -265,6 +266,7 @@ public class RepetitiveConditionsWindow
                                preferences.encoderCaptureMainVariableLowerActive,
                                preferences.encoderCaptureMainVariableLowerValue,
                                preferences.encoderCaptureFeedbackEccon,
+                               preferences.encoderCaptureShowLoss,
                                encoderRhythm,
                                preferences.forceSensorCaptureFeedbackActive,
                                preferences.forceSensorCaptureFeedbackAt,
@@ -294,6 +296,7 @@ public class RepetitiveConditionsWindow
                        bool encoderCaptureMainVariableLowerActive,
                        int encoderCaptureMainVariableLowerValue,
                        Preferences.EncoderPhasesEnum encoderCaptureFeedbackEccon,
+                       bool encoderCaptureShowLoss,
                        EncoderRhythm encoderRhythm,
                        bool forceSensorCaptureFeedbackActive,
                        int forceSensorCaptureFeedbackAt,
@@ -350,6 +353,7 @@ public class RepetitiveConditionsWindow
                                check_encoder_inertial_ecc_overload_percent.Active = true;
                                check_encoder_inertial_ecc_overload_percent.Visible = true;
                        }
+                       check_encoder_show_loss.Active = encoderCaptureShowLoss;
 
                        if(encoderSecondaryVariableShow)
                                check_encoder_show_secondary_variable.Active = true;
@@ -1095,6 +1099,10 @@ public class RepetitiveConditionsWindow
                }
        }
 
+       public bool EncoderCaptureShowLoss {
+               get { return check_encoder_show_loss.Active; }
+       }
+
        public double GetMainVariableHigher(string mainVariable) 
        {
                if(mainVariable == Constants.MeanSpeed && EncoderMeanSpeedHigher)


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