[chronojump] Encoder power feedback can be relative to set or historical



commit 8787fc1935a444bceb83a38e971ff3a725ef4072
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Sep 30 14:39:16 2017 +0200

    Encoder power feedback can be relative to set or historical

 glade/repetitive_conditions.glade |  358 +++++++++++++++++++++----------------
 src/gui/encoder.cs                |   44 +++--
 src/gui/repetitiveConditions.cs   |   43 ++++-
 3 files changed, 271 insertions(+), 174 deletions(-)
---
diff --git a/glade/repetitive_conditions.glade b/glade/repetitive_conditions.glade
index 6c938a8..9d92ec0 100644
--- a/glade/repetitive_conditions.glade
+++ b/glade/repetitive_conditions.glade
@@ -1632,28 +1632,48 @@
                 <property name="left_padding">10</property>
                 <property name="right_padding">10</property>
                 <child>
-                  <widget class="GtkHBox" id="hbox32">
+                  <widget class="GtkVBox" id="vbox2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="spacing">20</property>
                     <child>
-                      <widget class="GtkVBox" id="vbox6">
+                      <widget class="GtkHBox" id="hbox37">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox_combo_encoder_variable_automatic">
+                          <widget class="GtkRadioButton" id="radio_encoder_relative_to_set">
+                            <property name="label" translatable="yes">this set</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <placeholder/>
-                            </child>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <signal name="toggled" handler="on_radio_encoder_relative_to_toggled" 
swapped="no"/>
                           </widget>
                           <packing>
-                            <property name="expand">True</property>
+                            <property name="expand">False</property>
                             <property name="fill">False</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkRadioButton" id="radio_encoder_relative_to_historical">
+                            <property name="label" translatable="yes">historical of this person</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">radio_encoder_relative_to_set</property>
+                            <signal name="toggled" handler="on_radio_encoder_relative_to_toggled" 
swapped="no"/>
+                          </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>
@@ -1662,211 +1682,248 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkTable" id="table9">
+                      <widget class="GtkHBox" id="hbox32">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="n_rows">2</property>
-                        <property name="column_spacing">10</property>
-                        <property name="row_spacing">6</property>
+                        <property name="spacing">20</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox33">
+                          <widget class="GtkVBox" id="vbox6">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">10</property>
                             <child>
-                              <widget class="GtkLabel" id="label8">
+                              <widget class="GtkHBox" id="hbox_combo_encoder_variable_automatic">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label">&gt;=</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                               <packing>
-                                <property name="expand">False</property>
+                                <property name="expand">True</property>
                                 <property name="fill">False</property>
                                 <property name="position">0</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="GtkTable" id="table9">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="n_rows">2</property>
+                            <property name="column_spacing">10</property>
+                            <property name="row_spacing">6</property>
                             <child>
-                              <widget class="GtkSpinButton" id="spinbutton_encoder_automatic_greater">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="invisible_char">●</property>
-                                <property name="primary_icon_activatable">False</property>
-                                <property name="secondary_icon_activatable">False</property>
-                                <property name="primary_icon_sensitive">True</property>
-                                <property name="secondary_icon_sensitive">True</property>
-                                <property name="adjustment">90 10 100 1 1 0</property>
-                                <property name="climb_rate">10</property>
-                                <property name="snap_to_ticks">True</property>
-                                <property name="numeric">True</property>
-                                <signal name="value_changed" 
handler="on_spinbutton_encoder_automatic_greater_value_changed" swapped="no"/>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkLabel" id="label7">
+                              <widget class="GtkHBox" id="hbox33">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label">%</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkCheckButton" id="checkbutton_encoder_automatic_greater">
-                                <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">Bell bad</property>
-                                <property name="draw_indicator">True</property>
+                                <property name="spacing">10</property>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment19">
+                                  <widget class="GtkLabel" id="label8">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xscale">0</property>
-                                    <property name="yscale">0</property>
+                                    <property name="label">&gt;=</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="spinbutton_encoder_automatic_greater">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">●</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
+                                    <property name="adjustment">90 10 100 1 1 0</property>
+                                    <property name="climb_rate">10</property>
+                                    <property name="snap_to_ticks">True</property>
+                                    <property name="numeric">True</property>
+                                    <signal name="value_changed" 
handler="on_spinbutton_encoder_automatic_greater_value_changed" swapped="no"/>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label7">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label">%</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkCheckButton" id="checkbutton_encoder_automatic_greater">
+                                    <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">Bell bad</property>
+                                    <property name="draw_indicator">True</property>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox34">
+                                      <widget class="GtkAlignment" id="alignment19">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">2</property>
+                                        <property name="xscale">0</property>
+                                        <property name="yscale">0</property>
                                         <child>
