chronojump r480 - in trunk: . build/data glade src src/execute src/gui



Author: xaviblas
Date: Tue Mar 31 15:25:52 2009
New Revision: 480
URL: http://svn.gnome.org/viewvc/chronojump?rev=480&view=rev

Log:
multiChronopic shows graph real time for 4 chronopics, 
but still some little bugs to fix
multichronopic graph is bigger than others


Modified:
   trunk/TODO.txt
   trunk/build/data/chronojump.prg
   trunk/build/data/chronojump_mini.prg
   trunk/changelog.txt
   trunk/glade/chronojump.glade
   trunk/src/execute/event.cs
   trunk/src/execute/multiChronopic.cs
   trunk/src/gui/eventExecute.cs
   trunk/src/prepareEventGraphObjects.cs
   trunk/src/util.cs

Modified: trunk/TODO.txt
==============================================================================
--- trunk/TODO.txt	(original)
+++ trunk/TODO.txt	Tue Mar 31 15:25:52 2009
@@ -1,5 +1,10 @@
 TODO: 
 
+mirar fallo al tancar finestra executar fent click a X
+abans o desprÃs de cancelar
+i mirar la minifinestra que surt (de d'acord) que es pugui tancar tambà amb la X
+look also chrash on exiting thread is still open when 2 chronopics are used
+
 Add Cabedo's tests
 
 add a link to the server page. Develop web stats and survey on web site. Maybe

Modified: trunk/build/data/chronojump.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/chronojump_mini.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/changelog.txt
==============================================================================
--- trunk/changelog.txt	(original)
+++ trunk/changelog.txt	Tue Mar 31 15:25:52 2009
@@ -1,5 +1,10 @@
 CHANGELOG.txt
 
+31 mar 2009 (2)
+	multiChronopic shows graph real time for 4 chronopics, 
+	but still some little bugs to fix
+	multichronopic graph is bigger than others
+
 31 mar 2009
 	in execution graph put avgs as horizontal lines
 	and plot all tests of same type of same person

Modified: trunk/glade/chronojump.glade
==============================================================================
--- trunk/glade/chronojump.glade	(original)
+++ trunk/glade/chronojump.glade	Tue Mar 31 15:25:52 2009
@@ -8450,7 +8450,7 @@
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_taskbar_hint">True</property>
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
@@ -15688,7 +15688,7 @@
 	  <property name="shadow_type">GTK_SHADOW_IN</property>
 
 	  <child>
-	    <widget class="GtkAlignment" id="alignment58">
+	    <widget class="GtkAlignment" id="alignment1">
 	      <property name="visible">True</property>
 	      <property name="xalign">0.5</property>
 	      <property name="yalign">0.5</property>
@@ -15706,9 +15706,134 @@
 		  <property name="spacing">0</property>
 
 		  <child>
+		    <widget class="GtkHBox" id="hbox_drawingarea">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<widget class="GtkDrawingArea" id="drawingarea">
+			  <property name="width_request">300</property>
+			  <property name="height_request">200</property>
+			  <property name="visible">True</property>
+			  <signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Sun, 24 Sep 2006 22:41:38 GMT"/>
+			  <signal name="configure_event" handler="on_drawingarea_configure_event" last_modification_time="Tue, 31 Mar 2009 11:12:26 GMT"/>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkVBox" id="vbox183">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">0</property>
+
+			  <child>
+			    <widget class="GtkButton" id="button_zoom">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Update</property>
+			      <property name="can_focus">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <signal name="clicked" handler="on_button_zoom_clicked" last_modification_time="Tue, 31 Mar 2009 10:48:33 GMT"/>
+
+			      <child>
+				<widget class="GtkImage" id="image4224">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-zoom-in</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkButton" id="button_properties">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Properties</property>
+			      <property name="can_focus">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <signal name="clicked" handler="on_button_properties_clicked" last_modification_time="Sun, 08 Oct 2006 22:21:28 GMT"/>
+
+			      <child>
+				<widget class="GtkImage" id="image1664">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-properties</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkButton" id="button_update">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Update</property>
+			      <property name="can_focus">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <signal name="clicked" handler="on_button_update_clicked" last_modification_time="Sun, 08 Oct 2006 22:21:41 GMT"/>
+
+			      <child>
+				<widget class="GtkImage" id="image1665">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-refresh</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
+
+		  <child>
 		    <widget class="GtkTable" id="table_total">
 		      <property name="visible">True</property>
-		      <property name="n_rows">10</property>
+		      <property name="n_rows">9</property>
 		      <property name="n_columns">2</property>
 		      <property name="homogeneous">False</property>
 		      <property name="row_spacing">0</property>
@@ -15950,81 +16075,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">3</property>
-			  <property name="bottom_attach">4</property>
-			  <property name="x_options">fill</property>
-			  <property name="y_options">fill</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkVBox" id="vbox88">
-			  <property name="border_width">2</property>
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">4</property>
-
-			  <child>
-			    <widget class="GtkButton" id="button_properties">
-			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">Properties</property>
-			      <property name="can_focus">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <signal name="clicked" handler="on_button_properties_clicked" last_modification_time="Sun, 08 Oct 2006 22:21:28 GMT"/>
-
-			      <child>
-				<widget class="GtkImage" id="image1664">
-				  <property name="visible">True</property>
-				  <property name="stock">gtk-properties</property>
-				  <property name="icon_size">4</property>
-				  <property name="xalign">0.5</property>
-				  <property name="yalign">0.5</property>
-				  <property name="xpad">0</property>
-				  <property name="ypad">0</property>
-				</widget>
-			      </child>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkButton" id="button_update">
-			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">Update</property>
-			      <property name="can_focus">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <signal name="clicked" handler="on_button_update_clicked" last_modification_time="Sun, 08 Oct 2006 22:21:41 GMT"/>
-
-			      <child>
-				<widget class="GtkImage" id="image1665">
-				  <property name="visible">True</property>
-				  <property name="stock">gtk-refresh</property>
-				  <property name="icon_size">4</property>
-				  <property name="xalign">0.5</property>
-				  <property name="yalign">0.5</property>
-				  <property name="xpad">0</property>
-				  <property name="ypad">0</property>
-				</widget>
-			      </child>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="left_attach">0</property>
-			  <property name="right_attach">1</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -16210,8 +16262,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">5</property>
-			  <property name="bottom_attach">6</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -16357,8 +16409,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">2</property>
-			  <property name="bottom_attach">3</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -16804,8 +16856,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">3</property>
-			  <property name="bottom_attach">4</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -16951,8 +17003,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">5</property>
-			  <property name="bottom_attach">6</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -17227,8 +17279,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">6</property>
-			  <property name="bottom_attach">7</property>
+			  <property name="top_attach">5</property>
+			  <property name="bottom_attach">6</property>
 			  <property name="x_options">fill</property>
 			</packing>
 		      </child>
@@ -17413,8 +17465,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">6</property>
-			  <property name="bottom_attach">7</property>
+			  <property name="top_attach">5</property>
+			  <property name="bottom_attach">6</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -17552,8 +17604,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">7</property>
-			  <property name="bottom_attach">8</property>
+			  <property name="top_attach">6</property>
+			  <property name="bottom_attach">7</property>
 			  <property name="x_options">fill</property>
 			</packing>
 		      </child>
@@ -17682,8 +17734,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">7</property>
-			  <property name="bottom_attach">8</property>
+			  <property name="top_attach">6</property>
+			  <property name="bottom_attach">7</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -17765,8 +17817,8 @@
 			<packing>
 			  <property name="left_attach">0</property>
 			  <property name="right_attach">1</property>
-			  <property name="top_attach">9</property>
-			  <property name="bottom_attach">10</property>
+			  <property name="top_attach">8</property>
+			  <property name="bottom_attach">9</property>
 			  <property name="x_options">fill</property>
 			</packing>
 		      </child>
@@ -17867,8 +17919,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">9</property>
-			  <property name="bottom_attach">10</property>
+			  <property name="top_attach">8</property>
+			  <property name="bottom_attach">9</property>
 			  <property name="x_options">fill</property>
 			  <property name="y_options">fill</property>
 			</packing>
@@ -18054,8 +18106,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">2</property>
-			  <property name="bottom_attach">3</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
 			</packing>
 		      </child>
 
@@ -18143,8 +18195,8 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">4</property>
-			  <property name="bottom_attach">5</property>
+			  <property name="top_attach">3</property>
+			  <property name="bottom_attach">4</property>
 			</packing>
 		      </child>
 
@@ -18232,29 +18284,13 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">8</property>
-			  <property name="bottom_attach">9</property>
+			  <property name="top_attach">7</property>
+			  <property name="bottom_attach">8</property>
 			  <property name="x_options">fill</property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkDrawingArea" id="drawingarea">
-			  <property name="width_request">100</property>
-			  <property name="height_request">200</property>
-			  <property name="visible">True</property>
-			  <signal name="configure_event" handler="on_drawingarea_configure_event" last_modification_time="Sun, 24 Sep 2006 22:41:23 GMT"/>
-			  <signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Sun, 24 Sep 2006 22:41:38 GMT"/>
-			</widget>
-			<packing>
-			  <property name="left_attach">1</property>
-			  <property name="right_attach">2</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
-			</packing>
-		      </child>
-
-		      <child>
 			<widget class="GtkHBox" id="hbox_jump_simple_titles">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">True</property>
@@ -18338,16 +18374,15 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">1</property>
-			  <property name="bottom_attach">2</property>
-			  <property name="y_padding">8</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
 			</packing>
 		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
 		    </packing>
 		  </child>
 		</widget>
@@ -18570,8 +18605,8 @@
 		</widget>
 		<packing>
 		  <property name="padding">3</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
 		</packing>
 	      </child>
 	    </widget>

Modified: trunk/src/execute/event.cs
==============================================================================
--- trunk/src/execute/event.cs	(original)
+++ trunk/src/execute/event.cs	Tue Mar 31 15:25:52 2009
@@ -377,6 +377,10 @@
 				Log.Write("update graph: MULTICHRONOPIC");
 				eventExecuteWin.PrepareMultiChronopicGraph(
 						prepareEventGraphMultiChronopic.timestamp, 
+						prepareEventGraphMultiChronopic.cp1StartedIn, 
+						prepareEventGraphMultiChronopic.cp2StartedIn, 
+						prepareEventGraphMultiChronopic.cp3StartedIn, 
+						prepareEventGraphMultiChronopic.cp4StartedIn, 
 						prepareEventGraphMultiChronopic.cp1InStr, 
 						prepareEventGraphMultiChronopic.cp1OutStr,
 						prepareEventGraphMultiChronopic.cp2InStr, 

Modified: trunk/src/execute/multiChronopic.cs
==============================================================================
--- trunk/src/execute/multiChronopic.cs	(original)
+++ trunk/src/execute/multiChronopic.cs	Tue Mar 31 15:25:52 2009
@@ -31,6 +31,7 @@
 	private Chronopic cp;
 	string cp1InStr;
 	string cp1OutStr;
+	bool cp1StartedIn;
 
 	//2nd Chronopic stuff
 	protected Thread thread2;
@@ -39,6 +40,7 @@
 	protected States loggedState2;
 	string cp2InStr;
 	string cp2OutStr;
+	bool cp2StartedIn;
 	
 	//3rd Chronopic stuff
 	protected Thread thread3;
@@ -47,6 +49,7 @@
 	protected States loggedState3;
 	string cp3InStr;
 	string cp3OutStr;
+	bool cp3StartedIn;
 	
 	//4th Chronopic stuff
 	protected Thread thread4;
@@ -55,6 +58,7 @@
 	protected States loggedState4;
 	string cp4InStr;
 	string cp4OutStr;
+	bool cp4StartedIn;
 	
 
 	static bool firstValue = true;
@@ -162,17 +166,21 @@
 		
 			if (platformState==Chronopic.Plataforma.ON) {
 				loggedState = States.ON;
+				cp1StartedIn = true;
 			} else {
 				loggedState = States.OFF;
+				cp1StartedIn = false;
 			}
 		
 			if(chronopics > 1) {
 				platformState2 = chronopicInitialValue(cp2);
-		
+
 				if (platformState2==Chronopic.Plataforma.ON) {
 					loggedState2 = States.ON;
+					cp2StartedIn = true;
 				} else {
 					loggedState2 = States.OFF;
+					cp2StartedIn = false;
 				}
 
 				if(chronopics > 2) {
@@ -180,8 +188,10 @@
 
 					if (platformState3==Chronopic.Plataforma.ON) {
 						loggedState3 = States.ON;
+						cp3StartedIn = true;
 					} else {
 						loggedState3 = States.OFF;
+						cp3StartedIn = false;
 					}
 
 					if(chronopics > 3) {
@@ -189,8 +199,10 @@
 
 						if (platformState4==Chronopic.Plataforma.ON) {
 							loggedState4 = States.ON;
+							cp4StartedIn = true;
 						} else {
 							loggedState4 = States.OFF;
+							cp4StartedIn = false;
 						}
 					}
 				}
@@ -278,7 +290,8 @@
 							inEqual = "="; 
 						}
 
-						prepareEventGraphMultiChronopic = new PrepareEventGraphMultiChronopic(timestamp/1000.0,
+						prepareEventGraphMultiChronopic = new PrepareEventGraphMultiChronopic(timestamp/1000.0, 
+								cp1StartedIn, cp2StartedIn, cp3StartedIn, cp4StartedIn,
 								cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr);
 						needUpdateGraphType = eventType.MULTICHRONOPIC;
 						needUpdateGraph = true;

Modified: trunk/src/gui/eventExecute.cs
==============================================================================
--- trunk/src/gui/eventExecute.cs	(original)
+++ trunk/src/gui/eventExecute.cs	Tue Mar 31 15:25:52 2009
@@ -134,6 +134,8 @@
 	[Widget] Gtk.Image image_run_interval_time_bad;
 	
 	[Widget] Gtk.DrawingArea drawingarea;
+	[Widget] Box hbox_drawingarea;
+	[Widget] Gtk.Alignment alignment1;
 	static Gdk.Pixmap pixmap = null;
 
 
@@ -464,29 +466,33 @@
 
 		Gdk.Rectangle allocation = drawingarea.Allocation;
 		
-		if(pixmap == null) {
+		if(pixmap == null || sizeChanged) {
 			pixmap = new Gdk.Pixmap (window, allocation.Width, allocation.Height, -1);
 		
 			erasePaint(drawingarea);
 			
 			graphProgress = phasesGraph.DOING; 
+			sizeChanged = false;
 		}
 	}
-	
+	bool sizeChanged;
 	public void on_drawingarea_expose_event(object o, ExposeEventArgs args)
 	{
 		/* in some mono installations, configure_event is not called, but expose_event yes. 
 		 * Do here the initialization
 		 */
 		
-		if(pixmap == null) {
+		if(pixmap == null || sizeChanged) {
 			Gdk.Rectangle allocation = drawingarea.Allocation;
 			pixmap = new Gdk.Pixmap (drawingarea.GdkWindow, allocation.Width, allocation.Height, -1);
 			erasePaint(drawingarea);
 
 			graphProgress = phasesGraph.DOING; 
+			sizeChanged = false;
 		}
 
+		Console.WriteLine("---------EXPOSE!!!!!--------");
+
 			
 		Gdk.Rectangle area = args.Event.Area;
 
@@ -498,6 +504,7 @@
 				area.X, area.Y,
 				area.X, area.Y,
 				area.Width, area.Height);
+//drawingarea.Show();
 		}
 		
 	}
@@ -878,7 +885,9 @@
 	}
 	
 	// multi chronopic 
-	public void PrepareMultiChronopicGraph(double timestamp, string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
+	public void PrepareMultiChronopicGraph(double timestamp, 
+			bool cp1StartedIn, bool cp2StartedIn, bool cp3StartedIn, bool cp4StartedIn,
+			string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
 			string cp3InStr, string cp3OutStr, string cp4InStr, string cp4OutStr) { 
 		//check graph properties window is not null (propably user has closed it with the DeleteEvent
 		//then create it, but not show it
@@ -890,7 +899,7 @@
 		int topMargin = 10;
 		//if max value of graph is automatic
 		if(eventGraphConfigureWin.Max == -1) 
-			maxValue = timestamp;
+			maxValue = timestamp; //TODO: delete this, is not used here
 			/*
 			maxValue = Util.GetMax(
 					cp1InString + "=" + cp1OutStr + "=" + cp2InString + "=" + cp2OutStr + "=" +
@@ -924,6 +933,7 @@
 
 		//paint graph
 		paintMultiChronopic (drawingarea, timestamp, 
+				cp1StartedIn, cp2StartedIn, cp3StartedIn, cp4StartedIn,
 				cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr, 
 				maxValue, minValue, topMargin, bottomMargin);
 		
@@ -1416,103 +1426,114 @@
 		graphProgress = phasesGraph.DONE; 
 	}
 
+	double multiChronopicGetX(int ancho, double time, double timeOld, double timeTotal) {
+		if(time < 0)
+			time = 0;
+		//Console.WriteLine("   timestamp {0}, ancho {1}, x {2}, timeold{3}, xOld{4}", timestamp, ancho, Util.TrimDecimals(x,1), timeOld, Util.TrimDecimals(xOld,1));
+		return ( ancho * ( (timeOld + time) / timeTotal) ) -rightMargin;
+	}
 
 	//TODO: fix this method
 	private void paintMultiChronopic (Gtk.DrawingArea drawingarea, double timestamp, 
+			bool cp1StartedIn, bool cp2StartedIn, bool cp3StartedIn, bool cp4StartedIn,
 			string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
 			string cp3InStr, string cp3OutStr, string cp4InStr, string cp4OutStr, 
 			double maxValue, double minValue, int topMargin, int bottomMargin)
 	{
-		int ancho=drawingarea.Allocation.Width;
-		int alto=drawingarea.Allocation.Height;
-		
-		
-		erasePaint(drawingarea);
-		
-		//writeMarginsText(maxValue, minValue, alto);
-		
-		//check now here that we will have not division by zero problems
-		if(maxValue - minValue > 0) {
 
-			//blue time average discountinuos line	
-//			drawGuideOrAVG(pen_azul_discont, avgTime, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
-
-			//paint reference guide black and green if needed
-		//	drawGuideOrAVG(pen_negro_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
-		//	drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
-
-			//blue time evolution	
-			string [] cp1_i = cp1InStr.Split(new char[] {'='});
-			string [] cp1_o = cp1OutStr.Split(new char[] {'='});
-			int count = 0;
-			double timeOld = 0;
-			double xOld = 0;
-			double myTimeDouble = 0;
-			
-			Console.WriteLine("cp1InStr:*{0}*, cp1OutStr:*{1}*", cp1InStr, cp1OutStr);
-
-			double timeTotal = Util.GetTotalTime(cp1InStr + "=" + cp1OutStr);
+		double timeTotal1 = Util.GetTotalTime(cp1InStr + "=" + cp1OutStr);
+		double timeTotal2 = Util.GetTotalTime(cp2InStr + "=" + cp2OutStr);
+		double timeTotal3 = Util.GetTotalTime(cp3InStr + "=" + cp3OutStr);
+		double timeTotal4 = Util.GetTotalTime(cp4InStr + "=" + cp4OutStr);
+		double timeTotal = timeTotal1;
+		if(timeTotal2 > timeTotal)
+			timeTotal = timeTotal2;
+		if(timeTotal3 > timeTotal)
+			timeTotal = timeTotal3;
+		if(timeTotal4 > timeTotal)
+			timeTotal = timeTotal4;
+		Console.WriteLine("total time: {0}", timeTotal);
+
+
+		//TODO: done this now because we come here with only 1 string filled and this does problems
+		if(timeTotal == 0) {
+			alignment1.SetSizeRequest(700, 300);
+			sizeChanged = true;
+			return;
+		}
 
-			Console.WriteLine("total time: {0}", timeTotal);
+		int ancho=drawingarea.Allocation.Width;
+		int alto=drawingarea.Allocation.Height;
 
+		erasePaint(drawingarea);
 
-			//TODO: done this now because we come here with only 1 string filled and this does problems
-			if(timeTotal == 0)
-				return;
+		//writeMarginsText(maxValue, minValue, alto);
 
-			foreach (string myTime in cp1_i) {
-				if(cp1InStr.Length > 0) {
-					myTimeDouble = Convert.ToDouble(myTime);
-					if(myTimeDouble < 0)
-						myTimeDouble = 0;
-					double x = ancho * ( (timeOld + myTimeDouble) / timeTotal);
-Console.WriteLine("  IN: timestamp {0}, ancho {1}, x {2}, timeold{3}", timestamp, ancho, x, timeOld);
+		//check now here that we will have not division by zero problems
+		if(maxValue - minValue <= 0) 
+			return;
 
-						pixmap.DrawLine(pen_azul, //blue for time
-								Convert.ToInt32(xOld), 30,
-								Convert.ToInt32(x), 30);
+		paintMultiChronopic2 (ancho, cp1StartedIn, cp1InStr, cp1OutStr, timeTotal, 30,20);
+		paintMultiChronopic2 (ancho, cp2StartedIn, cp2InStr, cp2OutStr, timeTotal, 100,90);
+		paintMultiChronopic2 (ancho, cp3StartedIn, cp3InStr, cp3OutStr, timeTotal, 170,180);
 
-				/*
-				//paint Y lines
-				if(eventGraphConfigureWin.VerticalGrid) 
-					pixmap.DrawLine(pen_beige_discont, Convert.ToInt32((ancho - rightMargin) *(count+.5)/pulses), topMargin, Convert.ToInt32((ancho - rightMargin) *(count+.5)/pulses), alto-topMargin);
-					*/
-				
-				
-					timeOld = myTimeDouble;
-					xOld = x;
-				}
+		graphProgress = phasesGraph.DONE; 
+	}
 
-				if(cp1OutStr.Length > 0 && cp1_o.Length > count) {
-					myTimeDouble = Convert.ToDouble(cp1_o[count]);
-					if(myTimeDouble < 0)
-						myTimeDouble = 0;
-					double x = ancho * ( (timeOld + myTimeDouble) / timeTotal);
-Console.WriteLine("  OUT: timestamp {0}, ancho {1}, x {2}, timeold{3}", timestamp, ancho, x, timeOld);
-
-						pixmap.DrawLine(pen_rojo, //blue for time
-								Convert.ToInt32(xOld), 20,
-								Convert.ToInt32(x), 20);
+	private void paintMultiChronopic2 (int ancho, bool cpStartedIn, string cpInStr, string cpOutStr, double timeTotal, int h1, int h2) 
+	{
+		if(Util.GetTotalTime(cpInStr + "=" + cpOutStr) == 0) 
+			return;
 
+		int ticks;
+		int heightStart;
+		int heightEnd;
+		Gdk.GC penStart;
+		Gdk.GC penEnd;
+		string [] cpStart;
+		string [] cpEnd;
+		
+		if(cpStartedIn) {
+			cpStart = cpInStr.Split(new char[] {'='});
+			cpEnd =   cpOutStr.Split(new char[] {'='});
+			penStart = pen_rojo;
+			penEnd = pen_azul;
+			heightStart = h1;
+			heightEnd = h2;
+		}
+		else {
+			cpStart = cpOutStr.Split(new char[] {'='});
+			cpEnd =   cpInStr.Split(new char[] {'='});
+			penStart = pen_azul;
+			penEnd = pen_rojo;
+			heightStart = h2;
+			heightEnd = h1;
+		}
+		ticks = cpStart.Length;
+		double timeOld = 0;
+		double xOld = 0;
 
-					timeOld = myTimeDouble;
-					xOld = x;
-				}
+		Console.WriteLine("\n(A) cpInStr:*{0}*, cpOutStr:*{1}*", cpInStr, cpOutStr);
 
+		/*
+		   int maxTcTfs = 10; if(cp1_i.Length > maxTcTfs) cp1_i = Util.DeleteFirstStrings(cp1_i, maxTcTfs); if(cp1_o.Length > maxTcTfs) cp1_o = Util.DeleteFirstStrings(cp1_o, maxTcTfs); cp1InStr = Util.StringArrayToString(cp1_i, "="); cp1OutStr = Util.StringArrayToString(cp1_o, "="); Console.WriteLine("(B) cp1InStr:*{0}*, cp1OutStr:*{1}*", cp1InStr, cp1OutStr);
+		   */
 
-				count ++;
+		for(int i=0; i < ticks; i++) { 
+			if(cpStart.Length > i) {
+				double x = multiChronopicGetX(ancho, Convert.ToDouble(cpStart[i]), timeOld, timeTotal);
+				pixmap.DrawLine(penStart, Convert.ToInt32(xOld), heightStart, Convert.ToInt32(x), heightStart);
+				timeOld += Convert.ToDouble(cpStart[i]);
+				xOld = x;
 			}
-		
-//			drawCircleAndWriteValue(pen_azul, myTimeDouble, --count, pulses, ancho, alto, maxValue, minValue, topMargin, bottomMargin);
 
+			if(cpEnd.Length > i) {
+				double x = multiChronopicGetX(ancho, Convert.ToDouble(cpEnd[i]), timeOld, timeTotal);
+				pixmap.DrawLine(penEnd, Convert.ToInt32(xOld), heightEnd, Convert.ToInt32(x), heightEnd);
+				timeOld += Convert.ToDouble(cpEnd[i]);
+				xOld = x;
+			}
 		}
-	
-	/*	
-		label_pulse_now.Text = Util.TrimDecimals(lastTime.ToString(), pDN);
-		label_pulse_avg.Text = Util.TrimDecimals(avgTime.ToString(), pDN);
-		*/
-		
-		graphProgress = phasesGraph.DONE; 
 	}
 
 
@@ -1574,6 +1595,25 @@
 	}
 	
 	
