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



commit 1340fa3c8dc698b381fdb68c35fda268e92450d6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Aug 9 12:18:09 2019 +0200

    Menuitem Mode from radio to imagemenuitem. Encoder done!

 glade/app1.glade           | 69 ++++++++++++++++++++++++++++++++++++----------
 src/gui/chronojump.cs      | 46 ++++++++++---------------------
 src/gui/chronojumpIcons.cs |  4 +++
 3 files changed, 73 insertions(+), 46 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 5276031b..59aeba00 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -406,8 +406,41 @@
                       </widget>
                     </child>
                     <child>
-                      <widget class="GtkRadioMenuItem" id="radio_menuitem_mode_power_gravitatory">
+                      <widget class="GtkImageMenuItem" id="menuitem_mode_power_gravitatory">
+                        <property name="label" translatable="yes">Gravitatory</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <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_power_gravitatory">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkImageMenuItem" id="menuitem_mode_power_inertial">
+                        <property name="label" translatable="yes">Inertial</property>
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <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_power_inertial">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                        </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>
@@ -418,7 +451,6 @@
                     </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">Inertial</property>
                         <property name="draw_as_radio">True</property>
@@ -2190,6 +2222,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>
@@ -21477,6 +21512,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -23437,6 +23475,18 @@ 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>
@@ -23473,18 +23523,6 @@ 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>
@@ -30308,6 +30346,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 184df1b5..d294d87d 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -67,6 +67,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ImageMenuItem menuitem_mode_jumps_reactive;
        [Widget] Gtk.ImageMenuItem menuitem_mode_runs_simple;
        [Widget] Gtk.ImageMenuItem menuitem_mode_runs_intervallic;
+       [Widget] Gtk.ImageMenuItem menuitem_mode_power_gravitatory;
+       [Widget] Gtk.ImageMenuItem menuitem_mode_power_inertial;
 
        [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
@@ -820,23 +822,11 @@ public partial class ChronoJumpWindow
 
        private void formatModeMenu()
        {
-               /*
-               ((Label) radio_menuitem_mode_jumps_simple.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_jumps_simple.Child).Text;
-               ((Label) radio_menuitem_mode_jumps_reactive.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_jumps_reactive.Child).Text;
-               */
                ((Label) menuitem_mode_jumps_simple.Child).Text =
                        "   " + ((Label) menuitem_mode_jumps_simple.Child).Text;
                ((Label) menuitem_mode_jumps_reactive.Child).Text =
                        "   " + ((Label) menuitem_mode_jumps_reactive.Child).Text;
 
-               /*
-               ((Label) radio_menuitem_mode_runs_simple.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_runs_simple.Child).Text;
-               ((Label) radio_menuitem_mode_runs_intervallic.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_runs_intervallic.Child).Text;
-                       */
                ((Label) menuitem_mode_runs_simple.Child).Text =
                        "   " + ((Label) menuitem_mode_runs_simple.Child).Text;
                ((Label) menuitem_mode_runs_intervallic.Child).Text =
@@ -844,11 +834,10 @@ public partial class ChronoJumpWindow
                ((Label) radio_menuitem_mode_runs_encoder.Child).Text =
                        "   " + ((Label) radio_menuitem_mode_runs_encoder.Child).Text;
 
-               ((Label) radio_menuitem_mode_power_gravitatory.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_power_gravitatory.Child).Text;
-               ((Label) radio_menuitem_mode_power_inertial.Child).Text =
-                       "   " + ((Label) radio_menuitem_mode_power_inertial.Child).Text;
-
+               ((Label) menuitem_mode_power_gravitatory.Child).Text =
+                       "   " + ((Label) menuitem_mode_power_gravitatory.Child).Text;
+               ((Label) menuitem_mode_power_inertial.Child).Text =
+                       "   " + ((Label) menuitem_mode_power_inertial.Child).Text;
        }
 
        //different than on_preferences_activate (opening preferences window)
@@ -3705,11 +3694,17 @@ public partial class ChronoJumpWindow
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.RUNSSIMPLE);
                else if(o == menuitem_mode_runs_intervallic)
                        select_menuitem_mode_toggled(Constants.Menuitem_modes.RUNSINTERVALLIC);
+               else if(o == menuitem_mode_power_gravitatory)
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
+               else if(o == menuitem_mode_power_inertial)
+                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
 
                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");
                changeMenuitemModePixbuf(image_menuitem_mode_runs_simple, o == menuitem_mode_runs_simple, 
"image_run_simple.png", "image_run_simple_yellow.png");
                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");
        }
 
        private void changeMenuitemModePixbuf(Gtk.Image image, bool active, string pathImageInactive, string 
pathImageActive)
@@ -3762,26 +3757,13 @@ public partial class ChronoJumpWindow
                notebook_start_selector.CurrentPage = 1; //2nd selector
        }
 
-       bool radiobutton_dont_follow_signals = false;
        private void on_button_selector_start_encoder_gravitatory_clicked(object o, EventArgs args) 
        {
-               if(radiobutton_dont_follow_signals)
-                       return;
-
-               if(radio_menuitem_mode_power_gravitatory.Active)
-                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERGRAVITATORY);
-               else
-                       radio_menuitem_mode_power_gravitatory.Active = true;
+               on_menuitem_mode_activate(menuitem_mode_power_gravitatory, new EventArgs());
        }
        private void on_button_selector_start_encoder_inertial_clicked(object o, EventArgs args) 
        {
-               if(radiobutton_dont_follow_signals)
-                       return;
-
-               if(radio_menuitem_mode_power_inertial.Active)
-                       select_menuitem_mode_toggled(Constants.Menuitem_modes.POWERINERTIAL);
-               else
-                       radio_menuitem_mode_power_inertial.Active = true;
+               on_menuitem_mode_activate(menuitem_mode_power_inertial, new EventArgs());
        }
 
        private void on_button_selector_start_force_sensor_clicked(object o, EventArgs args)
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 9fbacd00..b48739c0 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -90,6 +90,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_menuitem_mode_jumps_reactive;
        [Widget] Gtk.Image image_menuitem_mode_runs_simple;
        [Widget] Gtk.Image image_menuitem_mode_runs_intervallic;
+       [Widget] Gtk.Image image_menuitem_mode_power_gravitatory;
+       [Widget] Gtk.Image image_menuitem_mode_power_inertial;
 
        //run
        [Widget] Gtk.Image image_run_execute_running;
@@ -263,8 +265,10 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_gravity.png");
                image_mode_encoder_gravitatory.Pixbuf = pixbuf;
+               image_menuitem_mode_power_gravitatory.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_inertia.png");
                image_mode_encoder_inertial.Pixbuf = pixbuf;
+               image_menuitem_mode_power_inertial.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]