[chronojump] EncoderConfigurationWin differentiates gravity/inertia



commit 5cc83aeedc08ae4cc9cddc09023e2b0707d2b1b5
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jun 18 20:27:44 2015 +0200

    EncoderConfigurationWin differentiates gravity/inertia

 glade/chronojump.glade          |  423 ++++++++++++++++++++++++++-------------
 src/encoder.cs                  |   66 ++++---
 src/gui/encoderConfiguration.cs |   53 +++++-
 src/utilEncoder.cs              |  108 ++++++-----
 4 files changed, 426 insertions(+), 224 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 109e396..bd225d9 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -7994,6 +7994,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                           </widget>
                                                           <packing>
                                                             <property name="expand">True</property>
@@ -9009,6 +9012,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -10276,6 +10282,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -11184,6 +11193,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -22474,6 +22486,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -23287,6 +23302,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24592,6 +24610,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -24954,6 +24975,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -27223,37 +27247,76 @@ comments</property>
               <widget class="GtkVBox" id="vbox_select_encoder">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">8</property>
-                <child>
-                  <widget class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Select encoder configuration</property>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
+                <property name="spacing">12</property>
                 <child>
-                  <widget class="GtkHBox" id="hbox3">
+                  <widget class="GtkTable" id="table2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">10</property>
-                    <property name="homogeneous">True</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">25</property>
+                    <property name="row_spacing">8</property>
                     <child>
-                      <widget class="GtkVBox" id="vbox7">
+                      <widget class="GtkLabel" id="label21">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Resistance</property>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_EXPAND</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Select encoder type</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox8">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">20</property>
+                        <property name="homogeneous">True</property>
                         <child>
-                          <widget class="GtkImage" id="image_encoder_linear">
-                            <property name="width_request">80</property>
-                            <property name="height_request">80</property>
+                          <widget class="GtkVBox" id="vbox5">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-missing-image</property>
+                            <child>
+                              <widget class="GtkImage" id="image_encoder_linear">
+                                <property name="width_request">80</property>
+                                <property name="height_request">80</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkRadioButton" id="radio_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="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <signal name="toggled" handler="on_radio_encoder_type_linear_toggled" 
swapped="no"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="padding">6</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -27262,84 +27325,111 @@ comments</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkRadioButton" id="radio_linear">
-                            <property name="label" translatable="yes">Linear</property>
+                          <widget class="GtkVBox" id="vbox6">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="on_radio_encoder_type_linear_toggled" 
swapped="no"/>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <widget class="GtkImage" id="image_encoder_rotary_friction">
+                                <property name="width_request">80</property>
+                                <property name="height_request">80</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkRadioButton" id="radio_rotary_friction">
+                                <property name="label" translatable="yes">Rotary friction</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">radio_linear</property>
+                                <signal name="toggled" 
handler="on_radio_encoder_type_rotary_friction_toggled" swapped="no"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="padding">6</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="padding">6</property>
                             <property name="position">1</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="GtkVBox" id="vbox5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
                         <child>
-                          <widget class="GtkImage" id="image_encoder_rotary_friction">
-                            <property name="width_request">80</property>
-                            <property name="height_request">80</property>
+                          <widget class="GtkVBox" id="vbox7">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-missing-image</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="radio_rotary_friction">
-                            <property name="label" translatable="yes">Rotary friction</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">radio_linear</property>
-                            <signal name="toggled" handler="on_radio_encoder_type_rotary_friction_toggled" 
swapped="no"/>
+                            <child>
+                              <widget class="GtkImage" id="image_encoder_rotary_axis">
+                                <property name="width_request">80</property>
+                                <property name="height_request">80</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkRadioButton" id="radio_rotary_axis">
+                                <property name="label" translatable="yes">Rotary axis</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">radio_linear</property>
+                                <signal name="toggled" handler="on_radio_encoder_type_rotary_axis_toggled" 
swapped="no"/>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="padding">6</property>
+                                <property name="pack_type">end</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="padding">6</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="position">1</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_EXPAND</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkVBox" id="vbox6">
+                      <widget class="GtkVBox" id="vbox10">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
+                        <property name="spacing">10</property>
                         <child>
