[chronojump] 705214 - Encoders selection and manag. (GUI done)



commit b1847059dd35fd075a4e4009f1e4fa304af108d8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 2 17:41:10 2013 +0200

    705214 - Encoders selection and manag. (GUI done)

 glade/chronojump.glade |  554 +++++++++++++++++++++++++++++++++++------------
 src/constants.cs       |    4 +
 src/gui/encoder.cs     |  142 +++++++++----
 3 files changed, 516 insertions(+), 184 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 5df400d..e75da44 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12011,30 +12011,6 @@ on current Chronojump version.</property>
                                                         <property name="column_spacing">8</property>
                                                         <property name="row_spacing">8</property>
                                                         <child>
-                                                          <widget class="GtkLabel" id="label119">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label" 
translatable="yes">Type</property>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="x_options">GTK_FILL</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkLabel" id="label84">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label" 
translatable="yes">Capture</property>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="top_attach">1</property>
-                                                            <property name="bottom_attach">2</property>
-                                                            <property name="x_options">GTK_FILL</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
                                                           <widget class="GtkHBox" id="hbox75">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -12045,16 +12021,10 @@ on current Chronojump version.</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_linear">
-                                                            <property name="label" 
translatable="yes">Linear</property>
+                                                            <widget class="GtkLabel" id="label84">
                                                             <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Linear encoder (default)</property>
-                                                            <property 
name="use_action_appearance">False</property>
-                                                            <property name="active">True</property>
-                                                            <property name="draw_indicator">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Type:</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12063,16 +12033,17 @@ on current Chronojump version.</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_linear_inverted">
-                                                            <property name="label" 
translatable="yes">Inverted</property>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_linear">
+                                                            <property name="label" 
translatable="yes">Linear</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Linear encoder upside down</property>
+                                                            <property name="tooltip" 
translatable="yes">Linear encoder (default)</property>
                                                             <property 
name="use_action_appearance">False</property>
+                                                            <property name="active">True</property>
                                                             <property name="draw_indicator">True</property>
-                                                            <property 
name="group">radiobutton_encoder_capture_linear</property>
+                                                            <signal name="toggled" 
handler="on_radiobutton_encoder_capture_l_r_toggled" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12091,6 +12062,7 @@ on current Chronojump version.</property>
                                                             <property 
name="use_action_appearance">False</property>
                                                             <property name="draw_indicator">True</property>
                                                             <property 
name="group">radiobutton_encoder_capture_linear</property>
+                                                            <signal name="toggled" 
handler="on_radiobutton_encoder_capture_l_r_toggled" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12100,27 +12072,23 @@ on current Chronojump version.</property>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkHBox" 
id="hbox_encoder_capture_inertial">
+                                                            <widget class="GtkHBox" id="hbox116">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkCheckButton" 
id="checkbutton_encoder_capture_inertial">
-                                                            <property name="label" 
translatable="yes">Inertial</property>
+                                                            <widget class="GtkCheckButton" 
id="checkbutton_encoder_capture_inverted">
+                                                            <property name="label" 
translatable="yes">Inverted</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Inertial machine (Yoyo, VersaPulley)</property>
                                                             <property 
name="use_action_appearance">False</property>
                                                             <property name="draw_indicator">True</property>
-                                                            <signal name="clicked" 
handler="on_checkbutton_encoder_capture_inertial_clicked" swapped="no"/>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -12129,80 +12097,44 @@ on current Chronojump version.</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_inertial">
-                                                            <property name="can_focus">True</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Inertia Momentum</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>
-                                                            <property name="adjustment">0.01 0 1 0.01 0.01 
0</property>
-                                                            <property name="climb_rate">1</property>
-                                                            <property name="digits">3</property>
-                                                            <property name="snap_to_ticks">True</property>
-                                                            <property name="numeric">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="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="left_attach">1</property>
-                                                            <property name="right_attach">2</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
-                                                          <widget class="GtkHBox" id="hbox76">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="spacing">10</property>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox102">
-                                                            <property name="visible">True</property>
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_capture_rotary_f_a">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_safe">
-                                                            <property name="label" 
translatable="yes">Safe</property>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_rotary_friction">
+                                                            <property name="label" 
translatable="yes">Friction</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
                                                             <property 
