[chronojump] DB: 2.31 RunEncoderExercise added segmentVariableCm and all gui



commit 351d903cf31658fc724dca1b30efb0eb0c1fd5fb
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 1 17:08:00 2022 +0100

    DB: 2.31 RunEncoderExercise added segmentVariableCm and all gui

 glade/app1.glade                 | 875 +++++++++++++++++++++++++++++++++++++++
 src/gui/app1/contactsExercise.cs |  55 ++-
 src/gui/app1/icons.cs            |   6 +
 src/gui/app1/runEncoder.cs       | 228 ++++++----
 src/runEncoder.cs                |  30 +-
 src/sqlite/main.cs               |  20 +-
 src/sqlite/runEncoder.cs         |  29 +-
 7 files changed, 1149 insertions(+), 94 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index e20f232ce..bec8fcf14 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -15295,6 +15295,845 @@ Resisted race analyzer</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkFrame" 
id="frame_run_encoder_exercise">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label_xalign">0.5</property>
+                                                            <property name="shadow_type">out</property>
+                                                            <child>
+                                                            <widget class="GtkAlignment" id="alignment345">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="top_padding">12</property>
+                                                            <property name="bottom_padding">12</property>
+                                                            <property name="left_padding">16</property>
+                                                            <property name="right_padding">16</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox129">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">12</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_contacts_exercise_error">
+                                                            <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>
+                                                            <child>
+                                                            <widget class="GtkTable" id="table24">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="n_rows">2</property>
+                                                            <property name="n_columns">2</property>
+                                                            <property name="column_spacing">20</property>
+                                                            <property name="row_spacing">16</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox122">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label290">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Name</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkEntry" 
id="entry_run_encoder_exercise_name">
+                                                            <property name="width_request">250</property>
+                                                            <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>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox137">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label291">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Description</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkEntry" 
id="entry_run_encoder_exercise_description">
+                                                            <property name="width_request">250</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="invisible_char">•</property>
+                                                            <property 
name="invisible_char_set">True</property>
+                                                            <property 
name="primary_icon_activatable">False</property>
+                                                            <property 
name="secondary_icon_activatable">False</property>
+                                                            <property 
name="primary_icon_sensitive">True</property>
+                                                            <property 
name="secondary_icon_sensitive">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox128">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkCheckButton" 
id="check_run_encoder_exercise_fixed_size">
+                                                            <property name="label" 
translatable="yes">Segments with fixed size</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <signal name="toggled" 
handler="on_check_run_encoder_exercise_fixed_size_toggled" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_run_encoder_exercise_fixed_segments_size">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_m">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="invisible_char">•</property>
+                                                            <property name="width_chars">2</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">5 1 30 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label289">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">m</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="top_attach">1</property>
+                                                            <property name="bottom_attach">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_run_encoder_exercise_notfixed_segment_num">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label302">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Number 
of segments</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_race_encoder_exercise_segments_num">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="invisible_char">•</property>
+                                                            <property name="width_chars">2</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">2 1 20 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <signal name="value_changed" 
handler="on_spin_race_encoder_exercise_segments_num_value_changed" 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="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="top_attach">1</property>
+                                                            <property name="bottom_attach">2</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkFrame" 
id="frame_run_encoder_exercise_notfixed_segments">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">out</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox130">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="border_width">6</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox142">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_0">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</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_race_encoder_exercise_segment_size_cm_1">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_2">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_3">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">3</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_4">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_5">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">5</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_6">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">6</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_7">
+                                                            <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">96 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">7</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_8">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">8</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_9">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">9</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="GtkHBox" id="hbox141">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_10">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</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_race_encoder_exercise_segment_size_cm_11">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_12">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_13">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">3</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_14">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_15">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">5</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_16">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">6</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_17">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">7</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_18">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">8</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_race_encoder_exercise_segment_size_cm_19">
+                                                            <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">100 1 5000 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">9</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox143">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label304">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Segments size</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="label439">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">(cm)</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="type">label_item</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_contacts_exercise_actions">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_contacts_exercise_actions_cancel">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_contacts_exercise_actions_cancel_clicked" swapped="no"/>
+                                                            <accelerator key="Escape" signal="clicked"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox140">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_contacts_exercise_actions_cancel">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</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="label303">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Cancel</property>
+                                                            </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">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox145">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_contacts_exercise_actions_edit_do">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_contacts_exercise_actions_edit_do_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox200">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_contacts_exercise_actions_edit_do">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</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="label305">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Save</property>
+                                                            </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">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_contacts_exercise_actions_add_do">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_contacts_exercise_actions_add_do_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox201">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_contacts_exercise_actions_add_do">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</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="label306">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Add</property>
+                                                            </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">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</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="type">label_item</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>
@@ -24848,6 +25687,24 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -40691,6 +41548,24 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/app1/contactsExercise.cs b/src/gui/app1/contactsExercise.cs
index b2715968f..3e17805d1 100644
--- a/src/gui/app1/contactsExercise.cs
+++ b/src/gui/app1/contactsExercise.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 
@@ -33,6 +33,9 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_contacts_exercise;
        [Widget] Gtk.Label label_contacts_exercise_selected_name;
        [Widget] Gtk.Label label_contacts_exercise_selected_options;
