[chronojump] Fixes on separation of two force modes (related to exercises shown on combos)



commit c39f5f046cb1eafb6633eafe6bc87c824f49e9e1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jul 13 11:39:27 2022 +0200

    Fixes on separation of two force modes (related to exercises shown on combos)

 src/gui/app1/chronojump.cs  |  6 ++++++
 src/gui/app1/forceSensor.cs | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index a6ae8167e..324ca1d43 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -2483,6 +2483,9 @@ public partial class ChronoJumpWindow
 
        private void on_combo_select_contacts_top_changed (object o, EventArgs args)
        {
+               if (comboSelectContactsTopNoFollow)
+                       return;
+
                LogB.Information("on_combo_select_contacts_top_changed");
 
                ComboBox combo = o as ComboBox;
@@ -3891,6 +3894,9 @@ public partial class ChronoJumpWindow
                        notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.CONTACTS);
                        notebooks_change(m);
 
+                       //combos should show exercises (isometric or elastic)
+                       updateForceExerciseCombo ();
+
                        vbox_contacts_load_recalculate.Visible = true;
                        button_contacts_exercise_close_and_recalculate.Visible = true;
 
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index 225e27e69..7b2fc2283 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -3269,9 +3269,10 @@ LogB.Information(" fs R ");
 
        string [] forceSensorComboExercisesString; //id:name (no translations, use user language)
 
-       //called on init
+       //called on initForceSensor (just one time)
        private void createForceExerciseCombo ()
        {
+               LogB.Information("createForceExerciseCombo start");
                //force_sensor_exercise
 
                combo_force_sensor_exercise = ComboBox.NewText ();
@@ -3285,6 +3286,22 @@ LogB.Information(" fs R ");
                on_combo_force_sensor_exercise_changed (new object (), new EventArgs ());
 
                
combo_force_sensor_button_sensitive_exercise(UtilGtk.ComboGetActive(combo_force_sensor_exercise) != "");
+               LogB.Information("createForceExerciseCombo end");
+       }
+
+       //called on change mode, can be from isometric to elastic
+       private void updateForceExerciseCombo ()
+       {
+               LogB.Information("updateForceExerciseCombo start");
+               combo_force_sensor_exercise.Changed -= new EventHandler 
(on_combo_force_sensor_exercise_changed);
+               UtilGtk.ComboDelAll(combo_force_sensor_exercise);
+               combo_force_sensor_exercise.Changed += new EventHandler 
(on_combo_force_sensor_exercise_changed);
+               LogB.Information("updateForceExerciseCombo going to fill");
+               fillForceSensorExerciseCombo("");
+               LogB.Information("updateForceExerciseCombo end");
+
+               //needed because the += EventHandler does not work on first fill of the combo
+               on_combo_force_sensor_exercise_changed (new object (), new EventArgs ());
        }
 
        //left-right buttons on force_sensor combo exercise selection


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