[chronojump] Menu 2.2.2 with fake double click on all modes except jumps and races



commit d3d68fb1d3db7da6ac3682d872c1a1a9b50df353
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 30 13:25:34 2022 +0200

    Menu 2.2.2 with fake double click on all modes except jumps and races

 glade/app1.glade           | 41 +++++++++++++++++++++++----------------
 src/gui/app1/chronojump.cs | 48 +++++++++++++++++++++++++++++++++-------------
 2 files changed, 60 insertions(+), 29 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 0847c0a5e..2376daf1c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -3038,7 +3038,7 @@
                                                             <property name="active">True</property>
                                                             <property name="draw_indicator">False</property>
                                                             <property 
name="group">radio_menu_2_2_2_jumps</property>
-                                                            <signal name="toggled" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkEventBox" 
id="eventbox_radio_menu_2_2_2_isometric">
                                                             <property name="visible">True</property>
@@ -3091,7 +3091,7 @@
                                                             <property name="active">True</property>
                                                             <property name="draw_indicator">False</property>
                                                             <property 
name="group">radio_menu_2_2_2_jumps</property>
-                                                            <signal name="toggled" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkEventBox" 
id="eventbox_radio_menu_2_2_2_elastic">
                                                             <property name="visible">True</property>
@@ -3144,7 +3144,7 @@
                                                             <property name="active">True</property>
                                                             <property name="draw_indicator">False</property>
                                                             <property 
name="group">radio_menu_2_2_2_jumps</property>
-                                                            <signal name="toggled" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkEventBox" 
id="eventbox_radio_menu_2_2_2_weights">
                                                             <property name="visible">True</property>
@@ -3197,7 +3197,7 @@
                                                             <property name="active">True</property>
                                                             <property name="draw_indicator">False</property>
                                                             <property 
name="group">radio_menu_2_2_2_jumps</property>
-                                                            <signal name="toggled" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_menu_2_2_2_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkEventBox" 
id="eventbox_radio_menu_2_2_2_inertial">
                                                             <property name="visible">True</property>
@@ -25858,6 +25858,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -32264,18 +32267,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>
@@ -32312,6 +32303,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>
@@ -41685,6 +41688,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -49702,6 +49708,9 @@ Since Chronojump 2.1.3, backups contain the complete data.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             </widget>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 0a65aaafd..63eaa2ee8 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -3407,39 +3407,41 @@ public partial class ChronoJumpWindow
        {
                notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.START);
 
+               //a double click cannot be managed now because start window is clicked from the "Mode" button 
at any mode
+
                if (current_mode == Constants.Modes.UNDEFINED ||
                                current_mode == Constants.Modes.JUMPSSIMPLE ||
                                current_mode == Constants.Modes.JUMPSREACTIVE)
                {
                        radio_menu_2_2_2_jumps.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_jumps, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_jumps, false); //cannot be a double click
                }
                else if (current_mode == Constants.Modes.RUNSSIMPLE ||
                                current_mode == Constants.Modes.RUNSINTERVALLIC ||
                                current_mode == Constants.Modes.RUNSENCODER)
                {
                        radio_menu_2_2_2_races.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_races, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_races, false);
                }
                else if (current_mode == Constants.Modes.FORCESENSORISOMETRIC)
                {
                        radio_menu_2_2_2_isometric.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_isometric, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_isometric, false);
                }
                else if (current_mode == Constants.Modes.FORCESENSORELASTIC)
                {
                        radio_menu_2_2_2_elastic.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_elastic, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_elastic, false);
                }
                else if (current_mode == Constants.Modes.POWERGRAVITATORY)
                {
                        radio_menu_2_2_2_weights.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_weights, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_weights, false);
                }
                else if (current_mode == Constants.Modes.POWERINERTIAL)
                {
                        radio_menu_2_2_2_inertial.Active = true;
-                       on_button_menu_2_2_2_clicked (radio_menu_2_2_2_inertial, new EventArgs ());
+                       button_menu_2_2_2_manage (radio_menu_2_2_2_inertial, false);
                }
 
                //show title
@@ -4402,20 +4404,35 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_selector_menu_2_2_2_title;
        [Widget] Gtk.Label label_selector_menu_2_2_2_desc;
 
+       //clicked from start_window
        private void on_button_menu_2_2_2_clicked (object o, EventArgs args)
+       {
+               //manage only Active events
+               if (! ((Gtk.RadioButton) o).Active)
+                       return;
+
+               //note on glade the event is button_clicked to receive a click when the radio is already 
active
+
+               button_menu_2_2_2_manage (o, true); //can have double click if that notebook_menu_2_2_2 is 
already that value
+       }
+
+       private void button_menu_2_2_2_manage (object o, bool canBeDoubleClick)
        {
                string title = "";
                string desc = "";
                if (o == (object) radio_menu_2_2_2_jumps)
                {
+                       canBeDoubleClick = false;
+
                        title = "Jumps";
                        desc = "Measured by a contact platform";
                        notebook_menu_2_2_2.CurrentPage = 0;
                }
                else if (o == (object) radio_menu_2_2_2_races)
                {
+                       canBeDoubleClick = false;
+
                        title = "Races";
-                       //desc = "Races with photocells (Wichro or wired), or RaceAnalyzer";
                        desc = "Measured by …";
                        notebook_menu_2_2_2.CurrentPage = 1;
                }
@@ -4444,13 +4461,18 @@ public partial class ChronoJumpWindow
                        notebook_menu_2_2_2.CurrentPage = 2;
                }
 
-               if (title != "")
-               {
-                       label_selector_menu_2_2_2_title.Text = "<b>" + title + "</b>";
-                       label_selector_menu_2_2_2_title.UseMarkup = true;
+               // if we already have clicked before, execute go!
+               if (canBeDoubleClick && label_selector_menu_2_2_2_title.Text == title) //note the "<b></b>" 
are not on .Text
+                       on_button_menu_2_2_2_go_clicked (new object (), new EventArgs ());
+               else {
+                       if (title != "")
+                       {
+                               label_selector_menu_2_2_2_title.Text = "<b>" + title + "</b>";
+                               label_selector_menu_2_2_2_title.UseMarkup = true;
+                       }
+                       if (desc != "")
+                               label_selector_menu_2_2_2_desc.Text = desc;
                }
-               if (desc != "")
-                       label_selector_menu_2_2_2_desc.Text = desc;
        }
 
        private void on_button_menu_2_2_2_go_clicked (object o, EventArgs args)


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