+       [Widget] Gtk.Button button_contacts_exercise_actions_edit_do;
+       [Widget] Gtk.Button button_contacts_exercise_actions_add_do;
+       [Widget] Gtk.Label label_contacts_exercise_error;
 
        private void on_button_contacts_exercise_clicked (object o, EventArgs args)
        {
@@ -45,6 +48,8 @@ public partial class ChronoJumpWindow
                hbox_contacts_sup_capture_analyze_two_buttons.Sensitive = false;
                hbox_top_person.Sensitive = false;
 
+               frame_run_encoder_exercise.Visible = false; //TODO: implement more modes in the future
+
                button_contacts_exercise_close_and_capture.Sensitive = myTreeViewPersons.IsThereAnyRecord();
                notebook_contacts_execute_or.CurrentPage = 
Convert.ToInt32(notebook_contacts_execute_or_pages.INSTRUCTIONS);
        }
@@ -302,6 +307,54 @@ public partial class ChronoJumpWindow
                                        button_combo_force_sensor_exercise_capture_left,
                                        button_combo_force_sensor_exercise_capture_right);
        }
+
+
+       // ---- start of manage exercise edit/add from the app1.glade ---->
+
+       private void show_contacts_exercise_add_edit (bool adding)
+       {
+               notebook_execute.Sensitive = false;
+               frame_run_encoder_exercise.Visible = true; //TODO: in the future implement more modes
+               notebook_options_top.Visible = false;
+               label_contacts_exercise_error.Text = "";
+
+               if(adding) {
+                       button_contacts_exercise_actions_edit_do.Visible = false;
+                       button_contacts_exercise_actions_add_do.Visible = true;
+               } else {
+                       button_contacts_exercise_actions_edit_do.Visible = true;
+                       button_contacts_exercise_actions_add_do.Visible = false;
+               }
+       }
+
+       private void hide_contacts_exercise_add_edit ()
+       {
+               notebook_execute.Sensitive = true;
+               frame_run_encoder_exercise.Visible = false;
+               notebook_options_top.Visible = true;
+       }
+
+       private void on_button_contacts_exercise_actions_cancel_clicked (object o, EventArgs args)
+       {
+               hide_contacts_exercise_add_edit ();
+       }
+
+       private void on_button_contacts_exercise_actions_edit_do_clicked (object o, EventArgs args)
+       {
+               if(current_mode == Constants.Modes.RUNSENCODER)
+                       if(run_encoder_exercise_do_add_or_edit (false))
+                               hide_contacts_exercise_add_edit ();
+       }
+
+       private void on_button_contacts_exercise_actions_add_do_clicked (object o, EventArgs args)
+       {
+               if(current_mode == Constants.Modes.RUNSENCODER)
+                       if(run_encoder_exercise_do_add_or_edit (true))
+                               hide_contacts_exercise_add_edit ();
+       }
+
+       // <---- end of manage exercise edit/add from the app1.glade ----
+
 }
 
 public class ContactsCaptureDisplay : BooleansInt
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 33e4b3dff..ffdfa93e1 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -79,6 +79,9 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_add_test5;
        [Widget] Gtk.Image image_test_inspect;
        [Widget] Gtk.Image image_test_inspect1;
