[chronojump/FS-TFT-Menu] CairoBars clickable moved from PassData to the constructor



commit cf865a7bce5246df8e5e52cadfdf55279b414a45
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Mar 23 17:21:37 2022 +0100

    CairoBars clickable moved from PassData to the constructor

 src/gui/cairo/bars.cs   | 22 +++++++++++-----------
 src/gui/eventExecute.cs | 40 ++++++++++++++++++++--------------------
 2 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index f6502fc39..73435d878 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -268,7 +268,7 @@ public abstract class CairoBars : CairoGeneric
        public virtual void PassData1Serie (List<PointF> pointMain_l,
                        List<Cairo.Color> colorMain_l, List<string> names_l,
                        int fontHeightAboveBar, int fontHeightForBottomNames, int marginForBottomNames,
-                       string title, bool clickable)
+                       string title)
        {
                //defined in CairoBars1Series
        }
@@ -277,15 +277,12 @@ public abstract class CairoBars : CairoGeneric
                        List<Cairo.Color> colorMain_l, List<Cairo.Color> colorSecondary_l, List<string> 
names_l,
                        string labelBarMain, string labelBarSecondary, bool labelRotateInFirstBar,
                        int fontHeightAboveBar, int fontHeightForBottomNames, int marginForBottomNames,
-                       string title, bool clickable)
+                       string title)
        {
                //defined in CairoBarsNHSeries
        }
 
-       public abstract void GraphDo();/* (List<PointF> pointMain_l, List<List<PointF>> pointSecondary_ll, 
bool mainAtLeft,
-                       List<Cairo.Color> colorMain_l, List<Cairo.Color> colorSecondary, List<string> names_l,
-                       string labelBarMain, string labelBarSecondary, bool labelRotateInFirstBar,
-                       int fontHeightForBottomNames, int marginForBottomNames, string title, bool 
clickable);*/
+       public abstract void GraphDo();
 
        protected void initGraph(string font, double widthPercent1)
        {
@@ -658,6 +655,7 @@ public abstract class CairoBars : CairoGeneric
        {
                g.SetFontSize(resultFontHeight);
 
+               /*
                double maxLengthNumber = 9.99;
                if(maxY >= 10)
                        maxLengthNumber = 99.99;
@@ -665,6 +663,7 @@ public abstract class CairoBars : CairoGeneric
                        maxLengthNumber = 999.99;
                if(maxY >= 1000)
                        maxLengthNumber = 9999.99;
+               */
 
                Cairo.TextExtents te;
                te = g.TextExtents(Util.TrimDecimals(result,decs));
@@ -829,9 +828,10 @@ public class CairoBars1Series : CairoBars
        }
 
        //regular constructor
-       public CairoBars1Series (DrawingArea area)
+       public CairoBars1Series (DrawingArea area, bool clickable)
        {
                this.area = area;
+               this.clickable = clickable;
 
                this.colorSerieA = colorFromGdk(Config.ColorBackground); //but note if we are using system 
colors, this will not match
        }
@@ -895,7 +895,7 @@ public class CairoBars1Series : CairoBars
        public override void PassData1Serie (List<PointF> pointMain_l,
                        List<Cairo.Color> colorMain_l, List<string> names_l,
                        int fontHeightAboveBar, int fontHeightForBottomNames, int marginForBottomNames,
-                       string title, bool clickable)
+                       string title)
        {
                this.pointMain_l = pointMain_l;
                this.colorMain_l = colorMain_l;
@@ -904,7 +904,6 @@ public class CairoBars1Series : CairoBars
                this.fontHeightForBottomNames = fontHeightForBottomNames;
                this.marginForBottomNames = marginForBottomNames;
                this.title = title;
-               this.clickable = clickable;
        }
 
        public override void GraphDo ()
@@ -971,10 +970,11 @@ public class CairoBarsNHSeries : CairoBars
        }
 
        //regular constructor
