[chronojump] All chronopic stuff now into chronopic window lots of changes in main gui and preferences
- From: Xavier de Blas <xaviblas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] All chronopic stuff now into chronopic window lots of changes in main gui and preferences
- Date: Sat, 26 Dec 2009 03:16:02 +0000 (UTC)
commit bbffb4e21dc75ba4005e137f5390dc602b344f87
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Dec 26 04:14:43 2009 +0100
All chronopic stuff now into chronopic window
lots of changes in main gui and preferences
now delete a session, deletes all tests, and deletes person if orphan
now delete a person from session also deletes its multiChronopic
other gui changes:
-quit -> standard gnome exit
-File -> Session
-windows -> tools
-preferences on tools
-chronopic window on tools
chronojump_server/bin/chronojumpServer.dll | Bin 275968 -> 276480 bytes
glade/chronojump.glade | 564 +++++++++++++++++--------
src/Makefile.am | 1 +
src/gui/chronojump.cs | 440 ++++---------------
src/gui/chronopic.cs | 638 ++++++++++++++++++++++++++++
src/gui/eventExecute.cs | 18 +-
src/gui/preferences.cs | 34 +-
src/sqlite/main.cs | 3 +-
src/sqlite/personSession.cs | 6 +
src/sqlite/session.cs | 25 +-
10 files changed, 1167 insertions(+), 562 deletions(-)
---
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index afd986b..92214c2 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 8bba526..1042909 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -1454,138 +1454,6 @@ comments</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
<child>
- <widget class="GtkVBox" id="vbox124">
- <property name="visible">True</property>
- <property name="border_width">8</property>
- <property name="orientation">vertical</property>
- <property name="spacing">10</property>
- <child>
- <widget class="GtkVBox" id="vbox125">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkLabel" id="label180">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Chronopic in</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox_port_linux">
- <property name="visible">True</property>
- <child>
- <widget class="GtkComboBox" id="combo_port_linux">
- <property name="visible">True</property>
- <property name="items">/dev/ttyUSB?
-</property>
- </widget>
- <packing>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkComboBox" id="combo_port_windows">
- <property name="visible">True</property>
- <property name="items">COM?</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_port">
- <property name="visible">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="padding">4</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_help">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip" translatable="yes">Help with Chronopic port</property>
- <signal name="clicked" handler="on_button_help_clicked"/>
- <child>
- <widget class="GtkAlignment" id="alignment109">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <widget class="GtkHBox" id="hbox267">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <widget class="GtkImage" id="image3128">
- <property name="visible">True</property>
- <property name="stock">gtk-help</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label506">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Port Help</property>
- <property name="use_underline">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label524">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Chronopic port</property>
- </widget>
- <packing>
- <property name="tab_fill">False</property>
- <property name="type">tab</property>
- </packing>
- </child>
- <child>
<widget class="GtkVBox" id="vbox142">
<property name="visible">True</property>
<property name="orientation">vertical</property>
@@ -1718,9 +1586,6 @@ comments</property>
</packing>
</child>
</widget>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
<child>
<widget class="GtkLabel" id="label528">
@@ -1728,7 +1593,6 @@ comments</property>
<property name="label" translatable="yes">Database</property>
</widget>
<packing>
- <property name="position">1</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -1903,7 +1767,7 @@ comments</property>
</child>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -1912,7 +1776,7 @@ comments</property>
<property name="label" translatable="yes">Show</property>
</widget>
<packing>
- <property name="position">2</property>
+ <property name="position">1</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -1993,7 +1857,7 @@ comments</property>
</child>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -2002,7 +1866,7 @@ comments</property>
<property name="label" translatable="yes">Other</property>
</widget>
<packing>
- <property name="position">3</property>
+ <property name="position">2</property>
<property name="tab_fill">False</property>
<property name="type">tab</property>
</packing>
@@ -6551,7 +6415,7 @@ suitable for agility tests)</property>
<child>
<widget class="GtkMenuItem" id="session">
<property name="visible">True</property>
- <property name="label" translatable="yes">_File</property>
+ <property name="label" translatable="yes">_Session</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="session_menu">
@@ -6701,22 +6565,8 @@ suitable for agility tests)</property>
</widget>
</child>
<child>
- <widget class="GtkImageMenuItem" id="menuitem_preferences">
- <property name="label">_Preferences</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <signal name="activate" handler="on_preferences_activate"/>
- </widget>
- </child>
- <child>
- <widget class="GtkSeparatorMenuItem" id="separador18">
- <property name="visible">True</property>
- </widget>
- </child>
- <child>
<widget class="GtkImageMenuItem" id="quit1">
- <property name="label">_Quit</property>
+ <property name="label">gtk-quit</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
@@ -7454,57 +7304,73 @@ suitable for agility tests)</property>
</widget>
</child>
<child>
- <widget class="GtkMenuItem" id="menu_windows">
+ <widget class="GtkMenuItem" id="menu_tools">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Windows</property>
+ <property name="label" translatable="yes">_Tools</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menu_view_menu">
<child>
- <widget class="GtkImageMenuItem" id="menuitem_view_stats">
- <property name="label">Stats window</property>
+ <widget class="GtkMenuItem" id="menuitem_chronopic1">
<property name="visible">True</property>
+ <property name="label" translatable="yes">Chronopic</property>
<property name="use_underline">True</property>
- <property name="use_stock">True</property>
+ <signal name="activate" handler="on_menuitem_chronopic_activate"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_view_stats">
+ <property name="label">Stats</property>
+ <property name="visible">True</property>
+ <property name="use_stock">False</property>
<signal name="activate" handler="on_menuitem_view_stats_activate"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_report_window">
- <property name="label">Report window</property>
+ <property name="label">Report</property>
<property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
+ <property name="use_stock">False</property>
<signal name="activate" handler="on_show_report_activate"/>
+ <child internal-child="image">
+ <widget class="GtkImage" id="image8">
+ <property name="visible">True</property>
+ <property name="stock">gtk-missing-image</property>
+ </widget>
+ </child>
</widget>
</child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkMenuItem" id="plataforma">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Chronopic</property>
- <property name="use_underline">True</property>
- <child>
- <widget class="GtkMenu" id="plataforma_menu">
<child>
- <widget class="GtkRadioMenuItem" id="menuitem_simulated">
+ <widget class="GtkMenuItem" id="menuitem_server1">
<property name="visible">True</property>
- <property name="label" translatable="yes">Simulated</property>
+ <property name="label" translatable="yes">Server</property>
<property name="use_underline">True</property>
- <property name="active">True</property>
- <signal name="toggled" handler="on_radiobutton_simulated"/>
+ <signal name="activate" handler="on_menuitem_server_activate"/>
</widget>
</child>
<child>
- <widget class="GtkRadioMenuItem" id="menuitem_chronopic">
+ <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
+ <property name="visible">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkImageMenuItem" id="menuitem_preferences">
+ <property name="label">_Preferences</property>
<property name="visible">True</property>
- <property name="label" translatable="yes">Chronopic</property>
<property name="use_underline">True</property>
- <property name="group">menuitem_simulated</property>
- <signal name="toggled" handler="on_radiobutton_chronopic"/>
+ <property name="use_stock">True</property>
+ <signal name="activate" handler="on_preferences_activate"/>
</widget>
</child>
</widget>
@@ -7652,8 +7518,8 @@ suitable for agility tests)</property>
<property name="receives_default">False</property>
<property name="tooltip" translatable="yes">Edit selected person (E)</property>
<signal name="clicked" handler="on_edit_current_person_clicked"/>
- <accelerator key="e" signal="clicked" modifiers="GDK_SHIFT_MASK"/>
<accelerator key="E" signal="clicked"/>
+ <accelerator key="e" signal="clicked" modifiers="GDK_SHIFT_MASK"/>
<child>
<widget class="GtkImage" id="image1977">
<property name="visible">True</property>
@@ -10066,7 +9932,6 @@ suitable for agility tests)</property>
</child>
<child>
<widget class="GtkFrame" id="frame46">
- <property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
@@ -16902,6 +16767,7 @@ comments</property>
<child>
<widget class="GtkVBox" id="vbox109">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<widget class="GtkHBox" id="hbox238">
@@ -20238,4 +20104,332 @@ by you</property>
</widget>
</child>
</widget>
+ <widget class="GtkWindow" id="chronopic_window">
+ <property name="border_width">10</property>
+ <property name="title" translatable="yes">Chronopic window</property>
+ <signal name="delete_event" handler="on_delete_event"/>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">8</property>
+ <property name="row_spacing">8</property>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkComboBox" id="combo_linux1">
+ <property name="visible">True</property>
+ <property name="items">/dev/ttyUSB?
+</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="combo_windows1">
+ <property name="visible">True</property>
+ <property name="items">COM?</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_connect_cp1">
+ <property name="label" translatable="yes">Connect</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_connect_cp1_clicked"/>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox185">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkImage" id="image_cp1_no">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image_cp1_yes">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox185">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkImage" id="image_cp2_no">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image_cp2_yes">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox185">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkImage" id="image_cp3_no">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image_cp3_yes">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox185">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <widget class="GtkImage" id="image_cp4_no">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image_cp4_yes">
+ <property name="visible">True</property>
+ <property name="stock">gtk-yes</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label">Chronopic 1</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label">Chronopic 2</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label">Chronopic 3</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label">Chronopic 4</property>
+ </widget>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="layout_style">spread</property>
+ <child>
+ <widget class="GtkButton" id="button_help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_button_help_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button2">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_button_close_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index 660a44f..d34c3d8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,7 @@ all: $(ASSEMBLY) $(COMMONAPPLICATIONDATA_ROOT) $(COMMONAPPLICATIONDATAROOT_IMAGE
FILES = \
gui/chronojump.cs\
+ gui/chronopic.cs\
gui/confirm.cs\
gui/error.cs\
gui/eventExecute.cs\
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 05818aa..a616995 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -26,7 +26,6 @@ using Glade;
using System.IO.Ports;
using Mono.Unix;
using System.IO; //"File" things
-using System.Threading;
using System.Collections; //ArrayList
@@ -143,10 +142,13 @@ public class ChronoJumpWindow
[Widget] Gtk.MenuItem menuitem_run_analysis;
[Widget] Gtk.Button button_run_analysis;
[Widget] Gtk.Entry entry_run_analysis_distance;
+ /*
[Widget] Gtk.ComboBox combo_port_linux;
[Widget] Gtk.ComboBox combo_port_windows;
[Widget] Gtk.Button button_connect_cp;
+ */
+ /*
[Widget] Gtk.Image image_cp1_yes;
[Widget] Gtk.Image image_cp1_no;
[Widget] Gtk.Image image_cp2_yes;
@@ -155,6 +157,7 @@ public class ChronoJumpWindow
[Widget] Gtk.Image image_cp3_no;
[Widget] Gtk.Image image_cp4_yes;
[Widget] Gtk.Image image_cp4_no;
+ */
[Widget] Gtk.CheckButton check_multi_sync;
[Widget] Gtk.CheckButton check_multi_delete_first;
@@ -175,7 +178,7 @@ public class ChronoJumpWindow
[Widget] Gtk.MenuItem menu_jumps;
[Widget] Gtk.MenuItem menu_runs;
[Widget] Gtk.MenuItem menu_other;
- [Widget] Gtk.MenuItem menu_windows;
+ [Widget] Gtk.MenuItem menu_tools;
[Widget] Gtk.MenuItem menuitem_jump_free;
[Widget] Gtk.MenuItem sj;
@@ -217,8 +220,8 @@ public class ChronoJumpWindow
[Widget] Gtk.Button button_show_all_person_events;
[Widget] Gtk.MenuItem show_all_person_events;
- [Widget] Gtk.RadioMenuItem menuitem_simulated;
- [Widget] Gtk.RadioMenuItem menuitem_chronopic;
+// [Widget] Gtk.RadioMenuItem menuitem_simulated;
+// [Widget] Gtk.RadioMenuItem menuitem_chronopic;
[Widget] Gtk.Notebook notebook;
@@ -253,12 +256,14 @@ public class ChronoJumpWindow
Random rand;
bool volumeOn;
+ /*
//chronopic connection thread
Thread thread;
bool needUpdateChronopicWin;
bool updateChronopicWinValuesState;
string updateChronopicWinValuesMessage;
[Widget] Gtk.Button fakeChronopicButton; //raised when chronopic detection ended
+ */
//persons
private TreeStore treeview_persons_store;
@@ -286,7 +291,7 @@ public class ChronoJumpWindow
private TreeViewMultiChronopic myTreeViewMultiChronopic;
//preferences variables
- private static string chronopicPort;
+ //private static string chronopicPort;
private static int prefsDigitsNumber;
private static bool showHeight;
private static bool showPower;
@@ -294,7 +299,7 @@ public class ChronoJumpWindow
private static bool showAngle;
private static bool showQIndex;
private static bool showDjIndex;
- private static bool simulated;
+// private static bool simulated;
private static bool askDeletion;
private static bool weightPercentPreferred;
private static bool heightPreferred;
@@ -362,21 +367,20 @@ public class ChronoJumpWindow
StatsWindow statsWin;
ReportWindow reportWin;
RepetitiveConditionsWindow repetitiveConditionsWin;
- ChronopicConnection chronopicWin;
GenericWindow genericWin;
EvaluatorWindow evalWin;
QueryServerWindow queryServerWin;
PersonNotUploadWindow personNotUploadWin;
+ ChronopicWindow chronopicWin;
+
static EventExecuteWindow eventExecuteWin;
- //platform state variables
- enum States {
- ON,
- OFF
- }
bool cpRunning;
+
+
+ /*
int currentCp; //1 to 4
//cp1
@@ -400,6 +404,7 @@ public class ChronoJumpWindow
Chronopic.Plataforma platformState4;
States loggedState; //log of last state
+ */
private bool firstRjValue;
@@ -431,32 +436,6 @@ public class ChronoJumpWindow
new DialogImageTest(currentEventType);
}
-/*
- private void on_so_asterisk_clicked(object o, EventArgs args) {
- Log.WriteLine("Asterisk");
- System.Media.SystemSounds.Asterisk.Play();
- }
-
- private void on_so_beep_clicked(object o, EventArgs args) {
- Log.WriteLine("Beep");
- System.Media.SystemSounds.Beep.Play();
- }
-
- private void on_so_exclamation_clicked(object o, EventArgs args) {
- Log.WriteLine("Exclamation");
- System.Media.SystemSounds.Exclamation.Play();
- }
-
- private void on_so_hand_clicked(object o, EventArgs args) {
- Log.WriteLine("Hand");
- System.Media.SystemSounds.Hand.Play();
- }
-
- private void on_so_question_clicked(object o, EventArgs args) {
- Log.WriteLine("Question");
- System.Media.SystemSounds.Question.Play();
- }
-*/
public ChronoJumpWindow(string progVersion, string progName, string runningFileName)
{
@@ -478,8 +457,6 @@ public class ChronoJumpWindow
//UtilGtk.ResizeIfNeeded(stats_window);
app1.Maximize();
- cpRunning = false;
-
report = new Report(-1); //when a session is loaded or created, it will change the report.SessionID value
//TODO: check what happens if a session it's deleted
//i think report it's deactivated until a new session is created or loaded,
@@ -507,12 +484,14 @@ public class ChronoJumpWindow
createComboRunsInterval();
//reaction_times has no combo
createComboPulses();
- createComboMultiChronopic();
+ //createComboMultiChronopic();
createdStatsWin = false;
repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
+ chronopicWin = ChronopicWindow.Create();
+
//We have no session, mark some widgets as ".Sensitive = false"
sensitiveGuiNoSession();
@@ -526,6 +505,7 @@ public class ChronoJumpWindow
rand = new Random(40);
putNonStandardIcons();
+ /*
if(chronopicPort != Constants.ChronopicDefaultPortWindows &&
(chronopicPort != Constants.ChronopicDefaultPortLinux && File.Exists(chronopicPort))
@@ -533,14 +513,15 @@ public class ChronoJumpWindow
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Do you want to connect to Chronopic now?"), "", "");
confirmWin.Button_accept.Clicked += new EventHandler(chronopicAtStart);
}
+ */
}
-
+/*
private void chronopicAtStart(object o, EventArgs args) {
//make active menuitem chronopic, and this
//will raise other things
- menuitem_chronopic.Active = true;
+ //menuitem_chronopic.Active = true;
}
-
+*/
//from SportsTracker code
[Glade.WidgetAttribute]
@@ -586,112 +567,12 @@ public class ChronoJumpWindow
menuitem_report_window.Image = new Gtk.Image(pixbuf);
}
- protected bool PulseGTK ()
- {
- if(needUpdateChronopicWin || ! thread.IsAlive) {
- fakeChronopicButton.Click();
- Log.Write("dying");
- return false;
- }
- //need to do this, if not it crashes because chronopicWin gets died by thread ending
- ChronopicConnection chronopicWin = ChronopicConnection.Show();
- chronopicWin.Pulse();
-
- Thread.Sleep (50);
- Log.Write(thread.ThreadState.ToString());
- return true;
- }
-
- private void updateChronopicWin(bool state, string message) {
- Log.WriteLine("-----------------");
-
- //need to do this, if not it crashes because chronopicWin gets died by thread ending
- chronopicWin = ChronopicConnection.Show();
-
- Log.WriteLine("+++++++++++++++++");
- if(state)
- chronopicWin.Connected(message);
- else
- chronopicWin.Disconnected(message);
-
- needUpdateChronopicWin = false;
- }
-
- //chronopic init should not touch gtk, for the threads
- 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())
- Log.WriteLine ( Catalog.GetString ("If you have previously used the modem via a serial port (in a GNU/Linux session, and you selected serial port), Chronojump will crash.") );
-
- success = true;
-
- Log.WriteLine("+++++++++++++++++ 1 ++++++++++++++++");
- Log.WriteLine(string.Format("chronopic port: {0}", myPort));
- mySp = new SerialPort(myPort);
- try {
- mySp.Open();
- Log.WriteLine("+++++++++++++++++ 2 ++++++++++++++++");
- //-- Create chronopic object, for accessing chronopic
- myCp = new Chronopic(mySp);
-
- Log.WriteLine("+++++++++++++++++ 3 ++++++++++++++++");
- //on windows, this check make a crash
- //i think the problem is: as we don't really know the Timeout on Windows (.NET) and this variable is not defined on chronopic.cs
- //the Read_platform comes too much soon (when cp is not totally created), and this makes crash
-
- //-- Obtener el estado inicial de la plataforma
-
- bool ok=false;
- Log.WriteLine("+++++++++++++++++ 4 ++++++++++++++++");
- do {
- Log.WriteLine("+++++++++++++++++ 5 ++++++++++++++++");
- ok=myCp.Read_platform(out myPS);
- Log.WriteLine("+++++++++++++++++ 6 ++++++++++++++++");
- } while(!ok);
- Log.WriteLine("+++++++++++++++++ 7 ++++++++++++++++");
- if (!ok) {
- //-- Si hay error terminar
- Log.WriteLine(string.Format("Error: {0}", myCp.Error));
- success = false;
- }
- } catch {
- success = false;
- }
-
- returnString = "";
- if(success) {
- if(currentCp == 1)
- cpRunning = true;
- returnString = string.Format(Catalog.GetString("<b>Connected</b> to Chronopic on port: {0}"), myPort);
- //appbar2.Push( 1, returnString);
- }
- if(! success) {
- returnString = Catalog.GetString("Problems communicating to chronopic.");
- if(currentCp == 1)
- returnString += " " + Catalog.GetString("Changed platform to 'Simulated'");
- if(Util.IsWindows()) {
- returnString += Catalog.GetString("\n\nOn Windows we recommend to remove and connect USB or serial cable from the computer after every unsuccessful port test.");
- returnString += Catalog.GetString("\n... And after cancelling Chronopic detection.");
- returnString += Catalog.GetString("\n\n... Later, when you close Chronojump it will probably get frozen. If this happens, let's press CTRL+C on the black screen.");
- }
-
- //this will raise on_radiobutton_simulated_ativate and
- //will put cpRunning to false, and simulated to true and cp.Close()
- if(currentCp == 1) {
- menuitem_simulated.Active = true;
- cpRunning = false;
- }
- }
- return myCp;
- }
-
private void loadPreferences ()
{
Log.WriteLine (string.Format(Catalog.GetString("Chronojump database version file: {0}"),
SqlitePreferences.Select("databaseVersion") ));
- chronopicPort = SqlitePreferences.Select("chronopicPort");
+ //chronopicPort = SqlitePreferences.Select("chronopicPort");
prefsDigitsNumber = Convert.ToInt32 ( SqlitePreferences.Select("digitsNumber") );
@@ -738,15 +619,15 @@ public class ChronoJumpWindow
if ( SqlitePreferences.Select("simulated") == "True" ) {
- simulated = true;
- menuitem_simulated.Active = true;
+// simulated = true;
+ //menuitem_simulated.Active = true;
- cpRunning = false;
+// cpRunning = false;
} else {
- simulated = false;
- menuitem_chronopic.Active = true;
+// simulated = false;
+ //menuitem_chronopic.Active = true;
- cpRunning = true;
+// cpRunning = true;
}
if ( SqlitePreferences.Select("askDeletion") == "True" )
@@ -1707,6 +1588,7 @@ public class ChronoJumpWindow
}
private void on_button_connect_cp_clicked (object o, EventArgs args) {
+ /*
if(image_cp2_no.Visible)
currentCp = 2;
else if(image_cp3_no.Visible)
@@ -1714,6 +1596,7 @@ public class ChronoJumpWindow
else if(image_cp4_no.Visible)
currentCp = 4;
prepareChronopicConnection();
+ */
}
private void on_treeview_multi_chronopic_cursor_changed (object o, EventArgs args) {
@@ -1827,6 +1710,7 @@ public class ChronoJumpWindow
combo_pulses.Sensitive = false;
}
+ /*
private void createComboMultiChronopic()
{
table_multi_chronopic_buttons.Sensitive = false;
@@ -1855,6 +1739,7 @@ public class ChronoJumpWindow
combo_port_linux.Changed += new EventHandler (on_combo_multi_chronopic_changed);
}
}
+ */
private void on_combo_jumps_changed(object o, EventArgs args) {
//combo_jumps.Changed -= new EventHandler (on_combo_jumps_changed);
@@ -1918,6 +1803,7 @@ public class ChronoJumpWindow
fillTreeView_pulses(myText);
}
+ /*
private void on_combo_multi_chronopic_changed(object o, EventArgs args) {
ComboBox combo = o as ComboBox;
if (o == null)
@@ -1931,6 +1817,7 @@ public class ChronoJumpWindow
if (o == combo_port_linux || o == combo_port_windows)
button_connect_cp.Sensitive = portOk;
}
+ */
/* ---------------------------------------------------------
@@ -1941,8 +1828,8 @@ public class ChronoJumpWindow
private void on_delete_event (object o, DeleteEventArgs args) {
Log.WriteLine("Bye!");
- if(simulated == false) {
- serialPortsClose();
+ if(chronopicWin.Connected == true) {
+ chronopicWin.SerialPortsClose();
}
try {
@@ -1968,8 +1855,8 @@ public class ChronoJumpWindow
private void on_quit1_activate (object o, EventArgs args) {
Log.WriteLine("Bye!");
- if(simulated == false) {
- serialPortsClose();
+ if(chronopicWin.Connected == true) {
+ chronopicWin.SerialPortsClose();
}
try {
@@ -2119,7 +2006,7 @@ public class ChronoJumpWindow
private void on_delete_session_accepted (object o, EventArgs args)
{
appbar2.Push( 1, Catalog.GetString("Deleted session and all its tests") );
- SqliteSession.DeleteWithJumps(currentSession.UniqueID.ToString());
+ SqliteSession.DeleteAllStuff(currentSession.UniqueID.ToString());
sensitiveGuiNoSession();
definedSession = false;
@@ -2333,36 +2220,10 @@ public class ChronoJumpWindow
private void on_paste1_activate (object o, EventArgs args) {
}
- private void serialPortsClose() {
- Console.WriteLine("Closing sp");
- sp.Close();
-
- image_cp1_no.Show();
- image_cp1_yes.Hide();
- //close connection with other chronopics on multiChronopic
- if(image_cp2_yes.Visible) {
- Console.WriteLine("Closing sp2");
- sp2.Close();
- image_cp2_no.Show();
- image_cp2_yes.Hide();
- }
- if(image_cp3_yes.Visible) {
- Console.WriteLine("Closing sp3");
- sp3.Close();
- image_cp3_no.Show();
- image_cp3_yes.Hide();
- }
- if(image_cp4_yes.Visible) {
- Console.WriteLine("Closing sp4");
- sp4.Close();
- image_cp4_no.Show();
- image_cp4_yes.Hide();
- }
- Console.WriteLine("Closed all");
- }
void on_radiobutton_simulated (object o, EventArgs args)
{
+ /*
Log.WriteLine(string.Format("RAD - simul. cpRunning: {0}", cpRunning));
if(menuitem_simulated.Active) {
Log.WriteLine("RadioSimulated - ACTIVE");
@@ -2395,10 +2256,12 @@ public class ChronoJumpWindow
Log.WriteLine("RadioSimulated - INACTIVE");
Log.WriteLine("all done");
+ */
}
void on_radiobutton_chronopic (object o, EventArgs args)
{
+ /*
Log.WriteLine(string.Format("RAD - chrono. cpRunning: {0}", cpRunning));
if(! preferencesLoaded)
return;
@@ -2420,149 +2283,14 @@ public class ChronoJumpWindow
currentCp = 1;
prepareChronopicConnection();
+ */
}
- void prepareChronopicConnection() {
- ChronopicConnection chronopicWin = ChronopicConnection.Show();
- chronopicWin.LabelFeedBackReset();
-
- chronopicWin.Button_cancel.Clicked += new EventHandler(on_chronopic_cancelled);
-
- fakeChronopicButton = new Gtk.Button();
- fakeChronopicButton.Clicked += new EventHandler(on_chronopic_detection_ended);
-
- thread = new Thread(new ThreadStart(waitChronopicStart));
- GLib.Idle.Add (new GLib.IdleHandler (PulseGTK));
- thread.Start();
- }
-
- protected void waitChronopicStart ()
- {
- if(currentCp == 1) {
- simulated = false;
- SqlitePreferences.Update("simulated", simulated.ToString(), false);
- if(cpRunning)
- return;
- }
-
- string message = "";
- string myPort = "";
- bool success = false;
-
- if(currentCp == 1)
- myPort = chronopicPort;
- else {
- if(Util.IsWindows())
- myPort = UtilGtk.ComboGetActive(combo_port_windows);
- else
- myPort = UtilGtk.ComboGetActive(combo_port_linux);
- }
-
- if(currentCp == 1) {
- cp = chronopicInit(cp, out sp, platformState, myPort, out message, out success);
- if(success) {
- image_cp1_no.Hide();
- image_cp1_yes.Show();
- } else {
- image_cp1_no.Show();
- image_cp1_yes.Hide();
- }
- }
- else if(currentCp == 2) {
- cp2 = chronopicInit(cp2, out sp2, platformState2, myPort, out message, out success);
- if(success) {
- image_cp2_no.Hide();
- image_cp2_yes.Show();
- }
- }
- else if(currentCp == 3) {
- cp3 = chronopicInit(cp3, out sp3, platformState3, myPort, out message, out success);
- if(success) {
- image_cp3_no.Hide();
- image_cp3_yes.Show();
- }
- }
- else if(currentCp == 4) {
- cp4 = chronopicInit(cp4, out sp4, platformState4, myPort, out message, out success);
- if(success) {
- image_cp4_no.Hide();
- image_cp4_yes.Show();
- button_connect_cp.Sensitive = false;
- }
- }
-
-
- Log.WriteLine(string.Format("wait_chronopic_start {0}", message));
-
- if(success) {
- updateChronopicWinValuesState= true; //connected
- updateChronopicWinValuesMessage= message;
-
- if(currentCp >= 2) {
- table_multi_chronopic_buttons.Sensitive = true;
- if(Util.IsNumber(entry_run_analysis_distance.Text, false)) {
- menuitem_multi_chronopic_start.Sensitive = true;
- menuitem_run_analysis.Sensitive = true;
- button_run_analysis.Sensitive = true;
- } else {
- menuitem_multi_chronopic_start.Sensitive = false;
- menuitem_run_analysis.Sensitive = false;
- button_run_analysis.Sensitive = false;
- }
- }
-
- //disallow selection of that port for other chronopics
- //and change sensitiveness of combo port
- if(Util.IsWindows()) {
- UtilGtk.ComboDelThisValue(combo_port_windows, myPort);
- combo_port_windows.Active = 0; //first option
- if(currentCp < 4)
- combo_port_windows.Sensitive = true;
- else
- combo_port_windows.Sensitive = false;
- } else {
- UtilGtk.ComboDelThisValue(combo_port_linux, myPort);
- combo_port_linux.Active = 0; //first option
- if(currentCp < 4)
- combo_port_linux.Sensitive = true;
- else
- combo_port_linux.Sensitive = false;
- }
- } else {
- updateChronopicWinValuesState= false; //disconnected
- updateChronopicWinValuesMessage= message;
- }
- needUpdateChronopicWin = true;
- }
-
- private void on_chronopic_detection_ended(object o, EventArgs args) {
- updateChronopicWin(updateChronopicWinValuesState, updateChronopicWinValuesMessage);
- }
-
-
- private void on_chronopic_cancelled (object o, EventArgs args) {
- Log.WriteLine("cancelled-----");
-
- //kill the chronopicInit function that is waiting event
- thread.Abort();
-
- menuitem_chronopic.Active = false;
- menuitem_simulated.Active = true;
-
- updateChronopicWinValuesState= false; //disconnected
- updateChronopicWinValuesMessage= Catalog.GetString("Cancelled by user");
- needUpdateChronopicWin = true;
-
- }
-
- //private void on_chronopic_closed (object o, EventArgs args) {
- //}
-
-
private void on_preferences_activate (object o, EventArgs args) {
PreferencesWindow myWin = PreferencesWindow.Show(
- chronopicPort, prefsDigitsNumber, showHeight, showPower, showInitialSpeed, showAngle, showQIndex, showDjIndex,
+ //chronopicPort, prefsDigitsNumber, showHeight, showPower, showInitialSpeed, showAngle, showQIndex, showDjIndex,
+ prefsDigitsNumber, showHeight, showPower, showInitialSpeed, showAngle, showQIndex, showDjIndex,
askDeletion, weightPercentPreferred, heightPreferred, metersSecondsPreferred,
//System.Threading.Thread.CurrentThread.CurrentUICulture.ToString(),
SqlitePreferences.Select("language"),
@@ -2573,7 +2301,7 @@ public class ChronoJumpWindow
private void on_preferences_accepted (object o, EventArgs args) {
prefsDigitsNumber = Convert.ToInt32 ( SqlitePreferences.Select("digitsNumber") );
- string myPort = SqlitePreferences.Select("chronopicPort");
+ //string myPort = SqlitePreferences.Select("chronopicPort");
//chronopicPort cannot change while chronopic is running.
//user change the port, and the clicks on radiobutton on platform menu
@@ -2583,7 +2311,7 @@ public class ChronoJumpWindow
// bool success = chronopicInit (myPort, out message);
//}
- chronopicPort = myPort;
+ //chronopicPort = myPort;
if ( SqlitePreferences.Select("askDeletion") == "True" )
@@ -2710,7 +2438,7 @@ public class ChronoJumpWindow
//unhide event buttons for next event
sensitiveGuiEventDone();
- if(!simulated)
+ if(chronopicWin.Connected)
checkCancelTotally(o, args);
//let update stats
@@ -2734,7 +2462,7 @@ public class ChronoJumpWindow
//unhide event buttons for next event
sensitiveGuiEventDone();
- if(!simulated)
+ if(chronopicWin.Connected)
checkCancelMultiTotally(o, args);
}
@@ -2803,7 +2531,7 @@ public class ChronoJumpWindow
//unhide event buttons for next event
sensitiveGuiEventDone();
- if(!simulated)
+ if(chronopicWin.Connected)
checkFinishTotally(o, args);
//let update stats
@@ -2831,7 +2559,7 @@ public class ChronoJumpWindow
//runA is not called for this, because it ends different
//and there's a message on gui/eventExecute.cs for runA
Console.WriteLine("RR1");
- if(currentMultiChronopicType.Name != Constants.RunAnalysisName && !simulated) {
+ if(currentMultiChronopicType.Name != Constants.RunAnalysisName && chronopicWin.Connected) {
checkFinishMultiTotally(o, args);
}
Console.WriteLine("RR2");
@@ -3239,7 +2967,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
"jump", //tableName
currentJumpType.Name,
- prefsDigitsNumber, myLimit, simulated);
+ prefsDigitsNumber, myLimit, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
@@ -3251,9 +2979,9 @@ Console.WriteLine("X");
currentEventExecute = new JumpExecute(eventExecuteWin, currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
- cp, appbar2, app1, prefsDigitsNumber, volumeOn);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, volumeOn);
- if (simulated)
+ if (!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
if( currentJumpType.StartIn )
@@ -3433,7 +3161,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
"jumpRj", //tableName
currentJumpType.Name,
- prefsDigitsNumber, myLimit, simulated);
+ prefsDigitsNumber, myLimit, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
@@ -3446,12 +3174,12 @@ Console.WriteLine("X");
currentEventExecute = new JumpRjExecute(eventExecuteWin, currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
myLimit, currentJumpType.JumpsLimited,
- cp, appbar2, app1, prefsDigitsNumber, allowFinishRjAfterTime, volumeOn, repetitiveConditionsWin);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, allowFinishRjAfterTime, volumeOn, repetitiveConditionsWin);
//suitable for limited by jump and time
//simulated always simulate limited by jumps
- if(simulated)
+ if(!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
currentEventExecute.Manage();
@@ -3659,7 +3387,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
"run", //tableName
currentRunType.Name,
- prefsDigitsNumber, myLimit, simulated);
+ prefsDigitsNumber, myLimit, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
@@ -3674,9 +3402,9 @@ Console.WriteLine("X");
currentEventExecute = new RunExecute(eventExecuteWin, currentPerson.UniqueID, currentSession.UniqueID,
currentRunType.Name, myDistance,
- cp, appbar2, app1, prefsDigitsNumber, metersSecondsPreferred, volumeOn);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, metersSecondsPreferred, volumeOn);
- if (simulated)
+ if (!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
currentEventExecute.Manage();
@@ -3852,7 +3580,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
Constants.RunIntervalTable, //tableName
currentRunType.Name,
- prefsDigitsNumber, myLimit, simulated);
+ prefsDigitsNumber, myLimit, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
@@ -3864,11 +3592,11 @@ Console.WriteLine("X");
currentEventExecute = new RunIntervalExecute(eventExecuteWin, currentPerson.UniqueID, currentSession.UniqueID, currentRunType.Name,
distanceInterval, myLimit, currentRunType.TracksLimited,
- cp, appbar2, app1, prefsDigitsNumber, metersSecondsPreferred, volumeOn, repetitiveConditionsWin);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, metersSecondsPreferred, volumeOn, repetitiveConditionsWin);
//suitable for limited by tracks and time
- if(simulated)
+ if(!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
currentEventExecute.Manage();
@@ -3968,7 +3696,7 @@ Console.WriteLine("X");
"reactionTime", //tableName
//currentJumpType.Name,
"",
- prefsDigitsNumber, myLimit, simulated);
+ prefsDigitsNumber, myLimit, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
@@ -3981,9 +3709,9 @@ Console.WriteLine("X");
currentEventExecute = new ReactionTimeExecute(eventExecuteWin, currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID,
//currentJumpType.Name,
- cp, appbar2, app1, prefsDigitsNumber, volumeOn);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, volumeOn);
- if (simulated)
+ if (!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
currentEventExecute.Manage();
@@ -4115,7 +3843,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
"pulse", //tableName
currentPulseType.Name,
- prefsDigitsNumber, totalPulses, simulated);
+ prefsDigitsNumber, totalPulses, chronopicWin.Connected);
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
@@ -4127,9 +3855,9 @@ Console.WriteLine("X");
currentEventExecute = new PulseExecute(eventExecuteWin, currentPerson.UniqueID, currentPerson.Name,
currentSession.UniqueID, currentPulseType.Name, pulseStep, totalPulses,
- cp, appbar2, app1, prefsDigitsNumber, volumeOn);
+ chronopicWin.CP, appbar2, app1, prefsDigitsNumber, volumeOn);
- if(simulated)
+ if(!chronopicWin.Connected)
currentEventExecute.SimulateInitValues(rand);
currentEventExecute.Manage();
@@ -4196,6 +3924,7 @@ Console.WriteLine("X");
}
private void on_multi_chronopic_start_clicked (object o, EventArgs args) {
+ /*
Log.WriteLine("multi chronopic accepted");
if(o == (object) button_multi_chronopic_start || o == (object) menuitem_multi_chronopic_start)
@@ -4224,7 +3953,7 @@ Console.WriteLine("X");
currentSession.UniqueID,
Constants.MultiChronopicTable, //tableName
currentMultiChronopicType.Name,
- prefsDigitsNumber, -1, simulated
+ prefsDigitsNumber, -1, chronopicWin.Connected
); //-1: unlimited pulses (or changes)
eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_multi_clicked);
@@ -4270,7 +3999,7 @@ Console.WriteLine("X");
entry_run_analysis_distance.Text.ToString(),
appbar2, app1);
- //if(simulated)
+ //if(!chronopicWin.Connected)
// currentEventExecute.SimulateInitValues(rand);
@@ -4279,6 +4008,7 @@ Console.WriteLine("X");
currentEventExecute.Manage();
currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_multi_chronopic_finished);
+ */
}
bool multiFinishing;
@@ -5163,7 +4893,7 @@ Console.WriteLine("X");
menu_jumps.Sensitive = false;
menu_runs.Sensitive = false;
menu_other.Sensitive = false;
- menu_windows.Sensitive = false;
+ menu_tools.Sensitive = false;
vbox_image_test.Sensitive = false;
frame_persons.Sensitive = false;
@@ -5221,7 +4951,7 @@ Console.WriteLine("X");
menu_jumps.Sensitive = false;
menu_runs.Sensitive = false;
menu_other.Sensitive = false;
- menu_windows.Sensitive = false;
+ menu_tools.Sensitive = false;
//menuitem_jump_type_add.Sensitive = false;
// button_last_delete.Sensitive = false;
@@ -5239,7 +4969,7 @@ Console.WriteLine("X");
menu_jumps.Sensitive = true;
menu_runs.Sensitive = true;
menu_other.Sensitive = true;
- menu_windows.Sensitive = true;
+ menu_tools.Sensitive = true;
//unsensitive edit, delete, repair events because no event is initially selected
showHideActionEventButtons(false, "ALL");
@@ -5398,4 +5128,14 @@ Console.WriteLine("X");
Console.WriteLine(myString[5]);
}
+ private void on_menuitem_chronopic_activate (object o, EventArgs args) {
+ Log.WriteLine("CP a");
+ chronopicWin = ChronopicWindow.View();
+ Log.WriteLine("CP b");
+ }
+ private void on_menuitem_server_activate (object o, EventArgs args) {
+ Log.WriteLine("SERVER");
+ }
+
+
}
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
new file mode 100644
index 0000000..0102ad6
--- /dev/null
+++ b/src/gui/chronopic.cs
@@ -0,0 +1,638 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * Chronojump 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.
+ *
+ * Chronojump 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
+ *
+ * Copyright (C) 2004-2009 Xavier de Blas <xaviblas gmail com>
+ */
+
+
+using System;
+using Gtk;
+using Gdk;
+using Glade;
+using System.IO.Ports;
+using Mono.Unix;
+using System.Threading;
+using System.IO; //"File" things
+
+
+public class ChronopicWindow
+{
+ [Widget] Gtk.Window chronopic_window;
+ static ChronopicWindow ChronopicWindowBox;
+ ChronopicConnection chronopicConnectionWin;
+
+
+ //[Widget] Gtk.Button button_connect_cp;
+
+ [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;
+ [Widget] Gtk.Image image_cp3_no;
+ [Widget] Gtk.Image image_cp4_yes;
+ [Widget] Gtk.Image image_cp4_no;
+
+ //[Widget] Gtk.Entry entry_multi_chronopic_cp2;
+
+// [Widget] Gtk.RadioMenuItem menuitem_simulated;
+// [Widget] Gtk.RadioMenuItem menuitem_chronopic;
+
+ [Widget] Gtk.ComboBox combo_linux1;
+ [Widget] Gtk.ComboBox combo_windows1;
+ string [] comboWindowsOptions;
+
+ //chronopic connection thread
+ Thread thread;
+ bool needUpdateChronopicWin;
+ bool updateChronopicWinValuesState;
+ string updateChronopicWinValuesMessage;
+ [Widget] Gtk.Button fakeChronopicButton; //raised when chronopic detection ended
+
+
+ //preferences variables
+ private static string chronopicPort;
+
+ //platform state variables
+ enum States {
+ ON,
+ OFF
+ }
+ bool connected;
+ int currentCp; //1 to 4
+
+ //cp1
+ Chronopic cp;
+ SerialPort sp;
+ Chronopic.Plataforma platformState; //on (in platform), off (jumping), or unknow
+
+ //cp2
+ Chronopic cp2;
+ SerialPort sp2;
+ Chronopic.Plataforma platformState2;
+
+ //cp3
+ Chronopic cp3;
+ SerialPort sp3;
+ Chronopic.Plataforma platformState3;
+
+ //cp4
+ Chronopic cp4;
+ SerialPort sp4;
+ Chronopic.Plataforma platformState4;
+
+ States loggedState; //log of last state
+
+
+
+ public ChronopicWindow()
+ {
+ Glade.XML gxml;
+ gxml = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "chronopic_window", null);
+ gxml.Autoconnect(this);
+
+ //put an icon to window
+ UtilGtk.IconWindow(chronopic_window);
+
+ if(Util.IsWindows())
+ combo_linux1.Hide();
+ else
+ combo_windows1.Hide();
+
+ connected = false;
+ image_cp1_yes.Hide();
+ image_cp2_yes.Hide();
+ image_cp3_yes.Hide();
+ image_cp4_yes.Hide();
+
+ currentCp = 1; //TODO: change
+
+ chronopicPort = SqlitePreferences.Select("chronopicPort");
+
+ if(chronopicPort != Constants.ChronopicDefaultPortWindows &&
+ (chronopicPort != Constants.ChronopicDefaultPortLinux && File.Exists(chronopicPort))
+ ) {
+ ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Do you want to connect to Chronopic now?"), "", "");
+ confirmWin.Button_accept.Clicked += new EventHandler(chronopicAtStart);
+ }
+ }
+
+ static public ChronopicWindow Create ()
+ {
+ if (ChronopicWindowBox == null) {
+ ChronopicWindowBox = new ChronopicWindow ();
+ }
+
+ //don't show until View is called
+ //ChronopicWindowBox.chronopic_window.Show ();
+
+ return ChronopicWindowBox;
+ }
+
+ static public ChronopicWindow View ()
+ {
+ if (ChronopicWindowBox == null) {
+ ChronopicWindowBox = new ChronopicWindow ();
+ }
+
+ ChronopicWindowBox.comboStuff();
+
+ ChronopicWindowBox.chronopic_window.Show();
+
+ return ChronopicWindowBox;
+ }
+
+ private void comboStuff() {
+ //combo port stuff
+ comboWindowsOptions = new string[257];
+ int count = 0;
+ for (int i=1; i <= 257; i ++)
+ comboWindowsOptions[i-1] = "COM" + i;
+
+ chronopicPort = SqlitePreferences.Select("chronopicPort");
+
+ if(Util.IsWindows()) {
+ UtilGtk.ComboUpdate(combo_windows1, comboWindowsOptions, comboWindowsOptions[0]);
+
+ if(chronopicPort.Length > 0)
+ combo_windows1.Active = UtilGtk.ComboMakeActive(comboWindowsOptions, chronopicPort);
+ else
+ combo_windows1.Active = 0; //first option
+ } else {
+ string [] usbSerial = Directory.GetFiles("/dev/", "ttyUSB*");
+ string [] serial = Directory.GetFiles("/dev/", "ttyS*");
+ string [] all = Util.AddArrayString(usbSerial, serial);
+ string [] def = Util.StringToStringArray(Constants.ChronopicDefaultPortLinux);
+ string [] allWithDef = Util.AddArrayString(def, all);
+
+ UtilGtk.ComboUpdate(combo_linux1, allWithDef, Constants.ChronopicDefaultPortLinux);
+
+ if(chronopicPort.Length > 0)
+ combo_linux1.Active = UtilGtk.ComboMakeActive(allWithDef, chronopicPort);
+ else
+ combo_linux1.Active = 0; //first option
+ }
+ }
+
+ private void chronopicAtStart(object o, EventArgs args) {
+ //make active menuitem chronopic, and this
+ //will raise other things
+// menuitem_chronopic.Active = true;
+ Log.WriteLine("CP AT START from gui/chronopic.cs");
+ }
+
+
+ protected bool PulseGTK ()
+ {
+ if(needUpdateChronopicWin || ! thread.IsAlive) {
+ fakeChronopicButton.Click();
+ Log.Write("dying");
+ return false;
+ }
+ //need to do this, if not it crashes because chronopicConnectionWin gets died by thread ending
+ ChronopicConnection chronopicConnectionWin = ChronopicConnection.Show();
+ chronopicConnectionWin.Pulse();
+
+ Thread.Sleep (50);
+ Log.Write(thread.ThreadState.ToString());
+ return true;
+ }
+
+ private void updateChronopicWin(bool state, string message) {
+ Log.WriteLine("-----------------");
+
+ //need to do this, if not it crashes because chronopicConnectionWin gets died by thread ending
+ chronopicConnectionWin = ChronopicConnection.Show();
+
+ Log.WriteLine("+++++++++++++++++");
+ if(state)
+ chronopicConnectionWin.Connected(message);
+ else
+ chronopicConnectionWin.Disconnected(message);
+
+ needUpdateChronopicWin = false;
+ }
+
+ //chronopic init should not touch gtk, for the threads
+ 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())
+ Log.WriteLine ( Catalog.GetString ("If you have previously used the modem via a serial port (in a GNU/Linux session, and you selected serial port), Chronojump will crash.") );
+
+ success = true;
+
+ Log.WriteLine("+++++++++++++++++ 1 ++++++++++++++++");
+ Log.WriteLine(string.Format("chronopic port: {0}", myPort));
+ mySp = new SerialPort(myPort);
+ try {
+ mySp.Open();
+ Log.WriteLine("+++++++++++++++++ 2 ++++++++++++++++");
+ //-- Create chronopic object, for accessing chronopic
+ myCp = new Chronopic(mySp);
+
+ Log.WriteLine("+++++++++++++++++ 3 ++++++++++++++++");
+ //on windows, this check make a crash
+ //i think the problem is: as we don't really know the Timeout on Windows (.NET) and this variable is not defined on chronopic.cs
+ //the Read_platform comes too much soon (when cp is not totally created), and this makes crash
+
+ //-- Obtener el estado inicial de la plataforma
+
+ bool ok=false;
+ Log.WriteLine("+++++++++++++++++ 4 ++++++++++++++++");
+ do {
+ Log.WriteLine("+++++++++++++++++ 5 ++++++++++++++++");
+ ok=myCp.Read_platform(out myPS);
+ Log.WriteLine("+++++++++++++++++ 6 ++++++++++++++++");
+ } while(!ok);
+ Log.WriteLine("+++++++++++++++++ 7 ++++++++++++++++");
+ if (!ok) {
+ //-- Si hay error terminar
+ Log.WriteLine(string.Format("Error: {0}", myCp.Error));
+ success = false;
+ }
+ } catch {
+ success = false;
+ }
+
+ returnString = "";
+ if(success) {
+ if(currentCp == 1)
+ connected = true;
+ returnString = string.Format(Catalog.GetString("<b>Connected</b> to Chronopic on port: {0}"), myPort);
+ //appbar2.Push( 1, returnString);
+ }
+ if(! success) {
+ returnString = Catalog.GetString("Problems communicating to chronopic.");
+ if(currentCp == 1)
+ returnString += " " + Catalog.GetString("Changed platform to 'Simulated'");
+ if(Util.IsWindows()) {
+ returnString += Catalog.GetString("\n\nOn Windows we recommend to remove and connect USB or serial cable from the computer after every unsuccessful port test.");
+ returnString += Catalog.GetString("\n... And after cancelling Chronopic detection.");
+ returnString += Catalog.GetString("\n\n... Later, when you close Chronojump it will probably get frozen. If this happens, let's press CTRL+C on the black screen.");
+ }
+
+ //this will raise on_radiobutton_simulated_ativate and
+ //will put cpRunning to false, and simulated to true and cp.Close()
+ if(currentCp == 1) {
+// menuitem_simulated.Active = true;
+ connected = false;
+ }
+ }
+ return myCp;
+ }
+
+
+ private void on_button_connect_cp1_clicked (object o, EventArgs args) {
+ /*
+ if(image_cp2_no.Visible)
+ currentCp = 2;
+ else if(image_cp3_no.Visible)
+ currentCp = 3;
+ else if(image_cp4_no.Visible)
+ currentCp = 4;
+ */
+
+ if(Util.IsWindows())
+ chronopicPort = UtilGtk.ComboGetActive(combo_windows1);
+ else
+ chronopicPort = UtilGtk.ComboGetActive(combo_linux1);
+ prepareChronopicConnection();
+ }
+
+ private void on_button_help_clicked (object o, EventArgs args) {
+ Log.WriteLine("HELP");
+ new HelpPorts();
+ }
+
+
+ /*
+ private void createComboMultiChronopic()
+ {
+ table_multi_chronopic_buttons.Sensitive = false;
+ menuitem_multi_chronopic_start.Sensitive = false;
+ menuitem_run_analysis.Sensitive = false;
+ button_connect_cp.Sensitive = false;
+ image_cp1_yes.Hide();
+ image_cp2_yes.Hide();
+ image_cp3_yes.Hide();
+ image_cp4_yes.Hide();
+
+ if(Util.IsWindows()) {
+ combo_windows1.Sensitive = false;
+ combo_linux1.Hide();
+ string [] comboWindowsOptions = new string[257];
+ for (int count = 0, i=1; i <= 257; i ++)
+ comboWindowsOptions[i-1] = "COM" + i;
+
+ UtilGtk.ComboUpdate(combo_windows1, comboWindowsOptions, comboWindowsOptions[0]);
+ combo_windows1.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+ } else {
+ combo_linux1.Sensitive = false;
+ combo_windows1.Hide();
+ UtilGtk.ComboUpdate(combo_linux1, Constants.ComboPortLinuxOptions, Constants.ComboPortLinuxOptions[0]);
+ combo_linux1.Active = 0; //first option
+ combo_linux1.Changed += new EventHandler (on_combo_multi_chronopic_changed);
+ }
+ }
+
+
+ private void on_combo_multi_chronopic_changed(object o, EventArgs args) {
+ ComboBox combo = o as ComboBox;
+ if (o == null)
+ return;
+
+ bool portOk = true;
+ if(UtilGtk.ComboGetActive(combo) == Constants.ChronopicDefaultPortWindows ||
+ UtilGtk.ComboGetActive(combo) == Constants.ChronopicDefaultPortLinux)
+ portOk = false;
+
+ if (o == combo_linux1 || o == combo_windows1)
+ button_connect_cp.Sensitive = portOk;
+ }
+ */
+
+
+ public void SerialPortsClose() {
+ Console.WriteLine("Closing sp");
+ sp.Close();
+ /*
+
+// image_cp1_no.Show();
+// image_cp1_yes.Hide();
+ //close connection with other chronopics on multiChronopic
+ if(image_cp2_yes.Visible) {
+ Console.WriteLine("Closing sp2");
+ sp2.Close();
+// image_cp2_no.Show();
+// image_cp2_yes.Hide();
+ }
+ if(image_cp3_yes.Visible) {
+ Console.WriteLine("Closing sp3");
+ sp3.Close();
+// image_cp3_no.Show();
+// image_cp3_yes.Hide();
+ }
+ if(image_cp4_yes.Visible) {
+ Console.WriteLine("Closing sp4");
+ sp4.Close();
+// image_cp4_no.Show();
+// image_cp4_yes.Hide();
+ }
+ Console.WriteLine("Closed all");
+ */
+ }
+
+ /*
+ void on_radiobutton_simulated (object o, EventArgs args)
+ {
+ Log.WriteLine(string.Format("RAD - simul. cpRunning: {0}", cpRunning));
+ if(menuitem_simulated.Active) {
+ Log.WriteLine("RadioSimulated - ACTIVE");
+ simulated = true;
+ SqlitePreferences.Update("simulated", simulated.ToString(), false);
+
+ //close connection with chronopic if initialized
+ if(cpRunning) {
+ serialPortsClose();
+
+ table_multi_chronopic_buttons.Sensitive = false;
+ combo_windows1.Sensitive = false;
+ combo_linux1.Sensitive = false;
+
+ //regenerate combos (maybe some ports have been deleted on using before going to simulated)
+ if(Util.IsWindows()) {
+ string [] comboWindowsOptions = new string[257];
+ for (int count = 0, i=1; i <= 257; i ++)
+ comboWindowsOptions[i-1] = "COM" + i;
+ UtilGtk.ComboUpdate(combo_windows1, comboWindowsOptions, comboWindowsOptions[0]);
+ } else {
+ UtilGtk.ComboUpdate(combo_linux1, Constants.ComboPortLinuxOptions, Constants.ComboPortLinuxOptions[0]);
+ combo_linux1.Active = 0; //first option
+ }
+ }
+ Log.WriteLine("cpclosed");
+ cpRunning = false;
+ }
+ else
+ Log.WriteLine("RadioSimulated - INACTIVE");
+
+ Log.WriteLine("all done");
+ }
+
+ void on_radiobutton_chronopic (object o, EventArgs args)
+ {
+ Log.WriteLine(string.Format("RAD - chrono. cpRunning: {0}", cpRunning));
+ if(! preferencesLoaded)
+ return;
+
+ if(! menuitem_chronopic.Active) {
+ appbar2.Push( 1, Catalog.GetString("Changed to simulated mode"));
+ Log.WriteLine("RadioChronopic - INACTIVE");
+ return;
+ }
+
+ if(chronopicPort == Constants.ChronopicDefaultPortWindows ||
+ chronopicPort == Constants.ChronopicDefaultPortLinux) {
+ new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("You need to configurate the Chronopic port at preferences."));
+ menuitem_simulated.Active = true;
+ return;
+ }
+
+ Log.WriteLine("RadioChronopic - ACTIVE");
+
+ currentCp = 1;
+ prepareChronopicConnection();
+ }
+ */
+
+ void prepareChronopicConnection() {
+ ChronopicConnection chronopicConnectionWin = ChronopicConnection.Show();
+ chronopicConnectionWin.LabelFeedBackReset();
+
+ chronopicConnectionWin.Button_cancel.Clicked += new EventHandler(on_chronopic_cancelled);
+
+ fakeChronopicButton = new Gtk.Button();
+ fakeChronopicButton.Clicked += new EventHandler(on_chronopic_detection_ended);
+
+ thread = new Thread(new ThreadStart(waitChronopicStart));
+ GLib.Idle.Add (new GLib.IdleHandler (PulseGTK));
+ thread.Start();
+ }
+
+ protected void waitChronopicStart ()
+ {
+ if(currentCp == 1) {
+ // simulated = false;
+ // SqlitePreferences.Update("simulated", simulated.ToString(), false);
+ if(connected)
+ return;
+ }
+
+ string message = "";
+ string myPort = "";
+ bool success = false;
+
+ //if(currentCp == 1)
+ myPort = chronopicPort;
+ /*
+ else {
+ if(Util.IsWindows())
+ myPort = UtilGtk.ComboGetActive(combo_windows1);
+ else
+ myPort = UtilGtk.ComboGetActive(combo_linux1);
+ }
+ */
+
+ if(currentCp == 1) {
+ cp = chronopicInit(cp, out sp, platformState, myPort, out message, out success);
+ if(success) {
+ image_cp1_no.Hide();
+ image_cp1_yes.Show();
+ } else {
+ image_cp1_no.Show();
+ image_cp1_yes.Hide();
+ }
+ }
+ else if(currentCp == 2) {
+ cp2 = chronopicInit(cp2, out sp2, platformState2, myPort, out message, out success);
+ if(success) {
+ image_cp2_no.Hide();
+ image_cp2_yes.Show();
+ }
+ }
+ else if(currentCp == 3) {
+ cp3 = chronopicInit(cp3, out sp3, platformState3, myPort, out message, out success);
+ if(success) {
+ image_cp3_no.Hide();
+ image_cp3_yes.Show();
+ }
+ }
+ else if(currentCp == 4) {
+ cp4 = chronopicInit(cp4, out sp4, platformState4, myPort, out message, out success);
+ if(success) {
+ image_cp4_no.Hide();
+ image_cp4_yes.Show();
+ //button_connect_cp.Sensitive = false;
+ }
+ }
+
+
+ Log.WriteLine(string.Format("wait_chronopic_start {0}", message));
+
+ if(success) {
+ updateChronopicWinValuesState= true; //connected
+ updateChronopicWinValuesMessage= message;
+
+ /*
+ if(currentCp >= 2) {
+// table_multi_chronopic_buttons.Sensitive = true;
+ if(Util.IsNumber(entry_run_analysis_distance.Text, false)) {
+// menuitem_multi_chronopic_start.Sensitive = true;
+// menuitem_run_analysis.Sensitive = true;
+// button_run_analysis.Sensitive = true;
+ } else {
+// menuitem_multi_chronopic_start.Sensitive = false;
+// menuitem_run_analysis.Sensitive = false;
+// button_run_analysis.Sensitive = false;
+ }
+ }
+
+ //disallow selection of that port for other chronopics
+ //and change sensitiveness of combo port
+ if(Util.IsWindows()) {
+ UtilGtk.ComboDelThisValue(combo_windows1, myPort);
+ combo_windows1.Active = 0; //first option
+ if(currentCp < 4)
+ combo_windows1.Sensitive = true;
+ else
+ combo_windows1.Sensitive = false;
+ } else {
+ UtilGtk.ComboDelThisValue(combo_linux1, myPort);
+ combo_linux1.Active = 0; //first option
+ if(currentCp < 4)
+ combo_linux1.Sensitive = true;
+ else
+ combo_linux1.Sensitive = false;
+ }
+ */
+ } else {
+ updateChronopicWinValuesState= false; //disconnected
+ updateChronopicWinValuesMessage= message;
+ }
+ needUpdateChronopicWin = true;
+ }
+
+ private void on_chronopic_detection_ended(object o, EventArgs args) {
+ updateChronopicWin(updateChronopicWinValuesState, updateChronopicWinValuesMessage);
+ }
+
+
+ private void on_chronopic_cancelled (object o, EventArgs args) {
+ Log.WriteLine("cancelled-----");
+
+ //kill the chronopicInit function that is waiting event
+ thread.Abort();
+
+ //menuitem_chronopic.Active = false;
+ //menuitem_simulated.Active = true;
+
+ updateChronopicWinValuesState= false; //disconnected
+ updateChronopicWinValuesMessage= Catalog.GetString("Cancelled by user");
+ needUpdateChronopicWin = true;
+
+ }
+
+ //private void on_chronopic_closed (object o, EventArgs args) {
+ //}
+
+ void on_button_close_clicked (object o, EventArgs args)
+ {
+ Log.WriteLine("CLOSE");
+ ChronopicWindowBox.chronopic_window.Hide();
+// ChronopicWindowBox = null;
+ }
+
+ void on_delete_event (object o, DeleteEventArgs args)
+ {
+ ChronopicWindowBox.chronopic_window.Hide();
+ ChronopicWindowBox = null;
+ }
+
+
+
+ public Chronopic CP {
+ get { return cp; }
+ }
+
+ public Chronopic CP2 {
+ get { return cp2; }
+ }
+
+ public Chronopic CP3 {
+ get { return cp3; }
+ }
+
+ public Chronopic CP4 {
+ get { return cp4; }
+ }
+
+ public bool Connected {
+ get { return connected; }
+ }
+
+}
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 49af08a..d0c76a8 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -200,7 +200,7 @@ public class EventExecuteWindow
static public EventExecuteWindow Show (
string windowTitle, string phasesName, int personID, string personName, int sessionID,
- string tableName, string eventType, int pDN, double limit, bool simulated)
+ string tableName, string eventType, int pDN, double limit, bool connected)
{
if (EventExecuteWindowBox == null) {
EventExecuteWindowBox = new EventExecuteWindow ();
@@ -216,7 +216,7 @@ public class EventExecuteWindow
EventExecuteWindowBox.initializeVariables (
windowTitle, phasesName, personID, personName, sessionID,
- tableName, eventType, pDN, limit, simulated);
+ tableName, eventType, pDN, limit, connected);
EventExecuteWindowBox.event_execute.Show ();
@@ -225,7 +225,7 @@ public class EventExecuteWindow
void initializeVariables (
string windowTitle, string phasesName, int personID, string personName, int sessionID,
- string tableName, string eventType, int pDN, double limit, bool simulated)
+ string tableName, string eventType, int pDN, double limit, bool connected)
{
event_execute.Title = windowTitle;
this.label_phases_name.Text = phasesName; //"Jumps" (rjInterval), "Runs" (runInterval), "Ticks" (pulses),
@@ -240,16 +240,16 @@ public class EventExecuteWindow
this.pDN = pDN;
this.limit = limit;
- if(simulated) {
- label_simulated.Show();
- image_simulated_l.Show();
- image_simulated_r.Show();
- }
- else {
+ if(connected) {
label_simulated.Hide();
image_simulated_l.Hide();
image_simulated_r.Hide();
}
+ else {
+ label_simulated.Show();
+ image_simulated_l.Show();
+ image_simulated_r.Show();
+ }
label_message1.Text = "";
label_message2.Text = "";
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 33fd430..933d737 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -32,8 +32,8 @@ public class PreferencesWindow {
[Widget] Gtk.Window preferences;
- [Widget] Gtk.ComboBox combo_port_linux;
- [Widget] Gtk.ComboBox combo_port_windows;
+// [Widget] Gtk.ComboBox combo_port_linux;
+// [Widget] Gtk.ComboBox combo_port_windows;
[Widget] Gtk.Label label_database;
[Widget] Gtk.Label label_database_temp;
@@ -67,10 +67,11 @@ public class PreferencesWindow {
//dialogMessage
private string languageIni;
- string [] comboWindowsOptions;
+// string [] comboWindowsOptions;
- PreferencesWindow (string entryChronopic) {
+ //PreferencesWindow (string entryChronopic) {
+ PreferencesWindow () {
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "preferences", null);
gladeXML.Autoconnect(this);
@@ -78,6 +79,7 @@ public class PreferencesWindow {
//put an icon to window
UtilGtk.IconWindow(preferences);
+ /*
//combo port stuff
comboWindowsOptions = new string[257];
int count = 0;
@@ -105,6 +107,7 @@ public class PreferencesWindow {
else
combo_port_linux.Active = 0; //first option
}
+ */
label_database.Visible = false;
label_database_temp.Visible = false;
@@ -115,15 +118,18 @@ public class PreferencesWindow {
//label_logs.Text = Log.GetDir();
}
- static public PreferencesWindow Show (string entryChronopic, int digitsNumber, bool showHeight, bool showPower,
+ //static public PreferencesWindow Show (string entryChronopic, int digitsNumber, bool showHeight, bool showPower,
+ static public PreferencesWindow Show (int digitsNumber, bool showHeight, bool showPower,
bool showInitialSpeed, bool showAngle, bool showQIndex, bool showDjIndex,
bool askDeletion, bool weightStatsPercent, bool heightPreferred, bool metersSecondsPreferred,
string language, bool allowFinishRjAfterTime)
{
if (PreferencesWindowBox == null) {
- PreferencesWindowBox = new PreferencesWindow (entryChronopic);
+ //PreferencesWindowBox = new PreferencesWindow (entryChronopic);
+ PreferencesWindowBox = new PreferencesWindow ();
}
+ /*
if(Util.IsWindows()) {
PreferencesWindowBox.combo_port_linux.Hide();
PreferencesWindowBox.combo_port_windows.Show();
@@ -131,6 +137,7 @@ public class PreferencesWindow {
PreferencesWindowBox.combo_port_windows.Hide();
PreferencesWindowBox.combo_port_linux.Show();
}
+ */
PreferencesWindowBox.languageIni = language;
//if(Util.IsWindows())
@@ -359,12 +366,12 @@ public class PreferencesWindow {
{
/* the falses are for the dbcon that is not opened */
-
+ /*
if(Util.IsWindows())
SqlitePreferences.Update("chronopicPort", UtilGtk.ComboGetActive(combo_port_windows), false);
else
SqlitePreferences.Update("chronopicPort", UtilGtk.ComboGetActive(combo_port_linux), false);
- //SqlitePreferences.Update("chronopicPort", label_port.Text.ToString(), false);
+ */
SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals), false);
SqlitePreferences.Update("showHeight", PreferencesWindowBox.checkbutton_height.Active.ToString(), false);
@@ -409,19 +416,16 @@ public class PreferencesWindow {
PreferencesWindowBox = null;
}
-
+ /*
private void on_button_help_clicked (object o, EventArgs args) {
new HelpPorts();
}
+ */
public Button Button_accept
{
- set {
- button_accept = value;
- }
- get {
- return button_accept;
- }
+ set { button_accept = value; }
+ get { return button_accept; }
}
}
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 6e369cc..ba0a3ca 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1283,7 +1283,8 @@ class Sqlite
conversionRate ++;
}
- //to convert to sqlite 0.73
+ //used to delete persons (if needed) when a session is deleted. See SqliteSession.DeleteAllStuff
+ //also used to convert to sqlite 0.73
protected internal static void deleteOrphanedPersons()
{
dbcmd.CommandText = "SELECT uniqueID FROM " + Constants.PersonTable;
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index 3454b6f..e83f831 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -357,6 +357,12 @@ class SqlitePersonSession : Sqlite
dbcmd.ExecuteNonQuery();
+ //delete multiChronopic
+ dbcmd.CommandText = "Delete FROM multiChronopic WHERE sessionID == " + sessionID +
+ " AND personID == " + personID;
+
+ dbcmd.ExecuteNonQuery();
+
dbcon.Close();
}
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index bed673e..e3d04f2 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -518,7 +518,7 @@ class SqliteSession : Sqlite
}
- public static void DeleteWithJumps(string uniqueID)
+ public static void DeleteAllStuff(string uniqueID)
{
dbcon.Open();
@@ -529,6 +529,8 @@ class SqliteSession : Sqlite
//delete relations (existance) within persons and sessions in this session
dbcmd.CommandText = "Delete FROM " + Constants.PersonSessionWeightTable + " WHERE sessionID == " + uniqueID;
dbcmd.ExecuteNonQuery();
+
+ Sqlite.deleteOrphanedPersons();
//delete normal jumps
dbcmd.CommandText = "Delete FROM " + Constants.JumpTable + " WHERE sessionID == " + uniqueID;
@@ -538,7 +540,26 @@ class SqliteSession : Sqlite
dbcmd.CommandText = "Delete FROM " + Constants.JumpRjTable + " WHERE sessionID == " + uniqueID;
dbcmd.ExecuteNonQuery();
- //runs PENDING
+ //delete normal runs
+ dbcmd.CommandText = "Delete FROM " + Constants.RunTable + " WHERE sessionID == " + uniqueID;
+ dbcmd.ExecuteNonQuery();
+
+ //delete intervallic runs
+ dbcmd.CommandText = "Delete FROM " + Constants.RunIntervalTable + " WHERE sessionID == " + uniqueID;
+ dbcmd.ExecuteNonQuery();
+
+ //delete reaction times
+ dbcmd.CommandText = "Delete FROM " + Constants.ReactionTimeTable + " WHERE sessionID == " + uniqueID;
+ dbcmd.ExecuteNonQuery();
+
+ //delete pulses
+ dbcmd.CommandText = "Delete FROM " + Constants.PulseTable + " WHERE sessionID == " + uniqueID;
+ dbcmd.ExecuteNonQuery();
+
+ //delete multiChronopic
+ dbcmd.CommandText = "Delete FROM " + Constants.MultiChronopicTable + " WHERE sessionID == " + uniqueID;
+ dbcmd.ExecuteNonQuery();
+
dbcon.Close();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]