+       [Widget] Gtk.Image image_button_contacts_exercise_actions_cancel;
+       [Widget] Gtk.Image image_button_contacts_exercise_actions_edit_do;
+       [Widget] Gtk.Image image_button_contacts_exercise_actions_add_do;
 
        [Widget] Gtk.Image image_logo_contacts;
        [Widget] Gtk.Image image_logo_contacts_transp;
@@ -768,6 +771,7 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_cancel.png");
                image_sprint_export_cancel.Pixbuf = pixbuf;
+               image_button_contacts_exercise_actions_cancel.Pixbuf = pixbuf;
                image_button_encoder_exercise_actions_cancel.Pixbuf = pixbuf;
                image_encoder_analyze_cancel.Pixbuf = pixbuf;
                image_force_sensor_export_cancel.Pixbuf = pixbuf;
@@ -858,6 +862,8 @@ public partial class ChronoJumpWindow
                image_button_contacts_capture_save_image_disk.Pixbuf = pixbuf;
                image_jumps_rj_fatigue_image_save.Pixbuf = pixbuf;
                image_sprint_analyze_table_save_1.Pixbuf = pixbuf;
+               image_button_contacts_exercise_actions_edit_do.Pixbuf = pixbuf;
+               image_button_contacts_exercise_actions_add_do.Pixbuf = pixbuf;
                image_button_encoder_exercise_actions_edit_do.Pixbuf = pixbuf;
                image_button_encoder_exercise_actions_add_do.Pixbuf = pixbuf;
                image_encoder_capture_curves_save.Pixbuf = pixbuf;
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 54c54cacb..5ba33ff92 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2018-2020   Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2018-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -62,6 +62,36 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.DrawingArea drawingarea_race_analyzer_capture_speed_time;
        [Widget] Gtk.DrawingArea drawingarea_race_analyzer_capture_accel_time;
 
+       [Widget] Gtk.Frame frame_run_encoder_exercise;
+       [Widget] Gtk.Entry entry_run_encoder_exercise_name;
+       [Widget] Gtk.Entry entry_run_encoder_exercise_description;
+       [Widget] Gtk.CheckButton check_run_encoder_exercise_fixed_size;
+       [Widget] Gtk.HBox hbox_run_encoder_exercise_fixed_segments_size;
+       [Widget] Gtk.HBox hbox_run_encoder_exercise_notfixed_segment_num;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_m;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segments_num;
+       [Widget] Gtk.Frame frame_run_encoder_exercise_notfixed_segments;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_0;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_1;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_2;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_3;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_4;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_5;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_6;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_7;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_8;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_9;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_10;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_11;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_12;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_13;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_14;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_15;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_16;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_17;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_18;
+       [Widget] Gtk.SpinButton spin_race_encoder_exercise_segment_size_cm_19;
+
        int race_analyzer_distance;
        int race_analyzer_temperature;
        RunEncoder.Devices race_analyzer_device;
@@ -1827,7 +1857,6 @@ public partial class ChronoJumpWindow
                }
        }
 
