Commit a9761682 authored by Xavier de Blas's avatar Xavier de Blas

minor RELEASE 0.41

jumps and jumpsRj show values in realtime in progressBar

repair_sub_events repairs also interval runs

cannot make 3.5 jumps (last tc will be deleted) also cannot select 3.5 jumps in jump extra.
fixed when finish button is pressed and no event was done

minor: decimal numbers by default to 3 (milliseconds)
minor: clean weight representation in treeviewjump add
parent fc304139
CHANGELOG:
14 des 2005 (minor RELEASE 0.41)
jumps and jumpsRj show values in realtime in progressBar
repair_sub_events repairs also interval runs
cannot make 3.5 jumps (last tc will be deleted)
also cannot select 3.5 jumps in jump extra
fixed when finish button is pressed and no event was done
minor: decimal numbers by default to 3 (milliseconds)
minor: clean weight representation in treeviewjump add
7 des 2005
repair_sub_events (reactive jumps) finished!
notebook changes for some menu events
......@@ -27,7 +39,7 @@ CHANGELOG:
if there are problems for accessing to /dev/ttyS0, now changes to
'simulated' automatically. Future: show a errorWindow
30 nov 2005
30 nov 2005 (RELEASE 0.4)
fixed bug in printed report (some persons doesn't shown, and order was
not correct)
......
No preview for this file type
......@@ -79,7 +79,7 @@
<signal name="activate" handler="on_open_activate" last_modification_time="Wed, 22 Sep 2004 23:55:11 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1378">
<widget class="GtkImage" id="image1407">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -100,7 +100,7 @@
<signal name="activate" handler="on_edit_session_activate" last_modification_time="Tue, 26 Jul 2005 19:12:07 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1379">
<widget class="GtkImage" id="image1408">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
......@@ -122,7 +122,7 @@
<signal name="activate" handler="on_delete_session_activate" last_modification_time="Thu, 28 Jul 2005 13:37:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1380">
<widget class="GtkImage" id="image1409">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -149,7 +149,7 @@
<signal name="activate" handler="on_export_session_activate" last_modification_time="Sat, 12 Feb 2005 21:57:07 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1381">
<widget class="GtkImage" id="image1410">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
......@@ -220,7 +220,7 @@
<signal name="activate" handler="on_person_add_single_activate" last_modification_time="Thu, 18 Aug 2005 23:07:39 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1382">
<widget class="GtkImage" id="image1411">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -241,7 +241,7 @@
<signal name="activate" handler="on_person_add_multiple_activate" last_modification_time="Thu, 18 Aug 2005 23:01:23 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1383">
<widget class="GtkImage" id="image1412">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -268,7 +268,7 @@
<signal name="activate" handler="on_recuperate_person_activate" last_modification_time="Sun, 12 Dec 2004 00:40:31 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1384">
<widget class="GtkImage" id="image1413">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -289,7 +289,7 @@
<signal name="activate" handler="on_recuperate_persons_from_session_activate" last_modification_time="Tue, 26 Jul 2005 19:12:07 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1385">
<widget class="GtkImage" id="image1414">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -316,7 +316,7 @@
<signal name="activate" handler="on_edit_current_person_clicked" last_modification_time="Sun, 17 Oct 2004 11:43:33 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1386">
<widget class="GtkImage" id="image1415">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -337,7 +337,7 @@
<signal name="activate" handler="on_show_all_person_events_activate" last_modification_time="Mon, 29 Aug 2005 09:51:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1387">
<widget class="GtkImage" id="image1416">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
......@@ -364,7 +364,7 @@
<signal name="activate" handler="on_delete_current_person_from_session_activate" last_modification_time="Thu, 28 Jul 2005 15:49:38 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1388">
<widget class="GtkImage" id="image1417">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -452,7 +452,7 @@
<signal name="activate" handler="on_button_more_clicked" last_modification_time="Thu, 10 Mar 2005 18:52:25 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1389">
<widget class="GtkImage" id="image1418">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -477,7 +477,7 @@
<signal name="activate" handler="on_edit_selected_jump_clicked" last_modification_time="Sun, 17 Oct 2004 11:47:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1390">
<widget class="GtkImage" id="image1419">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -498,7 +498,7 @@
<signal name="activate" handler="on_delete_selected_jump_clicked" last_modification_time="Tue, 19 Oct 2004 11:54:17 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1391">
<widget class="GtkImage" id="image1420">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -562,7 +562,7 @@
<signal name="activate" handler="on_button_more_rj_clicked" last_modification_time="Fri, 11 Mar 2005 14:45:23 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1392">
<widget class="GtkImage" id="image1421">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -587,7 +587,7 @@
<signal name="activate" handler="on_edit_selected_jump_rj_clicked" last_modification_time="Sun, 07 Nov 2004 17:37:37 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1393">
<widget class="GtkImage" id="image1422">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -608,7 +608,7 @@
<signal name="activate" handler="on_repair_selected_reactive_jump_clicked" last_modification_time="Wed, 07 Dec 2005 01:14:11 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1394">
<widget class="GtkImage" id="image1423">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
......@@ -629,7 +629,7 @@
<signal name="activate" handler="on_delete_selected_jump_rj_clicked" last_modification_time="Sun, 07 Nov 2004 17:37:37 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1395">
<widget class="GtkImage" id="image1424">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -656,7 +656,7 @@
<signal name="activate" handler="on_jump_type_add_activate" last_modification_time="Thu, 10 Mar 2005 18:52:25 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1396">
<widget class="GtkImage" id="image1425">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -762,7 +762,7 @@
<signal name="activate" handler="on_button_run_more_clicked" last_modification_time="Fri, 22 Apr 2005 14:37:06 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1397">
<widget class="GtkImage" id="image1426">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -787,7 +787,7 @@
<signal name="activate" handler="on_edit_selected_run_clicked" last_modification_time="Fri, 22 Apr 2005 14:34:58 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1398">
<widget class="GtkImage" id="image1427">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -808,7 +808,7 @@
<signal name="activate" handler="on_delete_selected_run_clicked" last_modification_time="Fri, 22 Apr 2005 14:34:58 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1399">
<widget class="GtkImage" id="image1428">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -871,7 +871,7 @@
<signal name="activate" handler="on_button_run_interval_more_clicked" last_modification_time="Tue, 16 Aug 2005 01:18:41 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1400">
<widget class="GtkImage" id="image1429">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -896,7 +896,7 @@
<signal name="activate" handler="on_edit_selected_run_interval_clicked" last_modification_time="Tue, 16 Aug 2005 12:33:39 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1401">
<widget class="GtkImage" id="image1430">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -909,6 +909,27 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_repair_selected_interval_run">
<property name="visible">True</property>
<property name="label" translatable="yes">Repair selected interval run</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_repair_selected_interval_run_clicked" last_modification_time="Thu, 08 Dec 2005 18:12:00 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1431">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_delete_selected_run_interval">
<property name="visible">True</property>
......@@ -917,7 +938,7 @@
<signal name="activate" handler="on_delete_selected_run_interval_clicked" last_modification_time="Tue, 16 Aug 2005 12:33:39 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1402">
<widget class="GtkImage" id="image1432">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -944,7 +965,7 @@
<signal name="activate" handler="on_run_type_add_activate" last_modification_time="Fri, 22 Apr 2005 14:34:58 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1403">
<widget class="GtkImage" id="image1433">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -977,7 +998,7 @@
<signal name="activate" handler="on_menuitem_view_stats_activate" last_modification_time="Tue, 26 Jul 2005 23:54:29 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1404">
<widget class="GtkImage" id="image1434">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
......@@ -998,7 +1019,7 @@
<signal name="activate" handler="on_show_report_activate" last_modification_time="Tue, 06 Sep 2005 09:10:32 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1405">
<widget class="GtkImage" id="image1435">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
......@@ -1179,7 +1200,7 @@
<child>
<widget class="GtkHBox" id="hbox_progress_bar">
<property name="width_request">150</property>
<property name="width_request">325</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
......@@ -3329,6 +3350,35 @@
</packing>
</child>
<child>
<widget class="GtkButton" id="button_repair_selected_interval_run">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Repair selected interval run</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_repair_selected_interval_run_clicked" last_modification_time="Thu, 08 Dec 2005 18:09:54 GMT"/>
<child>
<widget class="GtkImage" id="image1406">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_edit_selected_run_interval">
<property name="visible">True</property>
......@@ -5458,12 +5508,12 @@ weight</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">0</property>
<property name="digits">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_IF_VALID</property>
<property name="snap_to_ticks">True</property>
<property name="wrap">True</property>
<property name="adjustment">10 0 100 0.5 10 10</property>
<property name="adjustment">10 0 100 1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
......
......@@ -9,10 +9,10 @@ chronojump 0.5
- plot rjevolution consecutives in colors
- Chronojump will be a tool for training, not only for showing the results of train:
- add realtime info of every jump
- add realtime info of every reactive jump and intervalic run [DONE]
- show realtime graph of some different color lights depending on the value respect previous jumps
- add conditions for finishing a jump or run ("when Q index is under x three times" ...)
- edit reactive jump and intervalic run [WIP 75%]
- edit reactive jump and intervalic run [DONE]
- stats checkboxes selectable by an outside combo with (all, none, invert, man, woman, ...) [DONE]
- chronojump should be able of reading from usb with a serial-usb cable (ttyUSB0)
......
......@@ -159,7 +159,7 @@ public class ChronoJump
private Random rand;
private static string [] authors = {"Xavier de Blas", "Juan Gonzalez"};
private static string progversion = "0.4";
private static string progversion = "0.41";
private static string progname = "Chronojump";
//normal jumps
......@@ -222,6 +222,7 @@ public class ChronoJump
RunsIntervalMoreWindow runsIntervalMoreWin;
RunTypeAddWindow runTypeAddWin;
EditRunWindow editRunWin;
RepairRunIntervalWindow repairRunIntervalWin;
EditRunIntervalWindow editRunIntervalWin;
ConfirmWindowJumpRun confirmWinJumpRun; //for deleting jumps and RJ jumps (and runs)
......@@ -2003,7 +2004,7 @@ public class ChronoJump
if (lastRunIsInterval) {
//SqliteRun.RjDelete(currentRunRj.UniqueID.ToString());
} else {
SqliteRun.Delete(currentRun.UniqueID.ToString());
SqliteRun.Delete("run", currentRun.UniqueID.ToString());
}
button_last_delete.Sensitive = false ;
......@@ -2210,6 +2211,22 @@ public class ChronoJump
}
}
private void on_repair_selected_interval_run_clicked (object o, EventArgs args) {
notebook_change(3);
Console.WriteLine("Repair selected subrun");
//1.- check that there's a line selected
//2.- check that this line is a run and not a person
//(check also if it's not a individual run interval, then pass the parent run interval)
if (myTreeViewRunsInterval.RunSelectedID > 0) {
//3.- obtain the data of the selected run
RunInterval myRun = SqliteRun.SelectIntervalRunData( myTreeViewRunsInterval.RunSelectedID );
//4.- edit this run
repairRunIntervalWin = RepairRunIntervalWindow.Show(app1, myRun);
repairRunIntervalWin.Button_accept.Clicked += new EventHandler(on_repair_selected_run_interval_accepted);
}
}
private void on_edit_selected_run_accepted (object o, EventArgs args) {
Console.WriteLine("edit selected run accepted");
......@@ -2232,6 +2249,17 @@ public class ChronoJump
}
}
private void on_repair_selected_run_interval_accepted (object o, EventArgs args) {
Console.WriteLine("repair selected run interval accepted");
treeview_runs_interval_storeReset();
fillTreeView_runs_interval(treeview_runs_interval, treeview_runs_interval_store, combo_runs_interval.Entry.Text);
if(createdStatsWin) {
statsWin.FillTreeView_stats(false, false);
}
}
private void on_delete_selected_run_clicked (object o, EventArgs args) {
notebook_change(2);
Console.WriteLine("delete selected run (normal)");
......@@ -2272,7 +2300,7 @@ public class ChronoJump
private void on_delete_selected_run_accepted (object o, EventArgs args) {
Console.WriteLine("accept delete selected run");
SqliteRun.Delete( (myTreeViewRuns.RunSelectedID).ToString() );
SqliteRun.Delete( "run", (myTreeViewRuns.RunSelectedID).ToString() );
appbar2.Push( Catalog.GetString ( "Deleted run: " ) + myTreeViewRuns.RunSelectedID );
......@@ -2286,7 +2314,7 @@ public class ChronoJump
private void on_delete_selected_run_interval_accepted (object o, EventArgs args) {
Console.WriteLine("accept delete selected run");
SqliteRun.IntervalDelete( (myTreeViewRunsInterval.RunSelectedID).ToString() );
SqliteRun.Delete( "runInterval", (myTreeViewRunsInterval.RunSelectedID).ToString() );
appbar2.Push( Catalog.GetString ( "Deleted interval run: " ) + myTreeViewRunsInterval.RunSelectedID );
......
......@@ -240,6 +240,310 @@ public class EditRunIntervalWindow
}
//--------------------------------------------------------
//---------------- Repair runInterval WIDGET -------------
//--------------------------------------------------------
public class RepairRunIntervalWindow
{
[Widget] Gtk.Window repair_sub_event;
[Widget] Gtk.Label label_header;
[Widget] Gtk.Label label_totaltime_value;
[Widget] Gtk.TreeView treeview_subevents;
private TreeStore store;
[Widget] Gtk.Button button_accept;
[Widget] Gtk.Button button_add_before;
[Widget] Gtk.Button button_add_after;
[Widget] Gtk.Button button_delete;
[Widget] Gtk.TextView textview1;
static RepairRunIntervalWindow RepairRunIntervalWindowBox;
Gtk.Window parent;
RunType runType;
RunInterval runInterval; //used on button_accept
RepairRunIntervalWindow (Gtk.Window parent, RunInterval myRun) {
Glade.XML gladeXML = Glade.XML.FromAssembly ("chronojump.glade", "repair_sub_event", null);
gladeXML.Autoconnect(this);
this.parent = parent;
this.runInterval = myRun;
repair_sub_event.Title = Catalog.GetString("Repair interval run");
System.Globalization.NumberFormatInfo localeInfo = new System.Globalization.NumberFormatInfo();
localeInfo = System.Globalization.NumberFormatInfo.CurrentInfo;
label_header.Text = string.Format(Catalog.GetString("Use this window for repair a intervalic run\nDouble clic any cell for editing (decimal separator: '{0}')"), localeInfo.NumberDecimalSeparator);
runType = SqliteRunType.SelectAndReturnRunIntervalType(myRun.Type);
TextBuffer tb = new TextBuffer (new TextTagTable());
tb.SetText(createTextForTextView(runType));
textview1.Buffer = tb;
createTreeView(treeview_subevents);
//count, time
store = new TreeStore(typeof (string), typeof (string));
treeview_subevents.Model = store;
fillTreeView (treeview_subevents, store, myRun);
button_add_before.Sensitive = false;
button_add_after.Sensitive = false;
button_delete.Sensitive = false;
label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");
}
static public RepairRunIntervalWindow Show (Gtk.Window parent, RunInterval myRun)
{
//Console.WriteLine(myRun);
if (RepairRunIntervalWindowBox == null) {
RepairRunIntervalWindowBox = new RepairRunIntervalWindow (parent, myRun);
}
RepairRunIntervalWindowBox.repair_sub_event.Show ();
return RepairRunIntervalWindowBox;
}
private string createTextForTextView (RunType myRunType) {
string runTypeString = string.Format(Catalog.GetString(
"RunType: {0}."), myRunType.Name);
string fixedString = "";
if(myRunType.FixedValue > 0) {
if(myRunType.TracksLimited) {
//if it's a run type runsLimited with a fixed value, then don't allow the creation of more runs
fixedString = string.Format(Catalog.GetString("\nThis run type is fixed for {0} runs, you cannot add more."), myRunType.FixedValue);
} else {
//if it's a run type timeLimited with a fixed value, then complain when the total time is higher
fixedString = string.Format(Catalog.GetString("\nThis run type is fixed for {0} seconds, totaltime cannot be greater."), myRunType.FixedValue);
}
}
return runTypeString + fixedString;
}
private void createTreeView (Gtk.TreeView myTreeView) {
myTreeView.HeadersVisible=true;
int count = 0;
myTreeView.AppendColumn ( Catalog.GetString ("Count"), new CellRendererText(), "text", count++);
//myTreeView.AppendColumn ( Catalog.GetString ("Time"), new CellRendererText(), "text", count++);
Gtk.TreeViewColumn timeColumn = new Gtk.TreeViewColumn ();
timeColumn.Title = Catalog.GetString("TV");
Gtk.CellRendererText timeCell = new Gtk.CellRendererText ();
timeCell.Editable = true;
timeCell.Edited += timeCellEdited;
timeColumn.PackStart (timeCell, true);
timeColumn.AddAttribute(timeCell, "text", count ++);
myTreeView.AppendColumn ( timeColumn );
}
private void timeCellEdited (object o, Gtk.EditedArgs args)
{
Gtk.TreeIter iter;
store.GetIter (out iter, new Gtk.TreePath (args.Path));
if(Util.IsNumber(args.NewText)) {
//if it's limited by fixed value of seconds
//and new seconds are bigger than allowed, return
if(runType.FixedValue > 0 && ! runType.TracksLimited &&
getTotalTime() //current total time in treeview
- Convert.ToDouble((string) treeview_subevents.Model.GetValue(iter,1)) //-old cell
+ Convert.ToDouble(args.NewText) //+new cell
> runType.FixedValue) { //bigger than allowed
return;
} else {
store.SetValue(iter, 1, args.NewText);
//update the totaltime label
label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");
}
}
//if is not number or if it was -1, the old data will remain
}
private double getTotalTime() {
TreeIter myIter;
double totalTime = 0;
bool iterOk = store.GetIterFirst (out myIter);
if(iterOk) {
do {
double myTime = Convert.ToDouble((string) treeview_subevents.Model.GetValue(myIter, 1));
totalTime += myTime;
} while (store.IterNext (ref myIter));
}
return totalTime;
}
private void fillTreeView (Gtk.TreeView tv, TreeStore store, RunInterval myRun)
{
if(myRun.IntervalTimesString.Length > 0) {
string [] timeArray = myRun.IntervalTimesString.Split(new char[] {'='});
int count = 0;
foreach (string myTime in timeArray) {
store.AppendValues ( (count+1).ToString(), myTime );
count ++;
}
}
}
void on_treeview_cursor_changed (object o, EventArgs args) {
TreeView tv = (TreeView) o;
TreeModel model;
TreeIter iter;
if (tv.Selection.GetSelected (out model, out iter)) {
button_add_before.Sensitive = true;
button_add_after.Sensitive = true;
button_delete.Sensitive = true;
//don't allow to add a row before or after
//if the runtype is fixed to n runs and we reached n
if(runType.FixedValue > 0 && runType.TracksLimited) {
int lastRow = 0;
do {
lastRow = Convert.ToInt32 ((string) model.GetValue (iter, 0));
} while (store.IterNext (ref iter));
//don't allow if max rows reached
if(lastRow == runType.FixedValue) {
button_add_before.Sensitive = false;
button_add_after.Sensitive = false;
}
}
}
}
void on_button_add_before_clicked (object o, EventArgs args) {
TreeModel model;
TreeIter iter;
if (treeview_subevents.Selection.GetSelected (out model, out iter)) {
int position = Convert.ToInt32( (string) model.GetValue (iter, 0) ) -1; //count starts at '0'
store.Insert(out iter, position);
store.SetValue(iter, 1, "0");
putRowNumbers(store);
}
}
void on_button_add_after_clicked (object o, EventArgs args) {
TreeModel model;
TreeIter iter;
if (treeview_subevents.Selection.GetSelected (out model, out iter)) {
int position = Convert.ToInt32( (string) model.GetValue (iter, 0) ); //count starts at '0'
store.Insert(out iter, position);
store.SetValue(iter, 1, "0");
putRowNumbers(store);
}
}
private void putRowNumbers(TreeStore myStore) {
TreeIter myIter;
bool iterOk = myStore.GetIterFirst (out myIter);
if(iterOk) {
int count = 1;
do {
store.SetValue(myIter, 0, (count++).ToString());
} while (myStore.IterNext (ref myIter));
}
}
void on_button_delete_clicked (object o, EventArgs args) {
TreeModel model;
TreeIter iter;
if (treeview_subevents.Selection.GetSelected (out model, out iter)) {
store.Remove(ref iter);
putRowNumbers(store);
label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");
button_add_before.Sensitive = false;
button_add_after.Sensitive = false;
button_delete.Sensitive = false;
}
}
void on_button_accept_clicked (object o, EventArgs args)
{
//foreach all lines... extrac intervalTimesString
TreeIter myIter;
string timeString = "";
bool iterOk = store.GetIterFirst (out myIter);
if(iterOk) {
int count = 1;
string equal= ""; //first iteration should not appear '='
do {
timeString = timeString + equal + (string) treeview_subevents.Model.GetValue (myIter, 1);
equal = "=";
} while (store.IterNext (ref myIter));
}
//calculate other variables needed for runInterval creation
int runs = Util.GetNumberOfJumps(timeString); //don't need a GetNumberOfRuns, this works
string limitString = "";
if(runType.FixedValue > 0) {
//if this runType has a fixed value of runs or time, limitstring has not changed
if(runType.TracksLimited) {
limitString = runType.FixedValue.ToString() + "R";
} else {
limitString = runType.FixedValue.ToString() + "T";
}
} else {
//else limitstring should be calculated
if(runType.TracksLimited) {
limitString = runs.ToString() + "R";
} else {
limitString = Util.GetTotalTime(timeString) + "T";
}
}
//save it deleting the old first for having the same uniqueID
SqliteRun.Delete("runInterval", runInterval.UniqueID.ToString());
int uniqueID = SqliteRun.InsertInterval(runInterval.UniqueID.ToString(),
runInterval.PersonID, runInterval.SessionID,
runInterval.Type,
runs * runInterval.DistanceInterval, //distanceTotal
Util.GetTotalTime(timeString), //timeTotal
runInterval.DistanceInterval, //distanceInterval
timeString, runs,
runInterval.Description,
limitString
);
//close the window
RepairRunIntervalWindowBox.repair_sub_event.Hid