[chronojump] Added new mode inertial on main menu



commit cb1ea3dade382c31ef81bab196819fb90bc3cd77
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu May 26 14:38:15 2016 +0200

    Added new mode inertial on main menu

 glade/chronojump.glade |  270 ++++++++++++++++++++++++++++++++++++++++++++----
 src/config.cs          |   15 ++-
 src/gui/chronojump.cs  |   34 ++++--
 src/gui/networks.cs    |    6 +-
 4 files changed, 284 insertions(+), 41 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index ad5ef4c..c588bd7 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -289,10 +289,10 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power">
+                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power_gravitatory">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Power</property>
+                        <property name="label" translatable="yes">Power (gravitatory)</property>
                         <property name="use_underline">True</property>
                         <property name="draw_as_radio">True</property>
                         <property name="group">radio_menuitem_mode_jumps</property>
@@ -300,6 +300,16 @@
                       </widget>
                     </child>
                     <child>
+                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power_inertial">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Power (inertial)</property>
+                        <property name="draw_as_radio">True</property>
+                        <property name="group">radio_menuitem_mode_jumps</property>
+                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_other">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -561,10 +571,9 @@
                         <property name="can_focus">False</property>
                         <property name="spacing">30</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox122">
+                          <widget class="GtkHButtonBox" id="hbuttonbox1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">16</property>
                             <child>
                               <widget class="GtkButton" id="button_selector_start_jumps">
                                 <property name="visible">True</property>
@@ -579,8 +588,8 @@
                                     <property name="can_focus">False</property>
                                     <child>
                                       <widget class="GtkImage" id="image_selector_start_jumps">
-                                        <property name="width_request">250</property>
-                                        <property name="height_request">290</property>
+                                        <property name="width_request">225</property>
+                                        <property name="height_request">261</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-missing-image</property>
@@ -699,8 +708,8 @@
                                     <property name="can_focus">False</property>
                                     <child>
                                       <widget class="GtkImage" id="image_selector_start_runs">
-                                        <property name="width_request">250</property>
-                                        <property name="height_request">290</property>
+                                        <property name="width_request">225</property>
+                                        <property name="height_request">261</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-missing-image</property>
@@ -800,18 +809,18 @@
                                 </child>
                               </widget>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">False</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkButton" id="button_selector_start_encoder">
+                              <widget class="GtkButton" id="button_selector_start_encoder_gravitatory">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
                                 <property name="tooltip" translatable="yes">Or press '3'</property>
-                                <signal name="clicked" handler="on_button_selector_start_power_clicked" 
swapped="no"/>
+                                <signal name="clicked" 
handler="on_button_selector_start_power_gravitatory_clicked" swapped="no"/>
                                 <accelerator key="3" signal="clicked"/>
                                 <child>
                                   <widget class="GtkVBox" id="vbox80">
@@ -833,8 +842,8 @@
                                     </child>
                                     <child>
                                       <widget class="GtkImage" id="image_selector_start_encoder">
-                                        <property name="width_request">250</property>
-                                        <property name="height_request">290</property>
+                                        <property name="width_request">225</property>
+                                        <property name="height_request">261</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="stock">gtk-missing-image</property>
@@ -871,7 +880,7 @@
                                                 <property name="can_focus">False</property>
                                                 <property name="xpad">8</property>
                                                 <property name="ypad">8</property>
-                                                <property name="label" translatable="yes">Encoders</property>
+                                                <property name="label" translatable="yes">Gravitatory 
encoder</property>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -914,10 +923,119 @@
                                 <property name="position">2</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkButton" id="button_selector_start_encoder_inertial">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="tooltip" translatable="yes">Or press '4'</property>
+                                <signal name="clicked" 
handler="on_button_selector_start_power_inertial_clicked" swapped="no"/>
+                                <accelerator key="3" signal="clicked"/>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox41">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label39">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="xpad">8</property>
+                                        <property name="ypad">8</property>
+                                        <property name="label" translatable="yes">Power</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">-1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkImage" id="image_selector_start_encoder1">
+                                        <property name="width_request">225</property>
+                                        <property name="height_request">261</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="GtkHBox" id="hbox105">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <child>
+                                          <widget class="GtkHBox" id="hbox152">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <child>
+                                              <widget class="GtkLabel" id="label64">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label">[</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkLabel" id="label98">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="xpad">8</property>
+                                                <property name="ypad">8</property>
+                                                <property name="label" translatable="yes">Inertial 
encoder</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="label107">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label">]</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">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">True</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
@@ -944,7 +1062,7 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">True</property>
-                                <property name="tooltip" translatable="yes">Or press '4'</property>
+                                <property name="tooltip" translatable="yes">Or press '5'</property>
                                 <signal name="clicked" handler="on_button_selector_start_other_clicked" 