-       //info is now info and edit (all values can be changed), and detete (there's delete button)
        void on_button_run_encoder_exercise_edit_clicked (object o, EventArgs args)
        {
                if(UtilGtk.ComboGetActive(combo_run_encoder_exercise) == "")
@@ -1838,97 +1867,124 @@ public partial class ChronoJumpWindow
 
                RunEncoderExercise ex = (RunEncoderExercise) SqliteRunEncoderExercise.Select (
                                 false, getExerciseIDFromAnyCombo(combo_run_encoder_exercise, 
runEncoderComboExercisesString, false), false)[0];
-
                LogB.Information("selected exercise: " + ex.ToString());
 
-               ArrayList bigArray = new ArrayList();
-
-               ArrayList a1 = new ArrayList();
-               ArrayList a2 = new ArrayList();
-               ArrayList a3 = new ArrayList();
-
-               //0 is the widgget to show; 1 is the editable; 2 id default value
-               a1.Add(Constants.GenericWindowShow.ENTRY); a1.Add(true); a1.Add(ex.Name);
-               bigArray.Add(a1);
-
-               a2.Add(Constants.GenericWindowShow.ENTRY2); a2.Add(true); a2.Add(ex.Description);
-               bigArray.Add(a2);
-
-               a3.Add(Constants.GenericWindowShow.SPININT2); a3.Add(true); a3.Add("");
-               bigArray.Add(a3);
-
-               genericWin = GenericWindow.Show(Catalog.GetString("Exercise"), false,   //don't show now
-                               Catalog.GetString("Race analyzer exercise:"), bigArray);
-               genericWin.LabelEntry2 = Catalog.GetString("Description");
+               show_contacts_exercise_add_edit (false);
+               entry_run_encoder_exercise_name.Text = ex.Name;
+               entry_run_encoder_exercise_description.Text = ex.Description;
 
-               genericWin.ShowButtonCancel(false);
-               genericWin.HideOnAccept = false;
+               if(list_segments_size_cm == null)
+                       spin_race_encoder_exercise_segment_size_cm_create_list ();
 
-               genericWin.uniqueID = ex.UniqueID;
-               genericWin.LabelSpinInt2 = Catalog.GetString("Segments size (m)");
-               genericWin.SetSpin2Range(1, 30);
-               genericWin.SetSpin2Value(ex.SegmentMeters);
+               if(ex.SegmentMeters < 0)
+               {
+                       check_run_encoder_exercise_fixed_size.Active = false;
+                       spin_race_encoder_exercise_segments_num.Value = ex.SegmentVariableCm.Count;
 
-               genericWin.Button_accept.Clicked -= new 
EventHandler(on_button_run_encoder_exercise_edit_accepted);
-               genericWin.Button_accept.Clicked += new 
EventHandler(on_button_run_encoder_exercise_edit_accepted);
-               genericWin.ShowNow();
+                       int i = 0;
+                       foreach(int cm in ex.SegmentVariableCm)
+                       {
+                               ( (Gtk.SpinButton) list_segments_size_cm[i]).Value = ex.SegmentVariableCm[i];
+                               i ++;
+                       }
+               } else {
+                       check_run_encoder_exercise_fixed_size.Active = true;
+                       spin_race_encoder_exercise_segment_size_m.Value = ex.SegmentMeters;
+               }
+               //force managing:
+               on_check_run_encoder_exercise_fixed_size_toggled (new object (), new EventArgs ());
        }
 
-       private void on_button_run_encoder_exercise_add_clicked (object o, EventArgs args)
+       void on_button_run_encoder_exercise_add_clicked (object o, EventArgs args)
        {
-               ArrayList bigArray = new ArrayList();
+               show_contacts_exercise_add_edit (true);
 
-               ArrayList a1 = new ArrayList();
-               ArrayList a2 = new ArrayList();
-               ArrayList a3 = new ArrayList();
+               entry_run_encoder_exercise_name.Text = "";
+               entry_run_encoder_exercise_description.Text = "";
+               spin_race_encoder_exercise_segment_size_m.Value = RunEncoderExercise.SegmentMetersDefault;
+               spin_race_encoder_exercise_segments_num.Value = 2;
 
-               //0 is the widgget to show; 1 is the editable; 2 id default value
-               a1.Add(Constants.GenericWindowShow.ENTRY); a1.Add(true); a1.Add("");
-               bigArray.Add(a1);
+               if(list_segments_size_cm == null)
+                       spin_race_encoder_exercise_segment_size_cm_create_list ();
 
-               a2.Add(Constants.GenericWindowShow.ENTRY2); a2.Add(true); a2.Add("");
-               bigArray.Add(a2);
+               spin_race_encoder_exercise_segment_size_cm_reset_list (); //put default values;
 
-               a3.Add(Constants.GenericWindowShow.SPININT2); a3.Add(true); a3.Add("");
-               bigArray.Add(a3);
+               check_run_encoder_exercise_fixed_size.Active = true;
+               //force managing:
+               on_check_run_encoder_exercise_fixed_size_toggled (new object (), new EventArgs ());
+       }
 