name="use_action_appearance">False</property>
                                                             <property name="active">True</property>
                                                             <property name="draw_indicator">True</property>
+                                                            <signal name="toggled" 
handler="on_radiobutton_encoder_capture_rotary_friction_or_axis_toggled" swapped="no"/>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_external">
-                                                            <property name="label" 
translatable="yes">External</property>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_rotary_axis">
+                                                            <property name="label" 
translatable="yes">Axis</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="receives_default">False</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">External</property>
                                                             <property 
name="use_action_appearance">False</property>
-                                                            <property name="image_position">right</property>
+                                                            <property name="active">True</property>
                                                             <property name="draw_indicator">True</property>
-                                                            <property 
name="group">radiobutton_encoder_capture_safe</property>
+                                                            <property 
name="group">radiobutton_encoder_capture_rotary_friction</property>
+                                                            <signal name="toggled" 
handler="on_radiobutton_encoder_capture_rotary_friction_or_axis_toggled" swapped="no"/>
+                                                            </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>
@@ -12214,144 +12146,223 @@ on current Chronojump version.</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
-                                                            <child>
-                                                            <widget class="GtkHBox" id="hbox113">
+                                                          </widget>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox58">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox114">
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_capture_inertial">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">2</property>
+                                                            <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_time">
+                                                            <widget class="GtkCheckButton" 
id="checkbutton_encoder_capture_inertial">
+                                                            <property name="label" 
translatable="yes">Inertial</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Recording time</property>
+                                                            <property name="tooltip" 
translatable="yes">Inertial machine (Yoyo, VersaPulley)</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <signal name="clicked" 
handler="on_checkbutton_encoder_capture_inertial_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_inertial">
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Inertia Momentum</property>
                                                             <property name="invisible_char">●</property>
-                                                            <property name="width_chars">3</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>
-                                                            <property name="adjustment">5 5 180 1 10 
0</property>
+                                                            <property name="adjustment">0.01 0 1 0.01 0.01 
0</property>
                                                             <property name="climb_rate">1</property>
+                                                            <property name="digits">3</property>
                                                             <property name="snap_to_ticks">True</property>
                                                             <property name="numeric">True</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label71">
+                                                            <widget class="GtkButton" 
id="button_encoder_capture_inertial">
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Calcule inertial momentum</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image32">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="xalign">0</property>
-                                                            <property name="label" 
translatable="yes">s</property>
-                                                            <property name="use_markup">True</property>
+                                                            <property name="stock">gtk-execute</property>
+                                                            </widget>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="padding">4</property>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox115">
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_capture_diameter">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label118">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">2</property>
+                                                            <property name="label" 
translatable="yes">Diameter</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
                                                             <child>
-                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_min_height">
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_diameter">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Minimal height</property>
+                                                            <property name="tooltip" 
translatable="yes">Inertia Momentum</property>
                                                             <property name="invisible_char">●</property>
-                                                            <property name="width_chars">3</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>
-                                                            <property name="adjustment">20 1 300 1 10 
0</property>
+                                                            <property name="adjustment">4 0 40 1 10 
0</property>
                                                             <property name="climb_rate">1</property>
+                                                            <property name="digits">1</property>
                                                             <property name="snap_to_ticks">True</property>
                                                             <property name="numeric">True</property>
+                                                            <property 
name="update_policy">if-valid</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label81">
+                                                            <widget class="GtkLabel" id="label120">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="xalign">1</property>
                                                             <property name="label" 
translatable="yes">cm</property>
-                                                            <property name="use_markup">True</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="padding">4</property>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</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="GtkButton" id="button_encoder_help">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Help 
on encoder types</property>
+                                                            <property 
name="use_action_appearance">False</property>
                                                             <child>
-                                                            <widget class="GtkButton" 
id="button_encoder_bells">
+                                                            <widget class="GtkImage" id="image24">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-help</property>
+                                                            </widget>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="left_attach">1</property>
+                                                            <property name="right_attach">2</property>
+                                                            <property name="x_options">GTK_FILL</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox111">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_encoder_load_encoder">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" 
translatable="yes">Bells</property>
+                                                            <property name="tooltip" translatable="yes">Load 
encoder configuration</property>
                                                             <property 
name="use_action_appearance">False</property>
-                                                            <signal name="clicked" 
handler="on_button_encoder_bells_clicked" swapped="no"/>
                                                             <child>
