[chronojump] Encoder CairoBarplot only recalculate all stuff if is not an expose-event



commit 1a51a7c79c3b9ee189de1625112e4e717495abf6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 4 13:25:35 2022 +0200

    Encoder CairoBarplot only recalculate all stuff if is not an expose-event

 src/gui/app1/chronojump.cs |  2 +-
 src/gui/app1/encoder.cs    | 21 +++++++++++----------
 src/gui/eventExecute.cs    | 19 ++++++-------------
 3 files changed, 18 insertions(+), 24 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 7fbb92cf0..38aba92da 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -7833,7 +7833,7 @@ LogB.Debug("mc finished 5");
                                                        preferences.encoderCaptureShowNRepetitions,
                                                        preferences.volumeOn,
                                                        preferences.gstreamer);
-                                       prepareEncoderBarplotCairo ();
+                                       prepareEncoderBarplotCairo (true);
                                } else
                                        UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea, 
encoder_capture_curves_bars_pixmap);
                        }
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 2d511ae43..cf03bbecd 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -5926,7 +5926,7 @@ public partial class ChronoJumpWindow
                                        preferences.encoderCaptureShowNRepetitions,
                                        preferences.volumeOn,
                                        preferences.gstreamer);
-                       prepareEncoderBarplotCairo ();
+                       prepareEncoderBarplotCairo (true);
                }
        }
 
@@ -6042,20 +6042,21 @@ public partial class ChronoJumpWindow
 
                LogB.Information("on_encoder_capture_curves_bars_drawingarea_cairo_expose_event B");
                if(prepareEventGraphBarplotEncoder != null)
-                       prepareEncoderBarplotCairo ();
+                       prepareEncoderBarplotCairo (false); //just redraw the graph
        }
 
-       private void prepareEncoderBarplotCairo ()
+       private void prepareEncoderBarplotCairo (bool calculateAll)
        {
                LogB.Information("prepareEncoderBarplotCairo");
                if(currentPerson == null)
                        return;
 
-               cairoPaintBarsPre = new CairoPaintBarplotPreEncoder (
-                               preferences,
-                               encoder_capture_curves_bars_drawingarea_cairo, 
preferences.fontType.ToString(),
-                               currentPerson.Name, "", 3,
-                               prepareEventGraphBarplotEncoder);
+               if(cairoPaintBarsPre == null || calculateAll)
+                       cairoPaintBarsPre = new CairoPaintBarplotPreEncoder (
+                                       preferences,
+                                       encoder_capture_curves_bars_drawingarea_cairo, 
preferences.fontType.ToString(),
+                                       currentPerson.Name, "", 3,
+                                       prepareEventGraphBarplotEncoder);
 
                cairoPaintBarsPre.Paint();
        }
@@ -6836,7 +6837,7 @@ public partial class ChronoJumpWindow
                                                preferences.encoderCaptureShowNRepetitions,
                                                preferences.volumeOn,
                                                preferences.gstreamer);
-                               prepareEncoderBarplotCairo ();
+                               prepareEncoderBarplotCairo (true);
 
                                needToRefreshTreeviewCapture = false;
                        }
@@ -7437,7 +7438,7 @@ public partial class ChronoJumpWindow
                                                preferences.encoderCaptureShowNRepetitions,
                                                preferences.volumeOn,
                                                preferences.gstreamer);
-                               prepareEncoderBarplotCairo ();
+                               prepareEncoderBarplotCairo (true);
 
                                button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
                                button_encoder_signal_save_comment.Sensitive = false;
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 06f1b555c..2f9723c8a 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3441,6 +3441,12 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
                //messageNoStoreCreated = " no criteria ";
 
                initialize (darea, fontStr, mode, personName, testName, pDN);
+
+               //calcule all graph stuff
+               fillDataVariables1 ();
+               fillDataVariables2 ();
+               prepareTitle ();
+               prepareLossArrow ();
        }
 
        public override void ShowMessage (DrawingArea darea, string fontTypeStr, string message)
@@ -3454,7 +3460,6 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
 
        protected override bool storeCreated ()
        {
-               //return (eventGraphEncoderBarplotStored != null);
                return (pegbe.data9Variables.Count > 0);
        }
 
@@ -3465,12 +3470,6 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
 
        protected override void paintSpecific()
        {
-               //TODO: reorg/rename this
-               fillDataVariables1 ();
-               fillDataVariables2 ();
-               prepareTitle ();
-               prepareLossArrow ();
-
                paintSpecificDo ();
        }
 
@@ -3481,12 +3480,6 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
 
                pegbe.discardFirstN = preferences.encoderCaptureInertialDiscardFirstN;
                pegbe.showNRepetitions = preferences.encoderCaptureShowNRepetitions;
-
-               /*
-               if(layout_encoder_capture_curves_bars != null)
-                       layout_encoder_capture_curves_bars.FontDescription =
-                               Pango.FontDescription.FromString 
(preferences.GetFontTypeWithSize(preferences.encoderCaptureBarplotFontSize));
-               */
        }
 
        private void fillDataVariables1 () //copied from gui/encoderGraphObjects fillDataVariables()


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