-       public CairoBarsNHSeries (DrawingArea area, bool showLegend)
+       public CairoBarsNHSeries (DrawingArea area, bool showLegend, bool clickable)
        {
                this.area = area;
                this.showLegend = showLegend;
+               this.clickable = clickable;
 
                colorSerieA = colorFromGdk(UtilGtk.GetColorShifted(Config.ColorBackground,
                                        ! UtilGtk.ColorIsDark(Config.ColorBackground)));
@@ -1264,7 +1264,7 @@ public class CairoBarsNHSeries : CairoBars
                        List<Cairo.Color> colorMain_l, List<Cairo.Color> colorSecondary_l, List<string> 
names_l,
                        string labelBarMain, string labelBarSecondary, bool labelRotateInFirstBar,
                        int fontHeightAboveBar, int fontHeightForBottomNames, int marginForBottomNames,
-                       string title, bool clickable)
+                       string title)
        {
                this.pointSecondary_ll = pointSecondary_ll;
                this.pointMain_l = pointMain_l;
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 37c694be8..b59f0f144 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -2537,11 +2537,11 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
                        UseHeights = false;
 
                if(showBarA && showBarB) //Dja, Djna
-                       cb = new CairoBarsNHSeries (darea, true);
+                       cb = new CairoBarsNHSeries (darea, true, false);
                else if (showBarA) //takeOff, takeOffWeight
-                       cb = new CairoBars1Series (darea);
+                       cb = new CairoBars1Series (darea, false);
                else //rest of the jumps: sj, cmj, ..
-                       cb = new CairoBars1Series (darea);
+                       cb = new CairoBars1Series (darea, false);
 
                if(UseHeights) {
                        cb.YVariable = Catalog.GetString("Height");
@@ -2640,15 +2640,15 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
                        cb.PassData2Series (pointB_l, pointSecondary_ll, false,
                                        new List<Cairo.Color>(), new List<Cairo.Color>(), names_l,
                                        "", "", false,
-                                       -1, fontHeightForBottomNames, bottomMargin, title, false);
+                                       -1, fontHeightForBottomNames, bottomMargin, title);
                } else if (showBarA) //takeOff, takeOffWeight
                        cb.PassData1Serie (pointA_l,
                                        new List<Cairo.Color>(), names_l,
-                                       -1, fontHeightForBottomNames, bottomMargin, title, false);
+                                       -1, fontHeightForBottomNames, bottomMargin, title);
                else //rest of the jumps: sj, cmj, ..
                        cb.PassData1Serie (pointB_l,
                                        new List<Cairo.Color>(), names_l,
-                                       -1, fontHeightForBottomNames, bottomMargin, title, false);
+                                       -1, fontHeightForBottomNames, bottomMargin, title);
 
                cb.GraphDo();
        }
@@ -2679,7 +2679,7 @@ public class CairoPaintBarsPreJumpReactive : CairoPaintBarsPre
 
        protected override void paintSpecific()
        {
-               cb = new CairoBarsNHSeries (darea, true);
+               cb = new CairoBarsNHSeries (darea, true, false);
 
                cb.YVariable = Catalog.GetString("Time");
                cb.YUnits = "s";
@@ -2779,7 +2779,7 @@ public class CairoPaintBarsPreJumpReactive : CairoPaintBarsPre
                cb.PassData2Series (pointB_l, pointSecondary_ll, false,
                                new List<Cairo.Color>(), new List<Cairo.Color>(), names_l,
                                "", "", false,
-                               -1, fontHeightForBottomNames, bottomMargin, title, false);
+                               -1, fontHeightForBottomNames, bottomMargin, title);
                cb.GraphDo();
        }
 }
