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



Author: xaviblas
Date: Mon Mar 30 16:20:27 2009
New Revision: 478
URL: http://svn.gnome.org/viewvc/chronojump?rev=478&view=rev

Log:
multiChronopic:
-event window is connected and start showing graph data (incorrect now)
-data is recorded in strings
-better gui (no radio buttons and integration of cp1)
-if a chronopic port is opened, cannot be opened by others
-multiChronopic works also with one

solved sp disconnection (passed as out co chronopicInit)
helpPorts modal again

separated todo in changelog.txt to TODO.txt


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/jump.cs
   trunk/src/execute/multiChronopic.cs
   trunk/src/gui/chronojump.cs
   trunk/src/gui/eventExecute.cs
   trunk/src/prepareEventGraphObjects.cs
   trunk/src/utilGtk.cs

Modified: trunk/TODO.txt
==============================================================================
--- trunk/TODO.txt	(original)
+++ trunk/TODO.txt	Mon Mar 30 16:20:27 2009
@@ -1,45 +1,98 @@
-
 TODO: 
 
-try preferences/language combo (and default) on windows
-
--event edit (run) shows km/h not looking at prefs	DONE
--put a image_file, and a image_desc for every test type. DONE 
--create some images					DONE
--DialogImageTest will get data from event passed	DONE
--write some filter to update DB.			DONE
--add image and desc on new event type creation (desc is the current Description)
--allow to change image and desc of any event type
--put a try{} catch on loading of images (probably user made a mistake)
--clean warnings!!
--fix combo stuff on gtk2, see if it works on windows and maemo WINDOWS WORKS
--fix nplot texts ON WINDOWS WORKS (NOT ON LINUX)
-
-
-** OUTDATED file **
-
-
-
-TODO CURRENTLY NOT ADDED IN TASK MANAGER:
-----------------------------------------
-
-NEW FUTURE FEATURE (TEMPO): Avaluate the capacity of a person in following a tempo (o pulsation). 
-- Person can follow the tempo that they want and try to evaluate the accuracy. 
-- Or a rhythm (random or predefined) is presented by the program (with the buzzer) and the person has to follow it with the help of the buzzer or without it.
-- The Rhythm can be played with gtick (metronome)
-
-
-Hability of changing sensibility from chronojump
+Add Cabedo's tests
 
+add a link to the server page. Develop web stats and survey on web site. Maybe
+done by R script and calling to database
+http://cran.r-project.org/web/packages/RSQLite/index.html
+http://cran.r-project.org/web/packages/RSQLite/INSTALL
+http://cran.r-project.org/web/packages/DBI/index.html
+
+all this will be release 0.9
+
+do the ping gets real IP
+
+put thread in other server situations:
+-upload evaluator
+-upload session
+
+do the graph of last jump plot values of jumps before
+(maybe show last jumps of this kind on different people, and the avg of this
+user and all users (this two in different color))
+
+http://en.csharp-online.net/ASP.NET_Security_HacksÂAvoiding_SQL_Injection
+http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/
+every string that gets on server or complex object, sanitize it: see on sql or
+c# books. Or look for ; and after alter, insert, delete, drop, update, ...
+(low and hight case)
+i think there will be no problems because all is parametrized
+
+Fix bug on thread sqlite at start (see 2 pngs at Desktop)
+
+Put pictures and description of runAnalysis. Do svn add, Makefile, ...
+
+
+intersession stats only have to show one max or avg, not n max or all jumps
+stats all and limit is not updating the treeview stats. 
+
+us Util.DetectPortsLinux in gui/help ports
+
+when person weight is updated, description of eg. margaria (with power)
+doesn't change. Should change or use another thing. Recreate all time in
+session.... also same when edit jump.
+Maybe is better to don't have it (the power) recorded at any place but generate when it's
+required
+
+create a server mini program that tries to do a ping and if it fails, 
+then write something in a file, and another program restarts server
+fo it as to chrons. Record some stat data in another file
+just to know how xsp2 is working
+
+in execution graph put avgs as horizontal lines
+and plot all tests of same type of same person
+
+count time(s)  cp change diff same cp diff all cp
+1          10   1     IN           10          10
+2          15   2     IN           15           5
+3          20   1    OUT           10           5
+3          20   3     IN           20           0
+4          25   2    OUT           10           5
+5          30   3    OUT           10           5
+6          60   1     IN           40          30
+7          65   2     IN           40           5
+8          70   3     IN           40           5
+
+do like this:
+                     state  time change   time IN-IN time OUT-OUT
+count time(s)  cp1 cp2 cp3  cp1 cp2 cp3  cp1 cp2 cp3  cp1 cp2 cp3
+0           0  OUT OUT OUT 
+1          10   IN           10
+2          15       IN           15
+3          20  OUT      IN   10      20                20
+4          25  	   OUT           10                        25
+5          30          OUT           10                        30 
+6          60   IN           40           50
+7          65       IN           40           50
+8          70           IN           40           50
+
+doing gui/eventExecute multiChronopic
+-do 4 horiz lines that go from left to right
+-this 4 lines are updated at every change
+-all has to fit in the width of the graph (if impossible, double de width)
+-lines are like quadrated waves, are up (if person is out) and down if person
+is at platform)
+-each line has a color
+eg:
+ cp1:  ----
+           ------
 
-BUGS:
+ cp2:        -----
+       ------
 
-make that serial connection can be stablished regardless before a modem has been used in the same port
+ cp3:      -----  
+       ----     -
 
-graphs:
-	put a button for refreshing the graph
 
-show better info in the RJ jump edit
 
 edit jump need the hability of change the DJ fall and the SJ+ weight
 

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	Mon Mar 30 16:20:27 2009
@@ -1,76 +1,17 @@
-TODO:
+CHANGELOG.txt
 
-Add Cabedo's tests
+30 mar 2009
+	multiChronopic:
+	-event window is connected and start showing graph data (incorrect now)
+	-data is recorded in strings
+	-better gui (no radio buttons and integration of cp1)
+	-if a chronopic port is opened, cannot be opened by others
+	-multiChronopic works also with one
 
