[chronojump] Encoder: ec save-all saves curves correctly
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: ec save-all saves curves correctly
- Date: Tue, 12 Feb 2013 18:40:08 +0000 (UTC)
commit f357d30814f89816a85385b8e9ae502decf00306
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Feb 12 19:39:35 2013 +0100
Encoder: ec save-all saves curves correctly
src/gui/encoder.cs | 6 ++++--
src/util.cs | 7 +++++++
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 5ffd544..d7c1ef8 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -300,6 +300,7 @@ public partial class ChronoJumpWindow
//this is called by non gtk thread. Don't do gtk stuff here
//I suppose reading gtk is ok, changing will be the problem
+ //called on capture, recalculate and load
private void encoderCreateCurvesGraphR()
{
string analysisOptions = "-";
@@ -660,7 +661,8 @@ public partial class ChronoJumpWindow
encoder_pulsebar_capture.Text = encoderSaveSignalOrCurve("curve", selectedID);
} else if(button == button_encoder_save_all_curves)
for(int i=1; i <= UtilGtk.CountRows(encoderListStore); i++)
- encoder_pulsebar_capture.Text = encoderSaveSignalOrCurve("allCurves", i);
+ if(! Util.IsEven(i)) //use only uneven (spanish: "impar") values
+ encoder_pulsebar_capture.Text = encoderSaveSignalOrCurve("allCurves", i);
ArrayList data = SqliteEncoder.Select(false, -1,
currentPerson.UniqueID, currentSession.UniqueID, "curve");
@@ -1496,7 +1498,7 @@ public partial class ChronoJumpWindow
String.Format(UtilGtk.TVNumPrint(curve.N,1,0),Convert.ToInt32(curve.N));
else {
string phase = "e";
- bool isEven = (Convert.ToInt32(curve.N) % 2 == 0); //check if it's even (in spanish "par")
+ bool isEven = Util.IsEven(Convert.ToInt32(curve.N));
if(isEven)
phase = "c";
diff --git a/src/util.cs b/src/util.cs
index 148e16d..a72c6f6 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -668,6 +668,13 @@ public class Util
return true;
}
+ public static bool IsEven(string myString) {
+ return IsEven(Convert.ToInt32(myString));
+ }
+ public static bool IsEven(int myInt) {
+ return (myInt % 2 == 0); //check if it's even (in spanish "par")
+ }
+
//Adapted from Mono. A developer's notebook. p 244
//this is used in chronojump for working with the ports,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]