[chronojump] All cairo graphs with points with colorBackground



commit 0e07c74b132c2f5f38f865aa0b16157f714cb498
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Aug 19 18:20:26 2020 +0100

    All cairo graphs with points with colorBackground

 src/gui/app1/jumpsDjOptimalFall.cs    | 3 ++-
 src/gui/app1/jumpsEvolution.cs        | 3 ++-
 src/gui/app1/jumpsRjFatigue.cs        | 3 ++-
 src/gui/app1/jumpsWeightFVProfile.cs  | 3 +--
 src/gui/cairo/jumpsDjOptimalFall.cs   | 4 +++-
 src/gui/cairo/jumpsEvolution.cs       | 4 +++-
 src/gui/cairo/jumpsRjFatigue.cs       | 4 +++-
 src/gui/cairo/jumpsWeightFVProfile.cs | 4 +++-
 src/gui/cairo/xy.cs                   | 9 ++++++++-
 9 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/app1/jumpsDjOptimalFall.cs b/src/gui/app1/jumpsDjOptimalFall.cs
index 75d538dd..867a5320 100644
--- a/src/gui/app1/jumpsDjOptimalFall.cs
+++ b/src/gui/app1/jumpsDjOptimalFall.cs
@@ -97,7 +97,8 @@ public partial class ChronoJumpWindow
                                        jumpsDjOptimalFall.XatMaxY, //model
                                        jumpsDjOptimalFall.GetMaxValue(),
                                        drawingarea_jumps_dj_optimal_fall,
-                                       currentPerson.Name, jumpType, currentSession.DateShort);
+                                       currentPerson.Name, jumpType, currentSession.DateShort,
+                                       preferences.colorBackground);
                        jumpsDjOptimalFallGraph.Do();
 
                        button_jumps_dj_optimal_fall_save_image.Sensitive = true;
diff --git a/src/gui/app1/jumpsEvolution.cs b/src/gui/app1/jumpsEvolution.cs
index f510d835..b7aa0d01 100644
--- a/src/gui/app1/jumpsEvolution.cs
+++ b/src/gui/app1/jumpsEvolution.cs
@@ -104,7 +104,8 @@ public partial class ChronoJumpWindow
                                        jumpsEvolution.Slope,
                                        jumpsEvolution.Intercept,
                                        drawingarea_jumps_evolution,
-                                       currentPerson.Name, jumpType, currentSession.DateShort);
+                                       currentPerson.Name, jumpType, currentSession.DateShort,
+                                       preferences.colorBackground);
                        jumpsEvolutionGraph.Do();
 
                        button_jumps_evolution_save_image.Sensitive = true;
diff --git a/src/gui/app1/jumpsRjFatigue.cs b/src/gui/app1/jumpsRjFatigue.cs
index 612f29e8..c0fbb307 100644
--- a/src/gui/app1/jumpsRjFatigue.cs
+++ b/src/gui/app1/jumpsRjFatigue.cs
@@ -190,7 +190,8 @@ public partial class ChronoJumpWindow
                                        currentPerson.Name, jumpType,
                                        jumpDateStr,
                                        radio_jumps_rj_fatigue_heights.Active,
-                                       divideIn);
+                                       divideIn,
+                                       preferences.colorBackground);
                        jumpsRjFatigueGraph.Do();
 
                        button_jumps_rj_fatigue_save_image.Sensitive = true;
diff --git a/src/gui/app1/jumpsWeightFVProfile.cs b/src/gui/app1/jumpsWeightFVProfile.cs
index 04cee4c6..bfdef522 100644
--- a/src/gui/app1/jumpsWeightFVProfile.cs
+++ b/src/gui/app1/jumpsWeightFVProfile.cs
@@ -132,8 +132,7 @@ public partial class ChronoJumpWindow
                                        currentPerson.Name, //jumpType,
                                        currentSession.DateShort,
                                        radio_jumps_weight_fv_profile_show_full_graph.Active,
-                                       errorAtStart
-                                       );
+                                       errorAtStart, preferences.colorBackground);
                        jumpsWeightFVProfileGraph.Do();
 
                        button_jumps_weight_fv_profile_save_image.Sensitive = true;
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index 9475e674..2e67c617 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -49,7 +49,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
                        double xAtMMaxY, //x at Model MaxY
                        double pointsMaxValue,
                        DrawingArea area,
