[chronojump] Menuitem Mode from radio to imagemenuitem. Reaction time done!



commit 722729b4b5b8fa30b61cb98936d0093b11e1c107
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 9 14:10:22 2019 +0200

    Menuitem Mode from radio to imagemenuitem. Reaction time done!

 glade/app1.glade           | 51 ++++++++++++++++++++++++++++++----------------
 src/gui/chronojump.cs      | 20 ++++++++----------
 src/gui/chronojumpIcons.cs |  3 +++
 3 files changed, 44 insertions(+), 30 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 964af95f..4c54ed3c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -433,14 +433,20 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_rt">
+                      <widget class="GtkImageMenuItem" id="menuitem_mode_reaction_time">
+                        <property name="label" translatable="yes">Reaction time</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Reaction time</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_reaction_time">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                        </child>
                       </widget>
                     </child>
                     <child>
@@ -2188,6 +2194,9 @@
                                                             <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>
@@ -21484,6 +21493,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -23444,18 +23456,6 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -23492,6 +23492,18 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -30324,6 +30336,9 @@ then click this button.</property>
                                                             <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 0d79e7eb..fb498700 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -58,7 +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_rt;
        [Widget] Gtk.RadioMenuItem radio_menuitem_mode_other;
        [Widget] Gtk.ImageMenuItem menuitem_mode_jumps_simple;
        [Widget] Gtk.ImageMenuItem menuitem_mode_jumps_reactive;
@@ -67,6 +66,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ImageMenuItem menuitem_mode_power_gravitatory;
        [Widget] Gtk.ImageMenuItem menuitem_mode_power_inertial;
        [Widget] Gtk.ImageMenuItem menuitem_mode_force_sensor;
+       [Widget] Gtk.ImageMenuItem menuitem_mode_reaction_time;
 
        [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
@@ -3442,7 +3442,6 @@ public partial class ChronoJumpWindow
                else if(m == Constants.Menuitem_modes.RT)
                {
                        notebook_sup.CurrentPage = 0;
-                       radio_menuitem_mode_rt.Active = true;
                        notebooks_change(m);
                        on_extra_window_reaction_times_test_changed(new object(), new EventArgs());
 
@@ -3653,10 +3652,7 @@ public partial class ChronoJumpWindow
         */
        private Constants.Menuitem_modes getMenuItemMode() 
        {
-               if(radio_menuitem_mode_rt.Active)
-                       return Constants.Menuitem_modes.RT;
-               else // if(radio_menuitem_mode_other.Active)
-                       return Constants.Menuitem_modes.OTHER;
+               return Constants.Menuitem_modes.OTHER;
        }
 
        private void on_radio_menuitem_mode_activate(object o, EventArgs args) 
@@ -3689,6 +3685,8 @@ public partial class ChronoJumpWindow
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
                else if(o == menuitem_mode_force_sensor)
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.FORCESENSOR);
+               else if(o == menuitem_mode_reaction_time)
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.RT);
 
                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");
@@ -3697,6 +3695,7 @@ public partial class ChronoJumpWindow
                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");
+               changeMenuitemModePixbuf(image_menuitem_mode_reaction_time, o == menuitem_mode_reaction_time, 
"reaction_time_icon.png", "reaction_time_icon_yellow.png");
        }
 
        private void changeMenuitemModePixbuf(Gtk.Image image, bool active, string pathImageInactive, string 
pathImageActive)
@@ -3765,10 +3764,7 @@ public partial class ChronoJumpWindow
 
        private void on_button_selector_start_rt_clicked(object o, EventArgs args)
        {
-               if(radio_menuitem_mode_rt.Active)
-                       select_menuitem_mode_toggled(Constants.Menuitem_modes.RT);
-               else
-                       radio_menuitem_mode_rt.Active = true;
+               on_menuitem_mode_activate(menuitem_mode_reaction_time, new EventArgs());
        }
 
        private void on_button_selector_start_other_clicked(object o, EventArgs args)
@@ -3907,7 +3903,7 @@ public partial class ChronoJumpWindow
        {
                if(current_menuitem_mode == Constants.Menuitem_modes.FORCESENSOR)
                {
-                       LogB.Debug("radio_mode_force_sensor");
+                       //LogB.Debug("radio_mode_force_sensor");
                        /*
                         * force sensor is not FTDI
                         on_force_sensor_activate(canCaptureC);
@@ -4040,7 +4036,7 @@ public partial class ChronoJumpWindow
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.RT)
                {
-                       LogB.Debug("radio_mode_rt");
+                       LogB.Debug("menuitem_mode_rt");
        
                        if(extra_window_radio_reaction_time_discriminative.Active)
                                reaction_time_discriminative_lights_prepare();
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index a855277b..3a096fa1 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -93,6 +93,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_menuitem_mode_power_gravitatory;
        [Widget] Gtk.Image image_menuitem_mode_power_inertial;
        [Widget] Gtk.Image image_menuitem_mode_force_sensor;
+       [Widget] Gtk.Image image_menuitem_mode_reaction_time;
 
        //run
        [Widget] Gtk.Image image_run_execute_running;
@@ -273,6 +274,8 @@ public partial class ChronoJumpWindow
 
                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) + "reaction_time_icon.png");
+               image_menuitem_mode_reaction_time.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture.png");
                image_tests_capture.Pixbuf = pixbuf;


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