[chronojump] Menuitem Mode from radio to imagemenuitem. Force sensor done!



commit 088eebacbfa0df00eb821292397750b5ebded8d6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 9 13:28:58 2019 +0200

    Menuitem Mode from radio to imagemenuitem. Force sensor done!

 glade/app1.glade           | 85 ++++++++++++++++------------------------------
 src/gui/chronojump.cs      | 23 ++++---------
 src/gui/chronojumpIcons.cs |  4 +++
 src/gui/guiTests.cs        | 22 ++----------
 4 files changed, 43 insertions(+), 91 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 59aeba00..964af95f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -300,16 +300,6 @@
                         <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
                       </widget>
                     </child>
-                    <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_jumps_reactive">
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Multiple</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
-                      </widget>
-                    </child>
                     <child>
                       <widget class="GtkSeparatorMenuItem" id="menuitem4">
                         <property name="visible">True</property>
@@ -359,26 +349,6 @@
                         </child>
                       </widget>
                     </child>
-                    <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_runs_simple">
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Simple</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_runs_intervallic">
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Intervallic</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
-                      </widget>
-                    </child>
                     <child>
                       <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_runs_encoder">
                         <property name="visible">True</property>
@@ -439,25 +409,6 @@
                         </child>
                       </widget>
                     </child>
-                    <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power_gravitatory">
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Gravitatory</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power_inertial">
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Inertial</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
-                      </widget>
-                    </child>
                     <child>
                       <widget class="GtkSeparatorMenuItem" id="menuitem6">
                         <property name="visible">True</property>
@@ -465,14 +416,20 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_force_sensor">
+                      <widget class="GtkImageMenuItem" id="menuitem_mode_force_sensor">
+                        <property name="label" translatable="yes">Force sensor</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Force sensor</property>
-                        <property name="use_underline">True</property>
-                        <property name="draw_as_radio">True</property>
-                        <property name="group">radio_menuitem_mode_jumps_simple</property>
-                        <signal name="activate" handler="on_radio_menuitem_mode_activate" swapped="no"/>
+                        <property name="use_stock">False</property>
+                        <property name="always_show_image">True</property>
+                        <signal name="activate" handler="on_menuitem_mode_activate" swapped="no"/>
+                        <child internal-child="image">
+                          <widget class="GtkImage" id="image_menuitem_mode_force_sensor">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                        </child>
                       </widget>
                     </child>
                     <child>
@@ -2225,6 +2182,12 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -21515,6 +21478,12 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -30349,6 +30318,12 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index d294d87d..0d79e7eb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -58,9 +58,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_chronojump_logo;
 
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_runs_encoder;
-       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_power_gravitatory;
-       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_power_inertial;
-       [Widget] Gtk.RadioMenuItem radio_menuitem_mode_force_sensor;
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_rt;
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_other;
        [Widget] Gtk.ImageMenuItem menuitem_mode_jumps_simple;
@@ -69,6 +66,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ImageMenuItem menuitem_mode_runs_intervallic;
        [Widget] Gtk.ImageMenuItem menuitem_mode_power_gravitatory;
        [Widget] Gtk.ImageMenuItem menuitem_mode_power_inertial;
+       [Widget] Gtk.ImageMenuItem menuitem_mode_force_sensor;
 
        [Widget] Gtk.Notebook notebook_start;           //start window or program
        [Widget] Gtk.Notebook notebook_start_selector;  //use to display the start images to select different 