-                                                            <widget class="GtkImage" id="image_encoder_bell">
+                                                            <widget class="GtkImage" 
id="image_encoder_capture_open1">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            <property name="stock">gtk-open</property>
                                                             </widget>
                                                             </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">2</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_encoder_save_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Save 
encoder configuration</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image10">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-save</property>
+                                                            </widget>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
@@ -12361,6 +12372,7 @@ on current Chronojump version.</property>
                                                             <property name="right_attach">2</property>
                                                             <property name="top_attach">1</property>
                                                             <property name="bottom_attach">2</property>
+                                                            <property name="x_options"/>
                                                           </packing>
                                                         </child>
                                                       </widget>
@@ -12381,7 +12393,7 @@ on current Chronojump version.</property>
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
                                                         <property name="border_width">8</property>
-                                                        <property name="spacing">8</property>
+                                                        <property name="spacing">4</property>
                                                         <child>
                                                           <widget class="GtkVBox" id="vbox2">
                                                             <property name="visible">True</property>
@@ -12523,7 +12535,7 @@ on current Chronojump version.</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="n_rows">2</property>
                                                             <property name="n_columns">3</property>
-                                                            <property name="column_spacing">10</property>
+                                                            <property name="column_spacing">4</property>
                                                             <property name="row_spacing">8</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label88">
@@ -12703,6 +12715,264 @@ on current Chronojump version.</property>
                                                         <property name="type">tab</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkVBox" id="vbox19">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="border_width">8</property>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox76">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox102">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">12</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label93">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Type</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_safe">
+                                                            <property name="label" 
translatable="yes">Safe</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="active">True</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkRadioButton" 
id="radiobutton_encoder_capture_external">
+                                                            <property name="label" 
translatable="yes">External</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">External</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <property name="image_position">right</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <property 
name="group">radiobutton_encoder_capture_safe</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox113">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">10</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox114">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label111">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Recording time</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_time">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Recording time</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property name="width_chars">3</property>
+                                                            <property 
name="invisible_char_set">True</property>
+                                                            <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 5 180 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label71">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="label" 
translatable="yes">s</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox115">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label113">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Minimal height</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" 
id="spin_encoder_capture_min_height">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Minimal height</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property name="width_chars">3</property>
+                                                            <property 
name="invisible_char_set">True</property>
+                                                            <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">20 1 300 1 10 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label81">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">1</property>
+                                                            <property name="label" 
translatable="yes">cm</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_encoder_bells">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" 
translatable="yes">Bells</property>
+                                                            <property 
name="use_action_appearance">False</property>
+                                                            <signal name="clicked" 
handler="on_button_encoder_bells_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image_encoder_bell">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">2</property>
+                                                        <property name="tab_fill">False</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label89">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label" 
translatable="yes">Capture</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">2</property>
+                                                        <property name="tab_fill">False</property>
+                                                        <property name="type">tab</property>
+                                                      </packing>
+                                                    </child>
                                                   </widget>
                                                 </child>
                                               </widget>
diff --git a/src/constants.cs b/src/constants.cs
index 42ae876..c3f5717 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -602,6 +602,10 @@ public class Constants
        //if this name changes, change it in encoder/graph.R
        public static string EncoderGraphInputMulti = "chronojump-encoder-graph-input-multi.csv"; 
 