+	void on_button_zoom_clicked (object o, EventArgs args) {
+//drawingarea.Size(700,200);
+//event_execute.SetDefaultSize(700,200);
+//hbox_drawingarea.SetDefaultSize(700,200);
+//drawingarea.SetSizeRequest(700,200);
+sizeChanged = true;
+//drawingarea.ConfigureEvent;
+//drawingarea.ExposeEvent;
+/*
+Gtk.Object o = new Gtk.Object();
+ConfigureEventArgs args = new ConfigureEventArgs();
+on_drawingarea_configure_event(o, args);
+on_drawingarea_expose_event(o, args);
+*/
+//on_drawingarea_configure_event((Gtk.Object) drawingarea, new ConfigureEventArgs());
+//on_drawingarea_expose_event((Gtk.Object) drawingarea, new ExposeEventArgs());
+
+	}
+
 	
 	void on_button_properties_clicked (object o, EventArgs args) {
 		//now show the eventGraphConfigureWin

Modified: trunk/src/prepareEventGraphObjects.cs
==============================================================================
--- trunk/src/prepareEventGraphObjects.cs	(original)
+++ trunk/src/prepareEventGraphObjects.cs	Tue Mar 31 15:25:52 2009
@@ -132,13 +132,23 @@
 	public string cp3OutStr;
 	public string cp4InStr;
 	public string cp4OutStr;
+	public bool cp1StartedIn;
+	public bool cp2StartedIn;
+	public bool cp3StartedIn;
+	public bool cp4StartedIn;
 
 	public PrepareEventGraphMultiChronopic() {
 	}
 
-	public PrepareEventGraphMultiChronopic(double timestamp, string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
+	public PrepareEventGraphMultiChronopic(double timestamp, 
+			bool cp1StartedIn, bool cp2StartedIn, bool cp3StartedIn, bool cp4StartedIn,
+			string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
 			string cp3InStr, string cp3OutStr, string cp4InStr, string cp4OutStr) {
 		this.timestamp = timestamp;
+		this.cp1StartedIn = cp1StartedIn; 
+		this.cp2StartedIn = cp2StartedIn; 
+		this.cp3StartedIn = cp3StartedIn; 
+		this.cp4StartedIn = cp4StartedIn;
 		this.cp1InStr = cp1InStr;
 		this.cp1OutStr = cp1OutStr;
 		this.cp2InStr = cp2InStr;

Modified: trunk/src/util.cs
==============================================================================
--- trunk/src/util.cs	(original)
+++ trunk/src/util.cs	Tue Mar 31 15:25:52 2009
@@ -85,6 +85,9 @@
 		return myStringBuilder.ToString();
 	}
 
+	public static string TrimDecimals (double time, int prefsDigitsNumber) {
+		return Math.Round(time, prefsDigitsNumber).ToString();
+	}
 
 	public static string TrimDecimals (string time, int prefsDigitsNumber) {
 		if(time == "-1" || time == "-") {
@@ -375,6 +378,14 @@
 			return tcString;
 		}
 	}
+				
+	
+	public static string [] DeleteFirstStrings(string [] str, int maxStrings) {
+		string [] str2 = new String [maxStrings];
+		for(int i=str.Length - maxStrings, j=0; i < str.Length; i++, j++) 
+			str2[j] = str [i];
+		return str2;
+	}
 	
 	//called from jumpRj.Write() and from interval
 	//when we mark that jump should finish by time, chronopic thread is probably capturing data



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