[chronojump] encoder set graph: work on header outside main variable
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder set graph: work on header outside main variable
- Date: Fri, 2 Oct 2020 14:07:30 +0000 (UTC)
commit 8b159b8fb47015fdb5fc7eea4d7bf8662f982ee9
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Oct 2 16:07:02 2020 +0200
encoder set graph: work on header outside main variable
src/gui/encoderGraphObjects.cs | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index 9e194e55..d4710c4c 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -915,13 +915,6 @@ public class EncoderGraphDoPlot
Util.TrimDecimals( (sumSaved / countSaved), decimals) +
" " + units;
- //work
- title += "; " + Catalog.GetString("Work") + ": " + Util.TrimDecimals(workTotal, decimals);
- if(preferences.encoderWorkKcal)
- title += " Kcal";
- else
- title += " J";
-
string lossString = "";
//do not show lossString on Preferences.EncoderPhasesEnum.ECC
@@ -940,14 +933,23 @@ public class EncoderGraphDoPlot
}
}
+ //work
+ string workString = "] " + Catalog.GetString("Work") + ": " + Util.TrimDecimals(workTotal,
decimals);
+ if(preferences.encoderWorkKcal)
+ workString += " Kcal";
+ else
+ workString += " J";
+
//have title and titleFull to be able to position all perfectly but having two pens (colors)
- string titleFull = title + lossString + "]";
+ string titleFull = title + lossString + workString;
+
// 1) get the width of titleFull, title, lossString
textHeight = 1;
int titleFullWidth = 1;
int titleWidth = 1;
int lossStringWidth = 1;
+ int workStringWidth = 1;
layout_encoder_capture_curves_bars_text.SetMarkup(titleFull);
layout_encoder_capture_curves_bars_text.GetPixelSize(out titleFullWidth, out textHeight);
@@ -979,6 +981,7 @@ public class EncoderGraphDoPlot
layout_encoder_capture_curves_bars_text.GetPixelSize(out titleWidth, out textHeight);
layout_encoder_capture_curves_bars_text.SetMarkup(lossString);
layout_encoder_capture_curves_bars_text.GetPixelSize(out lossStringWidth, out textHeight);
+ layout_encoder_capture_curves_bars_text.GetPixelSize(out workStringWidth, out textHeight);
// 3) paint only title text (with black pen)
layout_encoder_capture_curves_bars_text.SetMarkup(title);
@@ -992,8 +995,8 @@ public class EncoderGraphDoPlot
Convert.ToInt32( (graphWidth/2) - titleFullWidth/2 + titleWidth), 0, //x, y
layout_encoder_capture_curves_bars_text);
- // 5) paint the "]";
- layout_encoder_capture_curves_bars_text.SetMarkup("]");
+ // 5) paint workString;
+ layout_encoder_capture_curves_bars_text.SetMarkup(workString);
pixmap.DrawLayout (pen_black_encoder_capture,
Convert.ToInt32( (graphWidth/2) - titleFullWidth/2 + titleWidth +
lossStringWidth), 0, //x, y
layout_encoder_capture_curves_bars_text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]