swapped="no"/>
                                 <accelerator key="4" signal="clicked"/>
                                 <child>
@@ -16407,6 +16525,12 @@ on current Chronojump version.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -21075,6 +21199,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -22224,6 +22354,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -23865,6 +24001,12 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -24563,6 +24705,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -37425,6 +37573,42 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -39984,6 +40168,30 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -41257,12 +41465,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -42411,6 +42613,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -46446,6 +46654,12 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -47259,6 +47473,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -48087,6 +48307,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/config.cs b/src/config.cs
index 5e38eee..9539137 100644
--- a/src/config.cs
+++ b/src/config.cs
@@ -31,7 +31,8 @@ public class Config
        public bool CustomButtons;
        public bool UseVideo;
        public AutodetectPortEnum AutodetectPort;
-       public bool OnlyEncoder;
+       public bool OnlyEncoderGravitatory;
+       public bool OnlyEncoderInertial;
        public bool EncoderCaptureShowOnlyBars;
        public bool EncoderUpdateTreeViewWhileCapturing; //recomended: false. Make it false if 
EncoderCaptureShowOnlyBars == true
                                                        //because treeview will be in 2n page of notebook
@@ -53,7 +54,8 @@ public class Config
                else
                        AutodetectPort = AutodetectPortEnum.ACTIVE;
 
-               OnlyEncoder = false;
+               OnlyEncoderGravitatory = false;
+               OnlyEncoderInertial = false;
                EncoderCaptureShowOnlyBars = false;
                EncoderUpdateTreeViewWhileCapturing = true;
                PersonWinHide = false;
@@ -91,8 +93,10 @@ public class Config
                                        else if(parts[0] == "AutodetectPort" && 
Enum.IsDefined(typeof(AutodetectPortEnum), parts[1]))
                                                AutodetectPort = (AutodetectPortEnum) 
                                                        Enum.Parse(typeof(AutodetectPortEnum), parts[1]);
-                                       else if(parts[0] == "OnlyEncoder" && Util.StringToBool(parts[1]))
-                                               OnlyEncoder = true;
+                                       else if(parts[0] == "OnlyEncoderGravitatory" && 
Util.StringToBool(parts[1]))
+                                               OnlyEncoderGravitatory = true;
+                                       else if(parts[0] == "OnlyEncoderInertial" && 
Util.StringToBool(parts[1]))
+                                               OnlyEncoderInertial = true;
                                        else if(parts[0] == "EncoderCaptureShowOnlyBars" && 
Util.StringToBool(parts[1]))
                                                EncoderCaptureShowOnlyBars = true;
                                        else if(parts[0] == "EncoderUpdateTreeViewWhileCapturing" && ! 
Util.StringToBool(parts[1]))
@@ -178,7 +182,8 @@ public class Config
                                "CustomButtons = " + CustomButtons.ToString() + "\n" +
                                "UseVideo = " + UseVideo.ToString() + "\n" +
                                "AutodetectPort = " + AutodetectPort.ToString() + "\n" +
-                               "OnlyEncoder = " + OnlyEncoder.ToString() + "\n" +
+                               "OnlyEncoderGravitatory = " + OnlyEncoderGravitatory.ToString() + "\n" +
+                               "OnlyEncoderInertial = " + OnlyEncoderInertial.ToString() + "\n" +
                                "EncoderCaptureShowOnlyBars = " + EncoderCaptureShowOnlyBars.ToString() + 
"\n" +
                                "EncoderUpdateTreeViewWhileCapturing = " + 
EncoderUpdateTreeViewWhileCapturing.ToString() + "\n" +
                                "PersonWinHide = " + PersonWinHide.ToString() + "\n" +
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 6f6b2dd..d7ec5b0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -42,7 +42,8 @@ public partial class ChronoJumpWindow
        
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_jumps;
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_runs;
-       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_power;
+       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_power_gravitatory;
+       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_power_inertial;
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_other;
 
        [Widget] Gtk.MenuItem menuitem_mode_selected_jumps;
@@ -3009,7 +3010,7 @@ public partial class ChronoJumpWindow
                main_menu.Visible = false;
        }       
        
