[chronojump] curves select by exercise (genericWin)



commit df79571423499770c668aa080993d30a7cf038e1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Mar 13 16:32:58 2013 +0100

    curves select by exercise (genericWin)

 src/gui/encoder.cs       |   13 ++++++++++---
 src/gui/genericWindow.cs |   30 +++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 2f731e1..1855ea9 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -436,13 +436,20 @@ public partial class ChronoJumpWindow
                
                a2.Add(Constants.GenericWindowShow.TREEVIEW); a2.Add(true); a2.Add("");
                bigArray.Add(a2);
+       
+               //add exercises to the combo (only the exercises done, and only unique)
+               ArrayList encoderExercisesNames = new ArrayList();
+               foreach(EncoderSQL es in data) {
+                       encoderExercisesNames = Util.AddToArrayListIfNotExist(encoderExercisesNames, 
es.exerciseName);
+               }
                
                genericWin = GenericWindow.Show(false,  //don't show now
                                string.Format(Catalog.GetString("Saved curves of athlete {0} on this 
session."), 
                                        currentPerson.Name), bigArray);
 
-               genericWin.CreateComboAllNoneSelected();
                genericWin.SetTreeview(columnsString, true, dataPrint, new ArrayList());
+               genericWin.AddOptionsToComboCheckBoxesOptions(encoderExercisesNames);
+               genericWin.CreateComboCheckBoxes();
                genericWin.MarkActiveCurves(checkboxes);
                genericWin.ShowButtonCancel(false);
                genericWin.SetButtonAcceptSensitive(true);
@@ -565,8 +572,8 @@ public partial class ChronoJumpWindow
                                string.Format(Catalog.GetString("Select persons to compare to {0}."), 
                                        currentPerson.Name), bigArray);
 
-               genericWin.CreateComboAllNoneSelected();
                genericWin.SetTreeview(columnsString, true, data, nonSensitiveRows);
+               genericWin.CreateComboCheckBoxes();
                genericWin.MarkActiveCurves(checkboxes);
                genericWin.ShowButtonCancel(false);
                genericWin.SetButtonAcceptSensitive(true);
@@ -664,8 +671,8 @@ public partial class ChronoJumpWindow
                        dataConverted.Add(encPS.ToStringArray());
                }
 
-               genericWin.CreateComboAllNoneSelected();
                genericWin.SetTreeview(columnsString, true, dataConverted, nonSensitiveRows);
+               genericWin.CreateComboCheckBoxes();
                genericWin.MarkActiveCurves(checkboxes);
                genericWin.ShowButtonCancel(false);
                genericWin.SetButtonAcceptSensitive(true);
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 3e5aaa3..90c8c18 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -177,9 +177,9 @@ public class GenericWindow
                        hbox_height_metric.Show();
                }
                else if(stuff == Constants.GenericWindowShow.COMBOALLNONESELECTED) {
-                       //createComboAllNoneSelected();
+                       //createComboCheckBoxes();
                        //combo_all_none_selected.Active = 
-                       //      UtilGtk.ComboMakeActive(comboAllNoneSelectedOptions, 
Catalog.GetString("Selected"));
+                       //      UtilGtk.ComboMakeActive(comboCheckBoxesOptions, 
Catalog.GetString("Selected"));
                        hbox_combo_all_none_selected.Show();
                        hbox_all_none_selected.Show();
                }
@@ -226,16 +226,23 @@ public class GenericWindow
                spin_int.SetRange(min, max);
        }
        
-       protected static string [] comboAllNoneSelectedOptions = {
+       protected string [] comboCheckBoxesOptions = {
                Catalog.GetString("All"),
                Catalog.GetString("None"),
                Catalog.GetString("Invert"),
                Catalog.GetString("Selected"),
        };
+       
+       //this search in first column
+       //private string [] addOptionsToComboCheckBoxesOptions(string [] newOptions) {
+       public void AddOptionsToComboCheckBoxesOptions(ArrayList newOptions) {
+               comboCheckBoxesOptions = Util.AddArrayString( comboCheckBoxesOptions, 
+                               Util.ArrayListToString(newOptions) );
+       }
 
-       public void CreateComboAllNoneSelected() {
+       public void CreateComboCheckBoxes() {
                combo_all_none_selected = ComboBox.NewText ();
-               UtilGtk.ComboUpdate(combo_all_none_selected, comboAllNoneSelectedOptions, "");
+               UtilGtk.ComboUpdate(combo_all_none_selected, comboCheckBoxesOptions, "");
                
                //combo_all_none_selected.DisableActivate ();
                combo_all_none_selected.Changed += new EventHandler (on_combo_all_none_selected_changed);
@@ -245,7 +252,7 @@ public class GenericWindow
                combo_all_none_selected.Sensitive = true;
                        
                combo_all_none_selected.Active = 
-                       UtilGtk.ComboMakeActive(comboAllNoneSelectedOptions, Catalog.GetString("Selected"));
+                       UtilGtk.ComboMakeActive(comboCheckBoxesOptions, Catalog.GetString("Selected"));
        }
        
        protected void on_combo_all_none_selected_changed(object o, EventArgs args) {
@@ -284,6 +291,15 @@ public class GenericWindow
                                do {
                                        store.SetValue (iter, 0, false);
                                } while ( store.IterNext(ref iter) );
+                       } else {        //encoderExercises
+                               do {
+                                       if(selected == (string) store.GetValue (iter, 2) &&
+                                                       ! Util.FoundInArrayList(nonSensitiveRows, i))
+                                               store.SetValue (iter, 0, true);
+                                       else
+                                               store.SetValue (iter, 0, false);
+                                       i++;
+                               } while ( store.IterNext(ref iter) );
                        }
                }
                        
@@ -455,7 +471,7 @@ public class GenericWindow
 
                                combo_all_none_selected.Active =
                                        UtilGtk.ComboMakeActive(
-                                                       comboAllNoneSelectedOptions, 
Catalog.GetString("Selected"));
+                                                       comboCheckBoxesOptions, 
Catalog.GetString("Selected"));
 
                                //check if there are rows checked for having sensitive or not
                                //buttonRecuperateChangeSensitiveness();


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