[chronojump] combo_select_contacts_top for changing exercise without need to press options button. Workin for jum



commit 974b22619d0e96d7d010b183535eecfde4ecb8c3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jul 30 16:17:52 2021 +0200

    combo_select_contacts_top for changing exercise without need to press options button. Workin for jumps 
simple, rj, runs, runsI

 glade/app1.glade                 |  48 +++++++----
 src/gui/app1/chronojump.cs       | 174 +++++++++++++++++++++++++++++++++++++--
 src/gui/app1/contactsExercise.cs |   2 +
 3 files changed, 204 insertions(+), 20 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 5f7d794c4..5ebf03048 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5974,6 +5974,20 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">10</property>
                                                             <child>
+                                                            <widget class="GtkHBox" 
id="hbox_combo_select_contacts_top">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_contacts_exercise_selected_name">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -5984,7 +5998,7 @@ EncoderInertialCapture</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -6020,7 +6034,7 @@ EncoderInertialCapture</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -25795,6 +25809,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -32106,6 +32123,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>
@@ -32142,18 +32171,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>
@@ -41400,6 +41417,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index ebea554ea..d80583c90 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -175,6 +175,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.HBox hbox_combo_select_jumps_rj;
        [Widget] Gtk.HBox hbox_combo_select_runs;
        [Widget] Gtk.HBox hbox_combo_select_runs_interval;
+       [Widget] Gtk.HBox hbox_combo_select_contacts_top;
 
        //auto mode     
        //[Widget] Gtk.Box hbox_jump_types_options;
@@ -212,12 +213,14 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ComboBox combo_select_jumps_rj;
        [Widget] Gtk.ComboBox combo_select_runs;
        [Widget] Gtk.ComboBox combo_select_runs_interval;
+       [Widget] Gtk.ComboBox combo_select_contacts_top;
 
        //new since 1.6.3. Using gui/cjCombo.cs
        CjComboSelectJumps comboSelectJumps;
        CjComboSelectJumpsRj comboSelectJumpsRj;
        CjComboSelectRuns comboSelectRuns;
        CjComboSelectRunsI comboSelectRunsI;
+       CjCombo comboSelectContactsTop;
        
        [Widget] Gtk.ComboBox combo_result_jumps;
        [Widget] Gtk.ComboBox combo_result_jumps_rj;
@@ -810,6 +813,17 @@ public partial class ChronoJumpWindow
                        SqlitePreferences.Update(SqlitePreferences.LoadLastModeAtStart, true, false);
                }
 
+               if(preferences.loadLastModeAtStart && preferences.lastMode != Constants.Modes.UNDEFINED)
+               {
+                       //if(mode == Constants.Modes.POWERGRAVITATORY || mode == 
Constants.Modes.POWERINERTIAL)
+                       //      createComboSelectEncoderTop (true);
+                       //else
+
+                       if(current_mode == Constants.Modes.JUMPSSIMPLE || current_mode == 
Constants.Modes.JUMPSREACTIVE ||
+                                       current_mode == Constants.Modes.RUNSSIMPLE || current_mode == 
Constants.Modes.RUNSINTERVALLIC)
+                               createComboSelectContactsTop (true);
+               }
+
                initialize_menu_or_menu_tiny();
 
                testNewStuff();
@@ -2177,6 +2191,56 @@ public partial class ChronoJumpWindow
        
        // ---------------- combo_select ----------------------
 