-                                          <widget class="GtkImage" 
id="image_repetitive_encoder_automatic_greater">
+                                          <widget class="GtkHBox" id="hbox34">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
+                                            <property name="spacing">2</property>
+                                            <child>
+                                              <widget class="GtkImage" 
id="image_repetitive_encoder_automatic_greater">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</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">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
                                         </child>
                                       </widget>
                                     </child>
                                   </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="padding">20</property>
+                                    <property name="position">3</property>
+                                  </packing>
                                 </child>
                               </widget>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="padding">20</property>
-                                <property name="position">3</property>
-                              </packing>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="x_options"/>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkHBox" id="hbox35">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="spacing">10</property>
-                            <child>
-                              <widget class="GtkLabel" id="label9">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label">&lt;=</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="spinbutton_encoder_automatic_lower">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="invisible_char">●</property>
-                                <property name="primary_icon_activatable">False</property>
-                                <property name="secondary_icon_activatable">False</property>
-                                <property name="primary_icon_sensitive">True</property>
-                                <property name="secondary_icon_sensitive">True</property>
-                                <property name="adjustment">70 10 100 1 1 0</property>
-                                <property name="climb_rate">10</property>
-                                <property name="snap_to_ticks">True</property>
-                                <property name="numeric">True</property>
-                                <signal name="value_changed" 
handler="on_spinbutton_encoder_automatic_lower_value_changed" swapped="no"/>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">1</property>
+                                <property name="x_options"/>
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkLabel" id="label12">
+                              <widget class="GtkHBox" id="hbox35">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label">%</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkCheckButton" id="checkbutton_encoder_automatic_lower">
-                                <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">Bell bad</property>
-                                <property name="draw_indicator">True</property>
+                                <property name="spacing">10</property>
                                 <child>
-                                  <widget class="GtkAlignment" id="alignment20">
+                                  <widget class="GtkLabel" id="label9">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xscale">0</property>
-                                    <property name="yscale">0</property>
+                                    <property name="label">&lt;=</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="spinbutton_encoder_automatic_lower">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">●</property>
+                                    <property name="primary_icon_activatable">False</property>
+                                    <property name="secondary_icon_activatable">False</property>
+                                    <property name="primary_icon_sensitive">True</property>
+                                    <property name="secondary_icon_sensitive">True</property>
+                                    <property name="adjustment">70 10 100 1 1 0</property>
+                                    <property name="climb_rate">10</property>
+                                    <property name="snap_to_ticks">True</property>
+                                    <property name="numeric">True</property>
+                                    <signal name="value_changed" 
handler="on_spinbutton_encoder_automatic_lower_value_changed" swapped="no"/>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label12">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label">%</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkCheckButton" id="checkbutton_encoder_automatic_lower">
+                                    <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">Bell bad</property>
+                                    <property name="draw_indicator">True</property>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox36">
+                                      <widget class="GtkAlignment" id="alignment20">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">2</property>
+                                        <property name="xscale">0</property>
+                                        <property name="yscale">0</property>
                                         <child>
-                                          <widget class="GtkImage" 
id="image_repetitive_encoder_automatic_lower">
+                                          <widget class="GtkHBox" id="hbox36">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
+                                            <property name="spacing">2</property>
+                                            <child>
+                                              <widget class="GtkImage" 
id="image_repetitive_encoder_automatic_lower">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</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">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
                                         </child>
                                       </widget>
                                     </child>
                                   </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="padding">20</property>
+                                    <property name="position">3</property>
+                                  </packing>
                                 </child>
                               </widget>
                               <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="padding">20</property>