-       enum menuitem_modes { JUMPS, RUNS, POWER, OTHER }
+       enum menuitem_modes { JUMPS, RUNS, POWERGRAVITATORY, POWERINERTIAL, OTHER }
        private void select_menuitem_mode_toggled(menuitem_modes m) 
        {
                menuitem_mode_selected_jumps.Visible = false;
@@ -3029,7 +3030,7 @@ public partial class ChronoJumpWindow
                        notebook_sup_contacts.CurrentPage = 1;
                        menuitem_mode_selected_runs.Visible = true;
                        radio_mode_runs_small.Active = true;
-               } else if(m == menuitem_modes.POWER) {
+               } else if(m == menuitem_modes.POWERGRAVITATORY || m == menuitem_modes.POWERINERTIAL) {
                        //on OSX R is not installed by default. Check if it's installed. Needed for encoder
                        if( UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX &&
                                        ! Util.FileExists(Constants.ROSX) )
@@ -3057,10 +3058,10 @@ public partial class ChronoJumpWindow
                main_menu.Visible = true;
 
                //do not perform autoDetect if we are on contacts and already detected
-               if(chronopicWin.Connected && m != menuitem_modes.POWER)
+               if( chronopicWin.Connected && m != menuitem_modes.POWERGRAVITATORY && m != 
menuitem_modes.POWERINERTIAL )
                        change_multitest_firmware(m);
                else
-                       autoDetectChronopic(m); //will perform change_multitest_firmware at the end (except 
on POWER)
+                       autoDetectChronopic(m); //will perform change_multitest_firmware at the end (except 
on POWERs)
                        
        }
        
@@ -3069,7 +3070,7 @@ public partial class ChronoJumpWindow
        {
                main_menu.Sensitive = false;
 
-               if(m == menuitem_modes.POWER) 
+               if(m == menuitem_modes.POWERGRAVITATORY || m == menuitem_modes.POWERINERTIAL) 
                {
                        hbox_chronopic_encoder_detecting.Visible = true;
                        viewport_chronopic_encoder.Visible = false;
@@ -3259,8 +3260,10 @@ public partial class ChronoJumpWindow
                        return menuitem_modes.JUMPS;
                else if(radio_menuitem_mode_runs.Active)
                        return menuitem_modes.RUNS;
-               else if(radio_menuitem_mode_power.Active)
-                       return menuitem_modes.POWER;
+               else if(radio_menuitem_mode_power_gravitatory.Active)
+                       return menuitem_modes.POWERGRAVITATORY;
+               else if(radio_menuitem_mode_power_inertial.Active)
+                       return menuitem_modes.POWERINERTIAL;
                else // if(radio_menuitem_mode_other.Active)
                        return menuitem_modes.OTHER;
        }
@@ -3291,12 +3294,19 @@ public partial class ChronoJumpWindow
                else
                        radio_menuitem_mode_runs.Active = true;
        }
-       private void on_button_selector_start_power_clicked(object o, EventArgs args) 
+       private void on_button_selector_start_power_gravitatory_clicked(object o, EventArgs args) 
        {
-               if(radio_menuitem_mode_power.Active)
-                       select_menuitem_mode_toggled(menuitem_modes.POWER);
+               if(radio_menuitem_mode_power_gravitatory.Active)
+                       select_menuitem_mode_toggled(menuitem_modes.POWERGRAVITATORY);
                else
-                       radio_menuitem_mode_power.Active = true;
+                       radio_menuitem_mode_power_gravitatory.Active = true;
+       }
+       private void on_button_selector_start_power_inertial_clicked(object o, EventArgs args) 
+       {
+               if(radio_menuitem_mode_power_inertial.Active)
+                       select_menuitem_mode_toggled(menuitem_modes.POWERINERTIAL);
+               else
+                       radio_menuitem_mode_power_inertial.Active = true;
        }
        private void on_button_selector_start_other_clicked(object o, EventArgs args) 
        {
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index cde7e5b..3309693 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -131,8 +131,10 @@ public partial class ChronoJumpWindow
                
 
                //show only power
-               if(config.OnlyEncoder)
-                       select_menuitem_mode_toggled(menuitem_modes.POWER);
+               if(config.OnlyEncoderGravitatory)
+                       select_menuitem_mode_toggled(menuitem_modes.POWERGRAVITATORY);
+               else if(config.OnlyEncoderInertial)
+                       select_menuitem_mode_toggled(menuitem_modes.POWERINERTIAL);
                
                if(config.EncoderCaptureShowOnlyBars) {
                        vpaned_encoder_capture_video_and_set_graph.Visible = false;


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