-               genericWin = GenericWindow.Show(Catalog.GetString("Exercise"), false,   //don't show now
-                               Catalog.GetString("Write the name of the exercise:"), bigArray);
-               genericWin.LabelEntry2 = Catalog.GetString("Description");
+       private void on_check_run_encoder_exercise_fixed_size_toggled (object o, EventArgs args)
+       {
+               if(check_run_encoder_exercise_fixed_size.Active)
+               {
+                       hbox_run_encoder_exercise_fixed_segments_size.Visible = true;
+                       hbox_run_encoder_exercise_notfixed_segment_num.Visible = false;
+                       frame_run_encoder_exercise_notfixed_segments.Visible = false;
+               } else {
+                       hbox_run_encoder_exercise_fixed_segments_size.Visible = false;
+                       hbox_run_encoder_exercise_notfixed_segment_num.Visible = true;
+                       frame_run_encoder_exercise_notfixed_segments.Visible = true;
 
-               genericWin.SetButtonAcceptLabel(Catalog.GetString("Add"));
-               genericWin.HideOnAccept = false;
+                       spin_race_encoder_exercise_segment_size_cm_show_needed ();
+               }
+       }
 
-               genericWin.LabelSpinInt2 = Catalog.GetString("Segments size (m)");
-               genericWin.SetSpin2Range(1, 30);
-               genericWin.SetSpin2Value(RunEncoderExercise.SegmentMetersDefault);
+       private void on_spin_race_encoder_exercise_segments_num_value_changed (object o, EventArgs args)
+       {
+               spin_race_encoder_exercise_segment_size_cm_show_needed ();
+       }
 
-               genericWin.Button_accept.Clicked -= new 
EventHandler(on_button_run_encoder_exercise_add_accepted);
-               genericWin.Button_accept.Clicked += new 
EventHandler(on_button_run_encoder_exercise_add_accepted);
-               genericWin.ShowNow();
+       List<Gtk.SpinButton> list_segments_size_cm;
+       private void spin_race_encoder_exercise_segment_size_cm_create_list ()
+       {
+               list_segments_size_cm = new List<Gtk.SpinButton>();
+
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_0);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_1);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_2);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_3);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_4);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_5);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_6);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_7);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_8);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_9);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_10);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_11);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_12);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_13);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_14);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_15);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_16);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_17);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_18);
+               list_segments_size_cm.Add(spin_race_encoder_exercise_segment_size_cm_19);
        }
 
-       void on_button_run_encoder_exercise_edit_accepted (object o, EventArgs args)
+       private void spin_race_encoder_exercise_segment_size_cm_reset_list ()
        {
-               if(run_encoder_exercise_do_add_or_edit(false))
-               {
-                       genericWin.Button_accept.Clicked -= new 
EventHandler(on_button_run_encoder_exercise_edit_accepted);
-                       genericWin.HideAndNull();
-               }
+               foreach(Gtk.SpinButton sb in list_segments_size_cm)
+                       sb.Value = 100;
        }
-       void on_button_run_encoder_exercise_add_accepted (object o, EventArgs args)
+
+       private void spin_race_encoder_exercise_segment_size_cm_show_needed ()
        {
-               if(run_encoder_exercise_do_add_or_edit(true))
+               int toShow = Convert.ToInt32(spin_race_encoder_exercise_segments_num.Value);
+
+               int count = 0;
+               foreach(Gtk.SpinButton sb in list_segments_size_cm)
                {
-                       genericWin.Button_accept.Clicked -= new 
EventHandler(on_button_run_encoder_exercise_add_accepted);
-                       genericWin.HideAndNull();
+                       sb.Visible = (count < toShow);
+                       count ++;
                }
        }
 
