[chronojump] Encoder capture treeview with checkboxes (100%)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder capture treeview with checkboxes (100%)
- Date: Mon, 12 May 2014 14:55:47 +0000 (UTC)
commit a8c2356fa3f2934381ac8efc4797e95459d7ab63
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 12 16:55:05 2014 +0200
Encoder capture treeview with checkboxes (100%)
src/gui/encoder.cs | 37 +++++++++++++++----------
src/gui/encoderTreeviews.cs | 63 +-----------------------------------------
2 files changed, 24 insertions(+), 76 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 6192628..82e1ffe 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1491,13 +1491,26 @@ public partial class ChronoJumpWindow
void on_button_encoder_save_clicked (object o, EventArgs args)
{
- /*
- int selectedID = treeviewEncoderCaptureCurvesEventSelectedID();
- label_encoder_save_curve.Text = encoderSaveSignalOrCurve("curve", selectedID);
+ int i = 1;
+ TreeIter iter;
+ bool iterOk = encoderCaptureListStore.GetIterFirst(out iter);
+ while(iterOk) {
+ //checked?
+ if(((EncoderCurve) encoderCaptureListStore.GetValue (iter, 0)).Record)
+ label_encoder_save_curve.Text = encoderSaveSignalOrCurve("curve", i);
+
+ i ++;
+ iterOk = encoderCaptureListStore.IterNext (ref iter);
+ //if is not "c", then there are two rows, but pass only the uneven rows (spanish:
"impar")
+ //then if IsEven (par), do not use it, use the next
+ if(iterOk && ecconLast != "c" && Util.IsEven(i)) {
+ i ++;
+ iterOk = encoderCaptureListStore.IterNext (ref iter);
+ }
+ }
+
updateUserCurvesLabelsAndCombo();
- */
- label_encoder_save_curve.Text = "disabled";
}
private int getActiveCurvesNum(ArrayList curvesArray) {
@@ -1549,22 +1562,16 @@ public partial class ChronoJumpWindow
string encoderSaveSignalOrCurve (string mode, int selectedID)
{
//mode is different than type.
- //mode can be curve, allCurves or signal
+ //mode can be curve or signal
//type is to print on db at type column: curve or signal + (bar or jump)
string signalOrCurve = "";
string feedback = "";
string fileSaved = "";
string path = "";
-
+
if(mode == "curve") {
signalOrCurve = "curve";
- decimal curveNum = (decimal) treeviewEncoderCaptureCurvesEventSelectedID(); //on c
and ec: 1,2,3,4,...
- if(ecconLast != "c")
- curveNum = decimal.Truncate((curveNum +1) /2); //1,1,2,2,...
- feedback = string.Format(Catalog.GetString("Curve {0} saved"), curveNum);
- } else if(mode == "allCurves") {
- signalOrCurve = "curve";
- feedback = Catalog.GetString("All curves saved");
+ feedback = Catalog.GetString("Saved");
} else { //mode == "signal"
signalOrCurve = "signal";
@@ -1575,7 +1582,7 @@ public partial class ChronoJumpWindow
}
string desc = "";
- if(mode == "curve" || mode == "allCurves") {
+ if(mode == "curve") {
EncoderCurve curve = treeviewEncoderCaptureCurvesGetCurve(selectedID,true);
//some start at ,5 because of the spline filtering
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index 50c0cf9..cb708a7 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -236,6 +236,8 @@ public partial class ChronoJumpWindow
}
void combo_encoder_capture_show_save_curve_button () {
+ label_encoder_save_curve.Text = "";
+
TreeIter iter;
bool iterOk = encoderCaptureListStore.GetIterFirst(out iter);
while(iterOk) {
@@ -970,67 +972,6 @@ public partial class ChronoJumpWindow
return curve;
}
- private int treeviewEncoderCaptureCurvesEventSelectedID() {
- TreeIter iter = new TreeIter();
- TreeModel myModel = treeview_encoder_capture_curves.Model;
-
- if(ecconLast == "c") {
- if (treeview_encoder_capture_curves.Selection.GetSelected (out myModel, out iter))
- return Convert.ToInt32(((EncoderCurve)
(treeview_encoder_capture_curves.Model.GetValue (iter, 0))).N); //this return an int, also in ec
- } else {
- int selectedLength =
treeview_encoder_capture_curves.Selection.GetSelectedRows().Length;
- if(selectedLength == 1 || selectedLength == 2) {
- TreePath path =
treeview_encoder_capture_curves.Selection.GetSelectedRows()[0];
- myModel.GetIter(out iter, path);
- return Convert.ToInt32(((EncoderCurve)
(treeview_encoder_capture_curves.Model.GetValue (iter, 0))).N);
- }
- }
- return 0;
- }
-
-/*
- private void on_treeview_encoder_capture_curves_cursor_changed (object o, EventArgs args)
- {
- int lineNum = treeviewEncoderCaptureCurvesEventSelectedID();
- encoderButtonsSensitive(encoderSensEnum.DONENOSIGNAL);
-
- //on ecc-con select both lines
- if(ecconLast == "c") {
- if (lineNum > 0)
- encoderButtonsSensitive(encoderSensEnum.SELECTEDCURVE);
- } else {
- TreeIter iter = new TreeIter();
-
- treeview_encoder_capture_curves.CursorChanged -=
on_treeview_encoder_capture_curves_cursor_changed;
-
- if (treeview_encoder_capture_curves.Selection.GetSelectedRows().Length == 1)
- {
- treeview_encoder_capture_curves.Selection.UnselectAll();
-
- //on even, select also previous row
- //on odd, select also next row
- treeview_encoder_capture_curves.Model.GetIterFirst ( out iter ) ;
- bool isEven = (lineNum % 2 == 0); //check if it's even (in spanish "par")
- int start = lineNum;
- if(isEven)
- start = lineNum-1;
-
- //select 1st row
- for(int i=1; i < start; i++)
- treeview_encoder_capture_curves.Model.IterNext (ref iter);
- treeview_encoder_capture_curves.Selection.SelectIter(iter);
-
- //select 2nd row
- treeview_encoder_capture_curves.Model.IterNext (ref iter);
- treeview_encoder_capture_curves.Selection.SelectIter(iter);
-
- if (treeview_encoder_capture_curves.Selection.GetSelectedRows().Length == 2)
- encoderButtonsSensitive(encoderSensEnum.SELECTEDCURVE);
- }
- treeview_encoder_capture_curves.CursorChanged +=
on_treeview_encoder_capture_curves_cursor_changed;
- }
- }
- */
// ---------helpful methods -----------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]