[chronojump] CairoBars encoder do not show grid/axis/white rectangle under resultOnBar
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] CairoBars encoder do not show grid/axis/white rectangle under resultOnBar
- Date: Wed, 23 Mar 2022 16:32:01 +0000 (UTC)
commit 2a6e4e36732ad83e649bd35236eb7c99a753a749
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Mar 23 17:31:25 2022 +0100
CairoBars encoder do not show grid/axis/white rectangle under resultOnBar
src/gui/cairo/bars.cs | 49 +++++++++++++++++++++++++++++++++----------------
src/gui/eventExecute.cs | 20 ++++++++++----------
2 files changed, 43 insertions(+), 26 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 73435d878..92ed581e4 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -34,6 +34,9 @@ public abstract class CairoBars : CairoGeneric
protected int marginForBottomNames;
protected string title;
protected bool clickable;
+ protected bool paintAxis;
+ protected bool paintGrid; //if paint grid, then paint a rectangle below resultOnBar (on encoder:
false)
+
//protected string jumpType;
//protected string runType;
protected string date;
@@ -342,7 +345,7 @@ public abstract class CairoBars : CairoGeneric
protected abstract void findMaximums(); //includes point and guides
- protected void paintAxis(int width)
+ protected void paintAxisDo (int width)
{
g.LineWidth = width;
g.MoveTo(leftMargin, topMargin);
@@ -697,14 +700,17 @@ public abstract class CairoBars : CairoGeneric
yStart = alto - te.Height;
*/
- if(textAboveBar)
- g.SetSourceColor(white); //to just hide the horizontal grid
- else
- g.SetSourceColor(yellow); //to have contrast with the bar
+ if(paintGrid)
+ {
+ if(textAboveBar)
+ g.SetSourceColor(white); //to just hide the horizontal grid
+ else
+ 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.Rectangle(x - te.Width/2, yStart, te.Width, te.Height);
- g.Fill();
+ //g.Rectangle(x - te.Width/2 -1, yStart-1, te.Width +2, te.Height+2);
+ g.Rectangle(x - te.Width/2, yStart, te.Width, te.Height);
+ g.Fill();
+ }
//write text
g.SetSourceColor(black);
@@ -763,7 +769,7 @@ public abstract class CairoBars : CairoGeneric
*/
//reccomended to 1st paint the grid, then the axis
- protected void paintGrid(gridTypes gridType, bool niceAutoValues)
+ protected void paintGridDo (gridTypes gridType, bool niceAutoValues)
{
if(minY == maxY)
return;
@@ -828,10 +834,12 @@ public class CairoBars1Series : CairoBars
}
//regular constructor
- public CairoBars1Series (DrawingArea area, bool clickable)
+ public CairoBars1Series (DrawingArea area, bool clickable, bool paintAxis, bool paintGrid)
{
this.area = area;
this.clickable = clickable;
+ this.paintAxis = paintAxis;
+ this.paintGrid = paintGrid;
this.colorSerieA = colorFromGdk(Config.ColorBackground); //but note if we are using system
colors, this will not match
}
@@ -915,8 +923,12 @@ public class CairoBars1Series : CairoBars
findMaximums();
g.SetFontSize(textHeight);
- paintAxis(2);
- paintGrid(gridTypes.HORIZONTALLINES, true);
+
+ if(paintAxis)
+ paintAxisDo (2);
+
+ if(paintGrid)
+ paintGridDo (gridTypes.HORIZONTALLINES, true);
//g.SetFontSize(textHeight);
if(cairoBarsGuideManage != null)
@@ -970,11 +982,13 @@ public class CairoBarsNHSeries : CairoBars
}
//regular constructor
- public CairoBarsNHSeries (DrawingArea area, bool showLegend, bool clickable)
+ public CairoBarsNHSeries (DrawingArea area, bool showLegend, bool clickable, bool paintAxis, bool
paintGrid)
{
this.area = area;
this.showLegend = showLegend;
this.clickable = clickable;
+ this.paintAxis = paintAxis;
+ this.paintGrid = paintGrid;
colorSerieA = colorFromGdk(UtilGtk.GetColorShifted(Config.ColorBackground,
! UtilGtk.ColorIsDark(Config.ColorBackground)));
@@ -1288,9 +1302,12 @@ public class CairoBarsNHSeries : CairoBars
findMaximums();
g.SetFontSize(textHeight);
- paintAxis(2);
- //paintAxis(2, textHeight -2);
- paintGrid(gridTypes.HORIZONTALLINES, true);
+
+ if(paintAxis)
+ paintAxisDo (2);
+
+ if(paintGrid)
+ paintGridDo (gridTypes.HORIZONTALLINES, true);
//g.SetFontSize(textHeight);
if(cairoBarsGuideManage != null)
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index b59f0f144..47ebe0a20 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, false);
+ cb = new CairoBarsNHSeries (darea, true, false, true, true);
else if (showBarA) //takeOff, takeOffWeight
- cb = new CairoBars1Series (darea, false);
+ cb = new CairoBars1Series (darea, false, true, true);
else //rest of the jumps: sj, cmj, ..
- cb = new CairoBars1Series (darea, false);
+ cb = new CairoBars1Series (darea, false, true, true);
if(UseHeights) {
cb.YVariable = Catalog.GetString("Height");
@@ -2679,7 +2679,7 @@ public class CairoPaintBarsPreJumpReactive : CairoPaintBarsPre
protected override void paintSpecific()
{
- cb = new CairoBarsNHSeries (darea, true, false);
+ cb = new CairoBarsNHSeries (darea, true, false, true, true);
cb.YVariable = Catalog.GetString("Time");
cb.YUnits = "s";
@@ -2809,7 +2809,7 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
protected override void paintSpecific()
{
- CairoBars1Series cb = new CairoBars1Series (darea, false);
+ CairoBars1Series cb = new CairoBars1Series (darea, false, true, true);
cb.YVariable = Catalog.GetString("Speed");
cb.YUnits = "m/s";
@@ -2910,7 +2910,7 @@ public class CairoPaintBarsPreRunInterval : CairoPaintBarsPre
protected override void paintSpecific()
{
- CairoBars1Series cb = new CairoBars1Series (darea, false);
+ CairoBars1Series cb = new CairoBars1Series (darea, false, true, true);
cb.YVariable = Catalog.GetString("Speed");
cb.YUnits = "m/s";
@@ -3065,7 +3065,7 @@ public class CairoPaintBarsPreJumpReactiveRealtimeCapture : CairoPaintBarsPre
if(tv_l.Count != tc_l.Count)
return;
- cb = new CairoBarsNHSeries (darea, true, false);
+ cb = new CairoBarsNHSeries (darea, true, false, true, true);
cb.YVariable = Catalog.GetString("Time");
cb.YUnits = "s";
@@ -3232,7 +3232,7 @@ public class CairoPaintBarsPreRunIntervalRealtimeCapture : CairoPaintBarsPre
//if(ifRSAstartRest)
// return;
- cb = new CairoBars1Series (darea, false);
+ cb = new CairoBars1Series (darea, false, true, true);
cb.YVariable = Catalog.GetString("Speed");
cb.YUnits = "m/s";
@@ -3765,9 +3765,9 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
private void paintSpecificDo ()
{
if(pegbe.eccon == "c")
- cb = new CairoBars1Series (darea, ! pegbe.capturing);
+ cb = new CairoBars1Series (darea, ! pegbe.capturing, false, false);
else
- cb = new CairoBarsNHSeries (darea, false, ! pegbe.capturing);
+ cb = new CairoBarsNHSeries (darea, false, ! pegbe.capturing, false, false);
//LogB.Information("data_l.Count: " + data_l.Count.ToString());
//cb.GraphInit(fontStr, true, false); //usePersonGuides, useGroupGuides
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]