-                          <widget class="GtkImage" id="image_encoder_rotary_axis">
-                            <property name="width_request">80</property>
-                            <property name="height_request">80</property>
+                          <widget class="GtkRadioButton" id="radio_gravity">
+                            <property name="label" translatable="yes">Gravity</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="stock">gtk-missing-image</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <signal name="toggled" handler="on_radio_gravity_toggled" swapped="no"/>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -27348,34 +27438,37 @@ comments</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkRadioButton" id="radio_rotary_axis">
-                            <property name="label" translatable="yes">Rotary axis</property>
+                          <widget class="GtkRadioButton" id="radio_inertia">
+                            <property name="label" translatable="yes">Inertia</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">radio_linear</property>
-                            <signal name="toggled" handler="on_radio_encoder_type_rotary_axis_toggled" 
swapped="no"/>
+                            <property name="group">radio_gravity</property>
+                            <signal name="toggled" handler="on_radio_inertia_toggled" swapped="no"/>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="padding">6</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                       </widget>
                       <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">2</property>
+                        <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"/>
+                        <property name="y_options">GTK_FILL</property>
+                        <property name="y_padding">12</property>
                       </packing>
                     </child>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
@@ -27406,86 +27499,96 @@ comments</property>
                           <widget class="GtkVBox" id="vbox3">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">8</property>
+                            <property name="spacing">16</property>
                             <child>
                               <widget class="GtkHBox" id="hbox2">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="spacing">10</property>
                                 <child>
-                                  <widget class="GtkButton" id="button_previous">
+                                  <widget class="GtkHBox" id="hbox3">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="xalign">0</property>
-                                    <signal name="clicked" handler="on_button_previous_clicked" 
swapped="no"/>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">10</property>
                                     <child>
-                                      <widget class="GtkAlignment" id="alignment1">
+                                      <widget class="GtkButton" id="button_previous">
                                         <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
                                         <property name="xalign">0</property>
+                                        <signal name="clicked" handler="on_button_previous_clicked" 
swapped="no"/>
                                         <child>
-                                          <widget class="GtkImage" id="image2988">
+                                          <widget class="GtkAlignment" id="alignment2">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="stock">gtk-media-previous</property>
+                                            <property name="xalign">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image2988">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-media-previous</property>
+                                                <property name="icon-size">3</property>
+                                              </widget>
+                                            </child>
                                           </widget>
                                         </child>
                                       </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
                                     </child>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkLabel" id="label_count">
-                                    <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">1</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkButton" id="button_next">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="xalign">0</property>
-                                    <signal name="clicked" handler="on_button_next_clicked" swapped="no"/>
                                     <child>
-                                      <widget class="GtkAlignment" id="alignment2">
+                                      <widget class="GtkLabel" id="label_count">
                                         <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">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkButton" id="button_next">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
                                         <property name="xalign">0</property>
+                                        <signal name="clicked" handler="on_button_next_clicked" 
swapped="no"/>
                                         <child>
-                                          <widget class="GtkImage" id="image1">
+                                          <widget class="GtkAlignment" id="alignment4">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="stock">gtk-media-next</property>
+                                            <property name="xalign">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image1">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="stock">gtk-media-next</property>
+                                                <property name="icon-size">3</property>
+                                              </widget>
+                                            </child>
                                           </widget>
                                         </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>
-                                    <property name="fill">True</property>
-                                    <property name="position">2</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
                                   </packing>
                                 </child>
-                                <child>
-                                  <placeholder/>
-                                </child>
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
-                                <property name="fill">True</property>
+                                <property name="fill">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -27929,8 +28032,8 @@ comments</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">1</property>
                           </packing>
                         </child>
@@ -28046,7 +28149,7 @@ comments</property>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="padding">8</property>
-                    <property name="position">2</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
@@ -28090,8 +28193,7 @@ comments</property>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">10</property>
-                    <property name="position">3</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </widget>
@@ -35599,6 +35701,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -36814,6 +36934,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -36835,8 +36967,8 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-               <signal name="clicked" handler="on_button_close_clicked" swapped="no"/>
-               <accelerator key="Escape" signal="clicked"/>
+                <signal name="clicked" handler="on_button_close_clicked" swapped="no"/>
+                <accelerator key="Escape" signal="clicked"/>
               </widget>
               <packing>
                 <property name="expand">True</property>
