[chronojump] EncoderBarsLimits -> RepetitionMouseLimits
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] EncoderBarsLimits -> RepetitionMouseLimits
- Date: Tue, 11 Feb 2020 17:14:53 +0000 (UTC)
commit 310f50e7d40e64b12da4be2ec62f76919c3d9e21
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Feb 11 11:13:26 2020 +0100
EncoderBarsLimits -> RepetitionMouseLimits
src/gui/encoderGraphObjects.cs | 41 +++++------------------------------------
src/gui/usefulObjects.cs | 32 ++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 36 deletions(-)
---
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index ec2b5d9d..9f5cdb44 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -55,7 +55,7 @@ public class EncoderGraphDoPlot
private ArrayList data; //data is related to mainVariable (barplot)
private ArrayList dataSecondary; //dataSecondary is related to secondary variable (by default range)
- private EncoderBarsLimits encoderBarsLimits;
+ private RepetitionMouseLimits encoderRepetitionMouseLimits;
Pango.Layout layout_encoder_capture_curves_bars;
Pango.Layout layout_encoder_capture_curves_bars_text; //e, c
@@ -161,7 +161,7 @@ public class EncoderGraphDoPlot
graphWidth = drawingarea.Allocation.Width;
graphHeight = drawingarea.Allocation.Height;
- encoderBarsLimits = new EncoderBarsLimits();
+ encoderRepetitionMouseLimits = new RepetitionMouseLimits();
fillDataVariables();
plot();
@@ -491,8 +491,6 @@ public class EncoderGraphDoPlot
pixmap.DrawRectangle(pen_colors_background_encoder_capture, true, rect);
}
- int encoderBarsLimitsCount = 0;
-
Gdk.Point dSecondaryPreviousPoint = new Gdk.Point(0,0);
bool iterOk = encoderCaptureListStore.GetIterFirst(out iter);
@@ -612,7 +610,7 @@ public class EncoderGraphDoPlot
rect = new Rectangle(dLeft, dTop, dWidth, dHeight);
pixmap.DrawRectangle(my_pen, true, rect);
- encoderBarsLimits.Add(encoderBarsLimitsCount ++, dLeft, dLeft + dWidth); //first rep
is 1
+ encoderRepetitionMouseLimits.Add(dLeft, dLeft + dWidth); //first rep is 1
//paint diagonal line to distinguish eccentric-concentric
//line is painted before the black outline to fix graphical problems
@@ -886,10 +884,10 @@ public class EncoderGraphDoPlot
public int FindBarInPixel (double pixel)
{
- if(encoderBarsLimits == null)
+ if(encoderRepetitionMouseLimits == null)
return -1;
- return encoderBarsLimits.FindBarInPixel(pixel);
+ return encoderRepetitionMouseLimits.FindBarInPixel(pixel);
}
public bool GraphPrepared {
@@ -927,32 +925,3 @@ public class EncoderBarsSecondaryLine
this.current = current;
}
}
-
-//to store the xStart and xEnd of every encoder capture reptition
-//in order to be saved or not on clicking screen
-//note every rep will be c or ec
-public class EncoderBarsLimits
-{
- private List<PointStartEnd> list;
-
- public EncoderBarsLimits()
- {
- list = new List<PointStartEnd>();
- }
-
- public void Add (int id, double start, double end)
- {
- PointStartEnd p = new PointStartEnd(id, start, end);
- list.Add(p);
- LogB.Information("Added: " + p.ToString());
- }
-
- public int FindBarInPixel (double pixel)
- {
- foreach(PointStartEnd p in list)
- if(pixel >= p.Start && pixel <= p.End)
- return p.Id;
-
- return -1;
- }
-}
diff --git a/src/gui/usefulObjects.cs b/src/gui/usefulObjects.cs
index d4235bf6..fa37e6e2 100644
--- a/src/gui/usefulObjects.cs
+++ b/src/gui/usefulObjects.cs
@@ -22,6 +22,7 @@ using System;
using System.Data;
using Gtk;
using System.Collections; //ArrayList
+using System.Collections.Generic; //List<T>
//this file has classes to allow to pass gui objectes easily
public class ExecutingGraphData
@@ -428,3 +429,34 @@ public class MovingBar
~MovingBar() {}
}
+
+//to store the xStart and xEnd of every encoder or forceSensor capture reptition
+//in order to be saved or not on clicking screen
+//note every rep will be c or ec
+public class RepetitionMouseLimits
+{
+ private List<PointStartEnd> list;
+ private int current;
+
+ public RepetitionMouseLimits()
+ {
+ list = new List<PointStartEnd>();
+ current = 0;
+ }
+
+ public void Add (double start, double end)
+ {
+ PointStartEnd p = new PointStartEnd(current ++, start, end);
+ list.Add(p);
+ LogB.Information("Added: " + p.ToString());
+ }
+
+ public int FindBarInPixel (double pixel)
+ {
+ foreach(PointStartEnd p in list)
+ if(pixel >= p.Start && pixel <= p.End)
+ return p.Id;
+
+ return -1;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]