[chronojump] Encoder sensitivity done. graph.R [()]



commit 7513e865f2aa8511d8b654f66f6e6f46857a5288
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jun 3 11:47:52 2012 +0200

    Encoder sensitivity done. graph.R [()]

 encoder/graph.R        |   38 +++++++------
 glade/chronojump.glade |   41 ++++++++++++-
 src/gui/chronojump.cs  |   37 ++++++------
 src/gui/encoder.cs     |  148 +++++++++++++++++++++++++++++++++++++-----------
 4 files changed, 192 insertions(+), 72 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 0e047ce..fd482d5 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -71,7 +71,7 @@ findCurves <- function(rawdata, eccon, min_height, draw) {
 					end[row]   = mean(which(a[tempStart:tempEnd] == bottom) + tempStart)
 					startH[row] = a[b$maxindex[i,1]]		#height at start
 					row=row+1
-					start[row] = end[row-1] + 1
+					start[row] = end[(row-1)] + 1
 					end[row]   = tempEnd
 					startH[row] = a[start[row]]		#height at start
 					row=row+1
@@ -253,12 +253,12 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
 		#maybe data has not started, then look what happens 2 ms later
 		for(i in crossSpeedInMiddle) {
 			if(i>2) {
-				if(speed$y[i-2]<0) {
+				if(speed$y[(i-2)]<0) {
 					crossDownToUp[count]=i
 					count=count+1
 				}
 			} else {
-				if(speed$y[i+2]>0) {
+				if(speed$y[(i+2)]>0) {
 					crossDownToUp[count]=i
 					count=count+1
 				}
@@ -388,7 +388,7 @@ paintPowerPeakPowerBars <- function(paf, myEccons) {
 			}
 		} else {
 			myEc=c("c","e")
-			myNums = paste(trunc((myNums+1)/2),myEc[(myNums%%2)+1],sep="")
+			myNums = paste(trunc((myNums+1)/2),myEc[((myNums%%2)+1)],sep="")
 		}
 	}
 
@@ -525,27 +525,31 @@ if(length(args) < 3) {
 					if(j == 1) {
 						dataTempPhase=dataTempFile[1:changePos]
 					} else {
+						#IMP: 
+						#note that following line without the parentheses on changePos+1
+						#gives different data.
+						#never forget parentheses to operate inside the brackets
 						dataTempPhase=dataTempFile[(changePos+1):length(dataTempFile)]
 						newLines=newLines+1
 					}
 				}
 				rawdata = c(rawdata, dataTempPhase)
-				start[i+newLines] = count
-				end[i+newLines] = length(dataTempPhase) + count -1
-				startH[i+newLines] = 0
-				exerciseName[i+newLines] = as.vector(inputMultiData$exerciseName[i])
-				mass[i+newLines] = inputMultiData$mass[i]
-				smooth[i+newLines] = inputMultiData$smoothingOne[i]
-				dateTime[i+newLines] = as.vector(inputMultiData$dateTime[i])
+				start[(i+newLines)] = count
+				end[(i+newLines)] = length(dataTempPhase) + count -1
+				startH[(i+newLines)] = 0
+				exerciseName[(i+newLines)] = as.vector(inputMultiData$exerciseName[i])
+				mass[(i+newLines)] = inputMultiData$mass[i]
+				smooth[(i+newLines)] = inputMultiData$smoothingOne[i]
+				dateTime[(i+newLines)] = as.vector(inputMultiData$dateTime[i])
 
 				#myEccon[i+newLines] = as.vector(inputMultiData$eccon[i])
 				if(processTimes == 2 & j == 1) 
-					myEccon[i+newLines] = "e"
+					myEccon[(i+newLines)] = "e"
 				else {
 					if(inputMultiData$eccon[i] == "c")
-						myEccon[i+newLines] = "c"
+						myEccon[(i+newLines)] = "c"
 					else
-						myEccon[i+newLines] = "ec"
+						myEccon[(i+newLines)] = "ec"
 				}
 
 				count = count + length(dataTempPhase)
@@ -570,7 +574,7 @@ if(length(args) < 3) {
 		rawdata.cumsum=cumsum(rawdata)
 	
 		curves=findCurves(rawdata, eccon, minHeight, curvesPlot)
-		#print(curves)
+		print(curves)
 		n=length(curves[,1])
 
 		for(i in 1:n) { 
@@ -584,7 +588,7 @@ if(length(args) < 3) {
 				adjVert = 0
 				if(eccon=="ecS") {
 					myEc=c("c","e")
-					myLabel = paste(trunc((i+1)/2),myEc[(i%%2)+1],sep="")
+					myLabel = paste(trunc((i+1)/2),myEc[((i%%2)+1)],sep="")
 					myY = rawdata.cumsum[curves[i,1]]/10
 					if(i%%2 == 1) {
 						adjVert = 1
@@ -596,7 +600,7 @@ if(length(args) < 3) {
 			}
 		}
 
-		#print(curves)
+		print(curves)
 	}
 
 	if(analysis=="single") {
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 5cf3573..33c9f2c 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -24048,7 +24048,7 @@ Evaluator can use real name or nickname.</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" translatable="yes">Add new exercise</property>
+                                                            <property name="tooltip" translatable="yes">Show description of this exercise</property>
                                                             <signal name="clicked" handler="on_button_encoder_exercise_info_clicked"/>
                                                             <child>
                                                             <widget class="GtkImage" id="image4">
@@ -24720,6 +24720,42 @@ Evaluator can use real name or nickname.</property>
                                                           </packing>
                                                         </child>
                                                         <child>
+                                                          <widget class="GtkHBox" id="hbox_encoder_user_curves_num">
+                                                            <property name="visible">True</property>
+                                                            <property name="sensitive">False</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label76">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes">(</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label_encoder_user_curves_num">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes">0</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label80">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes">)</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
                                                           <widget class="GtkButton" id="button_encoder_analyze_data_show_user_curves">
                                                             <property name="label" translatable="yes">Show</property>
                                                             <property name="visible">True</property>
@@ -24729,7 +24765,7 @@ Evaluator can use real name or nickname.</property>
                                                             <signal name="clicked" handler="on_button_encoder_analyze_data_show_user_curves_clicked"/>
                                                           </widget>
                                                           <packing>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                           </packing>
                                                         </child>
                                                       </widget>
@@ -24890,7 +24926,6 @@ Evaluator can use real name or nickname.</property>
                                                         <child>
                                                           <widget class="GtkHBox" id="hbox_encoder_analyze_eccon">
                                                             <property name="visible">True</property>
-                                                            <property name="sensitive">True</property>
                                                             <property name="spacing">8</property>
                                                             <child>
                                                             <widget class="GtkRadioButton" id="radiobutton_encoder_eccon_together">
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 2e36339..546399a 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1006,6 +1006,7 @@ public partial class ChronoJumpWindow
 			currentPersonSession = SqlitePersonSession.Select(Convert.ToInt32(selectedID), currentSession.UniqueID);
 			label_current_person.Text = "<b>" + currentPerson.Name + "</b>"; 
 			label_current_person.UseMarkup = true; 
+		
 			return true;
 		} else {
 			return false;
@@ -1030,6 +1031,8 @@ public partial class ChronoJumpWindow
 			currentPersonSession = SqlitePersonSession.Select(Convert.ToInt32(selectedID), currentSession.UniqueID);
 			label_current_person.Text = "<b>" + currentPerson.Name + "</b>"; 
 			label_current_person.UseMarkup = true; 
+		
+			encoderPersonChanged();
 		}
 	}
 
@@ -4981,7 +4984,7 @@ Console.WriteLine("X");
 				extra_window_multichronopic_can_do(false);
 		} else {
 			button_execute_test.Sensitive = myTreeViewPersons.IsThereAnyRecord();
-			button_encoder_capture.Sensitive = myTreeViewPersons.IsThereAnyRecord();
+			//button_encoder_capture.Sensitive = myTreeViewPersons.IsThereAnyRecord();
 		}
 
 		stats_win_change_test_type(notebook_execute.CurrentPage);
@@ -5105,9 +5108,9 @@ Console.WriteLine("X");
 		hbox_this_test_buttons.Sensitive = false;
 		hbox_execute_test.Sensitive = false;
 		button_execute_test.Sensitive = false;
-		button_encoder_capture.Sensitive = false;
-		button_encoder_recalculate.Sensitive = false;
-		button_encoder_load_signal.Sensitive = false;
+
+		encoderButtonsSensitive(encoderSensEnum.NOSESSION);
+		
 		eventExecuteHideAllTables();
 	}
 	
@@ -5131,9 +5134,9 @@ Console.WriteLine("X");
 		hbox_jumps.Sensitive = false;
 		hbox_jumps_rj.Sensitive = false;
 		button_execute_test.Sensitive = false;
-		button_encoder_capture.Sensitive = false;
-		button_encoder_recalculate.Sensitive = false;
-		button_encoder_load_signal.Sensitive = false;
+		
+		encoderButtonsSensitive(encoderSensEnum.NOPERSON);
+		encoderPersonChanged();
 
 		notebook_execute.Sensitive = false;
 		notebook_results.Sensitive = false;
@@ -5148,9 +5151,9 @@ Console.WriteLine("X");
 		hbox_jumps.Sensitive = true;
 		hbox_jumps_rj.Sensitive = true;
 		button_execute_test.Sensitive = true;
-		button_encoder_capture.Sensitive = true;
-		button_encoder_recalculate.Sensitive = true;
-		button_encoder_load_signal.Sensitive = true;
+
+		encoderButtonsSensitive(encoderSensEnum.YESPERSON);
+		encoderPersonChanged();
 
 		notebook_execute.Sensitive = true;
 		notebook_results.Sensitive = true;
@@ -5169,8 +5172,6 @@ Console.WriteLine("X");
 		combo_pulses.Sensitive = true;
 		
 		hbox_execute_test.Sensitive = true;
-
-		button_encoder_analyze.Sensitive = radiobutton_encoder_analyze_data_user_curves.Active;
 	}
 	
 	private void sensitiveGuiYesEvent () {
@@ -5183,9 +5184,9 @@ Console.WriteLine("X");
 		frame_persons.Sensitive = false;
 		
 		button_execute_test.Sensitive = false;
-		button_encoder_capture.Sensitive = false;
-		button_encoder_recalculate.Sensitive = false;
-		button_encoder_load_signal.Sensitive = false;
+
+		encoderButtonsSensitive(encoderSensEnum.PROCESSING);
+		
 		//hbox
 		hbox_jumps.Sensitive = false;
 		hbox_jumps_rj.Sensitive = false;
@@ -5209,9 +5210,9 @@ Console.WriteLine("X");
 		frame_persons.Sensitive = true;
 
 		button_execute_test.Sensitive = true;
-		button_encoder_capture.Sensitive = true;
-		button_encoder_recalculate.Sensitive = true;
-		button_encoder_load_signal.Sensitive = true;
+		
+		encoderButtonsSensitive(encoderSensEnum.DONENOSIGNAL);
+
 		//hbox
 		hbox_jumps.Sensitive = true;
 		hbox_jumps_rj.Sensitive = true;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 0c21a2e..e2e134f 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -61,6 +61,8 @@ public partial class ChronoJumpWindow
 	[Widget] Gtk.Button button_encoder_analyze;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_current_signal;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_user_curves;
+	[Widget] Gtk.Box hbox_encoder_user_curves_num;
+	[Widget] Gtk.Label label_encoder_user_curves_num;
 	[Widget] Gtk.Button button_encoder_analyze_data_show_user_curves;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_powerbars;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_single;
@@ -88,12 +90,13 @@ public partial class ChronoJumpWindow
 	private string encoderTimeStamp;
 	private string encoderSignalUniqueID;
 	enum encoderModes { CAPTURE, ANALYZE }
+	enum encoderSensEnum { 
+		NOSESSION, NOPERSON, YESPERSON, PROCESSING, DONENOSIGNAL, DONEYESSIGNAL, SELECTEDCURVE }
+
 	
 	//TODO: auto close capturing window
 
 	//TODO: Put person name in graph (at title,with small separation, or inside graph at topright) (if we click on another person on treeview person, we need to know wich person was last generated graph)
-	//TODO: when change person: unsensitive: recalculate, capture graph, treeview capture, buttons caputre on bottom, analyze button
-	//TODO: when selected user curves, Single curve spinbutton have to grow (done). Also do it if person changes (pending)
 	//TODO: laterality have to be shown on treeviews: signal and curve. also check that is correct in database
 
 	//TODO: put chronopic detection in a generic place. Done But:
@@ -107,6 +110,7 @@ public partial class ChronoJumpWindow
 	//TODO: powerbars with checkbox to show1 param, 2 or three
 	//TODO: on capture (quasi-realtime), show powerbars or curves or both
 	//
+	//TODO: exercises info, exercises add
 
 	
 	private void encoderInitializeStuff() {
@@ -115,11 +119,11 @@ public partial class ChronoJumpWindow
 		encoder_pulsebar_analyze.Fraction = 1;
 		encoder_pulsebar_analyze.Text = "";
 		
+		encoderListStore = new Gtk.ListStore (typeof (EncoderCurve));
+
 		//the glade cursor_changed does not work on mono 1.2.5 windows
 		treeview_encoder_curves.CursorChanged += on_treeview_encoder_curves_cursor_changed; 
-		sensitiveEncoderRowButtons(false);
 		createEncoderCombos();
-		sensitiveEncoderGlobalButtons(false);
 		spin_encoder_analyze_curve_num.SetRange(1,1);
 	}
 
@@ -203,20 +207,19 @@ public partial class ChronoJumpWindow
 	{
 		string contents = Util.ReadFile(Util.GetEncoderCurvesTempFileName());
 		if (contents == null) {
-			//TODO: no data: make some of the gui unsensitive ??
-			sensitiveEncoderGlobalButtons(false);
+			encoderButtonsSensitive(encoderSensEnum.DONENOSIGNAL);
 		} else {
-			removeColumns();
+			treeviewEncoderRemoveColumns();
 			int curvesNum = createTreeViewEncoder(contents);
 			if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
 					encoderEcconTranslation) != "Concentric") 
 				curvesNum = curvesNum / 2;
 			spin_encoder_analyze_curve_num.SetRange(1,curvesNum);
-			sensitiveEncoderGlobalButtons(true);
+			encoderButtonsSensitive(encoderSensEnum.DONEYESSIGNAL);
 		}
 	}
 	
-	private void removeColumns() {
+	private void treeviewEncoderRemoveColumns() {
 		Gtk.TreeViewColumn [] myColumns = treeview_encoder_curves.Columns;
 		foreach (Gtk.TreeViewColumn column in myColumns) 
 			treeview_encoder_curves.RemoveColumn (column);
@@ -566,15 +569,16 @@ public partial class ChronoJumpWindow
 	private void on_radiobutton_encoder_analyze_data_current_signal_toggled (object obj, EventArgs args) {
 		button_encoder_analyze.Sensitive = encoderTimeStamp != null;
 		button_encoder_analyze_data_show_user_curves.Sensitive = false;
+		hbox_encoder_user_curves_num.Sensitive = false;
 
 		spin_encoder_analyze_curve_num.SetRange(1, UtilGtk.CountRows(encoderListStore));
 	}
 	private void on_radiobutton_encoder_analyze_data_user_curves_toggled (object obj, EventArgs args) {
-		button_encoder_analyze.Sensitive = currentPerson != null;
+		button_encoder_analyze.Sensitive = (currentPerson != null && Convert.ToInt32(label_encoder_user_curves_num.Text) >0);
 		button_encoder_analyze_data_show_user_curves.Sensitive = currentPerson != null;
+		hbox_encoder_user_curves_num.Sensitive = currentPerson != null;
 		
-		ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve");
-		spin_encoder_analyze_curve_num.SetRange(1, data.Count);
+		spin_encoder_analyze_curve_num.SetRange(1, Convert.ToInt32(label_encoder_user_curves_num.Text));
 	}
 
 	//show curve_num only on simple and superpose
@@ -606,12 +610,9 @@ public partial class ChronoJumpWindow
 	private void on_radiobutton_encoder_analyze_powerbars_toggled (object obj, EventArgs args) {
 		spin_encoder_analyze_curve_num.Sensitive=false;
 		encoderAnalysis="powerBars";
-		//can select together or separated
-		//if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
-		//			encoderEcconTranslation) != "Concentric") {
-			label_encoder_analyze_eccon.Sensitive=true;
-			hbox_encoder_analyze_eccon.Sensitive=true;
-		//}
+			
+		label_encoder_analyze_eccon.Sensitive=true;
+		hbox_encoder_analyze_eccon.Sensitive=true;
 	}
 
 	private string findMass(bool includePerson) {
@@ -759,7 +760,6 @@ public partial class ChronoJumpWindow
 			Catalog.GetString("PeakPower/PPT") + "\n (W/s)"
 		};
 
-
 		encoderCurves = new ArrayList ();
 
 		string line;
@@ -1070,12 +1070,12 @@ public partial class ChronoJumpWindow
 	private void on_treeview_encoder_curves_cursor_changed (object o, EventArgs args) 
 	{
 		int lineNum = treeviewEncoderCurvesEventSelectedID();
-		sensitiveEncoderRowButtons(false);
+		encoderButtonsSensitive(encoderSensEnum.DONEYESSIGNAL);
 		
 		//on ecc-con select both lines
 		if(ecconLast == "c") {
 			if (lineNum > 0)
-				sensitiveEncoderRowButtons(true);
+				encoderButtonsSensitive(encoderSensEnum.SELECTEDCURVE);
 		} else {
 			TreeIter iter = new TreeIter();
 
@@ -1103,26 +1103,103 @@ public partial class ChronoJumpWindow
 				treeview_encoder_curves.Selection.SelectIter(iter);
 				
 				if (treeview_encoder_curves.Selection.GetSelectedRows().Length == 2) 
-					sensitiveEncoderRowButtons(true);
+					encoderButtonsSensitive(encoderSensEnum.SELECTEDCURVE);
 			}
 			treeview_encoder_curves.CursorChanged += on_treeview_encoder_curves_cursor_changed; 
 		}
 	}
+	
+	/* end of TreeView stuff */	
+
+	/* sensitivity stuff */	
+			
+	//called when a person changes
+	private void encoderPersonChanged() {
+		ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve");
+		label_encoder_user_curves_num.Text = data.Count.ToString();
+		spin_encoder_analyze_curve_num.SetRange(1, data.Count);
 
-	private void sensitiveEncoderGlobalButtons(bool sensitive) {
-		label_encoder_capture_comment.Sensitive = sensitive;
-		entry_encoder_capture_comment.Sensitive = sensitive;
-		button_encoder_save_signal.Sensitive = sensitive;
-		button_encoder_analyze.Sensitive = sensitive;
+		encoderButtonsSensitive(encoderSensEnum.YESPERSON);
+		treeviewEncoderRemoveColumns();
+		image_encoder_capture.Sensitive = false;
+		image_encoder_analyze.Sensitive = false;
 	}
 
-	private void sensitiveEncoderRowButtons(bool sensitive) {
-		button_encoder_delete_curve.Sensitive = sensitive;
-		button_encoder_save_curve.Sensitive = sensitive;
+	private void encoderButtonsSensitive(encoderSensEnum option) {
+		//columns
+		//c0 button_encoder_capture
+		//c1 button_encoder_recalculate
+		//c2 button_encoder_load_signal
+		//c3 button_encoder_save_all_curves && button_encoder_save_signal && 
+		//	label_encoder_capture_comment && entry_encoder_capture_comment
+		//c4 button_encoder_delete_curve && button_encoder_save_curve
+		//c5 button_encoder_analyze
+		//c6 button_encoder_analyze_data_show_user_curves
+
+		//other dependencies
+		//c5 True needs 
+		//	(signal || (! radiobutton_encoder_analyze_data_current_signal.Active && user has curves))
+		//c6 True needs ! radiobutton_encoder_analyze_data_current_signal.Active
+		
+		//columns		 0  1  2  3  4  5  6
+		int [] noSession = 	{0, 0, 0, 0, 0, 0, 0};
+		int [] noPerson = 	{0, 0, 0, 0, 0, 0, 0};
+		int [] yesPerson = 	{1, 0, 1, 0, 0, 1, 1};
+		int [] processing = 	{0, 0, 0, 0, 0, 0, 0};
+		int [] doneNoSignal = 	{1, 1, 1, 0, 0, 1, 1};
+		int [] doneYesSignal = 	{1, 1, 1, 1, 0, 1, 1};
+		int [] selectedCurve = 	{1, 1, 1, 1, 1, 1, 1};
+		int [] table = new int[7];
+
+		switch(option) {
+			case encoderSensEnum.NOSESSION:
+				table = noSession;
+				break;
+			case encoderSensEnum.NOPERSON:
+				table = noPerson;
+				break;
+			case encoderSensEnum.YESPERSON:
+				table = yesPerson;
+				break;
+			case encoderSensEnum.PROCESSING:
+				table = processing;
+				break;
+			case encoderSensEnum.DONENOSIGNAL:
+				table = doneNoSignal;
+				break;
+			case encoderSensEnum.DONEYESSIGNAL:
+				table = doneYesSignal;
+				break;
+			case encoderSensEnum.SELECTEDCURVE:
+				table = selectedCurve;
+				break;
+		}
+
+		button_encoder_capture.Sensitive = Util.IntToBool(table[0]);
+		button_encoder_recalculate.Sensitive = Util.IntToBool(table[1]);
+		button_encoder_load_signal.Sensitive = Util.IntToBool(table[2]);
+		
+		button_encoder_save_all_curves.Sensitive = Util.IntToBool(table[3]);
+		button_encoder_save_signal.Sensitive = Util.IntToBool(table[3]);
+		label_encoder_capture_comment.Sensitive = Util.IntToBool(table[3]);
+		entry_encoder_capture_comment.Sensitive = Util.IntToBool(table[3]);
+		
+		button_encoder_delete_curve.Sensitive = Util.IntToBool(table[4]);
+		button_encoder_save_curve.Sensitive = Util.IntToBool(table[4]);
+		
+		button_encoder_analyze.Sensitive = 
+			(Util.IntToBool(table[5]) && 
+			 (UtilGtk.CountRows(encoderListStore) > 0 ||
+			  (! radiobutton_encoder_analyze_data_current_signal.Active && 
+			   Convert.ToInt32(label_encoder_user_curves_num.Text) >0)));
+
+		button_encoder_analyze_data_show_user_curves.Sensitive = 
+			(Util.IntToBool(table[6]) && ! radiobutton_encoder_analyze_data_current_signal.Active);
 	}
-	
-	/* end of TreeView stuff */	
 
+	/* end of sensitivity stuff */	
+			
+	
 	/* thread stuff */
 
 	private void encoderThreadStart(encoderModes mode) {
@@ -1145,6 +1222,7 @@ public partial class ChronoJumpWindow
 			encoderThread = new Thread(new ThreadStart(analyze));
 			GLib.Idle.Add (new GLib.IdleHandler (pulseGTKEncoderAnalyze));
 		}
+		encoderButtonsSensitive(encoderSensEnum.PROCESSING);
 		encoderThread.Start(); 
 	}
 	
@@ -1152,7 +1230,6 @@ public partial class ChronoJumpWindow
 	{
 		if(! encoderThread.IsAlive) {
 			finishPulsebar(encoderModes.CAPTURE);
-			sensitiveEncoderRowButtons(false);
 			Log.Write("dying");
 			return false;
 		}
@@ -1166,7 +1243,6 @@ public partial class ChronoJumpWindow
 	{
 		if(! encoderThread.IsAlive) {
 			finishPulsebar(encoderModes.ANALYZE);
-			sensitiveEncoderRowButtons(false);
 			Log.Write("dying");
 			return false;
 		}
@@ -1201,6 +1277,10 @@ public partial class ChronoJumpWindow
 			Pixbuf pixbuf = new Pixbuf (Util.GetEncoderGraphTempFileName()); //from a file
 			image_encoder_analyze.Pixbuf = pixbuf;
 		}
+
+		treeview_encoder_curves.Sensitive = true;
+		image_encoder_capture.Sensitive = true;
+		image_encoder_analyze.Sensitive = true;
 	}
 	
 	/* end of thread stuff */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]