@@ -37886,6 +38018,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                             </child>
                           </widget>
@@ -38737,6 +38872,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -41578,6 +41716,9 @@ show elevation as:</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -42055,6 +42196,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -42547,6 +42691,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/encoder.cs b/src/encoder.cs
index 1310fd8..f7ff8cf 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -896,7 +896,7 @@ public class EncoderBarsData {
 public class EncoderConfiguration {
        public Constants.EncoderConfigurationNames name;
        public Constants.EncoderType type;
-       public int position;
+       public int position; //used to find values on the EncoderConfigurationList. Numeration changes on 
every encoder and on not inertial/inertial
        public string image;
        public string code;     //this code will be stored untranslated but will be translated just to be 
shown
        public string text;
@@ -961,6 +961,7 @@ public class EncoderConfiguration {
                gearedDown = 1;
 
                // ---- LINEAR ----
+               // ---- not inertial
                if(name == Constants.EncoderConfigurationNames.LINEAR) {
                        type = Constants.EncoderType.LINEAR;
                        position = 0;
@@ -975,22 +976,9 @@ public class EncoderConfiguration {
                        code = "Linear inv - barbell";
                        text = Catalog.GetString("Linear encoder inverted attached to a barbell.");
                }
-               else if(name == Constants.EncoderConfigurationNames.LINEARINERTIAL) {
-                       type = Constants.EncoderType.LINEAR;
-                       position = 2;
-                       image = Constants.FileNameEncoderLinearInertial;
-                       code = "Linear - inertial machine";
-                       text = Catalog.GetString("Linear encoder on inertia machine.") + "\n" + 
-                               Catalog.GetString("Configuration NOT Recommended! Please use a rotary 
encoder.") + "\n" +
-                               "*" + Catalog.GetString("Person has to start fully extended (on the toes).") 
+ "*" + "\n" + 
-                               Catalog.GetString("On inertial machines, 'd' means the average diameter where 
the pull-push string is rolled");
-                       
-                       has_d = true;
-                       has_inertia = true;
-               }
                else if(name == Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 3;
+                       position = 2;
                        image = Constants.FileNameEncoderWeightedMovPulleyOnPerson1;
                        code = "Linear - barbell - moving pulley";
                        text = Catalog.GetString("Linear encoder attached to a barbell.") + " " + 
@@ -1001,7 +989,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1INV) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 4;
+                       position = 3;
                        image = Constants.FileNameEncoderWeightedMovPulleyOnPerson1Inv;
                        code = "Linear inv - barbell - moving pulley";
                        text = Catalog.GetString("Linear encoder inverted attached to a barbell.") + " " + 
@@ -1012,7 +1000,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 5;
+                       position = 4;
                        image = Constants.FileNameEncoderWeightedMovPulleyOnPerson2;
                        code = "Linear - barbell - pulley - moving pulley";
                        text = Catalog.GetString("Linear encoder attached to a barbell.") + " " + 
@@ -1023,7 +1011,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2INV) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 6;
+                       position = 5;
                        image = Constants.FileNameEncoderWeightedMovPulleyOnPerson2Inv;
                        code = "Linear inv - barbell - pulley - moving pulley";
                        text = Catalog.GetString("Linear encoder inverted attached to a barbell.") + " " + 
@@ -1034,7 +1022,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYONLINEARENCODER) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 7;
+                       position = 6;
                        image = Constants.FileNameEncoderWeightedMovPulleyOnLinearEncoder;
                        code = "Linear - moving pulley";
                        text = Catalog.GetString("Linear encoder attached to a weighted moving pulley.")
@@ -1044,7 +1032,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.LINEARONPLANE) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 8;
+                       position = 7;
                        image = Constants.FileNameEncoderLinearOnPlane;
                        code = "Linear - inclinated plane";
                        text = Catalog.GetString("Linear encoder on a inclinated plane.");
@@ -1054,7 +1042,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.LINEARONPLANEWEIGHTDIFFANGLE) {
                        type = Constants.EncoderType.LINEAR;
-                       position = 9;
+                       position = 8;
                        image = Constants.FileNameEncoderLinearOnPlaneWeightDiffAngle;
                        code = "Linear - inclinated plane different angle";
                        text = Catalog.GetString("Linear encoder on a inclinated plane moving a weight in 
different angle.");
@@ -1062,7 +1050,22 @@ public class EncoderConfiguration {
                        has_angle_push = true;
                        has_angle_weight = true;
                }
+               // ---- inertial
+               else if(name == Constants.EncoderConfigurationNames.LINEARINERTIAL) {
+                       type = Constants.EncoderType.LINEAR;
+                       position = 0;
+                       image = Constants.FileNameEncoderLinearInertial;
+                       code = "Linear - inertial machine";
+                       text = Catalog.GetString("Linear encoder on inertia machine.") + "\n" + 
+                               Catalog.GetString("Configuration NOT Recommended! Please use a rotary 
encoder.") + "\n" +
+                               "*" + Catalog.GetString("Person has to start fully extended (on the toes).") 
+ "*" + "\n" + 
+                               Catalog.GetString("On inertial machines, 'd' means the average diameter where 
the pull-push string is rolled");
+                       
+                       has_d = true;
+                       has_inertia = true;
+               }
                // ---- ROTARY FRICTION ----
+               // ---- not inertial
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDE) {
                        type = Constants.EncoderType.ROTARYFRICTION;
                        position = 0;
@@ -1087,9 +1090,10 @@ public class EncoderConfiguration {
                        code = "Rotary friction - moving pulley";
                        text = Catalog.GetString("Rotary friction encoder on weighted moving pulley.");
                }
+               // ---- inertial
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIAL) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 3;
+                       position = 0;
                        image = Constants.FileNameEncoderFrictionSideInertial;
                        code = "Rotary friction - inertial machine side";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine side.") + "\n" +
@@ -1102,7 +1106,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIAL) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 4;
+                       position = 1;
                        image = Constants.FileNameEncoderFrictionAxisInertial;
                        code = "Rotary friction axis - inertial machine axis";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine axis.") + "\n" +
@@ -1114,7 +1118,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALLATERAL) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 5;
+                       position = 2;
                        image = Constants.FileNameEncoderFrictionSideInertialLateral;
                        code = "Rotary friction - inertial machine side - lateral movement";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine when person is 
moving laterally.") + "\n" +
@@ -1127,7 +1131,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALLATERAL) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 6;
+                       position = 3;
                        image = Constants.FileNameEncoderFrictionAxisInertialLateral;
                        code = "Rotary friction - inertial machine axis - lateral movement";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine when person is 
moving laterally.") + "\n" +
@@ -1139,7 +1143,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALMOVPULLEY) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 7;
+                       position = 4;
                        image = Constants.FileNameEncoderFrictionSideInertialMovPulley;
                        code = "Rotary friction - inertial machine side geared up";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine geared up.") + 
"\n" +
@@ -1155,7 +1159,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALMOVPULLEY) {
                        type = Constants.EncoderType.ROTARYFRICTION;
-                       position = 8;
+                       position = 5;
                        image = Constants.FileNameEncoderFrictionAxisInertialMovPulley;
                        code = "Rotary friction - inertial machine axis geared up";
                        text = Catalog.GetString("Rotary friction encoder on inertial machine geared up.") + 
"\n" +
@@ -1169,6 +1173,7 @@ public class EncoderConfiguration {
                        gearedDown = -2; //gearedDown is not used in inertial machines. It's hardcoded
                }
                // ---- ROTARY AXIS ----
+               // ---- not inertial
                else if(name == Constants.EncoderConfigurationNames.ROTARYAXIS) {
                        type = Constants.EncoderType.ROTARYAXIS;
                        position = 0;
@@ -1188,9 +1193,10 @@ public class EncoderConfiguration {
                        
                        gearedDown = 2;
                }
+               // ---- inertial
                else if(name == Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL) {
                        type = Constants.EncoderType.ROTARYAXIS;
-                       position = 2;
+                       position = 0;
                        image = Constants.FileNameEncoderAxisInertial;
                        code = "Rotary axis - inertial machine";
                        text = Catalog.GetString("Rotary axis encoder on inertial machine.") + "\n" +
@@ -1202,7 +1208,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYAXISINERTIALLATERAL) {
                        type = Constants.EncoderType.ROTARYAXIS;
-                       position = 3;
+                       position = 1;
                        image = Constants.FileNameEncoderAxisInertialLateral;
                        code = "Rotary axis - inertial machine - lateral movement";
                        text = Catalog.GetString("Rotary axis encoder on inertial machine when person is 
moving laterally.") + "\n" +
@@ -1214,7 +1220,7 @@ public class EncoderConfiguration {
                }
                else if(name == Constants.EncoderConfigurationNames.ROTARYAXISINERTIALMOVPULLEY) {
                        type = Constants.EncoderType.ROTARYAXIS;
-                       position = 4;
+                       position = 2;
                        image = Constants.FileNameEncoderAxisInertialMovPulley;
                        code = "Rotary axis - inertial machine geared up";
                        text = Catalog.GetString("Rotary axis encoder on inertial machine geared up.") + "\n" 
+
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index 81b3980..9c128a8 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.cs
@@ -26,7 +26,8 @@ using Glade;
 using Mono.Unix;
 
 
-public class EncoderConfigurationWindow {
+public class EncoderConfigurationWindow 
+{
        [Widget] Gtk.Window encoder_configuration;
        [Widget] Gtk.Image image_encoder_linear;
        [Widget] Gtk.Image image_encoder_rotary_friction;
@@ -36,7 +37,14 @@ public class EncoderConfigurationWindow {
        [Widget] Gtk.RadioButton radio_linear;
        [Widget] Gtk.RadioButton radio_rotary_friction;
        [Widget] Gtk.RadioButton radio_rotary_axis;
+       
+       [Widget] Gtk.RadioButton radio_gravity;
+       [Widget] Gtk.RadioButton radio_inertia;
+       
+       [Widget] Gtk.Button button_previous;
+       [Widget] Gtk.Button button_next;
        [Widget] Gtk.Label label_count;
+
        [Widget] Gtk.TextView textview;
        [Widget] Gtk.Box hbox_d;
        [Widget] Gtk.Box hbox_D;
@@ -113,8 +121,13 @@ public class EncoderConfigurationWindow {
                else    //linear
                        EncoderConfigurationWindowBox.radio_linear.Active = true;
 
+               if(! ec.has_inertia)
+                       EncoderConfigurationWindowBox.radio_gravity.Active = true;
+               else
+                       EncoderConfigurationWindowBox.radio_inertia.Active = true;
 
-               EncoderConfigurationWindowBox.initializeList(ec.type, ec.position);
+
+               EncoderConfigurationWindowBox.initializeList(ec.type, ec.has_inertia, ec.position);
                
                EncoderConfigurationWindowBox.putValuesStoredPreviously(
                                ec.d, ec.D, ec.anglePush, ec.angleWeight, 
@@ -126,19 +139,45 @@ public class EncoderConfigurationWindow {
        
        private void on_radio_encoder_type_linear_toggled (object obj, EventArgs args) {
                if(radio_linear.Active)
-                       initializeList(Constants.EncoderType.LINEAR, 0);
+                       initializeList(Constants.EncoderType.LINEAR, radio_inertia.Active, 0);
        }
        private void on_radio_encoder_type_rotary_friction_toggled (object obj, EventArgs args) {
                if(radio_rotary_friction.Active)
-                       initializeList(Constants.EncoderType.ROTARYFRICTION, 0);
+                       initializeList(Constants.EncoderType.ROTARYFRICTION, radio_inertia.Active, 0);
        }
        private void on_radio_encoder_type_rotary_axis_toggled (object obj, EventArgs args) {
                if(radio_rotary_axis.Active)
-                       initializeList(Constants.EncoderType.ROTARYAXIS, 0);
+                       initializeList(Constants.EncoderType.ROTARYAXIS, radio_inertia.Active, 0);
+       }
+       
+       private void on_radio_gravity_toggled (object obj, EventArgs args) {
+               if(radio_gravity.Active) {
+                       if(radio_linear.Active)
+                               initializeList(Constants.EncoderType.LINEAR, false, 0);
+                       else if(radio_rotary_friction.Active)
+                               initializeList(Constants.EncoderType.ROTARYFRICTION, false, 0);
+                       else //(radio_rotary_axis.Active)
+                               initializeList(Constants.EncoderType.ROTARYAXIS, false, 0);
+               }
+       }
+       private void on_radio_inertia_toggled (object obj, EventArgs args) {
+               if(radio_inertia.Active) {
+                       if(radio_linear.Active)
+                               initializeList(Constants.EncoderType.LINEAR, true, 0);
+                       else if(radio_rotary_friction.Active)
+                               initializeList(Constants.EncoderType.ROTARYFRICTION, true, 0);
+                       else //(radio_rotary_axis.Active)
+                               initializeList(Constants.EncoderType.ROTARYAXIS, true, 0);
+               }
        }
        
-       private void initializeList(Constants.EncoderType type, int position) {
-               list = UtilEncoder.EncoderConfigurationList(type);
+
+       private void initializeList(Constants.EncoderType type, bool inertial, int position) {
+               list = UtilEncoder.EncoderConfigurationList(type, inertial);
+
+               button_previous.Sensitive = (list.Count > 1);
+               button_next.Sensitive = (list.Count > 1);
+                       
                listCurrent = position; //current item on list
                
                selectedModeChanged();
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index 811e10c..25bcc24 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -699,59 +699,69 @@ public class UtilEncoder
                return fileCurve;
        }
 
-       public static ArrayList EncoderConfigurationList(Constants.EncoderType encoderType) {
+       public static ArrayList EncoderConfigurationList(Constants.EncoderType encoderType, bool inertial) {
                ArrayList list = new ArrayList();
                if(encoderType == Constants.EncoderType.LINEAR) {
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.LINEAR));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.LINEARINVERTED));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.LINEARINERTIAL));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1INV));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2INV));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYONLINEARENCODER));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.LINEARONPLANE));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.LINEARONPLANEWEIGHTDIFFANGLE));
+                       if(! inertial) {
+                               list.Add(new EncoderConfiguration(
+                                                       Constants.EncoderConfigurationNames.LINEAR));
+                               list.Add(new EncoderConfiguration(
+                                                       Constants.EncoderConfigurationNames.LINEARINVERTED));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON1INV));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYLINEARONPERSON2INV));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYONLINEARENCODER));
+                               list.Add(new EncoderConfiguration(
+                                                       Constants.EncoderConfigurationNames.LINEARONPLANE));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.LINEARONPLANEWEIGHTDIFFANGLE));
+                       } else {
+                               list.Add(new EncoderConfiguration(
+                                                       Constants.EncoderConfigurationNames.LINEARINERTIAL));
+                       }
                } else if(encoderType == Constants.EncoderType.ROTARYFRICTION) {
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDE));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYFRICTIONAXIS));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYROTARYFRICTION));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIAL));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIAL));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALLATERAL));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALLATERAL));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALMOVPULLEY));
-                       list.Add(new EncoderConfiguration(
-                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALMOVPULLEY));
+                       if(! inertial) {
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDE));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXIS));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYROTARYFRICTION));
+                       }
+                       else {
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALLATERAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALLATERAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONSIDEINERTIALMOVPULLEY));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYFRICTIONAXISINERTIALMOVPULLEY));
+                       }
                } else if(encoderType == Constants.EncoderType.ROTARYAXIS) {
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYAXIS));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYROTARYAXIS));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYAXISINERTIALLATERAL));
-                       list.Add(new EncoderConfiguration(
-                                       Constants.EncoderConfigurationNames.ROTARYAXISINERTIALMOVPULLEY));
+                       if(! inertial) {
+                               list.Add(new EncoderConfiguration(
+                                                       Constants.EncoderConfigurationNames.ROTARYAXIS));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.WEIGHTEDMOVPULLEYROTARYAXIS));
+                       } else {
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYAXISINERTIALLATERAL));
+                               list.Add(new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYAXISINERTIALMOVPULLEY));
+                       }
                }
                return list;
        }


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