[chronojump] Notifications bell change shape depending on if defined



commit 43c0b212424494daee29a82d03e2098d9f49ebe3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jun 29 07:01:08 2017 +0200

    Notifications bell change shape depending on if defined

 images/md/ic_notifications_active_blue_24dp_1x.png |  Bin 0 -> 504 bytes
 images/md/ic_notifications_none_blue_24dp_1x.png   |  Bin 0 -> 430 bytes
 src/Makefile.am                                    |    2 +
 src/gui/chronojump.cs                              |   81 +++++++++++++++-----
 src/gui/chronojumpIcons.cs                         |    4 +-
 src/gui/repetitiveConditions.cs                    |   30 +++++++
 6 files changed, 93 insertions(+), 24 deletions(-)
---
diff --git a/images/md/ic_notifications_active_blue_24dp_1x.png 
b/images/md/ic_notifications_active_blue_24dp_1x.png
new file mode 100644
index 0000000..5103953
Binary files /dev/null and b/images/md/ic_notifications_active_blue_24dp_1x.png differ
diff --git a/images/md/ic_notifications_none_blue_24dp_1x.png 
b/images/md/ic_notifications_none_blue_24dp_1x.png
new file mode 100644
index 0000000..34b6b45
Binary files /dev/null and b/images/md/ic_notifications_none_blue_24dp_1x.png differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 940887c..c44de02 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -354,6 +354,8 @@ RESOURCES = \
        ../images/infrared.jpg,infrared.jpg \
        ../images/mini/infrared.jpg,mini/infrared.jpg \
        ../images/md/ic_notifications_blue_24dp_1x.png,stock_bell.png \
+       ../images/md/ic_notifications_active_blue_24dp_1x.png,stock_bell_active.png \
+       ../images/md/ic_notifications_none_blue_24dp_1x.png,stock_bell_none.png \
        ../images/stock_bell_green.png,stock_bell_green.png \
        ../images/stock_bell_red.png,stock_bell_red.png \
        ../images/line_session_max.png,line_session_max.png \
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index bacbbe0..8d8a9ab 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6478,27 +6478,66 @@ LogB.Debug("X");
                repetitiveConditionsWin.View(Constants.BellModes.RUNS, preferences.volumeOn);
        }
        
-       private void on_repetitive_conditions_closed(object o, EventArgs args) {
-               //treeview_encoder should be updated (to colorize some cells)
-               //only if there was data
-               //this avoids misbehaviour when bell is pressed and there's no data in treeview
-               EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(1, false);
-               if(curve.N != null) {
-                       List<string> contents = 
Util.ReadFileAsStringList(UtilEncoder.GetEncoderCurvesTempFileName());
-                       encoderUpdateTreeViewCapture(contents); //this updates encoderCaptureCurves
-                       
-                       findAndMarkSavedCurves(false, false); //SQL closed; don't update curve SQL records 
(like future1: meanPower)
-                       
-                       //also update the bars plot (to show colors depending on bells changes)
-                       if(captureCurvesBarsData.Count > 0) {
-                               string mainVariable = 
Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable);
-                               double mainVariableHigher = 
repetitiveConditionsWin.GetMainVariableHigher(mainVariable);
-                               double mainVariableLower = 
repetitiveConditionsWin.GetMainVariableLower(mainVariable);
-                               plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower, 
captureCurvesBarsData,
-                                               repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
-                                               false); //not capturing
-                       } else
-                               UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, 
encoder_capture_curves_bars_pixmap);
+       private void on_repetitive_conditions_closed(object o, EventArgs args)
+       {
+               //update bell color if feedback exists
+               Constants.Menuitem_modes m = current_menuitem_mode;
+               Pixbuf pixbuf;
+
+               Constants.BellModes bellMode;
+               if(m == Constants.Menuitem_modes.JUMPSREACTIVE || m == 
Constants.Menuitem_modes.RUNSINTERVALLIC)
+               {
+                       bellMode = Constants.BellModes.JUMPS;
+                       if(m == Constants.Menuitem_modes.RUNSINTERVALLIC)
+                               bellMode = Constants.BellModes.RUNS;
+
+                       if(repetitiveConditionsWin.FeedbackActive(bellMode))
+                               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"stock_bell_active.png");
+                       else
+                               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_none.png");
+
+                       if(m == Constants.Menuitem_modes.JUMPSREACTIVE)
+                               image_jump_reactive_bell.Pixbuf = pixbuf;
+                       else
+                               image_run_interval_bell.Pixbuf = pixbuf;
+               }
+               else if(m == Constants.Menuitem_modes.POWERGRAVITATORY || m == 
Constants.Menuitem_modes.POWERINERTIAL)
+               {
+                       bellMode = Constants.BellModes.ENCODERGRAVITATORY;
+                       if(m == Constants.Menuitem_modes.POWERINERTIAL)
+                               bellMode = Constants.BellModes.ENCODERINERTIAL;
+
+                       if(repetitiveConditionsWin.FeedbackActive(bellMode))
+                               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"stock_bell_active.png");
+                       else
+                               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_none.png");
+
+                       image_encoder_bell.Pixbuf = pixbuf;
+               }
+
+               if(m == Constants.Menuitem_modes.POWERGRAVITATORY || m == 
Constants.Menuitem_modes.POWERINERTIAL)
+               {
+                       //treeview_encoder should be updated (to colorize some cells)
+                       //only if there was data
+                       //this avoids misbehaviour when bell is pressed and there's no data in treeview
+                       EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(1, false);
+                       if(curve.N != null) {
+                               List<string> contents = 
Util.ReadFileAsStringList(UtilEncoder.GetEncoderCurvesTempFileName());
+                               encoderUpdateTreeViewCapture(contents); //this updates encoderCaptureCurves
+
+                               findAndMarkSavedCurves(false, false); //SQL closed; don't update curve SQL 
records (like future1: meanPower)
+
+                               //also update the bars plot (to show colors depending on bells changes)
+                               if(captureCurvesBarsData.Count > 0) {
+                                       string mainVariable = 
Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable);
+                                       double mainVariableHigher = 
repetitiveConditionsWin.GetMainVariableHigher(mainVariable);
+                                       double mainVariableLower = 
repetitiveConditionsWin.GetMainVariableLower(mainVariable);
+                                       plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, 
mainVariableLower, captureCurvesBarsData,
+                                                       
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
+                                                       false); //not capturing
+                               } else
+                                       UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, 
encoder_capture_curves_bars_pixmap);
+                       }
                }
        }
        
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 952397a..9dd6da9 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -361,9 +361,7 @@ public partial class ChronoJumpWindow
                //not changed because it's small. TODO: do bigger
                //image_encoder_capture_open.Pixbuf = pixbuf;
 