-add a link to the server page. Develop web stats and survey on web site. Maybe
-done by R script and calling to database
-http://cran.r-project.org/web/packages/RSQLite/index.html
-http://cran.r-project.org/web/packages/RSQLite/INSTALL
-http://cran.r-project.org/web/packages/DBI/index.html
-
-all this will be release 0.9
-
-do the ping gets real IP
-
-put thread in other server situations:
--upload evaluator
--upload session
-
-do the graph of last jump plot values of jumps before
-(maybe show last jumps of this kind on different people, and the avg of this
-user and all users (this two in different color))
-
-http://en.csharp-online.net/ASP.NET_Security_Hacks¿Avoiding_SQL_Injection
-http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/
-every string that gets on server or complex object, sanitize it: see on sql or
-c# books. Or look for ; and after alter, insert, delete, drop, update, ...
-(low and hight case)
-i think there will be no problems because all is parametrized
-
-Fix bug on thread sqlite at start (see png at Desktop)
-
-Put pictures and description of runAnalysis. Do svn add, Makefile, ...
-
-
-intersession stats only have to show one max or avg, not n max or all jumps
-
-stats all and limit is not updating the treeview stats. 
-
-us Util.DetectPortsLinux in gui/help ports
-
-when person weight is updated, description of eg. margaria (with power)
-doesn't change. Should change or use another thing. Recreate all time in
-session.... also same when edit jump.
-Maybe is better to don't have it (the power) recorded at any place but generate when it's
-required
-
-in execution graph put avgs as horizontal lines
-and plot all tests of same type of same person
-
-count time(s)  cp change diff same cp diff all cp
-1          10   1     IN           10          10
-2          15   2     IN           15           5
-3          20   1    OUT           10           5
-3          20   3     IN           20           0
-4          25   2    OUT           10           5
-5          30   3    OUT           10           5
-6          60   1     IN           40          30
-7          65   2     IN           40           5
-8          70   3     IN           40           5
-
-do like this:
-                     state  time change   time IN-IN time OUT-OUT
-count time(s)  cp1 cp2 cp3  cp1 cp2 cp3  cp1 cp2 cp3  cp1 cp2 cp3
-0           0  OUT OUT OUT 
-1          10   IN           10
-2          15       IN           15
-3          20  OUT      IN   10      20                20
-4          25  	   OUT           10                        25
-5          30          OUT           10                        30 
-6          60   IN           40           50
-7          65       IN           40           50
-8          70           IN           40           50
+	solved sp disconnection (passed as out co chronopicInit)
+	helpPorts modal again
 
+	separated todo in changelog.txt to TODO.txt
 
 27 mar 2009
 	four chronopics can be connected from gui/chronojump.cs

Modified: trunk/glade/chronojump.glade
==============================================================================
--- trunk/glade/chronojump.glade	(original)
+++ trunk/glade/chronojump.glade	Mon Mar 30 16:20:27 2009
@@ -13194,144 +13194,126 @@
 				      <property name="spacing">11</property>
 
 				      <child>
-					<widget class="GtkVBox" id="vbox176">
+					<widget class="GtkHBox" id="hbox313">
 					  <property name="visible">True</property>
 					  <property name="homogeneous">False</property>
-					  <property name="spacing">5</property>
+					  <property name="spacing">4</property>
 
 					  <child>
-					    <widget class="GtkVBox" id="vbox_multi_chronopic_selectors">
+					    <widget class="GtkFrame" id="frame45">
 					      <property name="visible">True</property>
-					      <property name="homogeneous">False</property>
-					      <property name="spacing">2</property>
+					      <property name="label_xalign">0</property>
+					      <property name="label_yalign">0.5</property>
+					      <property name="shadow_type">GTK_SHADOW_NONE</property>
 
 					      <child>
-						<widget class="GtkLabel" id="label682">
+						<widget class="GtkAlignment" id="alignment138">
 						  <property name="visible">True</property>
-						  <property name="label" translatable="yes">Number of Chronopics</property>
-						  <property name="use_underline">False</property>
-						  <property name="use_markup">False</property>
-						  <property name="justify">GTK_JUSTIFY_LEFT</property>
-						  <property name="wrap">False</property>
-						  <property name="selectable">False</property>
 						  <property name="xalign">0.5</property>
 						  <property name="yalign">0.5</property>
-						  <property name="xpad">0</property>
-						  <property name="ypad">0</property>
-						  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-						  <property name="width_chars">-1</property>
-						  <property name="single_line_mode">False</property>
-						  <property name="angle">0</property>
-						</widget>
-						<packing>
-						  <property name="padding">0</property>
-						  <property name="expand">False</property>
-						  <property name="fill">False</property>
-						</packing>
-					      </child>
-
-					      <child>
-						<widget class="GtkHBox" id="hbox335">
-						  <property name="visible">True</property>
-						  <property name="homogeneous">False</property>
-						  <property name="spacing">0</property>
+						  <property name="xscale">1</property>
+						  <property name="yscale">1</property>
+						  <property name="top_padding">0</property>
+						  <property name="bottom_padding">0</property>
+						  <property name="left_padding">12</property>
+						  <property name="right_padding">0</property>
 
 						  <child>
-						    <widget class="GtkRadioButton" id="radio_chronopics2">
+						    <widget class="GtkTable" id="table66">
 						      <property name="visible">True</property>
-						      <property name="can_focus">True</property>
-						      <property name="label" translatable="yes">2</property>
-						      <property name="use_underline">True</property>
-						      <property name="relief">GTK_RELIEF_NORMAL</property>
-						      <property name="focus_on_click">True</property>
-						      <property name="active">False</property>
-						      <property name="inconsistent">False</property>
-						      <property name="draw_indicator">True</property>
-						      <signal name="toggled" handler="on_radio_multi_chronopics_toggled" last_modification_time="Thu, 26 Mar 2009 15:56:00 GMT"/>
-						    </widget>
-						    <packing>
-						      <property name="padding">0</property>
-						      <property name="expand">True</property>
-						      <property name="fill">True</property>
-						    </packing>
-						  </child>
+						      <property name="n_rows">1</property>
+						      <property name="n_columns">1</property>
+						      <property name="homogeneous">False</property>
+						      <property name="row_spacing">0</property>
+						      <property name="column_spacing">0</property>
 
-						  <child>
-						    <widget class="GtkRadioButton" id="radio_chronopics3">
-						      <property name="visible">True</property>
-						      <property name="can_focus">True</property>
-						      <property name="label" translatable="yes">3</property>
-						      <property name="use_underline">True</property>
-						      <property name="relief">GTK_RELIEF_NORMAL</property>
-						      <property name="focus_on_click">True</property>
-						      <property name="active">False</property>
-						      <property name="inconsistent">False</property>
-						      <property name="draw_indicator">True</property>
-						      <property name="group">radio_chronopics2</property>
-						      <signal name="toggled" handler="on_radio_multi_chronopics_toggled" last_modification_time="Thu, 26 Mar 2009 15:56:14 GMT"/>
-						    </widget>
-						    <packing>
-						      <property name="padding">0</property>
-						      <property name="expand">True</property>
-						      <property name="fill">True</property>
-						    </packing>
-						  </child>
+						      <child>
+							<widget class="GtkHBox" id="hbox337">
+							  <property name="visible">True</property>
+							  <property name="homogeneous">False</property>
+							  <property name="spacing">0</property>
 