-                                <property name="position">3</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options"/>
                               </packing>
                             </child>
                           </widget>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options"/>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                       </widget>
                       <packing>
-                        <property name="expand">False</property>
+                        <property name="expand">True</property>
                         <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
@@ -1879,7 +1936,8 @@
               <widget class="GtkLabel" id="label6">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Feedback relative to the maximum of the 
set</property>
+                <property name="xpad">12</property>
+                <property name="label" translatable="yes">Feedback relative to the maximum of ...</property>
                 <property name="use_markup">True</property>
               </widget>
               <packing>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4e89c67..2acb1c5 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -822,7 +822,7 @@ public partial class ChronoJumpWindow
 
        }
 
-       double maxPowerIntersessionOnCapture;
+       double maxPowerIntersession;
        //called from main GUI
        void on_button_encoder_capture_clicked (object o, EventArgs args) 
        {
@@ -842,8 +842,8 @@ public partial class ChronoJumpWindow
 
                firstSetOfCont = firstSet;
 
-               maxPowerIntersessionOnCapture = findMaxPowerIntersession();
-               //LogB.Information("maxPower: " + maxPowerIntersessionOnCapture);
+               maxPowerIntersession = findMaxPowerIntersession();
+               //LogB.Information("maxPower: " + maxPowerIntersession);
 
                if(encoderThreadBG != null && encoderThreadBG.IsAlive) //if we are capturing on the 
background ...
                {
@@ -1583,7 +1583,14 @@ public partial class ChronoJumpWindow
                genericWin.Button_accept.Clicked -= new EventHandler(on_encoder_load_signal_accepted);
 
                int uniqueID = genericWin.TreeviewSelectedRowID();
-               
+
+               /*
+                * maxPowerIntersession it's defined (Sqlite select) on capture and after capture
+                * if we have not captured yet, just Sqlite select now
+                */
+               if(! repetitiveConditionsWin.EncoderRelativeToSet)
+                       maxPowerIntersession = findMaxPowerIntersession();
+
                genericWin.HideAndNull();
 
                ArrayList data = SqliteEncoder.Select(
@@ -4591,17 +4598,19 @@ public partial class ChronoJumpWindow
                if(maxThisSet <= 0)
                        return; 
 
-               //get maxIntersession and update it if is lower than maxThisSet
-               double maxIntersession = -100000;
-               if(mainVariable == Constants.MeanPower)
-                       maxIntersession = maxPowerIntersessionOnCapture;
-
-               if(maxThisSet > maxIntersession)
-                       maxIntersession = maxThisSet;
-
                double maxAbsolute = maxThisSet;
-               if(maxIntersession > maxAbsolute)
-                       maxAbsolute = maxIntersession;
+               if(! repetitiveConditionsWin.EncoderRelativeToSet)
+               {
+                       //relative to historical of this person
+
+                       /*
+                        * if there's a set captured but without repetitions saved, maxPowerIntersession will 
be 0
+                        * and current set (loaded or captured) will have a power that will be out of the 
graph
+                        * for this reason use maxAbsolute or maxThisSet, whatever is higher
+                        */
+                       if(maxPowerIntersession > maxAbsolute)
+                               maxAbsolute = maxPowerIntersession;
+               }
 
                repetitiveConditionsWin.ResetBestSetValue();
                repetitiveConditionsWin.UpdateBestSetValue(maxAbsolute);
@@ -4654,9 +4663,8 @@ public partial class ChronoJumpWindow
                double countSaved = 0;
                
                //draw line for person max intersession
-               if(mainVariable == Constants.MeanPower && maxIntersession > 0)
+               if(! repetitiveConditionsWin.EncoderRelativeToSet)
                {
-                       //layout_encoder_capture_curves_bars_text.SetMarkup("Person's best: (" + 
Util.TrimDecimals(maxIntersession, 1) + "W)");
                        layout_encoder_capture_curves_bars_text.SetMarkup("Person's best:");
                        layout_encoder_capture_curves_bars_text.GetPixelSize(out textWidth, out textHeight);
                        encoder_capture_curves_bars_pixmap.DrawLayout (pen_yellow_encoder_capture,
@@ -4667,7 +4675,7 @@ public partial class ChronoJumpWindow
                                        left_margin, top_margin,
                                        graphWidth - right_margin, top_margin);
 
-                       layout_encoder_capture_curves_bars_text.SetMarkup(Util.TrimDecimals(maxIntersession, 
1) + "W");
+                       layout_encoder_capture_curves_bars_text.SetMarkup(Util.TrimDecimals(maxAbsolute, 1) + 
"W");
                        layout_encoder_capture_curves_bars_text.GetPixelSize(out textWidth, out textHeight);
                        encoder_capture_curves_bars_pixmap.DrawLayout (pen_yellow_encoder_capture,
                                                graphWidth - (right_margin + textWidth),
@@ -6106,7 +6114,7 @@ public partial class ChronoJumpWindow
                                }
 
 
-                               maxPowerIntersessionOnCapture = findMaxPowerIntersession();
+                               maxPowerIntersession = findMaxPowerIntersession();
                                plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower, 
captureCurvesBarsData,
                                                repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
                                                false); //not capturing
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 5d424b6..8f2b447 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -71,6 +71,8 @@ public class RepetitiveConditionsWindow
 
        /* encoder */
        [Widget] Gtk.Frame frame_encoder_automatic_conditions;
+       [Widget] Gtk.RadioButton radio_encoder_relative_to_set;
+       [Widget] Gtk.RadioButton radio_encoder_relative_to_historical;
        [Widget] Gtk.HBox hbox_combo_encoder_variable_automatic;
        [Widget] Gtk.ComboBox combo_encoder_variable_automatic;
        [Widget] Gtk.CheckButton checkbutton_encoder_automatic_greater;
@@ -238,16 +240,32 @@ public class RepetitiveConditionsWindow
                }
        }
                