@@ -2809,7 +2809,7 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
 
        protected override void paintSpecific()
        {
-               CairoBars1Series cb = new CairoBars1Series (darea);
+               CairoBars1Series cb = new CairoBars1Series (darea, false);
 
                cb.YVariable = Catalog.GetString("Speed");
                cb.YUnits = "m/s";
@@ -2880,7 +2880,7 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
 
                cb.PassData1Serie (point_l,
                                new List<Cairo.Color>(), names_l,
-                               -1, fontHeightForBottomNames, bottomMargin, title, false);
+                               -1, fontHeightForBottomNames, bottomMargin, title);
                cb.GraphDo();
        }
 }
@@ -2910,7 +2910,7 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
 
        protected override void paintSpecific()
        {
-               CairoBars1Series cb = new CairoBars1Series (darea);
+               CairoBars1Series cb = new CairoBars1Series (darea, false);
 
                cb.YVariable = Catalog.GetString("Speed");
                cb.YUnits = "m/s";
@@ -2991,7 +2991,7 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
 
                cb.PassData1Serie (point_l,
                                new List<Cairo.Color>(), names_l,
-                               -1, fontHeightForBottomNames, bottomMargin, title, false);
+                               -1, fontHeightForBottomNames, bottomMargin, title);
                cb.GraphDo();
        }
 }
@@ -3065,7 +3065,7 @@ public class CairoPaintBarsPreJumpReactiveRealtimeCapture : CairoPaintBarsPre
                if(tv_l.Count != tc_l.Count)
                        return;
 
-               cb = new CairoBarsNHSeries (darea, true);
+               cb = new CairoBarsNHSeries (darea, true, false);
 
                cb.YVariable = Catalog.GetString("Time");
                cb.YUnits = "s";
@@ -3121,7 +3121,7 @@ public class CairoPaintBarsPreJumpReactiveRealtimeCapture : CairoPaintBarsPre
                cb.PassData2Series (pointB_l, pointSecondary_ll, false,
                                new List<Cairo.Color>(), new List<Cairo.Color>(), names_l,
                                "", "", false,
-                               -1, 14, 8, title, false);
+                               -1, 14, 8, title);
                cb.GraphDo();
        }
 }
@@ -3232,7 +3232,7 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
                //if(ifRSAstartRest)
                //      return;
 
-               cb = new CairoBars1Series (darea);
+               cb = new CairoBars1Series (darea, false);
 
                cb.YVariable = Catalog.GetString("Speed");
                cb.YUnits = "m/s";
@@ -3293,7 +3293,7 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
 
                cb.PassData1Serie (point_l,
                                new List<Cairo.Color>(), names_l,
-                               -1, 14, 22, title, false); //22 because there are two rows
+                               -1, 14, 22, title); //22 because there are two rows
                cb.GraphDo();
        }
 }
@@ -3765,9 +3765,9 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
        private void paintSpecificDo ()
        {
                if(pegbe.eccon == "c")
-                       cb = new CairoBars1Series (darea);
+                       cb = new CairoBars1Series (darea, ! pegbe.capturing);
                else
-                       cb = new CairoBarsNHSeries (darea, false);
+                       cb = new CairoBarsNHSeries (darea, false, ! pegbe.capturing);
 
                //LogB.Information("data_l.Count: " + data_l.Count.ToString());
                //cb.GraphInit(fontStr, true, false); //usePersonGuides, useGroupGuides
@@ -3794,7 +3794,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
                if(pegbe.eccon == "c")
                        cb.PassData1Serie (dataA_l,
                                        colorMain_l, names_l,
-                                       20, 14, 8, "my title", ! pegbe.capturing);
+                                       20, 14, 8, "my title");
                else {
                        List<List<PointF>> pointSecondary_ll = new List<List<PointF>>();
                        pointSecondary_ll.Add(dataA_l);
@@ -3802,7 +3802,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
                        cb.PassData2Series (dataB_l, pointSecondary_ll, false,
                                        colorMain_l, colorSecondary_l, names_l,
                                        "Ecc", "Con", true,
-                                       20, 14, 8, "my title", ! pegbe.capturing);
+                                       20, 14, 8, "my title");
                }
 
                cb.GraphDo();


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