-
-
-               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell.png");
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_bell_none.png");
                image_jump_reactive_bell.Pixbuf = pixbuf;
                image_run_interval_bell.Pixbuf = pixbuf;
                image_encoder_bell.Pixbuf = pixbuf;
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index d907b71..34d4574 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -317,6 +317,36 @@ public class RepetitiveConditionsWindow
                args.RetVal = true;
        }
 
+       public bool FeedbackActive (Constants.BellModes bellMode)
+       {
+               if(bellMode == Constants.BellModes.JUMPS)
+               {
+                       if(checkbutton_height_greater.Active || checkbutton_height_lower.Active ||
+                                       checkbutton_tf_greater.Active || checkbutton_tf_lower.Active ||
+                                       checkbutton_tc_lower.Active || checkbutton_tc_greater.Active ||
+                                       checkbutton_tf_tc_greater.Active || checkbutton_tf_tc_lower.Active)
+                               return true;
+               }
+               else if(bellMode == Constants.BellModes.RUNS)
+               {
+                       if(checkbutton_time_lower.Active || checkbutton_time_greater.Active)
+                               return true;
+               }
+               else { //encoder (grav and inertial)
+                       if(checkbutton_encoder_automatic_greater.Active || 
checkbutton_encoder_automatic_lower.Active ||
+                                       checkbutton_encoder_height_higher.Active || 
checkbutton_encoder_height_lower.Active ||
+                                       checkbutton_encoder_mean_speed_higher.Active || 
checkbutton_encoder_mean_speed_lower.Active ||
+                                       checkbutton_encoder_max_speed_higher.Active || 
checkbutton_encoder_max_speed_lower.Active ||
+                                       checkbutton_encoder_mean_force_higher.Active || 
checkbutton_encoder_mean_force_lower.Active ||
+                                       checkbutton_encoder_max_force_higher.Active || 
checkbutton_encoder_max_force_lower.Active ||
+                                       checkbutton_encoder_power_higher.Active || 
checkbutton_encoder_power_lower.Active ||
+                                       checkbutton_encoder_peakpower_higher.Active || 
checkbutton_encoder_peakpower_lower.Active)
+                               return true;
+               }
+
+               return false;
+       }
+
        public bool VolumeOn {
                set { volumeOn = value; }
        }


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