[chronojump] Better CairoUtil rectangles for encoder/forceSensorAnalyze



commit f4d424d6682190b669509cb807255f768a6390af
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 14 19:11:59 2020 +0100

    Better CairoUtil rectangles for encoder/forceSensorAnalyze

 src/gui/app1/encoder.cs            |  1 +
 src/gui/app1/forceSensorAnalyze.cs |  3 ++-
 src/gui/cairo/util.cs              | 14 ++++++--------
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 27eeaccd..25337dfc 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -6542,6 +6542,7 @@ public partial class ChronoJumpWindow
                                        
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_a.Value)),
                                        
eai.GetVerticalLinePosition(Convert.ToInt32(hscale_encoder_analyze_b.Value)),
                                        checkbutton_encoder_analyze_b.Active,
+                                       9, 18, // top/bottom of the rectangle
                                        drawingarea_encoder_analyze_cairo_pixbuf);
        }
 
diff --git a/src/gui/app1/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index d8d5d428..65472a38 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -895,7 +895,8 @@ public partial class ChronoJumpWindow
                                        force_sensor_ai_drawingarea,
                                        
fsAI.GetXFromSampleCount(Convert.ToInt32(hscale_force_sensor_ai_a.Value)),
                                        
fsAI.GetXFromSampleCount(Convert.ToInt32(hscale_force_sensor_ai_b.Value)),
-                                       true); //paint the second line and rectangle (if a != b)
+                                       true, //paint the second line and rectangle (if a != b)
+                                       15, 0); // top/bottom of the rectangle (top is greater than at 
encoder to acomodate the repetition green text), bottom 0 is ok.
 
                force_sensor_ai_allocationXOld = allocation.Width;
 
diff --git a/src/gui/cairo/util.cs b/src/gui/cairo/util.cs
index 28b405c8..57d8688d 100644
--- a/src/gui/cairo/util.cs
+++ b/src/gui/cairo/util.cs
@@ -31,18 +31,17 @@ public static class CairoUtil
         */
 
        public static void PaintVerticalLinesAndRectangle (
-                       Gtk.DrawingArea darea, int xposA, int xposB, bool posBuse)
+                       Gtk.DrawingArea darea, int xposA, int xposB, bool posBuse, int topRect, int 
bottomRect)
        {
                using (Cairo.Context g = Gdk.CairoHelper.Create (darea.GdkWindow)) 
                {
-                       paintVerticalLinesAndRectangleDo (g, darea.Allocation.Height, xposA, xposB, posBuse);
+                       paintVerticalLinesAndRectangleDo (g, darea.Allocation.Height, xposA, xposB, posBuse, 
topRect, bottomRect);
                        g.Stroke();
                        g.GetTarget ().Dispose ();
                }
        }
        public static void PaintVerticalLinesAndRectangleOnSurface (
-                       Gtk.DrawingArea darea, int xposA, int xposB, bool posBuse,
-                       Pixbuf pixbuf)
+                       Gtk.DrawingArea darea, int xposA, int xposB, bool posBuse, int topRect, int 
bottomRect, Pixbuf pixbuf)
        {
                using (Cairo.Context g = Gdk.CairoHelper.Create (darea.GdkWindow)) 
                {
@@ -51,7 +50,7 @@ public static class CairoUtil
 
                        g.Paint();
 
-                       paintVerticalLinesAndRectangleDo (g, darea.Allocation.Height, xposA, xposB, posBuse);
+                       paintVerticalLinesAndRectangleDo (g, darea.Allocation.Height, xposA, xposB, posBuse, 
topRect, bottomRect);
                        g.Stroke();
                        g.GetTarget ().Dispose ();
                }
@@ -61,7 +60,7 @@ public static class CairoUtil
         * private methods
         */
 
-       private static void paintVerticalLinesAndRectangleDo (Cairo.Context g, int height, int xposA, int 
xposB, bool posBuse)
+       private static void paintVerticalLinesAndRectangleDo (Cairo.Context g, int height, int xposA, int 
xposB, bool posBuse, int topRect, int bottomRect)
        {
                //add rectangle
                g.SetSourceRGBA(0.906, 0.745, 0.098, 1); //Chronojump yellow
@@ -79,7 +78,7 @@ public static class CairoUtil
                        int max = Math.Max(xposA, xposB) -1;
                        if(min < max)
                        {
-                               g.Rectangle(min ,9 , max-min, height -18);
+                               g.Rectangle(min, topRect , max-min, height - bottomRect);
                                g.Fill();
                        }
                }
@@ -89,7 +88,6 @@ public static class CairoUtil
        {
                //vertical line
                g.MoveTo(x, 9);
-               //g.LineTo(x, drawingarea_encoder_analyze_cairo_pixbuf.Height);
                g.LineTo(x, height);
                g.Stroke();
 


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