+       public static string Concentric = "Concentric";
+       public static string EccentricConcentric = "Eccentric-concentric";
+       public static string ConcentricEccentric = "Concentric-eccentric";
+
        public enum EncoderCheckFileOp { ANALYZE_EXPORT_ALL_CURVES, ANALYZE_SAVE_IMAGE, ANALYZE_SAVE_TABLE}
        public enum EncoderSignalMode { 
                LINEAR, LINEARINVERTED, ROTARY, 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index ffbff6f..cb02ca4 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -36,10 +36,15 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.SpinButton spin_encoder_1RM_percent;
        
        [Widget] Gtk.RadioButton radiobutton_encoder_capture_linear;
-       [Widget] Gtk.RadioButton radiobutton_encoder_capture_linear_inverted;
        [Widget] Gtk.RadioButton radiobutton_encoder_capture_rotary;
+       [Widget] Gtk.RadioButton radiobutton_encoder_capture_rotary_friction;
+       [Widget] Gtk.RadioButton radiobutton_encoder_capture_rotary_axis;
+       [Widget] Gtk.CheckButton checkbutton_encoder_capture_inverted;
        [Widget] Gtk.CheckButton checkbutton_encoder_capture_inertial;
+       [Widget] Gtk.Box hbox_encoder_capture_rotary_f_a;
        [Widget] Gtk.SpinButton spin_encoder_capture_inertial;
+       [Widget] Gtk.Button button_encoder_capture_inertial;
+       [Widget] Gtk.Box hbox_encoder_capture_diameter;
 
        [Widget] Gtk.Button button_encoder_capture;
        [Widget] Gtk.RadioButton radiobutton_encoder_capture_safe;
@@ -272,7 +277,7 @@ public partial class ChronoJumpWindow
                                powerHigherCondition, powerLowerCondition,
                                peakPowerHigherCondition, peakPowerLowerCondition,
                                repetitiveConditionsWin.EncoderMainVariable,
-                               radiobutton_encoder_capture_linear_inverted.Active
+                               checkbutton_encoder_capture_inverted.Active
                                ); 
 
                EncoderStruct es = new EncoderStruct(
@@ -283,7 +288,7 @@ public partial class ChronoJumpWindow
                                "",                                     //SpecialData
                                ep);                            
                                
-               lastRecalculateWasInverted = radiobutton_encoder_capture_linear_inverted.Active;
+               lastRecalculateWasInverted = checkbutton_encoder_capture_inverted.Active;
 
                //Update inertia momentum of encoder if needed
                SqlitePreferences.Update("inertialmomentum", Util.ConvertToPoint((double) 
spin_encoder_capture_inertial.Value), false);
@@ -321,9 +326,51 @@ public partial class ChronoJumpWindow
                }
        }
        
+       //---- start of sensitiveness of encoder capture buttons
+
+       //diameter is shown when: 
+       //encoder rotary axis or
+       //encoder linear with inertial (wire will be surrounding the inertial machine)
+       
+       void on_radiobutton_encoder_capture_l_r_toggled (object o, EventArgs args) {
+               if(radiobutton_encoder_capture_linear.Active) {
+                       checkbutton_encoder_capture_inverted.Visible = true;
+                       hbox_encoder_capture_rotary_f_a.Visible = false;
+                       
+                       hbox_encoder_capture_diameter.Visible = (checkbutton_encoder_capture_inertial.Active);
+               } else {
+                       checkbutton_encoder_capture_inverted.Visible = false;
+                       hbox_encoder_capture_rotary_f_a.Visible = true;
+               
+                       hbox_encoder_capture_diameter.Visible = 
(radiobutton_encoder_capture_rotary_axis.Active);
+               }
+       }
+       
+       void on_radiobutton_encoder_capture_rotary_friction_or_axis_toggled (object o, EventArgs args) {
+               hbox_encoder_capture_diameter.Visible = 
+                       (radiobutton_encoder_capture_rotary_axis.Active);
+       }
+               
        void on_checkbutton_encoder_capture_inertial_clicked (object o, EventArgs args) {
                spin_encoder_capture_inertial.Visible = (checkbutton_encoder_capture_inertial.Active);
+               button_encoder_capture_inertial.Visible = (checkbutton_encoder_capture_inertial.Active);
+               
+               hbox_encoder_capture_diameter.Visible = (
+                       (checkbutton_encoder_capture_inertial.Active &&
+                        radiobutton_encoder_capture_linear.Active) ||
+                       (radiobutton_encoder_capture_rotary.Active &&
+                       radiobutton_encoder_capture_rotary_axis.Active)
+                       );
+
+               //if inertial machine use con-ecc
+               if(checkbutton_encoder_capture_inertial.Active) {
+                       combo_encoder_eccon.Active = UtilGtk.ComboMakeActive(combo_encoder_eccon, 
+                               Constants.ConcentricEccentric);
+               }
        }
