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

repair_sub_events (reactive jumps) finished!

notebook changes for some menu events
small bug fixed in showing delete_last button when no jumps or runs done
parent 9aa88241
CHANGELOG:
7 des 2005
repair_sub_events (reactive jumps) finished!
notebook changes for some menu events
small bug fixed in showing delete_last button when no jumps or runs done
7 des 2005
new window: repair_sub_events, allows repair reactive jumps by parts (future also runs).
Currently can add, edit, remove subjumps (different actions depending
......
No preview for this file type
No preview for this file type
......@@ -37,8 +37,8 @@ class Test {
Catalog.Init ("chronojump", "./locale");
//-- Crear objeto chronopic, para acceder al chronopic
//Chronopic cp = new Chronopic("/dev/ttyS0");
Chronopic cp = new Chronopic("/dev/ttyUSB0");
Chronopic cp = new Chronopic("/dev/ttyS0");
//Chronopic cp = new Chronopic("/dev/ttyUSB0");
//-- Obtener el estado inicial de la plataforma
......
......@@ -62,6 +62,7 @@ public class ChronoJump
[Widget] Gtk.Button button_edit_selected_jump_rj;
[Widget] Gtk.Button button_delete_selected_jump_rj;
[Widget] Gtk.Button button_repair_selected_reactive_jump;
[Widget] Gtk.MenuItem menuitem_repair_selected_reactive_jump;
[Widget] Gtk.CheckButton checkbutton_sort_by_type_run;
[Widget] Gtk.CheckButton checkbutton_sort_by_type_run_interval;
......@@ -790,6 +791,7 @@ public class ChronoJump
button_edit_selected_jump_rj.Sensitive = true;
button_delete_selected_jump_rj.Sensitive = true;
button_repair_selected_reactive_jump.Sensitive = true;
menuitem_repair_selected_reactive_jump.Sensitive = true;
treeview_jumps_rj_storeReset();
fillTreeView_jumps_rj(treeview_jumps, treeview_jumps_store, myText);
......@@ -1478,9 +1480,7 @@ public class ChronoJump
}
//change to page 0 of notebook if were in other
while(notebook.CurrentPage > 0) {
notebook.PrevPage();
}
notebook_change(0);
}
//unhide buttons that allow jumping
......@@ -1633,12 +1633,7 @@ public class ChronoJump
}
//change to page 1 of notebook if were in other
if(notebook.CurrentPage == 0) {
notebook.NextPage();
}
while(notebook.CurrentPage > 1) {
notebook.PrevPage();
}
notebook_change(1);
}
//unhide buttons that allow jumping
......@@ -1771,12 +1766,7 @@ public class ChronoJump
}
//change to page 2 of notebook if were in other
while(notebook.CurrentPage < 2) {
notebook.NextPage();
}
while(notebook.CurrentPage > 2) {
notebook.PrevPage();
}
notebook_change(2);
}
//unhide buttons that allow jumping, running
......@@ -1917,10 +1907,8 @@ public class ChronoJump
statsWin.FillTreeView_stats(false, false);
}
//change to page 4 of notebook if were in other
if(notebook.CurrentPage < 4) {
notebook.NextPage();
}
//change to page 3 of notebook if were in other
notebook_change(3);
}
sensitiveGuiYesJump();
......@@ -1936,6 +1924,15 @@ public class ChronoJump
* --------------------------------------------------------
*/
private void notebook_change(int desiredPage) {
if(notebook.CurrentPage < desiredPage) {
notebook.NextPage();
}
while(notebook.CurrentPage > desiredPage) {
notebook.PrevPage();
}
}
private void on_last_delete (object o, EventArgs args) {
Console.WriteLine("delete last (jump or run)");
......@@ -1944,11 +1941,15 @@ public class ChronoJump
if (askDeletion) {
int myID = myTreeViewJumps.JumpSelectedID;
if(lastJumpIsReactive) {
notebook_change(1);
warningString = Catalog.GetString("Atention: Deleting a RJ subjump will delete all the RJ");
myID = myTreeViewJumpsRj.JumpSelectedID;
} else {
notebook_change(0);
}
confirmWinJumpRun = ConfirmWindowJumpRun.Show(app1,
Catalog.GetString("Do you want to delete selected jump?"),
Catalog.GetString("Do you want to delete last jump?"),
warningString, "jump", myID);
confirmWinJumpRun.Button_accept.Clicked += new EventHandler(on_last_jump_delete_accepted);
} else {
......@@ -1962,9 +1963,13 @@ public class ChronoJump
warningString = Catalog.GetString("Atention: Deleting a intervalic sub-run will delete all the run");
myID = myTreeViewRunsInterval.JumpSelectedID;
*/
notebook_change(3);
} else {
notebook_change(2);
}
confirmWinJumpRun = ConfirmWindowJumpRun.Show(app1,
Catalog.GetString("Do you want to delete selected run?"),
Catalog.GetString("Do you want to delete last run?"),
warningString, "run", myID);
confirmWinJumpRun.Button_accept.Clicked += new EventHandler(on_last_run_delete_accepted);
} else {
......@@ -2016,6 +2021,7 @@ public class ChronoJump
}
private void on_edit_selected_jump_clicked (object o, EventArgs args) {
notebook_change(0);
Console.WriteLine("Edit selected jump (normal)");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person (check also if it's not a individual RJ, the pass the parent RJ)
......@@ -2030,6 +2036,7 @@ public class ChronoJump
}
private void on_edit_selected_jump_rj_clicked (object o, EventArgs args) {
notebook_change(1);
Console.WriteLine("Edit selected jump (RJ)");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person (check also if it's not a individual RJ, the pass the parent RJ)
......@@ -2044,6 +2051,7 @@ public class ChronoJump
}
private void on_repair_selected_reactive_jump_clicked (object o, EventArgs args) {
notebook_change(1);
Console.WriteLine("Repair selected subjump");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person (check also if it's not a individual RJ, the pass the parent RJ)
......@@ -2081,9 +2089,17 @@ public class ChronoJump
private void on_repair_selected_reactive_jump_accepted (object o, EventArgs args) {
Console.WriteLine("Repair selected reactive jump accepted");
treeview_jumps_rj_storeReset();
fillTreeView_jumps_rj(treeview_jumps_rj, treeview_jumps_rj_store, combo_jumps_rj.Entry.Text);
if(createdStatsWin) {
statsWin.FillTreeView_stats(false, false);
}
}
private void on_delete_selected_jump_clicked (object o, EventArgs args) {
notebook_change(0);
Console.WriteLine("delete selected jump (normal)");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person
......@@ -2101,6 +2117,7 @@ public class ChronoJump
}
private void on_delete_selected_jump_rj_clicked (object o, EventArgs args) {
notebook_change(1);
Console.WriteLine("delete selected reactive jump");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person (check also if it's not a individual RJ, the pass the parent RJ)
......@@ -2162,6 +2179,7 @@ public class ChronoJump
*/
private void on_edit_selected_run_clicked (object o, EventArgs args) {
notebook_change(2);
Console.WriteLine("Edit selected run (normal)");
//1.- check that there's a line selected
//2.- check that this line is a jump and not a person (check also if it's not a individual RJ, the pass the parent RJ)
......@@ -2177,6 +2195,7 @@ public class ChronoJump
}
private void on_edit_selected_run_interval_clicked (object o, EventArgs args) {
notebook_change(3);
Console.WriteLine("Edit selected run interval");
//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 subrun, the pass the parent run)
......@@ -2214,6 +2233,7 @@ public class ChronoJump
}
private void on_delete_selected_run_clicked (object o, EventArgs args) {
notebook_change(2);
Console.WriteLine("delete selected run (normal)");
//1.- check that there's a line selected
......@@ -2232,6 +2252,7 @@ public class ChronoJump
private void on_delete_selected_run_interval_clicked (object o, EventArgs args) {
notebook_change(3);
Console.WriteLine("delete selected run interval");
//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 a subrun, pass the parent run)
......@@ -2401,6 +2422,7 @@ public class ChronoJump
button_edit_selected_jump_rj.Sensitive = false;
button_delete_selected_jump_rj.Sensitive = false;
button_repair_selected_reactive_jump.Sensitive = false;
menuitem_repair_selected_reactive_jump.Sensitive = false;
menuitem_edit_selected_run.Sensitive = false;
menuitem_delete_selected_run.Sensitive = false;
button_edit_selected_run.Sensitive = false;
......@@ -2427,7 +2449,6 @@ public class ChronoJump
menu_view.Sensitive = true;
jump_type_add.Sensitive = true;
button_last_delete.Sensitive = true;
hbox_jumps.Sensitive = true;
hbox_jumps_rj.Sensitive = true;
......@@ -2446,6 +2467,7 @@ public class ChronoJump
button_edit_selected_jump_rj.Sensitive = true;
button_delete_selected_jump_rj.Sensitive = true;
button_repair_selected_reactive_jump.Sensitive = true;
menuitem_repair_selected_reactive_jump.Sensitive = true;
menuitem_edit_selected_run.Sensitive = true;
menuitem_delete_selected_run.Sensitive = true;
button_edit_selected_run.Sensitive = true;
......
......@@ -310,6 +310,7 @@ public class RepairJumpRjWindow
Gtk.Window parent;
JumpType jumpType;
JumpRj jumpRj; //used on button_accept
RepairJumpRjWindow (Gtk.Window parent, JumpRj myJump) {
......@@ -317,6 +318,7 @@ public class RepairJumpRjWindow
gladeXML.Autoconnect(this);
this.parent = parent;
this.jumpRj = myJump;
repair_sub_event.Title = Catalog.GetString("Repair reactive jump");
......@@ -489,19 +491,6 @@ public class RepairJumpRjWindow
}
}
void on_button_cancel_clicked (object o, EventArgs args)
{
RepairJumpRjWindowBox.repair_sub_event.Hide();
RepairJumpRjWindowBox = null;
}
void on_delete_event (object o, EventArgs args)
{
RepairJumpRjWindowBox.repair_sub_event.Hide();
RepairJumpRjWindowBox = null;
}
void on_treeview_cursor_changed (object o, EventArgs args) {
TreeView tv = (TreeView) o;
TreeModel model;
......@@ -597,12 +586,70 @@ public class RepairJumpRjWindow
void on_button_accept_clicked (object o, EventArgs args)
{
//foreach all lines
//create a jumpRj calculating all the data for the new changes
//save it
//foreach all lines... extrac tcString and tvString
TreeIter myIter;
string tcString = "";
string tvString = "";
bool iterOk = store.GetIterFirst (out myIter);
if(iterOk) {
int count = 1;
string equal= ""; //first iteration should not appear '='
do {
tcString = tcString + equal + (string) treeview_subevents.Model.GetValue (myIter, 1);
tvString = tvString + equal + (string) treeview_subevents.Model.GetValue (myIter, 2);
equal = "=";
} while (store.IterNext (ref myIter));
}
//calculate other variables needed for jumpRj creation
int jumps = Util.GetNumberOfJumps(tvString);
string limitString = "";
if(jumpType.FixedValue > 0) {
//if this jumpType has a fixed value of jumps or time, limitstring has not changed
if(jumpType.JumpsLimited) {
limitString = jumpType.FixedValue.ToString() + "J";
} else {
limitString = jumpType.FixedValue.ToString() + "T";
}
} else {
//else limitstring should be calculated
if(jumpType.JumpsLimited) {
limitString = jumps.ToString() + "J";
} else {
limitString = Util.GetTotalTime(tcString, tvString) + "T";
}
}
//save it deleting the old first for having the same uniqueID
SqliteJump.Delete("jumpRj", jumpRj.UniqueID.ToString());
int uniqueID = SqliteJump.InsertRj(jumpRj.UniqueID.ToString(), jumpRj.PersonID, jumpRj.SessionID,
jumpRj.Type, Util.GetMax(tvString), Util.GetMax(tcString),
jumpRj.Fall, jumpRj.Weight, jumpRj.Description,
Util.GetAverage(tvString), Util.GetAverage(tcString),
tvString, tcString,
jumps, Util.GetTotalTime(tcString, tvString), limitString
);
//close the window
RepairJumpRjWindowBox.repair_sub_event.Hide();
RepairJumpRjWindowBox = null;
}
void on_button_cancel_clicked (object o, EventArgs args)
{
RepairJumpRjWindowBox.repair_sub_event.Hide();
RepairJumpRjWindowBox = null;
}
void on_delete_event (object o, EventArgs args)
{
RepairJumpRjWindowBox.repair_sub_event.Hide();
RepairJumpRjWindowBox = null;
}
public Button Button_accept
{
set { button_accept = value; }
......
......@@ -705,7 +705,7 @@ public class JumpRj : Jump
}
}
uniqueID = SqliteJump.InsertRj(personID, sessionID,
uniqueID = SqliteJump.InsertRj("NULL", personID, sessionID,
type, Util.GetMax(tvString), Util.GetMax(tcString),
fall, weight, "", //fall, weight, description
Util.GetAverage(tvString), Util.GetAverage(tcString),
......
......@@ -98,13 +98,13 @@ class SqliteJump : Sqlite
}
//fall has values like "10J" or "10T" (10 jumps, or 10 seconds, respectively)
public static int InsertRj(int personID, int sessionID, string type, double tvMax, double tcMax, int fall, double weight, string description, double tvAvg, double tcAvg, string tvString, string tcString, int jumps, double time, string limited )
public static int InsertRj(string uniqueID, int personID, int sessionID, string type, double tvMax, double tcMax, int fall, double weight, string description, double tvAvg, double tcAvg, string tvString, string tcString, int jumps, double time, string limited )
{
dbcon.Open();
dbcmd.CommandText = "INSERT INTO jumpRj " +
"(uniqueID, personID, sessionID, type, tvMax, tcMax, fall, weight, description, " +
"tvAvg, tcAvg, tvString, tcString, jumps, time, limited )" +
"VALUES (NULL, " +
"VALUES (" + uniqueID + ", " +
personID + ", " + sessionID + ", '" + type + "', " +
Util.ConvertToPoint(tvMax) + ", " + Util.ConvertToPoint(tcMax) + ", '" +
fall + "', '" + Util.ConvertToPoint(weight) + "', '" + description + "', " +
......
......@@ -168,7 +168,8 @@ public class Util
string [] jumpsSeparated = myString.Split(new char[] {'='});
int count = 0;
foreach (string temp in jumpsSeparated) {
count++;
if(temp != "-1")
count++;
}
if(count == 0) { count =1; }
......@@ -187,10 +188,12 @@ public class Util
double totalTime = 0;
foreach (string jump in tc) {
totalTime = totalTime + Convert.ToDouble(jump);
if(jump != "-1")
totalTime = totalTime + Convert.ToDouble(jump);
}
foreach (string jump in tv) {
totalTime = totalTime + Convert.ToDouble(jump);
if(jump != "-1")
totalTime = totalTime + Convert.ToDouble(jump);
}
return totalTime ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment