[chronojump] New encoder autosavecurves mode: "from 4th to penultimate" repetition
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] New encoder autosavecurves mode: "from 4th to penultimate" repetition
- Date: Sat, 16 Jul 2016 13:45:33 +0000 (UTC)
commit 59b1d3e5bafbb39309d95cccd6200f36013c198d
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Jul 16 15:40:48 2016 +0200
New encoder autosavecurves mode: "from 4th to penultimate" repetition
glade/chronojump.glade | 223 +++++++++++++++++++++++++++++++++++++++++--
src/constants.cs | 2 +-
src/encoder.cs | 4 +
src/gui/encoder.cs | 3 +
src/gui/encoderTreeviews.cs | 15 +++-
src/gui/preferences.cs | 7 ++
6 files changed, 244 insertions(+), 10 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index cc3cefc..24f594f 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -13013,6 +13013,12 @@ low ressistance</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -14872,6 +14878,20 @@ low ressistance</property>
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton"
id="button_encoder_capture_curves_4top">
+ <property name="label"
translatable="yes">4toP</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_encoder_capture_curves_4top_clicked" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -17904,6 +17924,12 @@ low ressistance</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -22656,6 +22682,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23889,6 +23921,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -25614,6 +25652,12 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -26396,6 +26440,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -39746,6 +39796,42 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -42641,6 +42727,30 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -43830,12 +43940,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -45068,6 +45172,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -46681,6 +46791,87 @@ It starts before and arrives there with some speed.</property>
</packing>
</child>
<child>
+ <widget class="GtkRadioButton" id="radio_encoder_auto_save_curve_4top">
+ <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_auto_save_curve_best</property>
+ <child>
+ <widget class="GtkHBox" id="hbox18">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Save from 4th to
penultimate</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox19">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">(</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label42">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Good for
inertial</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label55">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">)</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -46721,7 +46912,7 @@ It starts before and arrives there with some speed.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -49187,6 +49378,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -50084,6 +50281,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -50996,6 +51199,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/constants.cs b/src/constants.cs
index 050cc8c..d0e2227 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -818,7 +818,7 @@ public class Constants
public enum Encoder1RMMethod { NONWEIGHTED, WEIGHTED, WEIGHTED2, WEIGHTED3 }
public enum ContextMenu { NONE, EDITDELETE, DELETE }
- public enum EncoderAutoSaveCurve { ALL, NONE, BEST }
+ public enum EncoderAutoSaveCurve { ALL, NONE, BEST, FROM4TOPENULTIMATE }
public enum DoubleContact {
NONE, FIRST, AVERAGE, LAST
diff --git a/src/encoder.cs b/src/encoder.cs
index ad00c67..3214dd1 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -412,6 +412,10 @@ public class EncoderSignal
this.curves = curves;
}
+ public int CurvesNum() {
+ return curves.Count;
+ }
+
//this can be an eccentric or concentric curve
public int FindPosOfBest(string variable) {
double bestValue = 0;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 124bcf8..79bca07 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3196,6 +3196,9 @@ public partial class ChronoJumpWindow
void on_button_encoder_capture_curves_none_clicked (object o, EventArgs args) {
encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.NONE,
encoderCaptureOptionsWin.GetMainVariable());
}
+ void on_button_encoder_capture_curves_4top_clicked (object o, EventArgs args) {
+ encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE,
encoderCaptureOptionsWin.GetMainVariable());
+ }
void on_combo_encoder_analyze_cross_changed (object o, EventArgs args)
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 09479e6..0e47c2a 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -337,14 +337,17 @@ public partial class ChronoJumpWindow
void encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve saveOption, string
mainVariable)
{
int bestRow = 0;
- if(saveOption == Constants.EncoderAutoSaveCurve.BEST) {
+ int numRows = 0;
+ if(saveOption == Constants.EncoderAutoSaveCurve.BEST || saveOption ==
Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE) {
if(ecconLast == "c") {
//get the concentric curves
EncoderSignal encoderSignal = new
EncoderSignal(treeviewEncoderCaptureCurvesGetCurves(AllEccCon.CON));
bestRow = encoderSignal.FindPosOfBest(mainVariable);
+ numRows = encoderSignal.CurvesNum();
} else {
EncoderSignal encoderSignal = new
EncoderSignal(treeviewEncoderCaptureCurvesGetCurves(AllEccCon.ALL));
bestRow = encoderSignal.FindPosOfBestEccCon(mainVariable); //will be pos of
the ecc
+ numRows = encoderSignal.CurvesNum();
}
}
@@ -366,12 +369,20 @@ public partial class ChronoJumpWindow
while(iterOk) {
TreePath path = encoderCaptureListStore.GetPath(iter);
+ bool from4ToPenult = false;
+ if( saveOption == Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE &&
+ ( (ecconLast == "c" && i > 2 && i < numRows -1) ||
+ (ecconLast != "c" && i > 4 && i < numRows -2) ) )
+ from4ToPenult = true;
+
EncoderCurve curve = (EncoderCurve) encoderCaptureListStore.GetValue (iter, 0);
if(
(! curve.Record && saveOption == Constants.EncoderAutoSaveCurve.ALL)
||
(! curve.Record && saveOption == Constants.EncoderAutoSaveCurve.BEST
&& i == bestRow) ||
+ (! curve.Record && saveOption ==
Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE && from4ToPenult) ||
(curve.Record && saveOption == Constants.EncoderAutoSaveCurve.BEST &&
i != bestRow) ||
- (curve.Record && saveOption == Constants.EncoderAutoSaveCurve.NONE) )
+ (curve.Record && saveOption == Constants.EncoderAutoSaveCurve.NONE) ||
+ (curve.Record && saveOption ==
Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE && ! from4ToPenult) )
{
changeTo = ! curve.Record;
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 0d62bb6..74e78f9 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -98,6 +98,7 @@ public class PreferencesWindow {
[Widget] Gtk.RadioButton radio_encoder_1RM_weighted2;
[Widget] Gtk.RadioButton radio_encoder_1RM_weighted3;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_best;
+ [Widget] Gtk.RadioButton radio_encoder_auto_save_curve_4top;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_all;
[Widget] Gtk.RadioButton radio_encoder_auto_save_curve_none;
@@ -315,6 +316,8 @@ public class PreferencesWindow {
if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.BEST)
PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active = true;
+ else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE)
+ PreferencesWindowBox.radio_encoder_auto_save_curve_4top.Active = true;
else if(preferences.encoderAutoSaveCurve == Constants.EncoderAutoSaveCurve.ALL)
PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active = true;
else
@@ -1021,6 +1024,10 @@ public class PreferencesWindow {
SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.BEST.ToString(), true);
preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BEST;
}
+ else if(PreferencesWindowBox.radio_encoder_auto_save_curve_4top.Active) {
+ SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE.ToString(), true);
+ preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE;
+ }
else if(PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active) {
SqlitePreferences.Update("encoderAutoSaveCurve",
Constants.EncoderAutoSaveCurve.ALL.ToString(), true);
preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]