[chronojump] report allows seing graph of any stat



commit c473c0f7835a68d967ca84ba27ae76c7d3918017
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Sep 4 14:36:21 2009 +0200

    report allows seing graph of any stat
    improved report gui
    fixed more licensing notes

 build/debian/copyright                     |    2 +-
 chronojump_server/bin/chronojumpServer.dll |  Bin 273408 -> 273408 bytes
 chronopic-tests/chronopic-serial-conf.c    |   21 +++-
 chronopic-tests/chronopic.c                |   19 +++-
 chronopic-tests/chronopic.cs               |   22 +++-
 chronopic-tests/termansi.c                 |   19 +++-
 chronopic-tests/termansi.h                 |   18 ++++
 chronopic-tests/test-precision.c           |   21 +++-
 chronopic-tests/test-saltos.c              |   23 +++-
 chronopic-tests/test-saltos.mono.cs        |   19 +++-
 chronopic-tests/test-tramas.c              |   22 +++-
 chronopic-tests/test.cs                    |   17 +++
 glade/chronojump.glade                     |  153 +++++++++++++++++++++++++--
 src/exportSession.cs                       |    4 +-
 src/gui/report.cs                          |  110 +++++++++++++++-----
 src/gui/stats.cs                           |    1 -
 src/report.cs                              |   92 +++++++++--------
 src/statType.cs                            |    2 -
 src/util.cs                                |    9 ++
 19 files changed, 460 insertions(+), 114 deletions(-)
---
diff --git a/build/debian/copyright b/build/debian/copyright
index 5ddf327..1e35848 100644
--- a/build/debian/copyright
+++ b/build/debian/copyright
@@ -9,7 +9,7 @@ Copyright: 2004-2009, Xavier de Blas <xaviblas gmail com>
 License: GPL-2+
 
 Files: chronopic-test/*
-Copyright: 2005 Juan Gonzalez Gomez
+Copyright: 1997, 2004-2005 Juan Gonzalez Gomez
 License: GPL-2+
 
 Files: chronopic-test/termansi.*
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 62d5ceb..26ec66a 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/chronopic-tests/chronopic-serial-conf.c b/chronopic-tests/chronopic-serial-conf.c
index 0c7ae7b..c4dd650 100644
--- a/chronopic-tests/chronopic-serial-conf.c
+++ b/chronopic-tests/chronopic-serial-conf.c
@@ -1,6 +1,22 @@
+/*
+ * Copyright (C) 2004  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /***************************************************************************/
 /* chronopic-serial-conf.c                                                 */
-/* (c) Juan Gonzalez. 2004                                                 */
 /*-------------------------------------------------------------------------*/
 /* Configurar el puerto serie para trabajar con chronopic                  */
 /* Este programa tiene las siguientes funciones:                           */
@@ -15,9 +31,6 @@
 /*                                                                         */
 /*  2) Tener disponibles las funciones en C, para poderlas utilizar        */
 /*     desde otros programas en C, o crear una libreria especifica         */
-/*-------------------------------------------------------------------------*/
-/* Licencia GPL                                                            */
-/***************************************************************************/
 /*-------------------------------------------------------------------------
  $Id: chronopic-serial-conf.c,v 1.1 2005/02/07 11:14:54 obijuan Exp $
  $Revision: 1.1 $
diff --git a/chronopic-tests/chronopic.c b/chronopic-tests/chronopic.c
index 0cb83b7..3055216 100644
--- a/chronopic-tests/chronopic.c
+++ b/chronopic-tests/chronopic.c
@@ -1,5 +1,20 @@
-/***********************************************************/
-/* chronopic.c        Juan Gonzalez Gomez. Febrero 2005    */
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /*---------------------------------------------------------*/
 /* Funciones de acceso a chronopic                         */
 /* Licencia GPL                                            */