+       
+       //---- end of sensitiveness of encoder capture buttons
+
 
        void on_combo_encoder_exercise_changed (object o, EventArgs args) {
                if(UtilGtk.ComboGetActive(combo_encoder_exercise) != "") //needed because 
encoder_exercise_edit updates this combo and can be without values in the changing process
@@ -435,11 +482,11 @@ public partial class ChronoJumpWindow
        void on_button_encoder_recalculate_clicked (object o, EventArgs args) 
        {
                if (File.Exists(Util.GetEncoderDataTempFileName())) {
-                       //change sign on signal file if radiobutton_encoder_capture_linear_inverted.Active 
changed
+                       //change sign on signal file if checkbutton_encoder_capture_inverted.Active changed
        
-                       if(lastRecalculateWasInverted != radiobutton_encoder_capture_linear_inverted.Active) {
+                       if(lastRecalculateWasInverted != checkbutton_encoder_capture_inverted.Active) {
                                Util.ChangeSign(Util.GetEncoderDataTempFileName());
-                               lastRecalculateWasInverted = 
radiobutton_encoder_capture_linear_inverted.Active;
+                               lastRecalculateWasInverted = checkbutton_encoder_capture_inverted.Active;
                        }
                        
                        encoderThreadStart(encoderModes.RECALCULATE_OR_LOAD);
@@ -460,7 +507,7 @@ public partial class ChronoJumpWindow
                                encoderButtonsSensitive(encoderSensEnum.DONENOSIGNAL);
                        else {
                                if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
-                                               encoderEcconTranslation) != "Concentric") 
+                                               encoderEcconTranslation) != Constants.Concentric) 
                                        curvesNum = curvesNum / 2;
                        
                                string [] activeCurvesList = new String[curvesNum];
@@ -496,16 +543,17 @@ public partial class ChronoJumpWindow
        private string getEncoderTypeByCombos() {
                string str = "";
                if(radiobutton_encoder_capture_linear.Active) {
-                       if(checkbutton_encoder_capture_inertial.Active)
-                               str = Constants.EncoderSignalMode.LINEARINERTIAL.ToString();
-                       else
-                               str = Constants.EncoderSignalMode.LINEAR.ToString();
-               }
-               else if(radiobutton_encoder_capture_linear_inverted.Active) {
-                       if(checkbutton_encoder_capture_inertial.Active)
-                               str = Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString();
-                       else
-                               str = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
+                       if(checkbutton_encoder_capture_inverted.Active) {
+                               if(checkbutton_encoder_capture_inertial.Active)
+                                       str = Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString();
+                               else
+                                       str = Constants.EncoderSignalMode.LINEARINVERTED.ToString();
+                       } else {
+                               if(checkbutton_encoder_capture_inertial.Active)
+                                       str = Constants.EncoderSignalMode.LINEARINERTIAL.ToString();
+                               else
+                                       str = Constants.EncoderSignalMode.LINEAR.ToString();
+                       }
                }
                else { //(radiobutton_encoder_capture_rotary.Active)
                        if(checkbutton_encoder_capture_inertial.Active)
@@ -521,33 +569,40 @@ public partial class ChronoJumpWindow
        }
        
        private void setEncoderCombos(string str) {
+               if (
+                               str.StartsWith(Constants.EncoderSignalMode.LINEARINERTIAL.ToString() + "-" ) 
||
+                               str.StartsWith(Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString() 
+ "-" ) ||
+                               str.StartsWith(Constants.EncoderSignalMode.ROTARYINERTIAL.ToString() + "-" )
+                  ) {
+                       //inertial machines
+                       checkbutton_encoder_capture_inertial.Active = true;
+                       string [] strFull = str.Split(new char[] {'-'});
+                       spin_encoder_capture_inertial.Value = 
+                               Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
+                       
+                       str=strFull[0]; //to be processed by the next ifs:
+               } else
+                       checkbutton_encoder_capture_inertial.Active = false;
+                               
+       
                if(str == Constants.EncoderSignalMode.LINEAR.ToString()) {
                        radiobutton_encoder_capture_linear.Active = true;
-                       checkbutton_encoder_capture_inertial.Active = false;
+                       checkbutton_encoder_capture_inverted.Active = false;
                }
                else if(str == Constants.EncoderSignalMode.LINEARINVERTED.ToString()) {
-                       radiobutton_encoder_capture_linear_inverted.Active = true;
-                       checkbutton_encoder_capture_inertial.Active = false;
+                       radiobutton_encoder_capture_linear.Active = true;
+                       checkbutton_encoder_capture_inverted.Active = true;
                }
-               else if(str == Constants.EncoderSignalMode.ROTARY.ToString()) {
+               else { //(str == Constants.EncoderSignalMode.ROTARY.ToString())
                        radiobutton_encoder_capture_rotary.Active = true;
-                       checkbutton_encoder_capture_inertial.Active = false;
-               }
-               else { //inertial machines
-                       checkbutton_encoder_capture_inertial.Active = true;
-                       string [] strFull = str.Split(new char[] {'-'});
-                       spin_encoder_capture_inertial.Value = 
-                               Convert.ToDouble(Util.ChangeDecimalSeparator(strFull[1]));
-                       
-                       if (str.StartsWith(Constants.EncoderSignalMode.LINEARINERTIAL.ToString() + "-" ))
-                               radiobutton_encoder_capture_linear.Active = true;
-                       else if (str.StartsWith(Constants.EncoderSignalMode.LINEARINVERTEDINERTIAL.ToString() 
+ "-" ))
-                               radiobutton_encoder_capture_linear_inverted.Active = true;
-                       else //(str.StartsWith(Constants.EncoderSignalMode.ROTARYINERTIAL.ToString() + "-" ))
-                               radiobutton_encoder_capture_rotary.Active = true;
+                       checkbutton_encoder_capture_inverted.Active = false;
                }
+
+               //TODO: fix this to use diameter if needed
        }
 
+
+       //TODO: fix this to use diameter if needed
        private string getEncoderAnalysisOptions(bool captureOrAnalyze) {
                //capture == true; analyze == false
 
@@ -563,7 +618,7 @@ public partial class ChronoJumpWindow
                        {
                                if(radiobutton_encoder_capture_rotary.Active)
                                        analysisOptions += ";ri;" + im;
-                               else    //(radiobutton_encoder_capture_linear.Active || 
radiobutton_encoder_capture_linear_inverted.Active)
+                               else    //(radiobutton_encoder_capture_linear.Active || 
checkbutton_encoder_capture_inverted.Active)
                                        analysisOptions += ";li;" + im;
                        } else 
                                analysisOptions += ";-;-";
@@ -1680,7 +1735,7 @@ public partial class ChronoJumpWindow
                                byteReaded = byteReaded - 256;
 
                        //invert sign if inverted is selected
-                       if(radiobutton_encoder_capture_linear_inverted.Active)
+                       if(checkbutton_encoder_capture_inverted.Active)
                                byteReaded *= -1;
 
                        i=i+1;
@@ -2165,17 +2220,17 @@ Log.WriteLine(str);
        //TODO: check all this  
        private string findEccon(bool forceEcconSeparated) {    
                if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
-                                       encoderEcconTranslation) == "Concentric") 
+                                       encoderEcconTranslation) == Constants.Concentric) 
                        return "c";
                else if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