-                       string title, string jumpType, string date)
+                       string title, string jumpType, string date,
+                       Gdk.Color colorBackground)
        {
                this.point_l = point_l;
                this.coefs = coefs;
@@ -60,6 +61,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
                this.title = title;
                this.jumpType = jumpType;
                this.date = date;
+               this.colorBackground = colorFromGdk(colorBackground);
 
                xVariable = fallStr;
                yVariable = heightStr;
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index b4c2108a..df5ae79c 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -44,7 +44,8 @@ public class JumpsEvolutionGraph : CairoXY
        //regular constructor
        public JumpsEvolutionGraph (
                        List<PointF> point_l, double slope, double intercept,
-                       DrawingArea area, string title, string jumpType, string date)
+                       DrawingArea area, string title, string jumpType, string date,
+                       Gdk.Color colorBackground)
        {
                this.point_l = point_l;
                this.slope = slope;
@@ -53,6 +54,7 @@ public class JumpsEvolutionGraph : CairoXY
                this.title = title;
                this.jumpType = jumpType;
                this.date = date;
+               this.colorBackground = colorFromGdk(colorBackground);
 
                xVariable = dateStr;
                yVariable = heightStr;
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index f7791a81..dd025305 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -44,7 +44,8 @@ public class JumpsRjFatigueGraph : CairoXY
        }
        public JumpsRjFatigueGraph (
                        List<PointF> point_l, double slope, double intercept,
-                       DrawingArea area, string title, string jumpType, string date, bool heights, int 
divideIn)
+                       DrawingArea area, string title, string jumpType, string date,
+                       bool heights, int divideIn, Gdk.Color colorBackground)
        {
                this.point_l = point_l;
                this.slope = slope;
@@ -54,6 +55,7 @@ public class JumpsRjFatigueGraph : CairoXY
                this.jumpType = jumpType;
                this.date = date;
                this.divideIn = divideIn;
+               this.colorBackground = colorFromGdk(colorBackground);
 
                xVariable = countStr;
                xUnits = "";
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index c34cc3a4..b282bf86 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -55,7 +55,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
                        JumpsWeightFVProfile jwp,
                        DrawingArea area, string title, //string jumpType,
                        string date, bool showFullGraph,
-                       ErrorAtStart errorMessage) //errorMessage, can make the graph but show the error
+                       ErrorAtStart errorMessage, //errorMessage, can make the graph but show the error
+                       Gdk.Color colorBackground)
        {
                this.point_l = jwp.Point_l_relative;
 
@@ -73,6 +74,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
                this.date = date;
                this.showFullGraph = showFullGraph;
                this.errorMessage = errorMessage;
+               this.colorBackground = colorFromGdk(colorBackground);
 
                outerMargins = 50; //blank space outside the axis
                if(showFullGraph)
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index dfeded6e..0ec558b7 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -51,6 +51,7 @@ public abstract class CairoXY
        protected string title;
        protected string jumpType;
        protected string date;
+       protected Cairo.Color colorBackground;
 
        protected Cairo.Context g;
        protected const int textHeight = 12;
@@ -410,7 +411,7 @@ public abstract class CairoXY
                        double xgraph = calculatePaintX(p.X);
                        double ygraph = calculatePaintY(p.Y);
                        g.Arc(xgraph, ygraph, pointsRadius, 0.0, 2.0 * Math.PI); //full circle
-                       g.Color = blue;
+                       g.Color = colorBackground;
                        g.FillPreserve();
                        g.SetSourceRGB(0, 0, 0);
                        g.Stroke ();
@@ -761,10 +762,16 @@ public abstract class CairoXY
        }
        */
 
+       //0 - 255
        protected Cairo.Color colorFromRGB(int red, int green, int blue)
        {
                return new Cairo.Color(red/256.0, green/256.0, blue/256.0);
        }
+       //0 - 65535
+       protected Cairo.Color colorFromGdk(Gdk.Color color)
+       {
+               return new Cairo.Color(color.Red/65536.0, color.Green/65536.0, color.Blue/65536.0);
+       }
 
        protected enum alignTypes { LEFT, CENTER, RIGHT }
        protected void printText (int x, int y, int height, int textHeight, string text, Cairo.Context g, 
alignTypes align)


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