-						  <child>
-						    <widget class="GtkRadioButton" id="radio_chronopics4">
-						      <property name="visible">True</property>
-						      <property name="can_focus">True</property>
-						      <property name="label" translatable="yes">4</property>
-						      <property name="use_underline">True</property>
-						      <property name="relief">GTK_RELIEF_NORMAL</property>
-						      <property name="focus_on_click">True</property>
-						      <property name="active">False</property>
-						      <property name="inconsistent">False</property>
-						      <property name="draw_indicator">True</property>
-						      <property name="group">radio_chronopics2</property>
-						      <signal name="toggled" handler="on_radio_multi_chronopics_toggled" last_modification_time="Thu, 26 Mar 2009 15:56:30 GMT"/>
+							  <child>
+							    <widget class="GtkVBox" id="vbox182">
+							      <property name="visible">True</property>
+							      <property name="homogeneous">False</property>
+							      <property name="spacing">0</property>
+
+							      <child>
+								<widget class="GtkImage" id="image_cp1_no">
+								  <property name="visible">True</property>
+								  <property name="stock">gtk-no</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>
+								<packing>
+								  <property name="padding">0</property>
+								  <property name="expand">True</property>
+								  <property name="fill">True</property>
+								</packing>
+							      </child>
+
+							      <child>
+								<widget class="GtkImage" id="image_cp1_yes">
+								  <property name="visible">True</property>
+								  <property name="stock">gtk-yes</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>
+								<packing>
+								  <property name="padding">0</property>
+								  <property name="expand">True</property>
+								  <property name="fill">True</property>
+								</packing>
+							      </child>
+							    </widget>
+							    <packing>
+							      <property name="padding">0</property>
+							      <property name="expand">False</property>
+							      <property name="fill">False</property>
+							      <property name="pack_type">GTK_PACK_END</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="y_options">fill</property>
+							</packing>
+						      </child>
 						    </widget>
-						    <packing>
-						      <property name="padding">0</property>
-						      <property name="expand">False</property>
-						      <property name="fill">True</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="GtkHBox" id="hbox326">
+						<widget class="GtkLabel" id="label690">
 						  <property name="visible">True</property>
-						  <property name="homogeneous">False</property>
-						  <property name="spacing">0</property>
-
-						  <child>
-						    <widget class="GtkButton" id="button_multi_chronopic_start">
-						      <property name="visible">True</property>
-						      <property name="can_focus">True</property>
-						      <property name="label" translatable="yes">Start</property>
-						      <property name="use_underline">True</property>
-						      <property name="relief">GTK_RELIEF_NORMAL</property>
-						      <property name="focus_on_click">True</property>
-						      <signal name="clicked" handler="on_button_multi_chronopic_start_clicked" last_modification_time="Tue, 24 Mar 2009 23:07:49 GMT"/>
-						    </widget>
-						    <packing>
-						      <property name="padding">0</property>
-						      <property name="expand">True</property>
-						      <property name="fill">True</property>
-						    </packing>
-						  </child>
+						  <property name="label">&lt;b&gt;1st Chronopic&lt;/b&gt;</property>
+						  <property name="use_underline">False</property>
+						  <property name="use_markup">True</property>
+						  <property name="justify">GTK_JUSTIFY_LEFT</property>
+						  <property name="wrap">False</property>
+						  <property name="selectable">False</property>
+						  <property name="xalign">0.5</property>
+						  <property name="yalign">0.5</property>
+						  <property name="xpad">0</property>
+						  <property name="ypad">0</property>
+						  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+						  <property name="width_chars">-1</property>
+						  <property name="single_line_mode">False</property>
+						  <property name="angle">0</property>
 						</widget>
 						<packing>
-						  <property name="padding">0</property>
-						  <property name="expand">True</property>
-						  <property name="fill">True</property>
+						  <property name="type">label_item</property>
 						</packing>
 					      </child>
 					    </widget>
@@ -13341,19 +13323,6 @@
 					      <property name="fill">True</property>
 					    </packing>
 					  </child>
-					</widget>
-					<packing>
-					  <property name="padding">0</property>
-					  <property name="expand">False</property>
-					  <property name="fill">True</property>
-					</packing>
-				      </child>
-
-				      <child>
-					<widget class="GtkHBox" id="hbox313">
-					  <property name="visible">True</property>
-					  <property name="homogeneous">False</property>
-					  <property name="spacing">4</property>
 
 					  <child>
 					    <widget class="GtkFrame" id="frame_chronopic2">
@@ -13534,7 +13503,7 @@
 					      <child>
 						<widget class="GtkLabel" id="label673">
 						  <property name="visible">True</property>
-						  <property name="label">&lt;b&gt;Configure 2nd Chronopic&lt;/b&gt;</property>
+						  <property name="label">&lt;b&gt;2nd&lt;/b&gt;</property>
 						  <property name="use_underline">False</property>
 						  <property name="use_markup">True</property>
 						  <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -13954,6 +13923,23 @@
 					  <property name="pack_type">GTK_PACK_END</property>
 					</packing>
 				      </child>
+
+				      <child>
+					<widget class="GtkButton" id="button_multi_chronopic_start">
+					  <property name="visible">True</property>
+					  <property name="can_focus">True</property>
+					  <property name="label" translatable="yes">Start</property>
+					  <property name="use_underline">True</property>
+					  <property name="relief">GTK_RELIEF_NORMAL</property>
+					  <property name="focus_on_click">True</property>
+					  <signal name="clicked" handler="on_button_multi_chronopic_start_clicked" last_modification_time="Tue, 24 Mar 2009 23:07:49 GMT"/>
+					</widget>
+					<packing>
+					  <property name="padding">0</property>
+					  <property name="expand">True</property>
+					  <property name="fill">True</property>
+					</packing>
+				      </child>
 				    </widget>
 				    <packing>
 				      <property name="padding">0</property>
@@ -14575,7 +14561,7 @@
   <property name="title" translatable="yes">Chronopic port help</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
+  <property name="modal">True</property>
   <property name="resizable">False</property>
   <property name="destroy_with_parent">False</property>
   <property name="decorated">True</property>

Modified: trunk/src/execute/event.cs
==============================================================================
--- trunk/src/execute/event.cs	(original)
+++ trunk/src/execute/event.cs	Mon Mar 30 16:20:27 2009
@@ -52,7 +52,7 @@
 	//also for the graph creation	
 	protected bool needUpdateGraph;
 	protected enum eventType {
-		JUMP, JUMPREACTIVE, RUN, RUNINTERVAL, PULSE, REACTIONTIME
+		JUMP, JUMPREACTIVE, RUN, RUNINTERVAL, PULSE, REACTIONTIME, MULTICHRONOPIC
 	}
 	protected eventType needUpdateGraphType;
 