-                                       encoderEcconTranslation) == "Eccentric-concentric") 
+                                       encoderEcconTranslation) == Constants.EccentricConcentric) 
                {
                        if(forceEcconSeparated || ! check_encoder_analyze_eccon_together.Active)
                                return "ecS";
                        else 
                                return "ec";
                }
-               else
+               else //Constants.ConcentricEccentric
                {
                        if(forceEcconSeparated || ! check_encoder_analyze_eccon_together.Active)
                                return "ceS";
@@ -2213,9 +2268,12 @@ Log.WriteLine(str);
                combo_encoder_exercise.Changed += new EventHandler (on_combo_encoder_exercise_changed);
                
                //create combo eccon
-               string [] comboEcconOptions = { "Concentric", "Eccentric-concentric", "Concentric-eccentric" 
};
+               string [] comboEcconOptions = { Constants.Concentric, 
+                       Constants.EccentricConcentric, Constants.ConcentricEccentric };
                string [] comboEcconOptionsTranslated = { 
-                       Catalog.GetString("Concentric"), Catalog.GetString("Eccentric-concentric"), 
Catalog.GetString("Concentric-eccentric") };
+                       Catalog.GetString(Constants.Concentric), 
+                       Catalog.GetString(Constants.EccentricConcentric), 
+                       Catalog.GetString(Constants.ConcentricEccentric) };
                encoderEcconTranslation = new String [comboEcconOptions.Length];
                for(int j=0; j < 3 ; j++)
                        encoderEcconTranslation[j] = comboEcconOptions[j] + ":" + 
comboEcconOptionsTranslated[j];


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