[chronojump] Save curves easier and less problematic (All/None)



commit 5f9487dedfb156b60da4bc81d46fd8f3ddf27b10
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jun 30 19:09:34 2014 +0200

    Save curves easier and less problematic (All/None)

 glade/chronojump.glade      |   99 ++++++++++++++++++++++++++++++++++++++++++-
 src/gui/encoder.cs          |   40 +++++-------------
 src/gui/encoderTreeviews.cs |   26 ++++-------
 3 files changed, 117 insertions(+), 48 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4422864..5275b42 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6171,6 +6171,9 @@ Second Chronopic to platforms.</property>
                                                         <child>
                                                           <placeholder/>
                                                         </child>
+                                                        <child>
+                                                          <placeholder/>
+                                                        </child>
                                                       </widget>
                                                       <packing>
                                                         <property name="expand">True</property>
@@ -6766,6 +6769,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -7495,6 +7501,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -7983,6 +7992,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -12837,13 +12849,51 @@ on current Chronojump version.</property>
                                                             <widget class="GtkHBox" id="hbox80">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="spacing">12</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_encoder_capture_curves_save_all_none">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
                                                             <property name="spacing">8</property>
                                                             <child>
-                                                            <widget class="GtkHBox" 
id="hbox_combo_encoder_capture_save_curve">
+                                                            <widget class="GtkLabel" id="label108">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Save</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
                                                             <child>
-                                                            <placeholder/>
+                                                            <widget class="GtkButton" 
id="button_encoder_capture_curves_all">
+                                                            <property name="label" 
translatable="yes">All</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_encoder_capture_curves_all_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_encoder_capture_curves_none">
+                                                            <property name="label" 
translatable="yes">None</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_encoder_capture_curves_none_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
                                                             </child>
                                                             </widget>
                                                             <packing>
@@ -17202,6 +17252,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -17598,6 +17651,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -18404,6 +18460,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -25840,6 +25902,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -27626,6 +27706,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                 <child>
                                   <placeholder/>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                             </child>
                           </widget>
@@ -28081,6 +28164,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -30018,6 +30104,9 @@ show elevation as:</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -30078,6 +30167,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -30153,6 +30245,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index d58628b..c660f19 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -73,8 +73,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ComboBox combo_encoder_eccon;
        [Widget] Gtk.Box hbox_combo_encoder_laterality;
        [Widget] Gtk.ComboBox combo_encoder_laterality;
-       [Widget] Gtk.Box hbox_combo_encoder_capture_save_curve;
-       [Widget] Gtk.ComboBox combo_encoder_capture_save_curve;
+       [Widget] Gtk.Box hbox_encoder_capture_curves_save_all_none;
+
        [Widget] Gtk.Box hbox_combo_encoder_analyze_cross;
        [Widget] Gtk.ComboBox combo_encoder_analyze_cross;
        
@@ -2775,7 +2775,6 @@ Log.Write(" AT ANALYZE 2 ");
        string [] encoderEcconTranslation;
        string [] encoderLateralityTranslation;
        string [] encoderDataCompareTranslation;
