[chronojump] Clean warnings: "g.Color = col; " to "g.SetSourceColor(col); "
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Clean warnings: "g.Color = col; " to "g.SetSourceColor(col); "
- Date: Wed, 15 Dec 2021 15:46:32 +0000 (UTC)
commit 444437f426c762c1e1ec5940d18f90f588b840f6
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Dec 15 16:39:59 2021 +0100
Clean warnings: "g.Color = col;" to "g.SetSourceColor(col);"
src/gui/cairo/bars.cs | 42 +++++++++++++++++------------------
src/gui/cairo/generic.cs | 3 +--
src/gui/cairo/jumpsRjFatigue.cs | 8 +++----
src/gui/cairo/jumpsWeightFVProfile.cs | 4 ++--
src/gui/cairo/radial.cs | 4 ++--
src/gui/cairo/runDoubleContacts.cs | 6 ++---
src/gui/cairo/util.cs | 2 +-
src/gui/cairo/xy.cs | 14 ++++++------
8 files changed, 41 insertions(+), 42 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index f1b436f65..25a59d913 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -84,7 +84,7 @@ public abstract class CairoBars : CairoGeneric
protected void drawGuides (Cairo.Color color)
{
- g.Color = color;
+ g.SetSourceColor(color);
double personMax = cairoBarsGuideManage.GetTipPersonMax();
double personAvg = cairoBarsGuideManage.GetTipPersonAvg();
@@ -202,32 +202,32 @@ public abstract class CairoBars : CairoGeneric
}
//print avg
- g.Color = red;
+ g.SetSourceColor(red);
Cairo.TextExtents te;
te = g.TextExtents(Util.TrimDecimals(avg,2));
if(ttp == textTickPos.ABOVETICK)
{
- g.Color = white;
+ g.SetSourceColor(white);
g.Rectangle(graphWidth - rightMargin +xStart +12 -te.Width/2 -1,
avgG -textHeight -1,
te.Width +2, te.Height+2);
g.Fill();
- g.Color = red;
+ g.SetSourceColor(red);
printText(graphWidth - rightMargin +xStart +12, avgG -textHeight/2, 0, textHeight -3,
Util.TrimDecimals(avg, 2),
g, alignTypes.CENTER);
}
else if(ttp == textTickPos.BELOWTICK)
{
- g.Color = white;
+ g.SetSourceColor(white);
g.Rectangle(graphWidth - rightMargin +xStart +12 -te.Width/2 -1,
avgG -1,
te.Width +2, te.Height+2);
g.Fill();
- g.Color = red;
+ g.SetSourceColor(red);
printText(graphWidth - rightMargin +xStart +12, avgG +textHeight/2, 0, textHeight -3,
Util.TrimDecimals(avg, 2),
g, alignTypes.CENTER);
@@ -564,15 +564,15 @@ public abstract class CairoBars : CairoGeneric
yStart = alto - te.Height;
if(textAboveBar)
- g.Color = white; //to just hide the horizontal grid
+ g.SetSourceColor(white); //to just hide the horizontal grid
else
- g.Color = yellow; //to have contrast with the bar
+ g.SetSourceColor(yellow); //to have contrast with the bar
g.Rectangle(x - te.Width/2 -1, yStart-1, te.Width +2, te.Height+2);
g.Fill();
//write text
- g.Color = black;
+ g.SetSourceColor(black);
printText(x, yStart+te.Height/2, 0, Convert.ToInt32(te.Height),
Util.TrimDecimals(result, decs), g, alignTypes.CENTER);
@@ -600,12 +600,12 @@ public abstract class CairoBars : CairoGeneric
messageTextHeight --;
} while (te.Width >= .9 * graphWidth && messageTextHeight >= 1);
- g.Color = yellow; //to have contrast with the bar
+ g.SetSourceColor(yellow); //to have contrast with the bar
g.Rectangle(graphWidth/2 -te.Width/2 -1, graphHeight/2 -messageTextHeight -1,
te.Width +2, te.Height+4);
g.Fill();
- g.Color = black;
+ g.SetSourceColor(black);
printText (graphWidth/2, graphHeight/2 -messageTextHeight/2,
0, messageTextHeight,
message, g, alignTypes.CENTER);
@@ -758,7 +758,7 @@ LogB.Information(string.Format("y: {0}, alto: {1}", y, graphHeight -y - bottomMa
if(cairoBarsGuideManage != null)
drawGuides(colorSerieA);
- g.Color = black;
+ g.SetSourceColor(black);
plotBars ();
writeTitleAtTop ();
@@ -855,10 +855,10 @@ public class CairoBarsNHSeries : CairoBars
double xStart = .5*graphWidth -.5*legendWidth;
//paint 1st box
- g.Color = colorSerieA;
+ g.SetSourceColor(colorSerieA);
g.Rectangle(xStart, topMargin -1.25*textHeight, boxWidth, boxWidth);
g.FillPreserve();
- g.Color = black;
+ g.SetSourceColor(black);
g.Stroke();
//write 1st variable
@@ -867,10 +867,10 @@ public class CairoBarsNHSeries : CairoBars
//paint 2nd box
xStart += serieAWidth + 2*boxWidth;
- g.Color = colorSerieB;
+ g.SetSourceColor(colorSerieB);
g.Rectangle(xStart, topMargin -1.25*textHeight, boxWidth, boxWidth);
g.FillPreserve();
- g.Color = black;
+ g.SetSourceColor(black);
g.Stroke();
//write 2nd variable
@@ -883,10 +883,10 @@ public class CairoBarsNHSeries : CairoBars
double xStart = .5*graphWidth -.5*rowWidth;
//paint 1st box
- g.Color = colorSerieA;
+ g.SetSourceColor(colorSerieA);
g.Rectangle(xStart, topMargin -1.25*textHeight, boxWidth, boxWidth);
g.FillPreserve();
- g.Color = black;
+ g.SetSourceColor(black);
g.Stroke();
//write 1st variable
@@ -898,10 +898,10 @@ public class CairoBarsNHSeries : CairoBars
xStart = .5*graphWidth -.5*rowWidth;
//paint 2nd box (1.25*textHeight below)
- g.Color = colorSerieB;
+ g.SetSourceColor(colorSerieB);
g.Rectangle(xStart, topMargin -1.25*textHeight +1.25*textHeight, boxWidth, boxWidth);
g.FillPreserve();
- g.Color = black;
+ g.SetSourceColor(black);
g.Stroke();
//write 2nd variable
@@ -1037,7 +1037,7 @@ public class CairoBarsNHSeries : CairoBars
if(cairoBarsGuideManage != null)
drawGuides(colorSerieB);
- g.Color = black;
+ g.SetSourceColor(black);
plotBars();
writeTitleAtTop ();
diff --git a/src/gui/cairo/generic.cs b/src/gui/cairo/generic.cs
index c580c41c4..6a0fe9c52 100644
--- a/src/gui/cairo/generic.cs
+++ b/src/gui/cairo/generic.cs
@@ -188,8 +188,7 @@ public abstract class CairoGeneric
ay -= spacement;
by += spacement;
}
- //g.SetSourceRGB(255,0,0);
- g.Color = color;
+ g.SetSourceColor(color);
// 2) write line (if it fits)
if(horiz && bx > ax || ! horiz && ay > by)
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index 2ce240be4..27e6796c4 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -88,12 +88,12 @@ public class JumpsRjFatigueGraph : CairoXY
paintGrid(gridTypes.VERTICALLINES, false);
paintAxis();
- g.Color = red;
+ g.SetSourceColor(red);
plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.TOUCH);
- //g.Color = black;
- g.Color = gray99;
+ //g.SetSourceColor(black);
+ g.SetSourceColor(gray99);
divideAndPlotAverage(divideIn);
- g.Color = black;
+ g.SetSourceColor(black);
plotRealPoints(PlotTypes.LINES);
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index cad7908b7..89a1deb41 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -190,7 +190,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
writeTextAtRight(ypos++, string.Format("- Profile (90ยบ): {0} %", Math.Round(fvprofile90,0)),
false);
writeTextAtRight(ypos++, string.Format("- Imbalance: {0} %", imbalance), false);
- g.Color = red;
+ g.SetSourceColor(red);
if(needDevelopForce)
writeTextAtRight(ypos++, "- " + Catalog.GetString("Need to develop force"), false);
else
@@ -208,7 +208,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
lineVertSpacing = .5;
}
- g.Color = bluePlots;
+ g.SetSourceColor(bluePlots);
writeTextAtRight(line, "Selected:", false);
g.SetSourceRGB(0, 0, 0);
diff --git a/src/gui/cairo/radial.cs b/src/gui/cairo/radial.cs
index dde1da5d9..c3fe928e4 100644
--- a/src/gui/cairo/radial.cs
+++ b/src/gui/cairo/radial.cs
@@ -81,7 +81,7 @@ public class CairoRadial : CairoGeneric
gray = colorFromRGB(99,99,99); //gray99
colorArrow = colorFromGdk(Config.ColorBackground);
- g.Color = black;
+ g.SetSourceColor(black);
minSide = graphWidth;
if(graphHeight < minSide)
minSide = graphHeight;
@@ -200,7 +200,7 @@ public class CairoRadial : CairoGeneric
margin + graphWidth/2 + (minSide/2) * .9 * Math.Cos(arc - Math.PI/2),
offsetV + margin + graphHeight/2 + (minSide/2) * .9 * Math.Sin(arc -
Math.PI/2));
- g.Color = color;
+ g.SetSourceColor(color);
g.Stroke();
}
diff --git a/src/gui/cairo/runDoubleContacts.cs b/src/gui/cairo/runDoubleContacts.cs
index 1d9d34154..7d3d35911 100644
--- a/src/gui/cairo/runDoubleContacts.cs
+++ b/src/gui/cairo/runDoubleContacts.cs
@@ -78,7 +78,7 @@ public class CairoRunDoubleContacts : CairoGeneric
black = colorFromRGB(0,0,0);
//gray = colorFromRGB(99,99,99); //gray99
- g.Color = black;
+ g.SetSourceColor(black);
}
public void GraphDo (
@@ -98,7 +98,7 @@ public class CairoRunDoubleContacts : CairoGeneric
double xEnd = rightMargin + (graphWidth - 2*rightMargin) *
(inPTL.tcEnd + negativePTLTime) / timeTotalWithExtraPTL;
- g.Color = colorBackground;
+ g.SetSourceColor(colorBackground);
g.Rectangle(xStart, 22, xEnd-xStart, 4);
g.Fill();
@@ -107,7 +107,7 @@ public class CairoRunDoubleContacts : CairoGeneric
if(inPTL.photocellEnd >= 0)
printText(xEnd, 30, 0, 10, inPTL.photocellEnd.ToString(), g,
alignTypes.CENTER);
- g.Color = black;
+ g.SetSourceColor(black);
//manage chunks indications
if(inPTL.phase == RunPhaseTimeListObject.Phases.START)
{
diff --git a/src/gui/cairo/util.cs b/src/gui/cairo/util.cs
index ca076f8ca..5e6e2f697 100644
--- a/src/gui/cairo/util.cs
+++ b/src/gui/cairo/util.cs
@@ -36,7 +36,7 @@ public static class CairoUtil
{
using (Cairo.Context g = Gdk.CairoHelper.Create (darea.GdkWindow))
{
- g.Color = color;
+ g.SetSourceColor(color);
g.MoveTo(x1, y1);
g.LineTo(x2, y2);
g.Stroke();
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index c168d25fa..9361c7839 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -448,7 +448,7 @@ public abstract class CairoXY : CairoGeneric
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 = colorBackground;
+ g.SetSourceColor(colorBackground);
g.FillPreserve();
g.SetSourceRGB(0, 0, 0);
g.Stroke (); //can this be done at the end?
@@ -483,7 +483,7 @@ public abstract class CairoXY : CairoGeneric
g.MoveTo(xgraph+8, ygraph);
g.Arc(xgraph, ygraph, 8.0, 0.0, 2.0 * Math.PI); //full circle
- g.Color = red;
+ g.SetSourceColor(red);
g.FillPreserve();
g.SetSourceRGB(0, 0, 0);
g.Stroke ();
@@ -534,11 +534,11 @@ public abstract class CairoXY : CairoGeneric
* This is not needed because graph is re-done at each mouse click
*
//rectangle to erase previous values
- g.Color = white;
+ g.SetSourceColor(white);
g.Rectangle(graphWidth + 1, Convert.ToInt32(graphHeight/2) + textHeight*2*line - textHeight,
area.Allocation.Width -1, textHeight*8);
g.Fill();
- g.Color = black;
+ g.SetSourceColor(black);
*/
// 2) exit if out of graph area
@@ -565,11 +565,11 @@ public abstract class CairoXY : CairoGeneric
LogB.Information("painting rectangle ...");
// 4) write text at right
// 5) paint rectangle around that point
- g.Color = bluePlots;
+ g.SetSourceColor(bluePlots);
g.Rectangle(calculatePaintX(pClosest.X) - 2*pointsRadius, calculatePaintY(pClosest.Y)
-2*pointsRadius,
4*pointsRadius, 4*pointsRadius);
g.Stroke();
- g.Color = black;
+ g.SetSourceColor(black);
LogB.Information("writeCoordinatesOfMouseClick done! disposing");
endGraphDisposing(g);
@@ -604,7 +604,7 @@ public abstract class CairoXY : CairoGeneric
protected virtual void writeSelectedValues(int line, PointF pClosest)
{
- g.Color = bluePlots;
+ g.SetSourceColor(bluePlots);
writeTextAtRight(line, Catalog.GetString("Selected") + ":", false);
g.SetSourceRGB(0, 0, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]