@@ -63,6 +63,7 @@
 	protected PrepareEventGraphRunInterval prepareEventGraphRunInterval;
 	protected PrepareEventGraphPulse prepareEventGraphPulse;
 	protected PrepareEventGraphReactionTime prepareEventGraphReactionTime;
+	protected PrepareEventGraphMultiChronopic prepareEventGraphMultiChronopic;
 	
 	protected bool needEndEvent;
 	
@@ -198,7 +199,7 @@
 			return false;
 		}
 		Thread.Sleep (50);
-		Log.Write(thread.ThreadState.ToString());
+		//Log.Write(thread.ThreadState.ToString());
 		return true;
 	}
 
@@ -372,6 +373,20 @@
 				eventExecuteWin.PrepareReactionTimeGraph(
 						prepareEventGraphReactionTime.time); 
 				break;
+			case eventType.MULTICHRONOPIC:
+				Log.Write("update graph: MULTICHRONOPIC");
+				eventExecuteWin.PrepareMultiChronopicGraph(
+						prepareEventGraphMultiChronopic.timestamp, 
+						prepareEventGraphMultiChronopic.cp1InStr, 
+						prepareEventGraphMultiChronopic.cp1OutStr,
+						prepareEventGraphMultiChronopic.cp2InStr, 
+						prepareEventGraphMultiChronopic.cp2OutStr,
+						prepareEventGraphMultiChronopic.cp3InStr, 
+						prepareEventGraphMultiChronopic.cp3OutStr,
+						prepareEventGraphMultiChronopic.cp4InStr, 
+						prepareEventGraphMultiChronopic.cp4OutStr
+						);
+				break;
 		}
 	}
 	

Modified: trunk/src/execute/jump.cs
==============================================================================
--- trunk/src/execute/jump.cs	(original)
+++ trunk/src/execute/jump.cs	Mon Mar 30 16:20:27 2009
@@ -82,8 +82,6 @@
 
 		//initialize eventDone as a Jump		
 		eventDone = new Jump();
-
-		//updateProgressBar = new UpdateProgressBar();
 	}
 	
 	public override void SimulateInitValues(Random randSent)
@@ -392,7 +390,6 @@
 		needUpdateGraphType = eventType.JUMP;
 		needUpdateGraph = true;
 		
-		//eventExecuteWin.EventEnded();
 		needEndEvent = true; //used for hiding some buttons on eventWindow
 	}
 	
@@ -496,8 +493,6 @@
 
 		//initialize eventDone as a JumpRj	
 		eventDone = new JumpRj();
-
-		//updateProgressBar = new UpdateProgressBar();
 	}
 
 	public override void Manage()