-       bool run_encoder_exercise_do_add_or_edit (bool adding)
+       private bool run_encoder_exercise_do_add_or_edit (bool adding)
        {
-               string name = 
Util.MakeValidSQLAndFileName(Util.RemoveTildeAndColonAndDot(genericWin.EntrySelected));
+               string name = 
Util.MakeValidSQLAndFileName(Util.RemoveTildeAndColonAndDot(entry_run_encoder_exercise_name.Text));
                name = Util.RemoveChar(name, '"');
+               label_contacts_exercise_error.Text = "";
 
                if(adding)
                        LogB.Information("run_encoder_exercise_do - Trying to insert: " + name);
@@ -1937,34 +1993,52 @@ public partial class ChronoJumpWindow
 
                if(name == "")
                {
-                       genericWin.SetLabelError(Catalog.GetString("Error: Missing name of exercise."));
+                       label_contacts_exercise_error.Text = Catalog.GetString("Error: Missing name of 
exercise.");
                        return false;
                }
                else if (adding && Sqlite.Exists(false, Constants.RunEncoderExerciseTable, name))
                {
-                       genericWin.SetLabelError(string.Format(Catalog.GetString(
-                                                       "Error: An exercise named '{0}' already exists."), 
name));
+                       label_contacts_exercise_error.Text = string.Format(Catalog.GetString(
+                                                       "Error: An exercise named '{0}' already exists."), 
name);
                        return false;
                }
                else if (! adding) //if we are editing
                {
                        //if we edit, check that this name does not exists (on other exercise, on current 
editing exercise is obviously fine)
                        int getIdOfThis = Sqlite.ExistsAndGetUniqueID(false, 
Constants.RunEncoderExerciseTable, name); //if not exists will be -1
-                       if(getIdOfThis != -1 && getIdOfThis != genericWin.uniqueID)
+                       if(getIdOfThis != -1 && getIdOfThis != 
getExerciseIDFromAnyCombo(combo_run_encoder_exercise, runEncoderComboExercisesString, false))
                        {
-                               genericWin.SetLabelError(string.Format(Catalog.GetString(
-                                                               "Error: An exercise named '{0}' already 
exists."), name));
+                               label_contacts_exercise_error.Text = string.Format(Catalog.GetString(
+                                                               "Error: An exercise named '{0}' already 
exists."), name);
 
                                return false;
                        }
                }
 
+               int segmentMeters = Convert.ToInt32(spin_race_encoder_exercise_segment_size_m.Value);
+               List<int> segmentVariableCm = new List<int>();
+               if(! check_run_encoder_exercise_fixed_size.Active)
+               {
+                       segmentMeters = -1;
+
+                       int i = 0;
+                       foreach(Gtk.SpinButton sb in list_segments_size_cm)
+                       {
+                               if(i < spin_race_encoder_exercise_segments_num.Value)
+                                       segmentVariableCm.Add(Convert.ToInt32(sb.Value));
+                               i ++;
+                       }
+               }
+
                if(adding)
-                       SqliteRunEncoderExercise.Insert(false, -1, name,
-                                       genericWin.Entry2Selected, genericWin.SpinInt2Selected);
-               else {
-                       RunEncoderExercise ex = new RunEncoderExercise(genericWin.uniqueID, name,
-                                       genericWin.Entry2Selected, genericWin.SpinInt2Selected);
+               {
+                       RunEncoderExercise ex = new RunEncoderExercise (
+                                       -1, name, entry_run_encoder_exercise_description.Text, segmentMeters, 
segmentVariableCm);
+                       ex.InsertSQL (false);
+               } else {
+                       RunEncoderExercise ex = new RunEncoderExercise(
+                                       getExerciseIDFromAnyCombo(combo_run_encoder_exercise, 
runEncoderComboExercisesString, false),
+                                       name, entry_run_encoder_exercise_description.Text, segmentMeters, 
segmentVariableCm);
 
                        SqliteRunEncoderExercise.Update(false, ex);
                }
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index e3a1d5491..4fc3982fa 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- *  Copyright (C) 2018-2020   Xavier de Blas <xaviblas gmail com>
+ *  Copyright (C) 2018-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -359,6 +359,7 @@ public class RunEncoderExercise
        private string description;
        private int segmentMeters;
        public static int SegmentMetersDefault = 5;
+       private List<int> segmentVariableCm; //if segmentMeters == -1 then this is used
 
        public RunEncoderExercise()
        {
@@ -369,12 +370,13 @@ public class RunEncoderExercise
                this.name = name;
        }
 
-       public RunEncoderExercise(int uniqueID, string name, string description, int segmentMeters)
+       public RunEncoderExercise(int uniqueID, string name, string description, int segmentMeters, List<int> 
segmentVariableCm)
        {
                this.uniqueID = uniqueID;
                this.name = name;
                this.description = description;
                this.segmentMeters = segmentMeters;
+               this.segmentVariableCm = segmentVariableCm;
        }
 
        public override string ToString()
@@ -382,6 +384,22 @@ public class RunEncoderExercise
                return string.Format("{0}:{1}:{2}:{3}", uniqueID, name, description, segmentMeters);
        }
 
+       public void InsertSQL (bool dbconOpened)
+       {
+               SqliteRunEncoderExercise.Insert(dbconOpened, toSQLInsertString());
+       }
+
+       private string toSQLInsertString()
+       {
+               string uniqueIDStr = "NULL";
+               if(uniqueID != -1)
+                       uniqueIDStr = uniqueID.ToString();
+
+               return
+                       "(" + uniqueIDStr + ", \"" + name + "\", \"" + description + "\", " +
+                       segmentMeters + ", \"" + SegmentVariableCmToSQL + "\")";
+       }
+
        public int UniqueID
        {
                get { return uniqueID; }
@@ -398,6 +416,14 @@ public class RunEncoderExercise
        {
                get { return segmentMeters; }
        }
+       public List<int> SegmentVariableCm
+       {
+               get { return segmentVariableCm; }
+       }
+       public string SegmentVariableCmToSQL
+       {
+               get { return Util.ListIntToSQLString (segmentVariableCm, ";"); }
+       }
 }
 
 //results coming from analyze (load) using R. To be published on exportable table
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 259b7d8f6..ec2aa2eaa 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.30";
+       static string lastChronojumpDatabaseVersion = "2.31";
 
        public Sqlite()
        {
@@ -3088,12 +3088,29 @@ class Sqlite
                                if(exercises == null || exercises.Count == 0)
                                        SqliteForceSensorExercise.insertDefault();
 
+                               /* moved to 2.30 to do it after RunEncoderExercise added segmentVariableCm
                                exercises = SqliteRunEncoderExercise.Select(true, -1, true);
                                if(exercises == null || exercises.Count == 0)
                                        SqliteRunEncoderExercise.insertDefault();
+                                       */
 
                                currentVersion = updateVersion("2.30");
                        }
+                       if(currentVersion == "2.30")
+                       {
+                               LogB.SQL("RunEncoderExercise ALTER TABLE added segmentVariableCm");
+                               try {
+                                       executeSQL("ALTER TABLE " + Constants.RunEncoderExerciseTable + " ADD 
COLUMN segmentVariableCm TEXT;");
+                               } catch {
+                                       LogB.SQL("Catched at Doing ALTER TABLE added segmentVariableCm.");
+                               }
+
+                               ArrayList exercises = SqliteRunEncoderExercise.Select(true, -1, true);
+                               if(exercises == null || exercises.Count == 0)
+                                       SqliteRunEncoderExercise.insertDefault();
+
+                               currentVersion = updateVersion("2.31");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -3315,6 +3332,7 @@ class Sqlite
                //changes [from - to - desc]
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
+               //2.30 - 2.31 Converted DB to 2.31 RunEncoderExercise ALTER TABLE added segmentVariableCm
                //2.29 - 2.30 Converted DB to 2.30 Inserted default exercises of forceSensor and raceAnalyzer 
if empty
                //2.28 - 2.29 Converted DB to 2.29 ForceSensor ALTER TABLE added maxForceRaw, maxAvgForce1s
                //2.27 - 2.28 Converted DB to 2.28 Inserted at preferences showJumpRSI
diff --git a/src/sqlite/runEncoder.cs b/src/sqlite/runEncoder.cs
index 04ebf9c48..906e60041 100644
--- a/src/sqlite/runEncoder.cs
+++ b/src/sqlite/runEncoder.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2019   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -329,7 +329,10 @@ class SqliteRunEncoder : Sqlite
 
                //need to create an exercise to assign to the imported files
                if(importedSomething)
-                       SqliteRunEncoderExercise.Insert(true, 0, "Sprint", "", 
RunEncoderExercise.SegmentMetersDefault);
+               {
+                       RunEncoderExercise ex = new RunEncoderExercise(0, "Sprint", "", 
RunEncoderExercise.SegmentMetersDefault, new List<int>());
+                       ex.InsertSQL(true);
+               }
 
                LogB.Information("end of import_from_1_70_to_1_71()");
                //LogB.PrintAllThreads = false; //TODO: remove this
@@ -357,25 +360,22 @@ class SqliteRunEncoderExercise : Sqlite
                        "uniqueID INTEGER PRIMARY KEY, " +
                        "name TEXT, " +
                        "description TEXT, " +
-                       "segmentMeters INT)";
+                       "segmentMeters INT, " +
+                       "segmentVariableCm TEXT)"; //separator is ;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
        }
 
        //undefined defaultAngle will be 1000
        //note execution can have a different angle than the default angle
-       public static int Insert (bool dbconOpened, int uniqueID, string name, string description, int 
segmentMeters)
+       public static int Insert (bool dbconOpened, string insertString)
        {
                if(! dbconOpened)
                        Sqlite.Open();
 
-               string uniqueIDStr = "NULL";
-               if(uniqueID != -1)
-                       uniqueIDStr = uniqueID.ToString();
-
                dbcmd.CommandText = "INSERT INTO " + table +
-                               " (uniqueID, name, description, segmentMeters) VALUES (" +
-                               uniqueIDStr + ", \"" + name + "\", \"" + description + "\", " + segmentMeters 
+ ")";
+                               " (uniqueID, name, description, segmentMeters, segmentVariableCm)" +
+                               " VALUES " + insertString;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
 
@@ -392,7 +392,8 @@ class SqliteRunEncoderExercise : Sqlite
        //Default exercise for users without exercises (empty database creation or never used raceAnalyzer)
        protected internal static void insertDefault ()
        {
-               Insert (true, -1, "Sprint", "", RunEncoderExercise.SegmentMetersDefault);
+               RunEncoderExercise re = new RunEncoderExercise (-1, "Sprint", "", 
RunEncoderExercise.SegmentMetersDefault, new List<int>());
+               re.InsertSQL(true);
        }
 
        public static void Update (bool dbconOpened, RunEncoderExercise ex)
@@ -410,7 +411,8 @@ class SqliteRunEncoderExercise : Sqlite
                        " name = \"" + ex.Name +
                        "\", description = \"" + ex.Description +
                        "\", segmentMeters = " + ex.SegmentMeters +
-                       " WHERE uniqueID = " + ex.UniqueID;
+                       ", segmentVariableCm = \"" + ex.SegmentVariableCmToSQL +
+                       "\" WHERE uniqueID = " + ex.UniqueID;
 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -468,7 +470,8 @@ class SqliteRunEncoderExercise : Sqlite
                                                Convert.ToInt32(reader[0].ToString()),  //uniqueID
                                                reader[1].ToString(),                   //name
                                                reader[2].ToString(),                   //description
-                                               Convert.ToInt32(reader[3].ToString())   //segmentMeters
+                                               Convert.ToInt32(reader[3].ToString()),  //segmentMeters
+                                               Util.SQLStringToListInt(reader[4].ToString(), ";")      
//segmentVariableCm
                                                );
                                array.Add(ex);
                        }


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