[chronojump/FS-TFT-Menu] Code clean
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/FS-TFT-Menu] Code clean
- Date: Wed, 20 Apr 2022 11:59:24 +0000 (UTC)
commit 9b5022912248d625bac1f091985db1d9d1212072
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Apr 8 18:28:34 2022 +0200
Code clean
src/gui/cairo/bars.cs | 12 +++++-------
src/gui/eventExecute.cs | 22 ++++++++--------------
2 files changed, 13 insertions(+), 21 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 64bb800f2..f3ed143c0 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -858,15 +858,13 @@ public abstract class CairoBars : CairoGeneric
protected void writeTitleAtTop()
{
if(encoderTitle)
- {
writeTitleAtTopEncoder ();
- return;
- }
-
- printText(graphWidth/2 + leftMargin, textHeight/2, 0, textHeight+2,
- titleStr, g, alignTypes.CENTER);
+ else
+ printText(graphWidth/2 + leftMargin, textHeight/2, 0, textHeight+2,
+ titleStr, g, alignTypes.CENTER);
}
+ int titleTextHeight;
protected void writeTitleAtTopEncoder()
{
g.Save();
@@ -875,7 +873,7 @@ public abstract class CairoBars : CairoGeneric
string titleFull = titleStr + lossStr + workStr + impulseStr;
// 1) get the titleTextHeight for titleFull
- int titleTextHeight = textHeight +2;
+ titleTextHeight = textHeight +2;
g.SetFontSize(titleTextHeight);
g.SelectFontFace(font, Cairo.FontSlant.Normal, Cairo.FontWeight.Bold);
Cairo.TextExtents te = g.TextExtents(titleFull);
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index ddf1695d4..26ed8cb04 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -3448,8 +3448,8 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
initialize (darea, fontStr, mode, personName, testName, pDN);
//calcule all graph stuff
- fillDataVariables1 ();
- fillDataVariables2 ();
+ fillArraysDiscardingReps ();
+ fillVariableListsForGraph ();
prepareTitle ();
prepareLossArrow ();
}
@@ -3487,7 +3487,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
pegbe.showNRepetitions = preferences.encoderCaptureShowNRepetitions;
}
- private void fillDataVariables1 () //copied from gui/encoderGraphObjects fillDataVariables()
+ private void fillArraysDiscardingReps () //copied from gui/encoderGraphObjects fillDataVariables()
{
data = new ArrayList (pegbe.data9Variables.Count); //data is related to mainVariable (barplot)
lineData_l = new List<double>(); //lineData_l is related to secondary variable (by default
range)
@@ -3556,7 +3556,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
}
}
- private void fillDataVariables2 ()
+ private void fillVariableListsForGraph ()
{
barA_l = new List<PointF>(); //data is related to mainVariable (barplot)
barB_l = new List<PointF>(); //data is related to mainVariable (barplot)
@@ -3854,7 +3854,7 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
private void prepareTitle ()
{
- string units = "";
+ units = "";
int decimals;
if(pegbe.mainVariable == Constants.MeanSpeed || pegbe.mainVariable == Constants.MaxSpeed) {
units = "m/s";
@@ -3933,19 +3933,13 @@ public class CairoPaintBarplotPreEncoder : CairoPaintBarsPre
//cb.GraphInit(fontStr, true, false); //usePersonGuides, useGroupGuides
cb.GraphInit(fontStr, false, false); //usePersonGuides, useGroupGuides
- string units = "";
int decs;
- if(pegbe.mainVariable == Constants.MeanSpeed || pegbe.mainVariable == Constants.MaxSpeed) {
- units = "m/s";
+ if(pegbe.mainVariable == Constants.MeanSpeed || pegbe.mainVariable == Constants.MaxSpeed)
decs = 2;
- } else if(pegbe.mainVariable == Constants.MeanForce || pegbe.mainVariable ==
Constants.MaxForce) {
- units = "N";
+ else if(pegbe.mainVariable == Constants.MeanForce || pegbe.mainVariable == Constants.MaxForce)
decs = 0;
- }
- else { //powers
- units = "W";
+ else //powers
decs = 0;
- }
cb.Decs = decs;
if(cairoBarsArrow != null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]