-       string [] encoderCaptureSaveTranslation;
        string [] encoderAnalyzeCrossTranslation;
        
        protected void createEncoderCombos() {
@@ -2834,22 +2833,6 @@ Log.Write(" AT ANALYZE 2 ");
                combo_encoder_laterality.Active = UtilGtk.ComboMakeActive(combo_encoder_laterality, 
                                Catalog.GetString(comboLateralityOptions[0]));
 
-               //create combo capure save curve
-               string [] comboEncoderCaptureSaveOptions = { Constants.All, Constants.None, 
Constants.Selected };
-               string [] comboEncoderCaptureSaveOptionsTranslated = { 
-                       Catalog.GetString(Constants.All), Catalog.GetString(Constants.None), 
-                       Catalog.GetString(Constants.Selected) };
-               encoderCaptureSaveTranslation = new String [comboEncoderCaptureSaveOptions.Length];
-               for(int j=0; j < 3 ; j++)
-                       encoderCaptureSaveTranslation[j] = 
-                               comboEncoderCaptureSaveOptions[j] + ":" + 
comboEncoderCaptureSaveOptionsTranslated[j];
-               combo_encoder_capture_save_curve = ComboBox.NewText();
-               UtilGtk.ComboUpdate(combo_encoder_capture_save_curve, 
comboEncoderCaptureSaveOptionsTranslated, "");
-               combo_encoder_capture_save_curve.Active = 
UtilGtk.ComboMakeActive(combo_encoder_capture_save_curve, 
-                               Catalog.GetString(comboEncoderCaptureSaveOptionsTranslated[2])); //SELECTED
-               combo_encoder_capture_save_curve.Changed += 
-                       new EventHandler(on_combo_encoder_capture_save_curve_changed );
-
 
                //create combo analyze data compare (variables)
                string [] comboDataCompareOptions = { 
@@ -2915,11 +2898,7 @@ Log.Write(" AT ANALYZE 2 ");
                hbox_encoder_analyze_data_compare.PackStart(combo_encoder_analyze_data_compare, true, true, 
0);
                hbox_encoder_analyze_data_compare.ShowAll();
                combo_encoder_analyze_data_compare.Sensitive = true;
-               
-               hbox_combo_encoder_capture_save_curve.PackStart(combo_encoder_capture_save_curve, true, true, 
0);
-               hbox_combo_encoder_capture_save_curve.ShowAll();
-               combo_encoder_capture_save_curve.Sensitive = true;
-               
+       
                hbox_combo_encoder_analyze_cross.PackStart(combo_encoder_analyze_cross, true, true, 0);
                hbox_combo_encoder_analyze_cross.ShowAll(); 
                combo_encoder_analyze_cross.Sensitive = true;
@@ -2935,9 +2914,12 @@ Log.Write(" AT ANALYZE 2 ");
        {
                update_neuromuscular_profile_sensitiveness();
        }
-       
-       void on_combo_encoder_capture_save_curve_changed (object o, EventArgs args) {
-               encoderCaptureSelectByCombo(UtilGtk.ComboGetActive(combo_encoder_capture_save_curve));
+
+       void on_button_encoder_capture_curves_all_clicked (object o, EventArgs args) {
+               encoderCaptureSaveCurvesAllNone(true);
+       }
+       void on_button_encoder_capture_curves_none_clicked (object o, EventArgs args) {
+               encoderCaptureSaveCurvesAllNone(false);
        }
 
        void on_combo_encoder_analyze_data_compare_changed (object o, EventArgs args)
@@ -3350,7 +3332,7 @@ Log.Write(" AT ANALYZE 2 ");
                //c0 button_encoder_capture
                //c1 button_encoder_recalculate
                //c2 button_encoder_load_signal
-               //c3 hbox_combo_encoder_capture_save_curve, button_encoder_export_all_curves,
+               //c3 hbox_encoder_capture_curves_save_all_none, button_encoder_export_all_curves,
                //      button_encoder_delete_signal, entry_encoder_signal_comment,
                //      and images: image_encoder_capture , image_encoder_analyze.Sensitive. Update: both NOT 
managed here
                //UNUSED c4 button_encoder_save_curve, entry_encoder_curve_comment
@@ -3412,7 +3394,7 @@ Log.Write(" AT ANALYZE 2 ");
                
                button_encoder_load_signal.Sensitive = Util.IntToBool(table[2]);
                
-               hbox_combo_encoder_capture_save_curve.Sensitive = Util.IntToBool(table[3]);
+               hbox_encoder_capture_curves_save_all_none.Sensitive = Util.IntToBool(table[3]);
                button_encoder_export_all_curves.Sensitive = Util.IntToBool(table[3]);
                button_encoder_delete_signal.Sensitive = Util.IntToBool(table[3]);
                //image_encoder_capture.Sensitive = Util.IntToBool(table[3]);
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index af096e7..bc73b5b 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -252,24 +252,16 @@ public partial class ChronoJumpWindow
                                encoderCaptureListStore.EmitRowChanged(path,iter);
                        }
                        
-                       combo_encoder_capture_save_curve.Active = UtilGtk.ComboMakeActive(
-                                       combo_encoder_capture_save_curve, 
-                                       Catalog.GetString(Constants.Selected));
-                       
                        updateUserCurvesLabelsAndCombo();
 
                        callPlotCurvesGraphDoPlot();
                }
        }
 
-       void encoderCaptureSelectByCombo(string toSelect) {
-               if(toSelect == Catalog.GetString(Constants.Selected))
-                       return;
-
-               bool val = true;
-               if(toSelect == Catalog.GetString(Constants.None))
-                       val = false;
-
+       
+       //allNone: true (save all), false (unsave all)
+       void encoderCaptureSaveCurvesAllNone(bool allNone)
+       {
                int i = 0; //on "c": i is every row; on other eccons: i is every two rows
                string sep = "";
                string messageRows = "";
@@ -279,22 +271,22 @@ public partial class ChronoJumpWindow
                        TreePath path = encoderCaptureListStore.GetPath(iter);
                        
                        EncoderCurve curve = (EncoderCurve) encoderCaptureListStore.GetValue (iter, 0);
-                       if(curve.Record != val) { 
+                       if(curve.Record != allNone) { 
                                //change value
-                               ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 0)).Record = val;
+                               ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 0)).Record = allNone;
 
                                //this makes RenderRecord work on changed row without having to put mouse 
there
                                encoderCaptureListStore.EmitRowChanged(path,iter);
 
                                //on "ecS" don't pass the 2nd row, pass always the first
-                               saveOrDeleteCurveFromCaptureTreeView(i, curve, val);
+                               saveOrDeleteCurveFromCaptureTreeView(i, curve, allNone);
                                
                                if(ecconLast != "c") {
                                        path.Next();
                                        encoderCaptureListStore.IterNext (ref iter);
                                
                                        //change value
-                                       ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 0)).Record = 
val;
+                                       ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 0)).Record = 
allNone;
 
                                        //this makes RenderRecord work on changed row without having to put 
mouse there
                                        encoderCaptureListStore.EmitRowChanged(path,iter);
@@ -312,7 +304,7 @@ public partial class ChronoJumpWindow
                //combo_encoder_capture_show_save_curve_button();
                        
                string message = "";
-               if(val)
+               if(allNone)
                        message = Catalog.GetString("Saved");
                else
                        message = Catalog.GetString("Removed");


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