diff --git a/chronopic-tests/chronopic.cs b/chronopic-tests/chronopic.cs
index 911ded4..617c8d6 100644
--- a/chronopic-tests/chronopic.cs
+++ b/chronopic-tests/chronopic.cs
@@ -1,8 +1,20 @@
-/**********************************************/
-/* chronopic.cs        Juan Gonzalez Gomez.   */
-/*--------------------------------------------*/
-/* Licencia GPL                               */
-/**********************************************/
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /*------------------------------------------------------------------------
  $Id: chronopic.cs,v 1.1 2005/02/07 11:14:54 obijuan Exp $
  $Revision: 1.1 $
diff --git a/chronopic-tests/termansi.c b/chronopic-tests/termansi.c
index c3a7198..97227f5 100644
--- a/chronopic-tests/termansi.c
+++ b/chronopic-tests/termansi.c
@@ -1,5 +1,20 @@
-/************************************************************************/
-/*  TERMANS.C.  (C) Grupo J&J. Noviembre 1997.                          */
+/*
+ * Copyright (C) 1997  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /* -------------------------------------------------------------------- */
 /*  Funciones para actuar sobre terminales ansi: cambiar el color,      */
 /*  borrar la pantalla...                                               */
diff --git a/chronopic-tests/termansi.h b/chronopic-tests/termansi.h
index 94779ca..8c7a198 100644
--- a/chronopic-tests/termansi.h
+++ b/chronopic-tests/termansi.h
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 1997  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
 #define NEGRO    0
 #define AZUL     4
 #define VERDE    2
diff --git a/chronopic-tests/test-precision.c b/chronopic-tests/test-precision.c
index 1b2cc26..ea6859c 100644
--- a/chronopic-tests/test-precision.c
+++ b/chronopic-tests/test-precision.c
@@ -1,13 +1,26 @@
-/***************************************************************************/
-/* test-precision.c (c) Juan Gonzalez.  Febrero 2005                       */
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /*-------------------------------------------------------------------------*/
 /* Comprobacion de la precision de Chronopic. Se mide mide el periodo y la */
 /* frecuencia de senales cuadradas aplicadas a Chronopic. De esta manera   */
 /* se puede comprobar cual es la precision en la medida                    */
 /*   Sirve para validar Chronopic                                          */
 /*-------------------------------------------------------------------------*/
-/* Licencia GPL                                                            */
-/***************************************************************************/
 /*-------------------------------------------------------------------------
  $Id: test-precision.c,v 1.1 2005/02/07 11:14:54 obijuan Exp $
  $Revision: 1.1 $
diff --git a/chronopic-tests/test-saltos.c b/chronopic-tests/test-saltos.c
index d090137..fde33b5 100644
--- a/chronopic-tests/test-saltos.c
+++ b/chronopic-tests/test-saltos.c
@@ -1,11 +1,22 @@
-/***************************************************************************/
-/* test-saltos.c (c) Juan Gonzalez.  Febrero 2005                          */
-/*-------------------------------------------------------------------------*/
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /* Pruebas de medidion de saltos. Se mide el tiempo de vuelo de los saltos */
 /* realizados, mostrandose los resultados por la pantalla                  */
-/*-------------------------------------------------------------------------*/
-/* Licencia GPL                                                            */
-/***************************************************************************/
 /*-------------------------------------------------------------------------
  $Id: test-saltos.c,v 1.1 2005/02/07 11:14:54 obijuan Exp $
  $Revision: 1.1 $
diff --git a/chronopic-tests/test-saltos.mono.cs b/chronopic-tests/test-saltos.mono.cs
index 461c433..0bd95b5 100644
--- a/chronopic-tests/test-saltos.mono.cs
+++ b/chronopic-tests/test-saltos.mono.cs
@@ -1,5 +1,20 @@
-/***********************************************************/
-/* test-saltos.mono    Juan Gonzalez Gomez. Febrero 2005   */
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /*---------------------------------------------------------*/
 /* Medir el tiempo de vuelo de los saltos                  */
 /* Licencia GPL                                            */
diff --git a/chronopic-tests/test-tramas.c b/chronopic-tests/test-tramas.c
index 60b22e8..1409e85 100644
--- a/chronopic-tests/test-tramas.c
+++ b/chronopic-tests/test-tramas.c
@@ -1,12 +1,24 @@
-/***************************************************************************/
-/* test-tramas.c                                                           */
-/* (c) Juan Gonzalez. 2005                                                 */
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 /*-------------------------------------------------------------------------*/
 /* Visualizacion de las tramas enviadas por ChronoPic. Es muy util para    */
 /* hacer pruebas y comprobar si el hardware esta funcionando correctamente */
 /*-------------------------------------------------------------------------*/