Modified: trunk/src/execute/multiChronopic.cs
==============================================================================
--- trunk/src/execute/multiChronopic.cs	(original)
+++ trunk/src/execute/multiChronopic.cs	Mon Mar 30 16:20:27 2009
@@ -29,36 +29,50 @@
 public class MultiChronopicExecute : EventExecute
 {
 	private Chronopic cp;
+	string cp1InStr;
+	string cp1OutStr;
 
 	//2nd Chronopic stuff
 	protected Thread thread2;
 	private Chronopic cp2;
 	private Chronopic.Plataforma platformState2;
 	protected States loggedState2;
+	string cp2InStr;
+	string cp2OutStr;
 	
 	//3rd Chronopic stuff
 	protected Thread thread3;
 	private Chronopic cp3;
 	private Chronopic.Plataforma platformState3;
 	protected States loggedState3;
+	string cp3InStr;
+	string cp3OutStr;
 	
 	//4th Chronopic stuff
 	protected Thread thread4;
 	private Chronopic cp4;
 	private Chronopic.Plataforma platformState4;
 	protected States loggedState4;
+	string cp4InStr;
+	string cp4OutStr;
 	
 
 	static bool firstValue = true;
 	int chronopics; 
 	
-
 	public MultiChronopicExecute() {
 	}
 
 	//execution
-	public MultiChronopicExecute(Chronopic cp, Gtk.Statusbar appbar, Gtk.Window app) {
+	public MultiChronopicExecute(EventExecuteWindow eventExecuteWin, int personID, string personName, int sessionID, 
+			Chronopic cp, Gtk.Statusbar appbar, Gtk.Window app) {
+		this.eventExecuteWin = eventExecuteWin;
+		this.personID = personID;
+		this.personName = personName;
+		this.sessionID = sessionID;
+		
 		this.cp = cp;
+		
 		this.appbar = appbar;
 		this.app = app;
 	
@@ -66,9 +80,16 @@
 		initValues();	
 	}
 	
-	public MultiChronopicExecute(Chronopic cp, Chronopic cp2, Gtk.Statusbar appbar, Gtk.Window app) {
+	public MultiChronopicExecute(EventExecuteWindow eventExecuteWin, int personID, string personName, int sessionID, 
+			Chronopic cp, Chronopic cp2, Gtk.Statusbar appbar, Gtk.Window app) {
+		this.eventExecuteWin = eventExecuteWin;
+		this.personID = personID;
+		this.personName = personName;
+		this.sessionID = sessionID;
+		
 		this.cp = cp;
 		this.cp2 = cp2;
+		
 		this.appbar = appbar;
 		this.app = app;
 	
@@ -76,10 +97,17 @@
 		initValues();	
 	}
 	
-	public MultiChronopicExecute(Chronopic cp, Chronopic cp2, Chronopic cp3, Gtk.Statusbar appbar, Gtk.Window app) {
+	public MultiChronopicExecute(EventExecuteWindow eventExecuteWin, int personID, string personName, int sessionID, 
+			Chronopic cp, Chronopic cp2, Chronopic cp3, Gtk.Statusbar appbar, Gtk.Window app) {
+		this.eventExecuteWin = eventExecuteWin;
+		this.personID = personID;
+		this.personName = personName;
+		this.sessionID = sessionID;
+		
 		this.cp = cp;
 		this.cp2 = cp2;
 		this.cp3 = cp3;
+		
 		this.appbar = appbar;
 		this.app = app;
 	
@@ -87,11 +115,18 @@
 		initValues();	
 	}
 
-	public MultiChronopicExecute(Chronopic cp, Chronopic cp2, Chronopic cp3, Chronopic cp4, Gtk.Statusbar appbar, Gtk.Window app) {
+	public MultiChronopicExecute(EventExecuteWindow eventExecuteWin, int personID, string personName, int sessionID, 
+			Chronopic cp, Chronopic cp2, Chronopic cp3, Chronopic cp4, Gtk.Statusbar appbar, Gtk.Window app) {
+		this.eventExecuteWin = eventExecuteWin;
+		this.personID = personID;
+		this.personName = personName;
+		this.sessionID = sessionID;
+		
 		this.cp = cp;
 		this.cp2 = cp2;
 		this.cp3 = cp3;
 		this.cp4 = cp4;
+		
 		this.appbar = appbar;
 		this.app = app;
 	
@@ -109,6 +144,7 @@
 	{
 	}
 
+	/*
 	//onTimer allow to update progressbar_time every 50 milliseconds
 	//also can change platform state in simulated mode
 	//protected void onTimer( Object source, ElapsedEventArgs e )
@@ -116,6 +152,7 @@
 	{
 		timerCount = timerCount + .05; //0,05 segons == 50 milliseconds, time between each call of onTimer
 	}
+	*/
 			
 
 	public override void Manage()
@@ -123,54 +160,38 @@
 		if(chronopics > 0) {
 			platformState = chronopicInitialValue(cp);
 		
-			string cpStr = "";
 			if (platformState==Chronopic.Plataforma.ON) {
-				cpStr = "cp1" + " " + "IN";
 				loggedState = States.ON;
 			} else {
-				cpStr = "cp1" + " " + "OUT";
 				loggedState = States.OFF;
 			}
-			appbar.Push( 1, cpStr);
 		
 			if(chronopics > 1) {
 				platformState2 = chronopicInitialValue(cp2);
 		
-				string cp2Str = "";
 				if (platformState2==Chronopic.Plataforma.ON) {
-					cp2Str = "cp2" + " " + "IN";
 					loggedState2 = States.ON;
 				} else {
-					cp2Str = "cp2" + " " + "OUT";
 					loggedState2 = States.OFF;
 				}
-				appbar.Push( 1, cpStr + " / " + cp2Str);
 
 				if(chronopics > 2) {
 					platformState3 = chronopicInitialValue(cp3);
 
-					string cp3Str = "";
 					if (platformState3==Chronopic.Plataforma.ON) {
-						cp3Str = "cp3" + " " + "IN";
 						loggedState3 = States.ON;
 					} else {
-						cp3Str = "cp3" + " " + "OUT";
 						loggedState3 = States.OFF;
 					}
-					appbar.Push( 1, cpStr + " / " + cp2Str + "/" + cp3Str);
 
 					if(chronopics > 3) {
 						platformState4 = chronopicInitialValue(cp4);
 
-						string cp4Str = "";
 						if (platformState4==Chronopic.Plataforma.ON) {
-							cp4Str = "cp4" + " " + "IN";
 							loggedState4 = States.ON;
 						} else {
-							cp4Str = "cp4" + " " + "OUT";
 							loggedState4 = States.OFF;
 						}
-						appbar.Push( 1, cpStr + " / " + cp2Str + "/" + cp3Str + "/" + cp4Str);
 					}
 				}
 			}
@@ -207,20 +228,24 @@
 
 	}
 
-	protected void waitEventPre () { waitEvent(cp, platformState, loggedState, "cp1"); }
+	protected void waitEventPre () { waitEvent(cp, platformState, loggedState, out cp1InStr, out cp1OutStr, 1); }
 	
-	protected void waitEventPre2 () { waitEvent(cp2, platformState2, loggedState2, "cp2"); }
+	protected void waitEventPre2 () { waitEvent(cp2, platformState2, loggedState2, out cp2InStr, out cp2OutStr, 2); }
 	
-	protected void waitEventPre3 () { waitEvent(cp3, platformState3, loggedState3, "cp3"); }
+	protected void waitEventPre3 () { waitEvent(cp3, platformState3, loggedState3, out cp3InStr, out cp3OutStr, 3); }
 	
-	protected void waitEventPre4 () { waitEvent(cp4, platformState4, loggedState4, "cp4"); }
+	protected void waitEventPre4 () { waitEvent(cp4, platformState4, loggedState4, out cp4InStr, out cp4OutStr, 4); }
 	
 	
-	protected void waitEvent (Chronopic myCP, Chronopic.Plataforma myPS, States myLS, string cpStr)
+	protected void waitEvent (Chronopic myCP, Chronopic.Plataforma myPS, States myLS, out string inStr, out string outStr, int cpNum)
 	{
 		double timestamp = 0;
 		bool success = false;
 		bool ok;
+		string inEqual = "";
+		string outEqual = "";
+		
+		inStr = ""; outStr = "";
 
 		do {
 			ok = myCP.Read_event(out timestamp, out myPS);
@@ -233,17 +258,38 @@
 				
 				//while no finished time or jumps, continue recording events
 				if ( ! success) {
-					//don't record the time until the first event
+					//don't record the time until the first event of the first Chronopic
 					if (firstValue) {
 						firstValue = false;
 						initializeTimer();
-					} else 
+					} else {
 						needSensitiveButtonFinish = true;
-						
-					if(myPS == Chronopic.Plataforma.ON && myLS == States.OFF)
-						Log.WriteLine(cpStr + " landed");
-					else if(myPS == Chronopic.Plataforma.OFF && myLS == States.ON)
-						Log.WriteLine(cpStr + " jumped");
+
+						if(myPS == Chronopic.Plataforma.ON && myLS == States.OFF) {
+							double lastOut = timestamp/1000.0;
+							Log.WriteLine(cpNum.ToString() + " landed: " + lastOut.ToString());
+							outStr = outStr + outEqual + lastOut.ToString();
+							outEqual = "="; 
+						}
+						else if(myPS == Chronopic.Plataforma.OFF && myLS == States.ON) {
+							double lastIn = timestamp/1000.0;
+							Log.WriteLine(cpNum.ToString() + " jumped: " + lastIn.ToString());
+							inStr = inStr + inEqual + lastIn.ToString();
+							inEqual = "="; 
+						}
+
+						prepareEventGraphMultiChronopic = new PrepareEventGraphMultiChronopic(timestamp/1000.0,
+								cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr);
+						needUpdateGraphType = eventType.MULTICHRONOPIC;
+						needUpdateGraph = true;
+					}
+
+					updateProgressBar = new UpdateProgressBar (
+							true, //isEvent
+							false, //means activity mode
+							-1 //don't show text
+							);
+					needUpdateEventProgressBar = true;
 
 				}
 
@@ -256,6 +302,7 @@
 		} while ( ! success && ! cancel && ! finish );
 	
 		if (finish) {
+			write();
 			totallyFinished = true;
 		}
 		if(cancel) {
@@ -282,6 +329,20 @@
 
 	protected override void write()
 	{
+		Log.WriteLine("----------WRITING----------");
+		Console.WriteLine("cp1 In:" + cp1InStr);
+		Console.WriteLine("cp1 Out:" + cp1OutStr + "\n");
+		Console.WriteLine("cp2 In:" + cp2InStr);
+		Console.WriteLine("cp2 Out:" + cp2OutStr + "\n");
+		Console.WriteLine("cp3 In:" + cp3InStr);
+		Console.WriteLine("cp3 Out:" + cp3OutStr + "\n");
+		Console.WriteLine("cp4 In:" + cp4InStr);
+		Console.WriteLine("cp4 Out:" + cp4OutStr + "\n");
+		
+		//event will be raised, and managed in chronojump.cs
+		fakeButtonFinished.Click();
+		
+		needEndEvent = true; //used for hiding some buttons on eventWindow
 	}
 	
 

Modified: trunk/src/gui/chronojump.cs
==============================================================================
--- trunk/src/gui/chronojump.cs	(original)
+++ trunk/src/gui/chronojump.cs	Mon Mar 30 16:20:27 2009
@@ -133,10 +133,7 @@
 	//[Widget] Gtk.Button button_pulse_more;
 
 	//multiChronopic	
-	[Widget] Gtk.Box vbox_multi_chronopic_selectors;
-	[Widget] Gtk.RadioButton radio_chronopics2;
-	[Widget] Gtk.RadioButton radio_chronopics3;
-	[Widget] Gtk.RadioButton radio_chronopics4;
+	[Widget] Gtk.Button button_multi_chronopic_start;
 	[Widget] Gtk.Frame frame_chronopic2;
 	[Widget] Gtk.Frame frame_chronopic3;
 	[Widget] Gtk.Frame frame_chronopic4;
@@ -149,6 +146,8 @@
 	[Widget] Gtk.Button button_connect_cp2;
 	[Widget] Gtk.Button button_connect_cp3;
 	[Widget] Gtk.Button button_connect_cp4;
+	[Widget] Gtk.Image image_cp1_yes;
+	[Widget] Gtk.Image image_cp1_no;
 	[Widget] Gtk.Image image_cp2_yes;
 	[Widget] Gtk.Image image_cp2_no;
 	[Widget] Gtk.Image image_cp3_yes;
@@ -609,7 +608,7 @@
 	}
 
 	//chronopic init should not touch  gtk, for the threads
-	private Chronopic chronopicInit (Chronopic myCp, SerialPort mySp, Chronopic.Plataforma myPS, string myPort, out string returnString, out bool success) 
+	private Chronopic chronopicInit (Chronopic myCp, out SerialPort mySp, Chronopic.Plataforma myPS, string myPort, out string returnString, out bool success) 
 	{
 		Log.WriteLine ( Catalog.GetString ("starting connection with chronopic") );
 		if(Util.IsWindows())
@@ -617,10 +616,10 @@
 
 		success = true;
 		
+		Log.WriteLine("+++++++++++++++++ 1 ++++++++++++++++");		
+		Log.WriteLine(string.Format("chronopic port: {0}", myPort));
+		mySp = new SerialPort(myPort);
 		try {
-			Log.WriteLine("+++++++++++++++++ 1 ++++++++++++++++");		
-			Log.WriteLine(string.Format("chronopic port: {0}", myPort));
-			mySp = new SerialPort(myPort);
 			mySp.Open();
 			Log.WriteLine("+++++++++++++++++ 2 ++++++++++++++++");		
 			//-- Create chronopic object, for accessing chronopic
@@ -1663,15 +1662,17 @@
 
 	private void createComboMultiChronopic() 
 	{
-		vbox_multi_chronopic_selectors.Sensitive = false;
-
-		radio_chronopics3.Sensitive = false;
-		radio_chronopics4.Sensitive = false;
+		button_multi_chronopic_start.Sensitive = false;
 
 		frame_chronopic2.Sensitive = false;
 		frame_chronopic3.Sensitive = false;
 		frame_chronopic4.Sensitive = false;
+			
+		button_connect_cp2.Sensitive = false;
+		button_connect_cp3.Sensitive = false;
+		button_connect_cp4.Sensitive = false;
 		
+		image_cp1_yes.Hide();
 		image_cp2_yes.Hide();
 		image_cp3_yes.Hide();
 		image_cp4_yes.Hide();
@@ -1688,6 +1689,10 @@
 			UtilGtk.ComboUpdate(combo_port_windows2, comboWindowsOptions, comboWindowsOptions[0]);
 			UtilGtk.ComboUpdate(combo_port_windows3, comboWindowsOptions, comboWindowsOptions[0]);
 			UtilGtk.ComboUpdate(combo_port_windows4, comboWindowsOptions, comboWindowsOptions[0]);
+			
+			combo_port_windows2.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+			combo_port_windows3.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+			combo_port_windows4.Changed += new EventHandler (on_combo_multi_chronopic_changed);
 		} else {
 			combo_port_windows2.Hide();
 			combo_port_windows3.Hide();
@@ -1699,6 +1704,10 @@
 			combo_port_linux3.Active = 0; //first option
 			UtilGtk.ComboUpdate(combo_port_linux4, Constants.ComboPortLinuxOptions, Constants.ComboPortLinuxOptions[0]);
 			combo_port_linux4.Active = 0; //first option
+		
+			combo_port_linux2.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+			combo_port_linux3.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+			combo_port_linux4.Changed += new EventHandler (on_combo_multi_chronopic_changed);
 		}
 	}
 
@@ -1764,25 +1773,32 @@
 		fillTreeView_pulses(myText);
 	}
 
-	void on_radio_multi_chronopics_toggled (object o, EventArgs args) {
-		//if there's no first chronopic working, don't allow others to be connected
-		if(!cpRunning) {
-			frame_chronopic3.Sensitive = false;
-			frame_chronopic4.Sensitive = false;
+	private void on_combo_multi_chronopic_changed(object o, EventArgs args) {
+		ComboBox combo = o as ComboBox;
+		if (o == null)
 			return;
-		} else {
-			if(radio_chronopics2.Active) {
-				frame_chronopic3.Sensitive = false;
-				frame_chronopic4.Sensitive = false;
-			} else if(radio_chronopics3.Active) {
-				frame_chronopic3.Sensitive = true;
-				frame_chronopic4.Sensitive = false;
-			} else if(radio_chronopics4.Active) {
-				frame_chronopic3.Sensitive = true;
-				frame_chronopic4.Sensitive = true;
-			}
-		}
+		
+		bool portOk = true;
+		if(UtilGtk.ComboGetActive(combo) == Constants.ChronopicDefaultPortWindows ||
+				UtilGtk.ComboGetActive(combo) == Constants.ChronopicDefaultPortLinux) 
+			portOk = false;
+
+		if (o == combo_port_linux2) 
+			button_connect_cp2.Sensitive = portOk;
+		if (o == combo_port_linux3) 
+			button_connect_cp3.Sensitive = portOk;
+		if (o == combo_port_linux4) 
+			button_connect_cp4.Sensitive = portOk;
+
+		if (o == combo_port_windows2) 
+			button_connect_cp2.Sensitive = portOk;
+		if (o == combo_port_windows3) 
+			button_connect_cp3.Sensitive = portOk;
+		if (o == combo_port_windows4) 
+			button_connect_cp4.Sensitive = portOk;
+
 	}
+	
 
 	/* ---------------------------------------------------------
 	 * ----------------  DELETE EVENT, QUIT  -----------------------
@@ -2225,16 +2241,20 @@
 		if(menuitem_simulated.Active) {
 			Log.WriteLine("RadioSimulated - ACTIVE");
 			simulated = true;
+Log.WriteLine("sqli start");
 			SqlitePreferences.Update("simulated", simulated.ToString(), false);
+Log.WriteLine("sqli end");
 
 			//close connection with chronopic if initialized
 			if(cpRunning) {
 				sp.Close();
 			}
+Log.WriteLine("cpclosed");
 			cpRunning = false;
 		}
 		else
 			Log.WriteLine("RadioSimulated - INACTIVE");
+Log.WriteLine("all done");
 	}
 	
 	void on_radiobutton_chronopic (object o, EventArgs args)
@@ -2292,12 +2312,22 @@
 		bool success = false;
 
 		if(currentCp == 1) {
-			cp = chronopicInit(cp, sp, platformState, chronopicPort, out message, out success);
+			cp = chronopicInit(cp, out sp, platformState, chronopicPort, out message, out success);
 			if(success) {
-				vbox_multi_chronopic_selectors.Sensitive = true;
+				image_cp1_no.Hide();
+				image_cp1_yes.Show();
+				button_multi_chronopic_start.Sensitive = true;
 				frame_chronopic2.Sensitive = true;
+				//disallow selection of that port for other chronopics
+				UtilGtk.ComboDelThisValue(combo_port_linux2, chronopicPort);
+				UtilGtk.ComboDelThisValue(combo_port_linux3, chronopicPort);
+				UtilGtk.ComboDelThisValue(combo_port_linux4, chronopicPort);
+
 			} else {
-				vbox_multi_chronopic_selectors.Sensitive = false;
+				image_cp1_no.Show();
+				image_cp1_yes.Hide();
+				button_multi_chronopic_start.Sensitive = false;
+				//allow to connect next chronopic
 				frame_chronopic2.Sensitive = false;
 			}
 		}
@@ -2306,14 +2336,18 @@
 				myPort = UtilGtk.ComboGetActive(combo_port_windows2);
 			else
 				myPort = UtilGtk.ComboGetActive(combo_port_linux2);
-			cp2 = chronopicInit(cp2, sp2, platformState2, myPort, out message, out success);
+			cp2 = chronopicInit(cp2, out sp2, platformState2, myPort, out message, out success);
 			if(success) {
 				image_cp2_no.Hide();
 				image_cp2_yes.Show();
 				combo_port_linux2.Sensitive = false;
 				combo_port_windows2.Sensitive = false;
 				button_connect_cp2.Sensitive = false;
-				radio_chronopics3.Sensitive = true;
+				//allow to connect next chronopic
+				frame_chronopic3.Sensitive = true;
+				//disallow selection of that port for other chronopics
+				UtilGtk.ComboDelThisValue(combo_port_linux3, myPort);
+				UtilGtk.ComboDelThisValue(combo_port_linux4, myPort);
 			} 
 		}
 		else if(currentCp == 3) {
@@ -2321,14 +2355,17 @@
 				myPort = UtilGtk.ComboGetActive(combo_port_windows3);
 			else
 				myPort = UtilGtk.ComboGetActive(combo_port_linux3);
-			cp3 = chronopicInit(cp3, sp3, platformState3, myPort, out message, out success);
+			cp3 = chronopicInit(cp3, out sp3, platformState3, myPort, out message, out success);
 			if(success) {
 				image_cp3_no.Hide();
 				image_cp3_yes.Show();
 				combo_port_linux3.Sensitive = false;
 				combo_port_windows3.Sensitive = false;
 				button_connect_cp3.Sensitive = false;
-				radio_chronopics4.Sensitive = true;
+				//allow to connect next chronopic
+				frame_chronopic4.Sensitive = true;
+				//disallow selection of that port for other chronopics
+				UtilGtk.ComboDelThisValue(combo_port_linux4, myPort);
 			} 
 		}
 		else if(currentCp == 4) {
@@ -2336,7 +2373,7 @@
 				myPort = UtilGtk.ComboGetActive(combo_port_windows4);
 			else
 				myPort = UtilGtk.ComboGetActive(combo_port_linux4);
-			cp4 = chronopicInit(cp4, sp4, platformState4, myPort, out message, out success);
+			cp4 = chronopicInit(cp4, out sp4, platformState4, myPort, out message, out success);
 			if(success) {
 				image_cp4_no.Hide();
 				image_cp4_yes.Show();
@@ -3864,12 +3901,22 @@
 				cp, appbar2, app1, prefsDigitsNumber, volumeOn);
 				*/
 
-		if(image_cp2_yes.Visible && image_cp3_no.Visible)
-			currentEventExecute = new MultiChronopicExecute(cp, cp2, appbar2, app1);
+		if(image_cp2_no.Visible)
+			currentEventExecute = new MultiChronopicExecute(
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, 
+					cp, appbar2, app1);
+		else if(image_cp2_yes.Visible && image_cp3_no.Visible)
+			currentEventExecute = new MultiChronopicExecute(
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, 
+					cp, cp2, appbar2, app1);
 		else if(image_cp3_yes.Visible && image_cp4_no.Visible)
-			currentEventExecute = new MultiChronopicExecute(cp, cp2, cp3, appbar2, app1);
+			currentEventExecute = new MultiChronopicExecute(
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, 
+					cp, cp2, cp3, appbar2, app1);
 		else if(image_cp4_yes.Visible)
-			currentEventExecute = new MultiChronopicExecute(cp, cp2, cp3, cp4, appbar2, app1);
+			currentEventExecute = new MultiChronopicExecute(
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, 
+					cp, cp2, cp3, cp4, appbar2, app1);
 
 		//if(simulated)	
 		//	currentEventExecute.SimulateInitValues(rand);

Modified: trunk/src/gui/eventExecute.cs
==============================================================================
--- trunk/src/gui/eventExecute.cs	(original)
+++ trunk/src/gui/eventExecute.cs	Mon Mar 30 16:20:27 2009
@@ -860,6 +860,60 @@
 		drawingarea.QueueDraw();
 	}
 	
+	// multi chronopic 
+	public void PrepareMultiChronopicGraph(double timestamp, 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
+		if(eventGraphConfigureWin == null)
+			eventGraphConfigureWin = EventGraphConfigureWindow.Show(false);
+
+		//search MAX 
+		double maxValue = 0;
+		int topMargin = 10;
+		//if max value of graph is automatic
+		if(eventGraphConfigureWin.Max == -1) 
+			maxValue = timestamp;
+			/*
+			maxValue = Util.GetMax(
+					cp1InString + "=" + cp1OutStr + "=" + cp2InString + "=" + cp2OutStr + "=" +
+					cp3InString + "=" + cp3OutStr + "=" + cp4InString + "=" + cp4OutStr);
+					*/
+		else {
+			maxValue = eventGraphConfigureWin.Max; //TODO
+			topMargin = 0;
+		}
+			
+		//search MIN 
+		double minValue = 1000;
+		int bottomMargin = 10;
+		//if min value of graph is automatic
+		if(eventGraphConfigureWin.Min == -1) 
+			minValue = 0;
+		/*
+			minValue = Util.GetMin(
+					cp1InString + "=" + cp1OutStr + "=" + cp2InString + "=" + cp2OutStr + "=" +
+					cp3InString + "=" + cp3OutStr + "=" + cp4InString + "=" + cp4OutStr);
+					*/
+		else {
+			minValue = eventGraphConfigureWin.Min; //TODO
+			bottomMargin = 0;
+		}
+			
+		/*
+		int cols = Util.GetNumberOfJumps(
+				cp1InString + "=" + cp2InString + "=" + cp3InString + "=" + cp4InString, true); 
+				*/
+
+		//paint graph
+		paintMultiChronopic (drawingarea, timestamp, 
+				cp1InStr, cp1OutStr, cp2InStr, cp2OutStr, cp3InStr, cp3OutStr, cp4InStr, cp4OutStr, 
+				maxValue, minValue, topMargin, bottomMargin);
+		
+		// -- refresh
+		drawingarea.QueueDraw();
+	}
+	
 
 	private void printLabelsJumpSimple (double tvNow, double tvPerson, double tvSession, double tcNow, double tcPerson, double tcSession) {
 		if(tcNow > 0) {
@@ -1318,6 +1372,105 @@
 	}
 
 
+	//TODO: fix this method
+	private void paintMultiChronopic (Gtk.DrawingArea drawingarea, double timestamp, 
+			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);
+
+			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)
+				return;
+
+			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);
+
+						pixmap.DrawLine(pen_azul, //blue for time
+								Convert.ToInt32(xOld), 30,
+								Convert.ToInt32(x), 30);
+
+				/*
+				//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;
+				}
+
+				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);
+
+
+					timeOld = myTimeDouble;
+					xOld = x;
+				}
+
+
+				count ++;
+			}
+		
+//			drawCircleAndWriteValue(pen_azul, myTimeDouble, --count, pulses, ancho, alto, maxValue, minValue, topMargin, bottomMargin);
+
+		}
+	
+	/*	
+		label_pulse_now.Text = Util.TrimDecimals(lastTime.ToString(), pDN);
+		label_pulse_avg.Text = Util.TrimDecimals(avgTime.ToString(), pDN);
+		*/
+		
+		graphProgress = phasesGraph.DONE; 
+	}
+
+
 	private void drawCircleAndWriteValue (Gdk.GC myPen, double myValue, int count, int total, int ancho, int alto, 
 			double maxValue, double minValue, int topMargin, int bottomMargin) {
 

Modified: trunk/src/prepareEventGraphObjects.cs
==============================================================================
--- trunk/src/prepareEventGraphObjects.cs	(original)
+++ trunk/src/prepareEventGraphObjects.cs	Mon Mar 30 16:20:27 2009
@@ -122,3 +122,33 @@
 	~PrepareEventGraphReactionTime() {}
 }
 
+public class PrepareEventGraphMultiChronopic {
+	public double timestamp;
+	public string cp1InStr;
+	public string cp1OutStr;
+	public string cp2InStr;
+	public string cp2OutStr;
+	public string cp3InStr;
+	public string cp3OutStr;
+	public string cp4InStr;
+	public string cp4OutStr;
+
+	public PrepareEventGraphMultiChronopic() {
+	}
+
+	public PrepareEventGraphMultiChronopic(double timestamp, string cp1InStr, string cp1OutStr, string cp2InStr, string cp2OutStr, 
+			string cp3InStr, string cp3OutStr, string cp4InStr, string cp4OutStr) {
+		this.timestamp = timestamp;
+		this.cp1InStr = cp1InStr;
+		this.cp1OutStr = cp1OutStr;
+		this.cp2InStr = cp2InStr;
+		this.cp2OutStr = cp2OutStr;
+		this.cp3InStr = cp3InStr;
+		this.cp3OutStr = cp3OutStr;
+		this.cp4InStr = cp4InStr;
+		this.cp4OutStr = cp4OutStr;
+	}
+
+	~PrepareEventGraphMultiChronopic() {}
+}
+

Modified: trunk/src/utilGtk.cs
==============================================================================
--- trunk/src/utilGtk.cs	(original)
+++ trunk/src/utilGtk.cs	Mon Mar 30 16:20:27 2009
@@ -79,7 +79,7 @@
 		return returnValue;
 	}
 
-	private static void comboDel(ComboBox myCombo) {
+	private static void comboDelAll(ComboBox myCombo) {
 		//myCombo = ComboBox.NewText(); don't work
 		TreeIter myIter;
 		while(myCombo.Model.GetIterFirst(out myIter)) {
@@ -87,10 +87,24 @@
 		}
 	}
 
+	public static void ComboDelThisValue(ComboBox myCombo, string toRemove) {
+		int i=0;
+		TreeIter iter;
+		myCombo.Model.GetIterFirst(out iter);
+		do {
+			string str = (string) myCombo.Model.GetValue (iter, 0);
+			if(str == toRemove) {
+				myCombo.RemoveText(i);
+				return;
+			}
+			i++;
+		} while (myCombo.Model.IterNext (ref iter));
+	}
+
 	//if there's no default value, simply pass a "" and there will be returned a 0, that's the first value of combo
 	public static int ComboUpdate(ComboBox myCombo, string [] myData, string strDefault) {
 		//1stdelete combo values
-		comboDel(myCombo);
+		comboDelAll(myCombo);
 
 		//2nd put new values
 		int i=0;
@@ -107,7 +121,7 @@
 	//when only one value has to be displayed
 	public static void ComboUpdate(ComboBox myCombo, string myData) {
 		//1stdelete combo values
-		comboDel(myCombo);
+		comboDelAll(myCombo);
 
 		//2nd put new values
 		myCombo.AppendText (myData);



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