modes
@@ -3405,7 +3403,6 @@ public partial class ChronoJumpWindow
                else if(m == Constants.Menuitem_modes.FORCESENSOR)
                {
                        notebook_sup.CurrentPage = 0;
-                       radio_menuitem_mode_force_sensor.Active = true;
                        notebooks_change(m);
 //                     on_extra_window_reaction_times_test_changed(new object(), new EventArgs());
 
@@ -3656,15 +3653,7 @@ public partial class ChronoJumpWindow
         */
        private Constants.Menuitem_modes getMenuItemMode() 
        {
-               if(radio_menuitem_mode_runs_encoder.Active)
-                       return Constants.Menuitem_modes.RUNSENCODER;
-               else if(radio_menuitem_mode_power_gravitatory.Active)
-                       return Constants.Menuitem_modes.POWERGRAVITATORY;
-               else if(radio_menuitem_mode_power_inertial.Active)
-                       return Constants.Menuitem_modes.POWERINERTIAL;
-               else if(radio_menuitem_mode_force_sensor.Active)
-                       return Constants.Menuitem_modes.FORCESENSOR;
-               else if(radio_menuitem_mode_rt.Active)
+               if(radio_menuitem_mode_rt.Active)
                        return Constants.Menuitem_modes.RT;
                else // if(radio_menuitem_mode_other.Active)
                        return Constants.Menuitem_modes.OTHER;
@@ -3698,6 +3687,8 @@ public partial class ChronoJumpWindow
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
                else if(o == menuitem_mode_power_inertial)
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
+               else if(o == menuitem_mode_force_sensor)
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.FORCESENSOR);
 
                changeMenuitemModePixbuf(image_menuitem_mode_jumps_simple, o == menuitem_mode_jumps_simple, 
"image_jump_simple.png", "image_jump_simple_yellow.png");
                changeMenuitemModePixbuf(image_menuitem_mode_jumps_reactive, o == 
menuitem_mode_jumps_reactive, "image_jump_reactive.png", "image_jump_reactive_yellow.png");
@@ -3705,6 +3696,7 @@ public partial class ChronoJumpWindow
                changeMenuitemModePixbuf(image_menuitem_mode_runs_intervallic, o == 
menuitem_mode_runs_intervallic, "image_run_multiple.png", "image_run_multiple_yellow.png");
                changeMenuitemModePixbuf(image_menuitem_mode_power_gravitatory, o == 
menuitem_mode_power_gravitatory, "image_gravity.png", "image_gravity_yellow.png");
                changeMenuitemModePixbuf(image_menuitem_mode_power_inertial, o == 
menuitem_mode_power_inertial, "image_inertia.png", "image_inertia_yellow.png");
+               changeMenuitemModePixbuf(image_menuitem_mode_force_sensor, o == menuitem_mode_force_sensor, 
"force_sensor_icon.png", "force_sensor_icon_yellow.png");
        }
 
        private void changeMenuitemModePixbuf(Gtk.Image image, bool active, string pathImageInactive, string 
pathImageActive)
@@ -3768,10 +3760,7 @@ public partial class ChronoJumpWindow
 
        private void on_button_selector_start_force_sensor_clicked(object o, EventArgs args)
        {
-               if(radio_menuitem_mode_force_sensor.Active)
-                       select_menuitem_mode_toggled(Constants.Menuitem_modes.FORCESENSOR);
-               else
-                       radio_menuitem_mode_force_sensor.Active = true;
+               on_menuitem_mode_activate(menuitem_mode_force_sensor, new EventArgs());
        }
 
        private void on_button_selector_start_rt_clicked(object o, EventArgs args)
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index b48739c0..a855277b 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -92,6 +92,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_menuitem_mode_runs_intervallic;
        [Widget] Gtk.Image image_menuitem_mode_power_gravitatory;
        [Widget] Gtk.Image image_menuitem_mode_power_inertial;
+       [Widget] Gtk.Image image_menuitem_mode_force_sensor;
 
        //run
        [Widget] Gtk.Image image_run_execute_running;
@@ -270,6 +271,9 @@ public partial class ChronoJumpWindow
                image_mode_encoder_inertial.Pixbuf = pixbuf;
                image_menuitem_mode_power_inertial.Pixbuf = pixbuf;
 
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "force_sensor_icon.png");
+               image_menuitem_mode_force_sensor.Pixbuf = pixbuf;
+
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture.png");
                image_tests_capture.Pixbuf = pixbuf;
                image_mode_encoder_capture.Pixbuf = pixbuf;
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index 8a37a60c..44f994b5 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -433,32 +433,16 @@ public partial class ChronoJumpWindow
                //configAutodetectPort = Config.AutodetectPortEnum.INACTIVE;
 
                if(m == Constants.Menuitem_modes.JUMPSSIMPLE)
-               {
                        on_menuitem_mode_activate(menuitem_mode_jumps_simple, new EventArgs());
-               }
                else if(m == Constants.Menuitem_modes.JUMPSREACTIVE)
-               {
                        on_menuitem_mode_activate(menuitem_mode_jumps_reactive, new EventArgs());
-               }
                else if(m == Constants.Menuitem_modes.RUNSSIMPLE)
-               {
                        on_menuitem_mode_activate(menuitem_mode_runs_simple, new EventArgs());
-               }
                else if(m == Constants.Menuitem_modes.POWERGRAVITATORY)
-               {
-                       if(radio_menuitem_mode_power_gravitatory.Active)
-                               select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
-                       else
-                               radio_menuitem_mode_power_gravitatory.Active = true;
-               }
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
                else if(m == Constants.Menuitem_modes.POWERINERTIAL)
-               {
-                       if(radio_menuitem_mode_power_inertial.Active)
-                               select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
-                       else
-                               radio_menuitem_mode_power_inertial.Active = true;
-               }
-               
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
+
                LogB.TestEnd("chronojumpWindowTestsMode");
        }
 


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