[chronojump] EncoderConfigWin & encoderConfigurationCurrent changes depending on gravitatory or inertial



commit 4d288492a1e01395ecf4cabc116ca442561a1d0d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu May 26 17:47:16 2016 +0200

    EncoderConfigWin & encoderConfigurationCurrent changes depending on gravitatory or inertial

 glade/chronojump.glade          |   61 ++++++++++++++++++++++++++++++++++++--
 src/gui/chronojump.cs           |   18 ++++++++++-
 src/gui/encoder.cs              |    1 +
 src/gui/encoderConfiguration.cs |   15 +++++++++-
 4 files changed, 88 insertions(+), 7 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 1256712..76ed2e1 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -16538,6 +16538,9 @@ on current Chronojump version.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -21212,6 +21215,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -22367,6 +22373,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24014,6 +24023,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>
@@ -24718,6 +24730,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -27219,7 +27234,6 @@ comments</property>
                     </child>
                     <child>
                       <widget class="GtkVBox" id="vbox10">
-                        <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="spacing">10</property>
                         <child>
@@ -37616,6 +37630,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>
@@ -40199,6 +40231,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>
@@ -41469,9 +41513,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -42626,6 +42667,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>
@@ -46667,6 +46711,9 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -47486,6 +47533,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -48320,6 +48370,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 44d8acc..2f9792d 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3045,10 +3045,24 @@ public partial class ChronoJumpWindow
                        }
 
                        notebook_sup.CurrentPage = 1;
-                       if(m == menuitem_modes.POWERGRAVITATORY)
+                       if(m == menuitem_modes.POWERGRAVITATORY) {
                                menuitem_mode_selected_power_gravitatory.Visible = true;
-                       else
+
+                               //change encoderConfigurationCurrent if needed
+                               if(encoderConfigurationCurrent.has_inertia) {
+                                       encoderConfigurationCurrent = new EncoderConfiguration(); //LINEAR, 
not INERTIAL
+                                       label_encoder_selected.Text = encoderConfigurationCurrent.code;
+                               }
+                       } else {
                                menuitem_mode_selected_power_inertial.Visible = true;
+
+                               //change encoderConfigurationCurrent if needed
+                               if(! encoderConfigurationCurrent.has_inertia) {
+                                       encoderConfigurationCurrent = new EncoderConfiguration(
+                                                       
Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL);        
+                                       label_encoder_selected.Text = encoderConfigurationCurrent.code;
+                               }
+                       }
                } else {        //m == menuitem_modes.OTHER (contacts / other)
                        notebook_sup.CurrentPage = 0;
                        notebook_sup_contacts.CurrentPage = 2;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 6116be6..96aac15 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -418,6 +418,7 @@ public partial class ChronoJumpWindow
 
        void on_button_encoder_select_clicked (object o, EventArgs args) {
                encoder_configuration_win = EncoderConfigurationWindow.View(
+                               radio_menuitem_mode_power_gravitatory.Active, //false if inertial
                                encoderConfigurationCurrent, 
                                encoderConfigurationDefinedFromFile  //defined at chronojump_config.txt and 
only few changes can be done
                                );
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index bce0fb8..7d421eb 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.cs
@@ -138,7 +138,20 @@ public class EncoderConfigurationWindow
                UtilGtk.IconWindow(encoder_configuration);
        }
        
-       static public EncoderConfigurationWindow View (EncoderConfiguration ec, bool definedInConfig) {
+       static public EncoderConfigurationWindow View (bool gravitatory, EncoderConfiguration ec, bool 
definedInConfig) 
+       {
+               /*
+                * if we are on gravitatory but ec is inertial, then put definedInConfig as false
+                * and create a new ec that suits
+                */
+               if(ec.has_inertia == gravitatory) {
+                       definedInConfig = false;
+                       if(gravitatory)
+                               ec = new EncoderConfiguration(); //LINEAR, not inertial
+                       else
+                               ec = new 
EncoderConfiguration(Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL);
+               }
+
                if (EncoderConfigurationWindowBox == null) {
                        EncoderConfigurationWindowBox = new EncoderConfigurationWindow (definedInConfig);
                }


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