+       private bool comboSelectContactsTopNoFollow;
+       private void createComboSelectContactsTop (bool create)
+       {
+               if(create)
+               {
+                       //delete children if any
+                       if(hbox_combo_select_contacts_top.Children.Length > 0)
+                               hbox_combo_select_contacts_top.Remove(combo_select_contacts_top);
+
+                       if(current_mode == Constants.Modes.JUMPSSIMPLE)
+                       {
+                               comboSelectContactsTop = new CjComboSelectJumps (combo_select_contacts_top, 
hbox_combo_select_contacts_top, false);
+                               combo_select_contacts_top = comboSelectContactsTop.Combo;
+                               combo_select_contacts_top.Active = combo_select_jumps.Active;
+                               combo_select_contacts_top.Sensitive = true;
+                       }
+                       else if(current_mode == Constants.Modes.JUMPSREACTIVE)
+                       {
+                               comboSelectContactsTop = new CjComboSelectJumpsRj (combo_select_contacts_top, 
hbox_combo_select_contacts_top);
+                               combo_select_contacts_top = comboSelectContactsTop.Combo;
+                               combo_select_contacts_top.Active = combo_select_jumps_rj.Active;
+                               combo_select_contacts_top.Sensitive = true;
+                       }
+                       else if(current_mode == Constants.Modes.RUNSSIMPLE)
+                       {
+                               comboSelectContactsTop = new CjComboSelectRuns(combo_select_contacts_top, 
hbox_combo_select_contacts_top);
+                               combo_select_contacts_top = comboSelectContactsTop.Combo;
+                               combo_select_contacts_top.Active = combo_select_runs.Active;
+                               combo_select_contacts_top.Sensitive = true;
+                       }
+                       else if(current_mode == Constants.Modes.RUNSINTERVALLIC)
+                       {
+                               comboSelectContactsTop = new CjComboSelectRunsI(combo_select_contacts_top, 
hbox_combo_select_contacts_top);
+                               combo_select_contacts_top = comboSelectContactsTop.Combo;
+                               combo_select_contacts_top.Active = combo_select_runs_interval.Active;
+                               combo_select_contacts_top.Sensitive = true;
+                       }
+                       /*
+                       TODO:
+                       //else if(current_mode == Constants.Modes.FORCESENSOR)
+                       //{
+                       //}
+                       ...
+                       */
+
+                       combo_select_contacts_top.Changed -= new EventHandler 
(on_combo_select_contacts_top_changed);
+                       combo_select_contacts_top.Changed += new EventHandler 
(on_combo_select_contacts_top_changed);
+               }
+       }
+
        private void createComboSelectJumps(bool create) 
        {
                if(create)
@@ -2324,10 +2388,48 @@ public partial class ChronoJumpWindow
 
        // -------------- combo select tests changed --------
 
-       private void on_combo_select_jumps_changed(object o, EventArgs args) {
+       private void on_combo_select_contacts_top_changed (object o, EventArgs args)
+       {
+               LogB.Information("on_combo_select_contacts_top_changed");
+               if(current_mode == Constants.Modes.JUMPSSIMPLE)
+                       on_combo_select_jumps_changed(o, args);
+               else if(current_mode == Constants.Modes.JUMPSREACTIVE)
+                       on_combo_select_jumps_rj_changed(o, args);
+               else if(current_mode == Constants.Modes.RUNSSIMPLE)
+                       on_combo_select_runs_changed(o, args);
+               else if(current_mode == Constants.Modes.RUNSINTERVALLIC)
+                       on_combo_select_runs_interval_changed(o, args);
+       }
+
+       private void on_combo_select_jumps_changed(object o, EventArgs args)
+       {
+               LogB.Information("on_combo_select_jumps_changed");
                ComboBox combo = o as ComboBox;
-               if (o == null)
+               if (o == null) {
+                       LogB.Information("o is null");
                        return;
+               }
+
+               //two combobox are linked ---->
+               if(comboSelectContactsTopNoFollow)
+               {
+                       LogB.Information("no follow");
+                       return;
+               }
+
+               comboSelectContactsTopNoFollow = true;
+               if (o == combo_select_jumps)
+               {
+                       LogB.Information("o is combo_select_jumps");
+                       combo_select_contacts_top.Active = combo_select_jumps.Active;
+               }
+               else if (o == combo_select_contacts_top)
+               {
+                       LogB.Information("o is combo_select_contacts_top");
+                       combo_select_jumps.Active = combo_select_contacts_top.Active;
+               }
+               comboSelectContactsTopNoFollow = false;
+               //<---- two combobox are linked
 
                sensitiveLastTestButtons(false);
 
@@ -2342,10 +2444,35 @@ public partial class ChronoJumpWindow
                on_extra_window_jumps_test_changed(o, args);
        }
        
-       private void on_combo_select_jumps_rj_changed(object o, EventArgs args) {
+       private void on_combo_select_jumps_rj_changed(object o, EventArgs args)
+       {
+               LogB.Information("on_combo_select_jumps_rj_changed");
                ComboBox combo = o as ComboBox;
-               if (o == null)
+               if (o == null) {
+                       LogB.Information("o is null");
+                       return;
+               }
+
+               //two combobox are linked ---->
+               if(comboSelectContactsTopNoFollow)
+               {
+                       LogB.Information("no follow");
                        return;
+               }
+
+               comboSelectContactsTopNoFollow = true;
+               if (o == combo_select_jumps_rj)
+               {
+                       LogB.Information("o is combo_select_jumps_rj");
+                       combo_select_contacts_top.Active = combo_select_jumps_rj.Active;
+               }
+               else if (o == combo_select_contacts_top)
+               {
+                       LogB.Information("o is combo_select_contacts_top");
+                       combo_select_jumps_rj.Active = combo_select_contacts_top.Active;
+               }
+               comboSelectContactsTopNoFollow = false;
+               //<---- two combobox are linked
 
                sensitiveLastTestButtons(false);
 
@@ -2360,11 +2487,24 @@ public partial class ChronoJumpWindow
                on_extra_window_jumps_rj_test_changed(o, args);
        }
        
-       private void on_combo_select_runs_changed(object o, EventArgs args) {
+       private void on_combo_select_runs_changed(object o, EventArgs args)
+       {
                ComboBox combo = o as ComboBox;
                if (o == null)
                        return;
 
+               //two combobox are linked ---->
+               if(comboSelectContactsTopNoFollow)
+                       return;
+
+               comboSelectContactsTopNoFollow = true;
+               if (o == combo_select_runs)
+                       combo_select_contacts_top.Active = combo_select_runs.Active;
+               else if (o == combo_select_contacts_top)
+                       combo_select_runs.Active = combo_select_contacts_top.Active;
+               comboSelectContactsTopNoFollow = false;
+               //<---- two combobox are linked
+
                sensitiveLastTestButtons(false);
 
                string myText = UtilGtk.ComboGetActive(combo);
@@ -2378,11 +2518,24 @@ public partial class ChronoJumpWindow
                on_extra_window_runs_test_changed(o, args);
        }
        
-       private void on_combo_select_runs_interval_changed(object o, EventArgs args) {
+       private void on_combo_select_runs_interval_changed(object o, EventArgs args)
+       {
                ComboBox combo = o as ComboBox;
                if (o == null)
                        return;
 
+               //two combobox are linked ---->
+               if(comboSelectContactsTopNoFollow)
+                       return;
+
+               comboSelectContactsTopNoFollow = true;
+               if (o == combo_select_runs_interval)
+                       combo_select_contacts_top.Active = combo_select_runs_interval.Active;
+               else if (o == combo_select_contacts_top)
+                       combo_select_runs_interval.Active = combo_select_contacts_top.Active;
+               comboSelectContactsTopNoFollow = false;
+               //<---- two combobox are linked
+
                sensitiveLastTestButtons(false);
 
                string myText = UtilGtk.ComboGetActive(combo);
@@ -3258,6 +3411,8 @@ public partial class ChronoJumpWindow
                vbox_contacts_signal_comment.Visible = false;
                frame_jumps_automatic.Visible = false;
 
+               hbox_combo_select_contacts_top.Visible = false; //TODO: this will be unneded
+
                //blank exercise options: useful for changing from jumps or runs to forceSensor, runEncoder, 
reaction time, other
                label_contacts_exercise_selected_options.Text = "";
 
@@ -3328,6 +3483,9 @@ public partial class ChronoJumpWindow
                                pixbufModeCurrent = new Pixbuf (null, Util.GetImagePath(false) + 
"image_jump_reactive.png");
                        }
 
+                       createComboSelectContactsTop (true);
+                       hbox_combo_select_contacts_top.Visible = true; //this will be unneded
+
                        /*
                        if(radio_mode_contacts_jumps_profile.Active || 
radio_mode_contacts_jumps_dj_optimal_fall.Active ||
                                        radio_mode_contacts_jumps_weight_fv_profile.Active || 
radio_mode_contacts_jumps_evolution.Active)
@@ -3389,6 +3547,10 @@ public partial class ChronoJumpWindow
                                        radio_mode_contacts_analyze_buttons_visible (m);
                        }
 
+                       createComboSelectContactsTop (true);
+                       hbox_combo_select_contacts_top.Visible = true; //this will be unneded
+
+
                        pixbufModeGrid = new Pixbuf (null, Util.GetImagePath(false) + "image_modes_run.png");
                }
                else if(m == Constants.Modes.POWERGRAVITATORY || m == Constants.Modes.POWERINERTIAL) 
diff --git a/src/gui/app1/contactsExercise.cs b/src/gui/app1/contactsExercise.cs
index 6a5da9c88..050325bf8 100644
--- a/src/gui/app1/contactsExercise.cs
+++ b/src/gui/app1/contactsExercise.cs
@@ -32,6 +32,7 @@ public partial class ChronoJumpWindow
                notebook_contacts_capture_doing_wait.Sensitive = false;
                hbox_contacts_device_adjust_threshold.Sensitive = false;
                frame_persons.Sensitive = false;
+               combo_select_contacts_top.Sensitive = false;
                button_contacts_exercise.Sensitive = false;
                hbox_contacts_sup_capture_analyze_two_buttons.Sensitive = false;
                hbox_top_person.Sensitive = false;
@@ -45,6 +46,7 @@ public partial class ChronoJumpWindow
                notebook_contacts_capture_doing_wait.Sensitive = true;
                hbox_contacts_device_adjust_threshold.Sensitive = true;
                frame_persons.Sensitive = true;
+               combo_select_contacts_top.Sensitive = true;
                button_contacts_exercise.Sensitive = true;
                hbox_contacts_sup_capture_analyze_two_buttons.Sensitive = true;
                hbox_top_person.Sensitive = true;


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