[chronojump/FS-TFT-Menu] CairoBars clickable mark adapted to last encoder margins



commit d682c969ae07561f6754cd01715459e887d28860
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 31 11:18:07 2022 +0200

    CairoBars clickable mark adapted to last encoder margins

 src/gui/cairo/bars.cs    | 14 ++++++++++++--
 src/gui/cairo/generic.cs |  7 ++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 912790d64..02f3cd1e9 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -1158,7 +1158,12 @@ public class CairoBars1Series : CairoBars
                writeTitleAtTop ();
 
                if(clickable)
-                       addClickableMark (g);
+               {
+                       if(type == Type.ENCODER)
+                               addClickableMark (g, 0);
+                       else
+                               addClickableMark (g, 1); //default
+               }
 
                endGraphDisposing(g, surface, area.GdkWindow);
        }
@@ -1580,7 +1585,12 @@ public class CairoBarsNHSeries : CairoBars
                        writeLegend ();
 
                if(clickable)
-                       addClickableMark (g);
+               {
+                       if(type == Type.ENCODER)
+                               addClickableMark (g, 0);
+                       else
+                               addClickableMark (g, 1); //default
+               }
 
                endGraphDisposing(g, surface, area.GdkWindow);
        }
diff --git a/src/gui/cairo/generic.cs b/src/gui/cairo/generic.cs
index 9ac572c0b..b83b185b8 100644
--- a/src/gui/cairo/generic.cs
+++ b/src/gui/cairo/generic.cs
@@ -371,10 +371,15 @@ public abstract class CairoGeneric
        }
 
        protected void addClickableMark (Cairo.Context g)
+       {
+               addClickableMark (g, 1); //default
+       }
+       //double mousesFromRight is how many mouses width should be at right of the graph
+       protected void addClickableMark (Cairo.Context g, double mousesFromRight)
        {
                Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (null, Util.GetImagePath(false) + "mouse.png"); //18px
                Gdk.CairoHelper.SetSourcePixbuf (g, pixbuf,
-                               graphWidth -rightMargin -18,// -4,
+                               graphWidth -rightMargin -mousesFromRight*18,// -4,
                                graphHeight - bottomMargin -18 -4);
                g.Paint();
        }


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