[chronojump] current_menuitem_mode var to know mode better



commit 841e6749fb49c2de4cc76f06675f67a6149b4dcd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jun 26 17:52:57 2017 +0200

    current_menuitem_mode var to know mode better

 src/gui/chronojump.cs |   12 ++++++++++--
 src/gui/chronopic.cs  |    2 +-
 src/gui/encoder.cs    |    2 +-
 3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 336b22d..bacbbe0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2722,7 +2722,7 @@ public partial class ChronoJumpWindow
 
        private void on_preferences_activate (object o, EventArgs args) 
        {
-               preferencesWin = PreferencesWindow.Show(preferences, rfdList, impulse, getMenuItemMode());
+               preferencesWin = PreferencesWindow.Show(preferences, rfdList, impulse, current_menuitem_mode);
                
                preferencesWin.FakeButtonImported.Clicked += new 
EventHandler(on_preferences_import_configuration);
                preferencesWin.FakeButtonDebugModeStart.Clicked += new 
EventHandler(on_preferences_debug_mode_start);
@@ -2814,10 +2814,13 @@ public partial class ChronoJumpWindow
                main_menu.Visible = false;
        }       
        
+       private Constants.Menuitem_modes current_menuitem_mode;
        private Constants.Menuitem_modes last_menuitem_mode; //store it to decide not change threshold when 
change from jumps to jumpsRj
        private bool last_menuitem_mode_defined = false; //undefined when first time entry on a mode (jumps, 
jumpRj, ...)
        private void select_menuitem_mode_toggled(Constants.Menuitem_modes m) 
        {
+               current_menuitem_mode = m;
+
                menuitem_mode_selected_jumps_simple.Visible = false;
                menuitem_mode_selected_jumps_reactive.Visible = false;
                menuitem_mode_selected_runs_simple.Visible = false;
@@ -3226,6 +3229,11 @@ public partial class ChronoJumpWindow
        */
                
 
+       /*
+        * used after changing radio
+        * for other uses, check:
+        * current_menuitem_mode
+        */
        private Constants.Menuitem_modes getMenuItemMode() 
        {
                if(radio_menuitem_mode_jumps_simple.Active)
@@ -3597,7 +3605,7 @@ public partial class ChronoJumpWindow
        DialogThreshold dialogThreshold;
        private void on_threshold_clicked (object o, EventArgs args)
        {
-               dialogThreshold = new DialogThreshold(getMenuItemMode(), threshold.GetT);
+               dialogThreshold = new DialogThreshold(current_menuitem_mode, threshold.GetT);
                dialogThreshold.FakeButtonClose.Clicked += new EventHandler(on_threshold_close);
        }
 
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 317f25c..f0729d2 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -142,7 +142,7 @@ public partial class ChronoJumpWindow
        private void changeMultitestFirmwareIfNeeded(int cpCount)
        {
                //change multitest stuff
-               threshold.UpdateAtDatabaseIfNeeded(getMenuItemMode());
+               threshold.UpdateAtDatabaseIfNeeded(current_menuitem_mode);
                if(threshold.ShouldUpdateChronopicFirmware(cpCount))
                {
                        bool ok = cp2016.ChangeMultitestFirmwarePre(threshold.GetT, cpCount);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index f7722f1..0ca7559 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -6220,7 +6220,7 @@ public partial class ChronoJumpWindow
                        }
 
                        //on inertial, check after capture if string was not fully extended and was corrected
-                       if(getMenuItemMode() == Constants.Menuitem_modes.POWERINERTIAL && 
+                       if(current_menuitem_mode == Constants.Menuitem_modes.POWERINERTIAL &&
                                        action == encoderActions.CURVES_AC && 
                                        Util.FileExists(UtilEncoder.GetEncoderSpecialDataTempFileName())) 
                        {


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