Commit 092a4c0d authored by Xavier de Blas's avatar Xavier de Blas

load persons multiple finished (closes task: 271)

fixed bug: partial times in treviewrun add (for the first run of a person) was not shown
parent 045bd5a2
CHANGELOG:
22 aug 2005
load persons multiple finished (closes task: 271)
fixed bug: partial times in treviewrun add (for the first run of a
person) was not shown
21 aug 2005
stats and graphs have now an:
All simple jump stats (without TC, and mixing jumps with or without weight)
......
No preview for this file type
......@@ -76,7 +76,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="image1048">
<widget class="GtkImage" id="image1094">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -97,7 +97,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="image1049">
<widget class="GtkImage" id="image1095">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
......@@ -119,7 +119,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="image1050">
<widget class="GtkImage" id="image1096">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -146,7 +146,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="image1051">
<widget class="GtkImage" id="image1097">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
......@@ -217,7 +217,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="image1052">
<widget class="GtkImage" id="image1098">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -238,7 +238,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="image1053">
<widget class="GtkImage" id="image1099">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -265,7 +265,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="image1054">
<widget class="GtkImage" id="image1100">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -281,12 +281,12 @@
<child>
<widget class="GtkImageMenuItem" id="menuitem_recuperate_persons_from_session">
<property name="visible">True</property>
<property name="label" translatable="yes">Load persons from other session (PENDING)</property>
<property name="label" translatable="yes">Load persons from other session</property>
<property name="use_underline">True</property>
<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="image1055">
<widget class="GtkImage" id="image1101">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
......@@ -313,7 +313,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="image1056">
<widget class="GtkImage" id="image1102">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -340,7 +340,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="image1057">
<widget class="GtkImage" id="image1103">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -378,7 +378,7 @@
<child>
<widget class="GtkMenuItem" id="sj">
<property name="visible">True</property>
<property name="label">SJ</property>
<property name="label" translatable="yes">SJ</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_jump_activate" last_modification_time="Sat, 02 Oct 2004 20:23:20 GMT"/>
</widget>
......@@ -387,7 +387,7 @@
<child>
<widget class="GtkMenuItem" id="sj_plus">
<property name="visible">True</property>
<property name="label">SJ+</property>
<property name="label" translatable="yes">SJ+</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_jump_extra_activate" last_modification_time="Fri, 11 Mar 2005 13:16:49 GMT"/>
</widget>
......@@ -396,7 +396,7 @@
<child>
<widget class="GtkMenuItem" id="cmj">
<property name="visible">True</property>
<property name="label">CMJ</property>
<property name="label" translatable="yes">CMJ</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_jump_activate" last_modification_time="Sat, 02 Oct 2004 20:23:30 GMT"/>
</widget>
......@@ -405,7 +405,7 @@
<child>
<widget class="GtkMenuItem" id="abk">
<property name="visible">True</property>
<property name="label">ABK</property>
<property name="label" translatable="yes">ABK</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_jump_activate" last_modification_time="Sat, 02 Oct 2004 20:26:59 GMT"/>
</widget>
......@@ -414,7 +414,7 @@
<child>
<widget class="GtkMenuItem" id="dj">
<property name="visible">True</property>
<property name="label">DJ</property>
<property name="label" translatable="yes">DJ</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_jump_extra_activate" last_modification_time="Fri, 11 Mar 2005 13:17:03 GMT"/>
</widget>
......@@ -428,7 +428,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="image1058">
<widget class="GtkImage" id="image1104">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -453,7 +453,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="image1059">
<widget class="GtkImage" id="image1105">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -474,7 +474,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="image1060">
<widget class="GtkImage" id="image1106">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -505,7 +505,7 @@
<child>
<widget class="GtkMenuItem" id="rj_j">
<property name="visible">True</property>
<property name="label">RJ(j)</property>
<property name="label" translatable="yes">RJ(j)</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_rj_activate" last_modification_time="Wed, 22 Sep 2004 23:57:11 GMT"/>
</widget>
......@@ -514,7 +514,7 @@
<child>
<widget class="GtkMenuItem" id="rj_t">
<property name="visible">True</property>
<property name="label">RJ(t)</property>
<property name="label" translatable="yes">RJ(t)</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_rj_activate" last_modification_time="Fri, 11 Mar 2005 14:37:31 GMT"/>
</widget>
......@@ -538,7 +538,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="image1061">
<widget class="GtkImage" id="image1107">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -563,7 +563,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="image1062">
<widget class="GtkImage" id="image1108">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -584,7 +584,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="image1063">
<widget class="GtkImage" id="image1109">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -611,7 +611,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="image1064">
<widget class="GtkImage" id="image1110">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -667,7 +667,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_100m">
<property name="visible">True</property>
<property name="label">100m</property>
<property name="label" translatable="yes">100m</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_run_activate" last_modification_time="Tue, 02 Aug 2005 22:26:54 GMT"/>
</widget>
......@@ -676,7 +676,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_200m">
<property name="visible">True</property>
<property name="label">200m</property>
<property name="label" translatable="yes">200m</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_run_activate" last_modification_time="Tue, 02 Aug 2005 22:26:54 GMT"/>
</widget>
......@@ -685,7 +685,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_400m">
<property name="visible">True</property>
<property name="label">400m</property>
<property name="label" translatable="yes">400m</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_run_activate" last_modification_time="Tue, 02 Aug 2005 22:26:54 GMT"/>
</widget>
......@@ -694,7 +694,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_1000m">
<property name="visible">True</property>
<property name="label">1000m</property>
<property name="label" translatable="yes">1000m</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_run_activate" last_modification_time="Tue, 02 Aug 2005 22:26:54 GMT"/>
</widget>
......@@ -703,7 +703,7 @@
<child>
<widget class="GtkMenuItem" id="menuitem_2000m">
<property name="visible">True</property>
<property name="label">2000m</property>
<property name="label" translatable="yes">2000m</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_normal_run_activate" last_modification_time="Tue, 02 Aug 2005 22:26:54 GMT"/>
</widget>
......@@ -717,7 +717,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="image1065">
<widget class="GtkImage" id="image1111">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -742,7 +742,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="image1066">
<widget class="GtkImage" id="image1112">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -763,7 +763,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="image1067">
<widget class="GtkImage" id="image1113">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -826,7 +826,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="image1068">
<widget class="GtkImage" id="image1114">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -851,7 +851,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="image1069">
<widget class="GtkImage" id="image1115">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
......@@ -872,7 +872,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="image1070">
<widget class="GtkImage" id="image1116">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
......@@ -899,7 +899,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="image1071">
<widget class="GtkImage" id="image1117">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -961,7 +961,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">Serial Port</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="active">False</property>
<property name="group">menuitem_simulated</property>
<signal name="activate" handler="on_radiobutton_serial_port_activate" last_modification_time="Sat, 08 Jan 2005 05:11:45 GMT"/>
</widget>
......@@ -4434,7 +4434,7 @@ DD/MM/YYYY</property>
<widget class="GtkWindow" id="person_recuperate">
<property name="border_width">10</property>
<property name="width_request">400</property>
<property name="height_request">350</property>
<property name="height_request">400</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Load persons</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
......@@ -4481,6 +4481,61 @@ DD/MM/YYYY</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox_from_session_hide">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label157">
<property name="visible">True</property>
<property name="label" translatable="yes">From session</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox_combo_sessions">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="checkbutton_sort_by_creation_date">
<property name="visible">True</property>
......
......@@ -202,6 +202,7 @@ public class ChronoJump
SessionEditWindow sessionEditWin;
SessionLoadWindow sessionLoadWin;
PersonRecuperateWindow personRecuperateWin;
PersonsRecuperateFromOtherSessionWindow personsRecuperateFromOtherSessionWin;
PersonAddWindow personAddWin;
PersonAddMultipleWindow personAddMultipleWin;
PersonModifyWindow personModifyWin;
......@@ -812,7 +813,7 @@ public class ChronoJump
private void on_combo_person_current_changed(object o, EventArgs args) {
string myText = combo_person_current.Entry.Text;
if(myText != "" && myText.LastIndexOf(":") != -1) {
//if people modify the values in the combo_person_current, and this valeus are not correct,
//if people modify the values in the combo_person_current, and this values are not correct,
//let's update the combosujetocurrent
if(SqlitePersonSession.PersonSelectExistsInSession(Util.FetchID(myText), currentSession.UniqueID))
......@@ -1008,6 +1009,18 @@ public class ChronoJump
sensitiveGuiYesPerson();
}
private void on_recuperate_persons_from_session_activate (object o, EventArgs args) {
Console.WriteLine("recuperate persons from other session (not implemented)");
personsRecuperateFromOtherSessionWin = PersonsRecuperateFromOtherSessionWindow.Show(app1, currentSession.UniqueID);
personsRecuperateFromOtherSessionWin.Button_recuperate.Clicked += new EventHandler(on_recuperate_persons_from_session_accepted);
}
private void on_recuperate_persons_from_session_accepted (object o, EventArgs args) {
currentPerson = personsRecuperateFromOtherSessionWin.CurrentPerson;
updateComboSujetoCurrent();
sensitiveGuiYesPerson();
}
private void on_person_add_single_activate (object o, EventArgs args) {
personAddWin = PersonAddWindow.Show(app1, currentSession.UniqueID);
personAddWin.Button_accept.Clicked += new EventHandler(on_person_add_single_accepted);
......@@ -1071,12 +1084,6 @@ public class ChronoJump
}
}
private void on_recuperate_persons_from_session_activate (object o, EventArgs args) {
Console.WriteLine("recupuerate persons from other session (not implemented)");
//personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession.UniqueID);
//personRecuperateWin.Button_recuperate.Clicked += new EventHandler(on_recuperate_person_accepted);
}
private void on_delete_current_person_from_session_activate (object o, EventArgs args) {
Console.WriteLine("delete current person from this session");
......
......@@ -31,23 +31,29 @@ using System.Collections; //ArrayList
//load person (jumper)
public class PersonRecuperateWindow {
[Widget] Gtk.Window person_recuperate;
[Widget] protected Gtk.Window person_recuperate;
[Widget] Gtk.CheckButton checkbutton_sorted_by_creation_date;
bool sortByCreationDate = false;
[Widget] protected Gtk.CheckButton checkbutton_sorted_by_creation_date;
protected bool sortByCreationDate = false;
private TreeStore store;
private string selected;
[Widget] Gtk.TreeView treeview_person_recuperate;
[Widget] Gtk.Button button_recuperate;
protected TreeStore store;
protected string selected;
[Widget] protected Gtk.TreeView treeview_person_recuperate;
[Widget] protected Gtk.Button button_recuperate;
[Widget] protected Gtk.Box hbox_from_session_hide; //used in person recuperate multiple (hided in current class)
static PersonRecuperateWindow PersonRecuperateWindowBox;
Gtk.Window parent;
protected Gtk.Window parent;
private int sessionID;
protected int sessionID;
private Person currentPerson;
protected Person currentPerson;
protected PersonRecuperateWindow () {
}
PersonRecuperateWindow (Gtk.Window parent, int sessionID) {
Glade.XML gladeXML = Glade.XML.FromAssembly ("chronojump.glade", "person_recuperate", null);
......@@ -58,8 +64,10 @@ public class PersonRecuperateWindow {
//no posible to recuperate until one person is selected
button_recuperate.Sensitive = false;
hbox_from_session_hide.Hide(); //used in person recuperate multiple (hided in current class)
createTreeView(treeview_person_recuperate);
createTreeView(treeview_person_recuperate, 0);
store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string),
typeof (string), typeof(string), typeof(string) );
treeview_person_recuperate.Model = store;
......@@ -76,10 +84,9 @@ public class PersonRecuperateWindow {
return PersonRecuperateWindowBox;
}
private void createTreeView (Gtk.TreeView tv) {
protected void createTreeView (Gtk.TreeView tv, int count) {
tv.HeadersVisible=true;
int count = 0;
tv.AppendColumn ( Catalog.GetString("Number"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("ID"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("Name"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("Sex"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("Height"), new CellRendererText(), "text", count++);
......@@ -88,23 +95,22 @@ public class PersonRecuperateWindow {
tv.AppendColumn ( Catalog.GetString("Description"), new CellRendererText(), "text", count++);
}
private void fillTreeView (Gtk.TreeView tv, TreeStore store) {
TreeIter iter = new TreeIter();
protected void fillTreeView (Gtk.TreeView tv, TreeStore store) {
string [] mySessions;
int except = sessionID;
int inSession = -1; //search persons for recuperating in all sessions
string mySort = "name";
if(sortByCreationDate) {
mySessions = SqlitePerson.SelectAllPersonsRecuperable("uniqueID", sessionID); //returns a string of values separated by ':'
} else {
mySessions = SqlitePerson.SelectAllPersonsRecuperable("name", sessionID); //returns a string of values separated by ':'
mySort = "uniqueID";
}
mySessions = SqlitePerson.SelectAllPersonsRecuperable(mySort, except, inSession);
foreach (string session in mySessions) {
string [] myStringFull = session.Split(new char[] {':'});
iter = store.AppendValues (myStringFull[0], myStringFull[1],
store.AppendValues (myStringFull[0], myStringFull[1],
getCorrectSex(myStringFull[2]), myStringFull[4], myStringFull[5],
myStringFull[3], myStringFull[6]
);
......@@ -112,13 +118,16 @@ public class PersonRecuperateWindow {
}
private string getCorrectSex (string sex)
protected string getCorrectSex (string sex)
{
if (sex == "M") return Catalog.GetString("Man");
else return Catalog.GetString ("Woman");
else if (sex == "W") return Catalog.GetString ("Woman");
else {
return ""; //PersonsRecuperateFromOtherSessionWindow should pass a "" for ALL PERSONS
}
}
private void on_checkbutton_sort_by_creation_date_clicked(object o, EventArgs args) {
protected virtual void on_checkbutton_sort_by_creation_date_clicked(object o, EventArgs args) {
if (sortByCreationDate) { sortByCreationDate = false; }
else { sortByCreationDate = true; }
......@@ -130,7 +139,7 @@ public class PersonRecuperateWindow {
}
//puts a value in private member selected
private void on_treeview_person_recuperate_cursor_changed (object o, EventArgs args)
protected virtual void on_treeview_person_recuperate_cursor_changed (object o, EventArgs args)
{
TreeView tv = (TreeView) o;
TreeModel model;
......@@ -146,19 +155,19 @@ public class PersonRecuperateWindow {
}
}
void on_button_close_clicked (object o, EventArgs args)
protected virtual void on_button_close_clicked (object o, EventArgs args)
{
PersonRecuperateWindowBox.person_recuperate.Hide();
PersonRecuperateWindowBox = null;
}
void on_person_recuperate_delete_event (object o, EventArgs args)
protected virtual void on_person_recuperate_delete_event (object o, EventArgs args)
{
PersonRecuperateWindowBox.person_recuperate.Hide();
PersonRecuperateWindowBox = null;
}
void on_row_double_clicked (object o, EventArgs args)
protected virtual void on_row_double_clicked (object o, EventArgs args)
{
TreeView tv = (TreeView) o;
TreeModel model;
......@@ -172,11 +181,11 @@ public class PersonRecuperateWindow {
}
}
void on_button_recuperate_clicked (object o, EventArgs args)
protected virtual void on_button_recuperate_clicked (object o, EventArgs args)
{
if(selected != "-1")
{
int myInt = SqlitePersonSession.Insert(Convert.ToInt32(selected), sessionID);
SqlitePersonSession.Insert(Convert.ToInt32(selected), sessionID);
currentPerson = SqlitePersonSession.PersonSelect(selected);
store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string),
......@@ -206,6 +215,251 @@ public class PersonRecuperateWindow {
}
//load person (jumper)
public class PersonsRecuperateFromOtherSessionWindow : PersonRecuperateWindow
{
static PersonsRecuperateFromOtherSessionWindow PersonsRecuperateFromOtherSessionWindowBox;
[Widget] Gtk.Box hbox_combo_sessions;
[Widget] Gtk.Combo combo_sessions;
PersonsRecuperateFromOtherSessionWindow (Gtk.Window parent, int sessionID) {
Glade.XML gladeXML = Glade.XML.FromAssembly ("chronojump.glade", "person_recuperate", null);
gladeXML.Autoconnect(this);
this.parent = parent;
this.sessionID = sessionID;
button_recuperate.Sensitive = true;
createComboSessions();
createCheckboxes(treeview_person_recuperate);
createTreeView(treeview_person_recuperate, 1);
store = new TreeStore( typeof (bool), typeof (string), typeof (string), typeof (string), typeof (string),
typeof (string), typeof(string), typeof(string) );
treeview_person_recuperate.Model = store;
string myText = combo_sessions.Entry.Text;
if(myText != "") {
string [] myStringFull = myText.Split(new char[] {':'});
fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
}
}
static public new PersonsRecuperateFromOtherSessionWindow Show (Gtk.Window parent, int sessionID)
{
if (PersonsRecuperateFromOtherSessionWindowBox == null) {
PersonsRecuperateFromOtherSessionWindowBox =
new PersonsRecuperateFromOtherSessionWindow (parent, sessionID);
}
PersonsRecuperateFromOtherSessionWindowBox.person_recuperate.Show ();
return PersonsRecuperateFromOtherSessionWindowBox;
}
private void createComboSessions() {
combo_sessions = new Combo ();
bool commentsDisable = true;
int sessionIdDisable = sessionID; //for not showing current session on the list
combo_sessions.PopdownStrings =
SqliteSession.SelectAllSessionsSimple(commentsDisable, sessionIdDisable);
combo_sessions.DisableActivate ();
combo_sessions.Entry.Changed += new EventHandler (on_combo_sessions_changed);
hbox_combo_sessions.PackStart(combo_sessions, true, true, 0);
hbox_combo_sessions.ShowAll();
combo_sessions.Sensitive = true;
}
private void on_combo_sessions_changed(object o, EventArgs args) {
string myText = combo_sessions.Entry.Text;
if(myText != "") {
store = new TreeStore( typeof (bool), typeof (string), typeof (string), typeof (string), typeof (string),
typeof (string), typeof(string), typeof(string) );
treeview_person_recuperate.Model = store;
string [] myStringFull = myText.Split(new char[] {':'});
//fill the treeview passing the uniqueID of selected session as the reference for loading persons
fillTreeView( treeview_person_recuperate, store, Convert.ToInt32(myStringFull[0]) );
}
}
void createCheckboxes(TreeView tv)
{
CellRendererToggle rendererToggle = new CellRendererToggle ();
rendererToggle.Xalign = 0.0f;
GLib.Object ugly = (GLib.Object) rendererToggle;
ugly.Data ["column"] = 0;
rendererToggle.Toggled += new ToggledHandler (ItemToggled);
rendererToggle.Activatable = true;
rendererToggle.Active = true;
TreeViewColumn column = new TreeViewColumn ("", rendererToggle, "active", 0);
column.Sizing = TreeViewColumnSizing.Fixed;
column.FixedWidth = 50;
column.Clickable = true;
tv.InsertColumn (column, 0);
}
void ItemToggled(object o, ToggledArgs args) {
Console.WriteLine("Toggled");
GLib.Object cellRendererToggle = (GLib.Object) o;
int column = (int) cellRendererToggle.Data["column"];
Gtk.TreeIter iter;
if (store.GetIterFromString (out iter, args.Path))
{
bool val = (bool) store.GetValue (iter, column);
Console.WriteLine ("toggled {0} with value {1}", args.Path, !val);
if(args.Path == "0") {
if (store.GetIterFirst(out iter)) {
val = (bool) store.GetValue (iter, column);
store.SetValue (iter, column, !val);
while ( store.IterNext(ref iter) ){
store.SetValue (iter, column, !val);
}
}
} else {
store.SetValue (iter, column, !val);
}
}
}