-/* Licencia GPL                                                            */
-/***************************************************************************/
 /*-------------------------------------------------------------------------
  $Id: test-tramas.c,v 1.1 2005/02/07 11:14:54 obijuan Exp $
  $Revision: 1.1 $
diff --git a/chronopic-tests/test.cs b/chronopic-tests/test.cs
index a166da6..52fed6a 100644
--- a/chronopic-tests/test.cs
+++ b/chronopic-tests/test.cs
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2005  Juan Gonzalez Gomez
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
 using System;
 using System.Collections;
 using Gtk;
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index b3aa0a5..043182a 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -7908,8 +7908,6 @@ suitable for agility tests)</property>
 
 <widget class="GtkWindow" id="report_window">
   <property name="border_width">10</property>
-  <property name="width_request">550</property>
-  <property name="height_request">420</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">Chronojump Report window</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -8418,6 +8416,7 @@ suitable for agility tests)</property>
 
 		  <child>
 		    <widget class="GtkScrolledWindow" id="scrolledwindow21">
+		      <property name="width_request">400</property>
 		      <property name="visible">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
@@ -8485,19 +8484,149 @@ suitable for agility tests)</property>
 			  </child>
 
 			  <child>
-			    <widget class="GtkAlignment" id="alignment_button_delete">
+			    <widget class="GtkButton" id="button_graph">
 			      <property name="visible">True</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</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">0</property>
-			      <property name="right_padding">0</property>
+			      <property name="tooltip" translatable="yes">Graph this statistic</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_graph_clicked" last_modification_time="Sat, 19 Feb 2005 17:36:34 GMT"/>
 
 			      <child>
-				<placeholder/>
+				<widget class="GtkAlignment" id="alignment146">
+				  <property name="visible">True</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xscale">0</property>
+				  <property name="yscale">0</property>
+				  <property name="top_padding">0</property>
+				  <property name="bottom_padding">0</property>
+				  <property name="left_padding">0</property>
+				  <property name="right_padding">0</property>
+
+				  <child>
+				    <widget class="GtkHBox" id="hbox377">
+				      <property name="visible">True</property>
+				      <property name="homogeneous">False</property>
+				      <property name="spacing">2</property>
+
+				      <child>
+					<widget class="GtkImage" id="image_report_win_graph">
+					  <property name="visible">True</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">False</property>
+					  <property name="fill">False</property>
+					</packing>
+				      </child>
+
+				      <child>
+					<widget class="GtkLabel" id="label773">
+					  <property name="visible">True</property>
+					  <property name="label" translatable="yes">See graph</property>
+					  <property name="use_underline">True</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>
+				    </widget>
+				  </child>
+				</widget>
+			      </child>
+			    </widget>
+			  </child>
+
+			  <child>
+			    <widget class="GtkButton" id="button_add_comment">
+			      <property name="visible">True</property>
+			      <property name="can_default">True</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_add_comment_clicked" last_modification_time="Fri, 04 Sep 2009 12:27:28 GMT"/>
+
+			      <child>
+				<widget class="GtkAlignment" id="alignment147">
+				  <property name="visible">True</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xscale">0</property>
+				  <property name="yscale">0</property>
+				  <property name="top_padding">0</property>
+				  <property name="bottom_padding">0</property>
+				  <property name="left_padding">0</property>
+				  <property name="right_padding">0</property>
+
+				  <child>
+				    <widget class="GtkHBox" id="hbox378">
+				      <property name="visible">True</property>
+				      <property name="homogeneous">False</property>
+				      <property name="spacing">2</property>
+
+				      <child>
+					<widget class="GtkImage" id="image4481">
+					  <property name="visible">True</property>
+					  <property name="stock">gtk-edit</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">False</property>
+					  <property name="fill">False</property>
+					</packing>
+				      </child>
+
+				      <child>
+					<widget class="GtkLabel" id="label774">
+					  <property name="visible">True</property>
+					  <property name="label" translatable="yes">Add comment</property>
+					  <property name="use_underline">True</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>
+				    </widget>
+				  </child>
+				</widget>
 			      </child>
 			    </widget>
 			  </child>
diff --git a/src/exportSession.cs b/src/exportSession.cs
index 18306e8..a4d6c0f 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -43,8 +43,8 @@ public class ExportSession
 	protected string fileName;
 	
 	protected int prefsDigitsNumber;
-	protected bool heightPreferred;
-	protected bool weightStatsPercent;
+	public bool heightPreferred;
+	public bool weightStatsPercent;
 					
 	protected string spreadsheetString;
 
diff --git a/src/gui/report.cs b/src/gui/report.cs
index a920cd3..7307015 100644
--- a/src/gui/report.cs
+++ b/src/gui/report.cs
@@ -46,18 +46,19 @@ public class ReportWindow {
 	[Widget] Gtk.CheckButton cb_runs_interval_with_subruns;
 	[Widget] Gtk.CheckButton cb_reaction_times;
 	[Widget] Gtk.CheckButton cb_pulses;
+	[Widget] Gtk.Image image_report_win_graph;
 	[Widget] Gtk.Image image_report_win_report;
 	
 	static ReportWindow ReportWindowBox;
 
 	Gtk.Window parent;
 	
-	//protected int sessionID;
+	//private int sessionID;
 
 	Report report;
 
 	
-	protected ReportWindow () {
+	private ReportWindow () {
 	}
 
 	ReportWindow (Gtk.Window parent, Report report ) {
@@ -115,11 +116,14 @@ public class ReportWindow {
 	}
 
 	private void putNonStandardIcons() {
-		Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_task-assigned.png");
+		Pixbuf pixbuf;
+		pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "gpm-statistics.png");
+		image_report_win_graph.Pixbuf = pixbuf;
+		pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_task-assigned.png");
 		image_report_win_report.Pixbuf = pixbuf;
 	}
 	
-	protected void createTreeView (Gtk.TreeView tv) {
+	private void createTreeView (Gtk.TreeView tv) {
 		tv.HeadersVisible=true;
 		int count = 0;
 		tv.AppendColumn ( Catalog.GetString("Type"), new CellRendererText(), "text", count++);
@@ -202,7 +206,7 @@ public class ReportWindow {
 		report_window.Show ();
 	}
 	
-	protected virtual void on_cb_jumps_reactive_clicked (object o, EventArgs args) {
+	private void on_cb_jumps_reactive_clicked (object o, EventArgs args) {
 		if(cb_jumps_reactive.Active) {
 			cb_jumps_reactive_with_subjumps.Show();
 		} else {
@@ -210,7 +214,7 @@ public class ReportWindow {
 		}
 	}
 
-	protected virtual void on_cb_runs_interval_clicked (object o, EventArgs args) {
+	private void on_cb_runs_interval_clicked (object o, EventArgs args) {
 		if(cb_runs_interval.Active) {
 			cb_runs_interval_with_subruns.Show();
 		} else {
@@ -218,7 +222,7 @@ public class ReportWindow {
 		}
 	}
 
-	protected virtual void onSelectionEntry (object o, EventArgs args)
+	private void onSelectionEntry (object o, EventArgs args)
 	{
 		//TreeView tv = (TreeView) o;
 		TreeModel model;
@@ -231,7 +235,7 @@ public class ReportWindow {
 		}
 	}
 	
-	protected virtual void on_button_up_clicked (object o, EventArgs args) {
+	private void on_button_up_clicked (object o, EventArgs args) {
 		if(selected)
 		{
 			TreeModel model;
@@ -251,7 +255,7 @@ public class ReportWindow {
 		}
 	}
 	
-	protected virtual void on_button_down_clicked (object o, EventArgs args) {
+	private void on_button_down_clicked (object o, EventArgs args) {
 		if(selected)
 		{
 			TreeModel model;
@@ -271,7 +275,61 @@ public class ReportWindow {
 		}
 	}
 	
-	protected virtual void on_button_delete_clicked (object o, EventArgs args) {
+	private void on_button_graph_clicked (object o, EventArgs args) {
+		if(selected)
+		{
+			TreeModel model;
+			TreeIter iter1; 
+
+			if (treeview1.Selection.GetSelected (out model, out iter1)) {
+				string str=getRow(iter1);
+				string [] statRow = str.ToString().Split(new char[] {'\t'});
+			
+				string subType;
+				int rj_evolution_mark_consecutives = report.GetRjEvolutionMarkConsecutives(statRow[1], out subType);
+			
+				ArrayList sendSelectedSessions = report.GetSelectedSessions(statRow[3]);
+
+				Gtk.TreeView treeviewFake = new Gtk.TreeView(); //not needed for graph
+						
+				bool showSex = Util.StringToBool(statRow[5]);
+			
+				int limit = -1;
+				int statsJumpsType = report.GetStatsJumpTypeAndLimit(statRow[4], out limit);
+
+				ArrayList arrayListMarkedRows = Util.StringToArrayList(statRow[6], ':');
+
+				GraphROptions graphROptions = new GraphROptions(statRow[7]);
+
+				StatType myStatType = new StatType(
+						statRow[0], 		//statisticType
+						subType,
+						statRow[2], 		//statisticApplyTo,
+						treeviewFake, 
+						sendSelectedSessions, 
+						3, 			//prefsDigitsNumber, don't care, it's a graph
+						showSex,
+						statsJumpsType, 
+						limit, 	
+						report.heightPreferred, 
+						report.weightStatsPercent, 
+						arrayListMarkedRows,
+						rj_evolution_mark_consecutives,
+						graphROptions,
+						true,	//graph
+						false  //always false in this class
+						);
+				myStatType.ChooseStat();
+			}
+		
+		}
+	}
+	
+	private void on_button_add_comment_clicked (object o, EventArgs args) {
+		new DialogMessage(Constants.MessageTypes.INFO, "not implemented yet");
+	}
+
+	private void on_button_delete_clicked (object o, EventArgs args) {
 		if(selected)
 		{
 			TreeModel model;
@@ -332,25 +390,27 @@ public class ReportWindow {
 				iterOk = store.IterNext (ref myIter); 
 			}
 			
-			if (iterOk) {
-				arrayToRecord.Add ( 
-					(string) treeview1.Model.GetValue (myIter, 0) + "\t" +	//type
-					(string) treeview1.Model.GetValue (myIter, 1) + "\t" +	//subtype
-					(string) treeview1.Model.GetValue (myIter, 2) + "\t" +	//apply to
-					(string) treeview1.Model.GetValue (myIter, 3) + "\t" +	//sessionString
-					(string) treeview1.Model.GetValue (myIter, 4) + "\t" +	//showJumps
-					(string) treeview1.Model.GetValue (myIter, 5) + "\t" +  //showSex
-					(string) treeview1.Model.GetValue (myIter, 6) + "\t" +	//markedRowsString
-					(string) treeview1.Model.GetValue (myIter, 7) 		//GraphROptions
-					);
-			}
+			if (iterOk) 
+				arrayToRecord.Add (getRow(myIter));
 		}
 
 		report.StatisticsData = arrayToRecord;
 
 	}
+
+	private string getRow(TreeIter myIter) {
+		return	(string) treeview1.Model.GetValue (myIter, 0) + "\t" +	//type
+			(string) treeview1.Model.GetValue (myIter, 1) + "\t" +	//subtype
+			(string) treeview1.Model.GetValue (myIter, 2) + "\t" +	//apply to
+			(string) treeview1.Model.GetValue (myIter, 3) + "\t" +	//sessionString
+			(string) treeview1.Model.GetValue (myIter, 4) + "\t" +	//showJumps
+			(string) treeview1.Model.GetValue (myIter, 5) + "\t" +  //showSex
+			(string) treeview1.Model.GetValue (myIter, 6) + "\t" +	//markedRowsString
+			(string) treeview1.Model.GetValue (myIter, 7) 		//GraphROptions
+			;
+	}
 	
-	protected virtual void on_button_close_clicked (object o, EventArgs args)
+	private void on_button_close_clicked (object o, EventArgs args)
 	{
 		recordData();
 		
@@ -358,7 +418,7 @@ public class ReportWindow {
 		//ReportWindowBox = null;
 	}
 	
-	protected virtual void on_delete_event (object o, DeleteEventArgs args)
+	private void on_delete_event (object o, DeleteEventArgs args)
 	{
 		recordData();
 		
@@ -366,7 +426,7 @@ public class ReportWindow {
 		ReportWindowBox = null;
 	}
 	
-	protected virtual void on_button_make_report_clicked (object o, EventArgs args)
+	private void on_button_make_report_clicked (object o, EventArgs args)
 	{
 		recordData();
 	
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 632ec40..175ceaf 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -1168,7 +1168,6 @@ public class StatsWindow {
 			reportWin = ReportWindow.Show(parent, report);
 			//add current stat
 			reportWin.Add(statisticType, statisticSubType, statisticApplyTo, 
-					//sessionsAsAString, statsShowJumps, showSex.ToString());
 					sendSelectedSessions, statsShowJumps, showSex.ToString(), 
 					myStatType.MarkedRows, fillGraphROptions());
 					
diff --git a/src/report.cs b/src/report.cs
index 32754e3..01ffadc 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -301,64 +301,75 @@ public class Report : ExportSession
 			writer.WriteLine( "<br>" );
 		}
 	}
-	
+
+	public ArrayList GetSelectedSessions(string sessionsString) {
+		ArrayList sendSelectedSessions = new ArrayList(1);
+		string [] sessionsStrFull = sessionsString.Split(new char[] {':'});
+		for (int j=0; j < sessionsStrFull.Length ; j++) {
+			Session tempSession = SqliteSession.Select(sessionsStrFull[j]);
+			sendSelectedSessions.Add(tempSession.UniqueID + ":" + tempSession.Name + ":" + tempSession.DateShort);
+		}
+		return sendSelectedSessions;
+	}
+			
+	public int GetStatsJumpTypeAndLimit(string str, out int limit) {
+		int jumpsType = 0;
+		limit = -1;
+		string [] strJumpsType = str.ToString().Split(new char[] {'.'});
+		if(strJumpsType[0] == Catalog.GetString("All")) 
+			jumpsType = 0;
+		else if(strJumpsType[0] == Catalog.GetString("Limit")) {
+			jumpsType = 1;
+			limit = Convert.ToInt32 ( strJumpsType[1] ); 
+		} else if(strJumpsType[0] == Catalog.GetString("Jumper's best")) {
+			jumpsType = 2;
+			limit = Convert.ToInt32 ( strJumpsType[1] ); 
+		} else if(strJumpsType[0] == Catalog.GetString("Jumper's average")) 
+			jumpsType = 3;
+		
+		return jumpsType;
+	}
+			
+	public int GetRjEvolutionMarkConsecutives(string strIni, out string strEnd) {
+		strEnd = strIni;
+		int rj_evolution_mark_consecutives = -1;
+		if(strEnd.StartsWith(Catalog.GetString("Evolution."))) {
+			string [] strEvo = strEnd.Split(new char[] {'.'});
+			strEnd = strEvo[0];
+			rj_evolution_mark_consecutives = Convert.ToInt32(strEvo[1]);
+		}
+		return rj_evolution_mark_consecutives;
+	}
+
 	protected void printStats()
 	{
 		if(StatisticsData.Count > 0)
-			writer.WriteLine("<h2>Statitistics</h2>");
+			writer.WriteLine("<h2>Statistics</h2>");
 		
 		//obtain every report stats one by one
 		for(int i=0; i < StatisticsData.Count ; i++) {
-			//string [] strFull = StatisticsData[i].ToString().Split(new char[] {'\n'});
 			string [] strFull = StatisticsData[i].ToString().Split(new char[] {'\t'});
 			
 			string myHeaderStat = "";
 
 			//separate in sessions
-			ArrayList sendSelectedSessions = new ArrayList(1);
-			string [] sessionsStrFull = strFull[3].Split(new char[] {':'});
-			for (int j=0; j < sessionsStrFull.Length ; j++) {
-				Session tempSession = SqliteSession.Select(sessionsStrFull[j]);
-				sendSelectedSessions.Add(tempSession.UniqueID + ":" + tempSession.Name + ":" + tempSession.DateShort);
-			}
+			ArrayList sendSelectedSessions = GetSelectedSessions(strFull[3]);
 
 			//separate in markedRows
-			ArrayList arrayListMarkedRows = new ArrayList(1);
-			string [] markedStrFull = strFull[6].Split(new char[] {':'});
-			for (int j=0; j < markedStrFull.Length ; j++) {
-				arrayListMarkedRows.Add(markedStrFull[j]);
-			}
+			ArrayList arrayListMarkedRows = Util.StringToArrayList(strFull[6], ':');
 
 			string applyTo = strFull[2];
 			myHeaderStat += "<h3> " + strFull[0] + " : " + strFull[1] + " : " + applyTo + "</h3> ";
 
-			bool showSex = false;
-			if(strFull[5] == "True") {
-				showSex = true;
-			}
+			bool showSex = Util.StringToBool(strFull[5]);
 
-			int statsJumpsType = 0;
-			int limit = -1;
-			string [] strJumpsType = strFull[4].ToString().Split(new char[] {'.'});
-			if(strJumpsType[0] == Catalog.GetString("All")) {
-				statsJumpsType = 0;
-			} else if(strJumpsType[0] == Catalog.GetString("Limit")) {
-				statsJumpsType = 1;
-				limit = Convert.ToInt32 ( strJumpsType[1] ); 
-			} else if(strJumpsType[0] == Catalog.GetString("Jumper's best")) {
-				statsJumpsType = 2;
-				limit = Convert.ToInt32 ( strJumpsType[1] ); 
-			} else if(strJumpsType[0] == Catalog.GetString("Jumper's average")) {
-				statsJumpsType = 3;
-			}
+			int limit;
+			int statsJumpsType = GetStatsJumpTypeAndLimit(strFull[4], out limit);
 
 			//obtain marked jumps of rj evolution if needed
-			int rj_evolution_mark_consecutives = -1;
-			if(strFull[1].StartsWith(Catalog.GetString("Evolution."))) {
-				string [] strEvo = strFull[1].Split(new char[] {'.'});
-				strFull[1] = strEvo[0];
-				rj_evolution_mark_consecutives = Convert.ToInt32(strEvo[1]);
-			}
+			string subType;
+			int rj_evolution_mark_consecutives = GetRjEvolutionMarkConsecutives(strFull[1], out subType);
+
 			
 			
 			myHeaderStat += "\n<p><TABLE cellpadding=2 cellspacing=2><tr><td>\n";
@@ -372,7 +383,7 @@ public class Report : ExportSession
 
 			myStatType = new StatType(
 					strFull[0], 		//statisticType
-					strFull[1], 		//statisticSubType
+					subType, 		//statisticSubType
 					strFull[2], 		//statisticApplyTo
 					sendSelectedSessions, 
 					prefsDigitsNumber,
@@ -400,7 +411,7 @@ public class Report : ExportSession
 			//report of graph
 			myStatType = new StatType(
 					strFull[0], 		//statisticType
-					strFull[1], 		//statisticSubType
+					subType, 		//statisticSubType
 					strFull[2], 		//statisticApplyTo
 					sendSelectedSessions, 
 					prefsDigitsNumber,
@@ -418,7 +429,6 @@ public class Report : ExportSession
 					fileName		//fileName for exporting there
 					);
 
-			//allFine = myStatType.ChooseStat();
 			myStatType.ChooseStat();
 
 			//enunciate is prented here and not before 
diff --git a/src/statType.cs b/src/statType.cs
index 56223d0..105e3f5 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -194,10 +194,8 @@ public class StatType {
 	public StatType (string statisticType, string statisticSubType, string statisticApplyTo,
 			ArrayList sendSelectedSessions, int prefsDigitsNumber, bool sex_active, 
 			int statsJumpsType, int limit, bool heightPreferred, bool weightStatsPercent, 
-			//int statsJumpsType, int limit, bool heightPreferred, 
 			ArrayList markedRows, 
 			int rj_evolution_mark_consecutives, 
-			//string graphType, string graphPalette, bool graphTransposed,
 			GraphROptions gRO,
 			bool graph, bool toReport, TextWriter writer, string fileName)
 	{
diff --git a/src/util.cs b/src/util.cs
index a804354..9d4afa5 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -946,6 +946,15 @@ public class Util
 		ret[0] = str;
 		return ret;
 	}
+	
+	public static ArrayList StringToArrayList (string str, char sep) {
+		ArrayList array = new ArrayList(1);
+		string [] strFull = str.Split(new char[] {sep});
+		for (int i=0; i < strFull.Length ; i++) {
+			array.Add(strFull[i]);
+		}
+		return array;
+	}
 
 
 



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