-       private void createComboEncoderAutomaticVariable() {
+       private void createComboEncoderAutomaticVariable()
+       {
                combo_encoder_variable_automatic = ComboBox.NewText ();
-               string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, 
Constants.MaxForce, Constants.MeanPower, Constants.PeakPower };
-               UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, "");
-               combo_encoder_variable_automatic.Active = 
UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power");
-               
+
+               comboEncoderAutomaticVariableFillThisSet();
+
                hbox_combo_encoder_variable_automatic.PackStart(combo_encoder_variable_automatic, false, 
false, 0);
                hbox_combo_encoder_variable_automatic.ShowAll();
                combo_encoder_variable_automatic.Sensitive = true;
        }
+       //all values
+       private void comboEncoderAutomaticVariableFillThisSet()
+       {
+               string [] values = { Constants.MeanSpeed, Constants.MaxSpeed, Constants.MeanForce, 
Constants.MaxForce, Constants.MeanPower, Constants.PeakPower };
+
+               UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, "");
+               combo_encoder_variable_automatic.Active = 
UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power");
+       }
+       //currently only power
+       private void comboEncoderAutomaticVariableFillHistorical()
+       {
+               string [] values = { Constants.MeanPower };
+
+               UtilGtk.ComboUpdate(combo_encoder_variable_automatic, values, "");
+               combo_encoder_variable_automatic.Active = 
UtilGtk.ComboMakeActive(combo_encoder_variable_automatic, "Mean power");
+       }
 
        private void putNonStandardIcons() {
                Pixbuf pixbuf;
@@ -391,6 +409,15 @@ public class RepetitiveConditionsWindow
        }
 
        /* encoder */
+
+       void on_radio_encoder_relative_to_toggled (object o, EventArgs args)
+       {
+               if(radio_encoder_relative_to_set.Active)
+                       comboEncoderAutomaticVariableFillThisSet();
+               else
+                       comboEncoderAutomaticVariableFillHistorical();
+       }
+
        void on_spinbutton_encoder_automatic_greater_value_changed (object o, EventArgs args) {
                checkbutton_encoder_automatic_greater.Active = true;
        }
@@ -609,7 +636,11 @@ public class RepetitiveConditionsWindow
        private int encoderAutomaticLowerValue {
                get { return Convert.ToInt32(spinbutton_encoder_automatic_lower.Value); }
        }
-       
+
+       public bool EncoderRelativeToSet {
+               get { return radio_encoder_relative_to_set.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]