[chronojump] RepetitiveConditions apply at start without need to open/close window



commit 0e6ceb2526dc116d50530370aa5c3da51615cc9e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 27 12:04:32 2020 +0100

    RepetitiveConditions apply at start without need to open/close window

 src/gui/app1/chronojump.cs      | 28 ++++++++++++++++++++++++++--
 src/gui/app1/encoder.cs         |  2 +-
 src/gui/app1/icons.cs           |  8 ++------
 src/gui/repetitiveConditions.cs |  6 ++++--
 4 files changed, 33 insertions(+), 11 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 442abfb7..497867c8 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -612,6 +612,9 @@ public partial class ChronoJumpWindow
                createdStatsWin = false;
                
                repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
+               //to have objects ok to be able to be readed before viewing the repetitiveConditionsWin
+               repetitiveConditionsWin.View(Constants.BellModes.ENCODERGRAVITATORY, preferences, 
encoderRhythm, false); //not viewWindow
+               repetitiveConditionsWin.View(Constants.BellModes.FORCESENSOR, preferences, encoderRhythm, 
false); //not viewWindow
                repetitiveConditionsWin.FakeButtonClose.Clicked += new 
EventHandler(on_repetitive_conditions_closed);
 
                on_extra_window_multichronopic_test_changed(new object(), new EventArgs());
@@ -630,7 +633,7 @@ public partial class ChronoJumpWindow
 
                formatModeMenu();
 
-               putNonStandardIcons(preferences.encoderCaptureMainVariableGreaterActive || 
preferences.encoderCaptureMainVariableLowerActive);
+               putNonStandardIcons();
                eventExecutePutNonStandardIcons();
                //eventExecuteCreateComboGraphResultsSize();
 
@@ -3402,6 +3405,27 @@ public partial class ChronoJumpWindow
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
                }
 
+               //show feedback icon
+               Pixbuf pixbufBellActive = new Pixbuf (null, Util.GetImagePath(false) + 
"stock_bell_active.png");
+               Pixbuf pixbufBellInactive = new Pixbuf (null, Util.GetImagePath(false) + 
"stock_bell_none.png");
+               if(
+                               ( (m == Constants.Menuitem_modes.JUMPSSIMPLE || m == 
Constants.Menuitem_modes.JUMPSREACTIVE) &&
+                                 repetitiveConditionsWin.FeedbackActive(Constants.BellModes.JUMPS)) ||
+                               ( (m == Constants.Menuitem_modes.RUNSSIMPLE || m == 
Constants.Menuitem_modes.RUNSINTERVALLIC) &&
+                                 repetitiveConditionsWin.FeedbackActive(Constants.BellModes.RUNS)) ||
+                               ( m == Constants.Menuitem_modes.FORCESENSOR &&
+                                 repetitiveConditionsWin.FeedbackActive(Constants.BellModes.FORCESENSOR)) )
+                       image_contacts_bell.Pixbuf = pixbufBellActive;
+               else
+                       image_contacts_bell.Pixbuf = pixbufBellInactive;
+
+               if( (m == Constants.Menuitem_modes.POWERGRAVITATORY || m == 
Constants.Menuitem_modes.POWERINERTIAL)
+                               &&  
repetitiveConditionsWin.FeedbackActive(Constants.BellModes.ENCODERGRAVITATORY) )
+                       image_encoder_bell.Pixbuf = pixbufBellActive;
+               else
+                       image_encoder_bell.Pixbuf = pixbufBellInactive;
+
+
                //show the program
                notebook_start.CurrentPage = 1;
 
@@ -4031,7 +4055,7 @@ public partial class ChronoJumpWindow
                                m != Constants.Menuitem_modes.FORCESENSOR)
                        return;
 
-               repetitiveConditionsWin.View(getBellMode(m), preferences, encoderRhythm);
+               repetitiveConditionsWin.View(getBellMode(m), preferences, encoderRhythm, true);
        }
 
        private void change_notebook_results_data()
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 11832a87..9f1fde69 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -623,7 +623,7 @@ public partial class ChronoJumpWindow
        
        private void on_button_encoder_bells_clicked(object o, EventArgs args)
        {
-               repetitiveConditionsWin.View(getBellMode(current_menuitem_mode), preferences, encoderRhythm);
+               repetitiveConditionsWin.View(getBellMode(current_menuitem_mode), preferences, encoderRhythm, 
true);
        }
 
        /*
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index b6e99877..58b99a66 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -229,7 +229,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_message_permissions_at_boot;
        [Widget] Gtk.Image image_camera_at_boot;
 
-       private void putNonStandardIcons(bool encoderBellActive)
+       private void putNonStandardIcons()
        {
                Pixbuf pixbuf;
 
@@ -602,12 +602,8 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_none.png");
                image_contacts_bell.Pixbuf = pixbuf;
-
-               if(encoderBellActive)
-                       pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_active.png");
-
                image_encoder_bell.Pixbuf = pixbuf;
-               
+
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "preferences-system.png");
                image_jump_reactive_repair.Pixbuf = pixbuf;
                image_run_interval_repair.Pixbuf = pixbuf;
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 5bca8dc6..5bd6e260 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -251,7 +251,7 @@ public class RepetitiveConditionsWindow
                return RepetitiveConditionsWindowBox;
        }
 
-       public void View (Constants.BellModes bellMode, Preferences preferences, EncoderRhythm encoderRhythm)
+       public void View (Constants.BellModes bellMode, Preferences preferences, EncoderRhythm encoderRhythm, 
bool viewWindow)
        {
                //when user "deleted_event" the window
                if (RepetitiveConditionsWindowBox == null) {
@@ -273,7 +273,9 @@ public class RepetitiveConditionsWindow
                                preferences.forceSensorCaptureFeedbackAt,
                                preferences.forceSensorCaptureFeedbackRange);
 
-               RepetitiveConditionsWindowBox.repetitive_conditions.Show ();
+               if(viewWindow)
+                       RepetitiveConditionsWindowBox.repetitive_conditions.Show ();
+
                RepetitiveConditionsWindowBox.volumeOn = preferences.volumeOn;
                RepetitiveConditionsWindowBox.gstreamer = preferences.gstreamer;
        }


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