[chronojump] force sensor: Several changes on elastic band management



commit d5e719540ada1318843966ca77605d87b4e19c31
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Nov 8 17:15:37 2019 +0100

    force sensor: Several changes on elastic band management

 glade/app1.glade                       |  59 ++++-
 glade/force_sensor_elastic_bands.glade | 385 +++++++++++++++++++++++----------
 src/Makefile.am                        |   1 +
 src/gui/chronojumpIcons.cs             |   4 +-
 src/gui/forceSensor.cs                 |  42 +++-
 src/gui/forceSensorElasticBands.cs     |  58 +++--
 6 files changed, 391 insertions(+), 158 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 87e1107f..fc08b700 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -9220,6 +9220,35 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <signal name="clicked" 
handler="on_button_force_sensor_stiffness_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox288">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_button_force_sensor_stiffness">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_force_sensor_stiffness_problem">
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22159,6 +22188,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24208,6 +24240,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -24244,18 +24288,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -31254,6 +31286,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/glade/force_sensor_elastic_bands.glade b/glade/force_sensor_elastic_bands.glade
index 49ae7a87..568316d1 100644
--- a/glade/force_sensor_elastic_bands.glade
+++ b/glade/force_sensor_elastic_bands.glade
@@ -100,7 +100,7 @@
                   </widget>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
@@ -110,12 +110,43 @@
                     <property name="can_focus">False</property>
                     <property name="spacing">20</property>
                     <child>
-                      <widget class="GtkButton" id="button_add_show">
-                        <property name="label" translatable="yes">Add new elastic band/tube</property>
+                      <widget class="GtkButton" id="button_add">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <signal name="clicked" handler="on_button_add_show_clicked" swapped="no"/>
+                        <property name="tooltip" translatable="yes">Add new elastic band/tube</property>
+                        <signal name="clicked" handler="on_button_add_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkImage" id="image_add">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label9">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Add new</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">True</property>
@@ -125,12 +156,42 @@
                     </child>
                     <child>
                       <widget class="GtkButton" id="button_delete">
-                        <property name="label" translatable="yes">Delete selected</property>
                         <property name="visible">True</property>
                         <property name="sensitive">False</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <signal name="clicked" handler="on_button_delete_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox11">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkImage" id="image_delete">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label10">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Delete selected</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -165,7 +226,7 @@
             <property name="visible">True</property>
             <property name="sensitive">False</property>
             <property name="can_focus">False</property>
-            <property name="label_xalign">0.30000001192092896</property>
+            <property name="label_xalign">0.5</property>
             <property name="shadow_type">out</property>
             <child>
               <widget class="GtkVBox" id="vbox1">
@@ -177,7 +238,7 @@
                   <widget class="GtkTable" id="table_add_edit">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="n_rows">5</property>
+                    <property name="n_rows">4</property>
                     <property name="n_columns">2</property>
                     <property name="column_spacing">20</property>
                     <property name="row_spacing">8</property>
@@ -196,8 +257,8 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
                       </packing>
                     </child>
                     <child>
@@ -208,8 +269,8 @@
                         <property name="label">Comments</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">4</property>
-                        <property name="bottom_attach">5</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
                         <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
@@ -226,57 +287,6 @@
                         <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
-                    <child>
-                      <widget class="GtkLabel" id="label_entry2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
-                        <property name="label">Color</property>
-                      </widget>
-                      <packing>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
-                        <property name="x_options">GTK_FILL</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkEntry" id="entry_brand">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
-                        <property name="invisible_char_set">True</property>
-                        <property name="primary_icon_activatable">False</property>
-                        <property name="secondary_icon_activatable">False</property>
-                        <property name="primary_icon_sensitive">True</property>
-                        <property name="secondary_icon_sensitive">True</property>
-                        <signal name="changed" handler="on_entries_changed" swapped="no"/>
-                      </widget>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkEntry" id="entry_color">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="invisible_char">●</property>
-                        <property name="invisible_char_set">True</property>
-                        <property name="primary_icon_activatable">False</property>
-                        <property name="secondary_icon_activatable">False</property>
-                        <property name="primary_icon_sensitive">True</property>
-                        <property name="secondary_icon_sensitive">True</property>
-                        <signal name="changed" handler="on_entries_changed" swapped="no"/>
-                      </widget>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">3</property>
-                        <property name="bottom_attach">4</property>
-                      </packing>
-                    </child>
                     <child>
                       <widget class="GtkLabel" id="label5">
                         <property name="visible">True</property>
@@ -408,7 +418,7 @@
                               </widget>
                               <packing>
                                 <property name="expand">False</property>
-                                <property name="fill">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -419,57 +429,11 @@
                             <property name="position">0</property>
                           </packing>
                         </child>
-                        <child>
-                          <widget class="GtkButton" id="button_save">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="border_width">8</property>
-                            <signal name="clicked" handler="on_button_save_clicked" swapped="no"/>
-                            <child>
-                              <widget class="GtkHBox" id="hbox7">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="spacing">6</property>
-                                <child>
-                                  <widget class="GtkImage" id="image_save">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="stock">gtk-missing-image</property>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkLabel" id="label7">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">Save</property>
-                                  </widget>
-                                  <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </widget>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="pack_type">end</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
@@ -485,13 +449,177 @@
                         <property name="x_options">GTK_FILL</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox13">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">20</property>
+                        <child>
+                          <widget class="GtkEntry" id="entry_brand">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="on_entries_changed" swapped="no"/>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label_entry2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label">Color</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="entry_color">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">●</property>
+                            <property name="invisible_char_set">True</property>
+                            <property name="primary_icon_activatable">False</property>
+                            <property name="secondary_icon_activatable">False</property>
+                            <property name="primary_icon_sensitive">True</property>
+                            <property name="secondary_icon_sensitive">True</property>
+                            <signal name="changed" handler="on_entries_changed" swapped="no"/>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
+                <child>
+                  <widget class="GtkHButtonBox" id="hbuttonbox2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">20</property>
+                    <property name="layout_style">end</property>
+                    <child>
+                      <widget class="GtkButton" id="button_save">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <signal name="clicked" handler="on_button_save_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox9">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkImage" id="image_save">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label7">
+                                <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">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="button_cancel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <signal name="clicked" handler="on_button_cancel_clicked" swapped="no"/>
+                        <child>
+                          <widget class="GtkHBox" id="hbox10">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkImage" id="image_cancel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label8">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">Cancel</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </widget>
             </child>
             <child>
@@ -506,7 +634,7 @@
           </widget>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">False</property>
+            <property name="fill">True</property>
             <property name="position">2</property>
           </packing>
         </child>
@@ -521,14 +649,43 @@
                 <property name="can_focus">False</property>
                 <child>
                   <widget class="GtkButton" id="button_close">
-                    <property name="label">gtk-close</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="can_default">True</property>
                     <property name="receives_default">False</property>
-                    <property name="use_stock">True</property>
                     <signal name="clicked" handler="on_button_close_clicked" swapped="no"/>
                     <accelerator key="Escape" signal="clicked"/>
+                    <child>
+                      <widget class="GtkHBox" id="hbox12">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <widget class="GtkImage" id="image_close">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label11">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Close</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
                   </widget>
                   <packing>
                     <property name="expand">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index ff577e21..aabdb390 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -417,6 +417,7 @@ RESOURCES = \
        ../images/md/ic_import_1x.png,import.png \
        ../images/md/ic_export_1x.png,export.png \
        ../images/md/ic_settings_blue_24dp_1x.png,image_settings.png \
+       ../images/md/ic_close_blue_24dp_1x.png,image_close_blue.png \
        ../images/md/ic_close_red_24dp_1x.png,image_close.png \
        ../images/md/ic_close_blue_24dp_2x.png,image_close_big.png \
        ../images/md/ic_power_settings_new_blue_24dp_1x.png,image_quit.png \
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index f9bf9c87..855f5a11 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -256,7 +256,9 @@ public partial class ChronoJumpWindow
                image_quit2.Pixbuf = pixbuf;
                image_quit_from_app1.Pixbuf = pixbuf;
 
-               image_message_permissions_at_boot.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"image_warning_red.png");
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_warning_red.png");
+               image_message_permissions_at_boot.Pixbuf = pixbuf;
+               image_button_force_sensor_stiffness_problem.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "muscle-concentric.png");
                image_top_eccon.Pixbuf = pixbuf;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index c4144832..af56a1d0 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -71,6 +71,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.HBox hbox_combo_force_sensor_exercise;
        [Widget] Gtk.ComboBox combo_force_sensor_exercise;
        [Widget] Gtk.Button button_force_sensor_stiffness;
+       [Widget] Gtk.Label label_button_force_sensor_stiffness;
+       [Widget] Gtk.Image image_button_force_sensor_stiffness_problem;
        [Widget] Gtk.ComboBox combo_force_sensor_capture_options;
        [Widget] Gtk.RadioButton radio_force_sensor_laterality_both;
        [Widget] Gtk.RadioButton radio_force_sensor_laterality_l;
@@ -369,7 +371,7 @@ public partial class ChronoJumpWindow
                        if(currentForceSensorExercise.ComputeAsElastic)
                        {
                                List<ForceSensorElasticBand> list_fseb = 
SqliteForceSensorElasticBand.SelectAll(false, true); //not opened, onlyActive
-                               if(ForceSensorElasticBand.GetStiffnessOfActiveBands(list_fseb) == 0)
+                               if(ForceSensorElasticBand.GetStiffnessOfActiveBands(list_fseb) == 0 || 
image_button_force_sensor_stiffness_problem.Visible)
                                {
                                        new DialogMessage(Constants.MessageTypes.WARNING, 
Catalog.GetString("Need to configure fixture to know stiffness of this elastic exercise."));
                                        return;
@@ -1539,6 +1541,7 @@ LogB.Information(" fs R ");
                assignCurrentForceSensorExercise();
 
                // stiffness 1: change button_force_sensor_stiffness
+               image_button_force_sensor_stiffness_problem.Visible = false;
                if(currentForceSensorExercise.ComputeAsElastic)
                {
                        setStiffnessButtonLabel(fs.Stiffness);
@@ -1553,10 +1556,12 @@ LogB.Information(" fs R ");
                                new DialogMessage(Constants.MessageTypes.WARNING,
                                                Catalog.GetString("Loaded set used elastic bands removed from 
database or with changed values.") + "\n\n" +
                                                Catalog.GetString("Stiffness calculation is correct but 
stiffness configuration window will not be able to match elastic bands and total stiffness."));
+
+                               image_button_force_sensor_stiffness_problem.Visible = true;
                        }
                } else
                {
-                       button_force_sensor_stiffness.Label = "0";
+                       label_button_force_sensor_stiffness.Text = "0";
                        button_force_sensor_stiffness.Visible = false;
                }
 
@@ -1718,6 +1723,16 @@ LogB.Information(" fs R ");
                //recalculate graphs will be different if exercise changed, so need to know the exercise
                assignCurrentForceSensorExercise();
 
+               if(currentForceSensorExercise.ComputeAsElastic)
+               {
+                       List<ForceSensorElasticBand> list_fseb = 
SqliteForceSensorElasticBand.SelectAll(false, true); //not opened, onlyActive
+                       if(ForceSensorElasticBand.GetStiffnessOfActiveBands(list_fseb) == 0 || 
image_button_force_sensor_stiffness_problem.Visible)
+                       {
+                               new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Need to 
configure fixture to know stiffness of this elastic exercise."));
+                               return;
+                       }
+               }
+
                if(lastForceSensorFullPath != null && lastForceSensorFullPath != "")
                        forceSensorCopyTempAndDoGraphs(forceSensorGraphsEnum.SIGNAL);
 
@@ -2290,7 +2305,8 @@ LogB.Information(" fs R ");
                                        combo_force_sensor_exercise, forceSensorComboExercisesString, false), 
false );
                if(array.Count == 0)
                {
-                       button_force_sensor_stiffness.Label = "0";
+                       label_button_force_sensor_stiffness.Text = "0";
+                       image_button_force_sensor_stiffness_problem.Visible = true;
                        button_force_sensor_stiffness.Visible = false;
                        return;
                }
@@ -2304,8 +2320,9 @@ LogB.Information(" fs R ");
                        setStiffnessButtonLabel(stiffness);
                        button_force_sensor_stiffness.Visible = true;
                } else {
-                       button_force_sensor_stiffness.Label = "0";
+                       label_button_force_sensor_stiffness.Text = "0";
                        button_force_sensor_stiffness.Visible = false;
+                       image_button_force_sensor_stiffness_problem.Visible = false;
                }
        }
 
@@ -2453,10 +2470,13 @@ LogB.Information(" fs R ");
 
        private void on_button_force_sensor_stiffness_clicked (object o, EventArgs args)
        {
-               forceSensorElasticBandsWin = ForceSensorElasticBandsWindow.Show(
-                               Catalog.GetString("Stiffness configuration"), Catalog.GetString("Configure 
attached elastic bands/tubes"));
+               //done like this to be able to call on_elastic_bands_win_stiffness_changed before the Show is 
done, because in the Show is where the stiffness will change
+               forceSensorElasticBandsWin = new ForceSensorElasticBandsWindow();
                forceSensorElasticBandsWin.FakeButton_stiffness_changed.Clicked -= new 
EventHandler(on_elastic_bands_win_stiffness_changed);
                forceSensorElasticBandsWin.FakeButton_stiffness_changed.Clicked += new 
EventHandler(on_elastic_bands_win_stiffness_changed);
+
+               forceSensorElasticBandsWin.Show(
+                               Catalog.GetString("Stiffness configuration"), Catalog.GetString("Configure 
attached elastic bands/tubes"));
        }
 
        private void on_elastic_bands_win_stiffness_changed(object o, EventArgs args)
@@ -2467,10 +2487,14 @@ LogB.Information(" fs R ");
        private void setStiffnessButtonLabel (double stiffness)
        {
                if(stiffness <= 0)
-                       button_force_sensor_stiffness.Label = Catalog.GetString("Configure bands/tubes");
-               else
-                       button_force_sensor_stiffness.Label = Catalog.GetString("Stiffness:") + " " +
+               {
+                       label_button_force_sensor_stiffness.Text = Catalog.GetString("Configure bands/tubes");
+                       image_button_force_sensor_stiffness_problem.Visible = true;
+               } else {
+                       label_button_force_sensor_stiffness.Text = Catalog.GetString("Stiffness:") + " " +
                                stiffness.ToString() + " N/m";
+                       image_button_force_sensor_stiffness_problem.Visible = false;
+               }
        }
 
 
diff --git a/src/gui/forceSensorElasticBands.cs b/src/gui/forceSensorElasticBands.cs
index e9e56f3a..ab64ee59 100644
--- a/src/gui/forceSensorElasticBands.cs
+++ b/src/gui/forceSensorElasticBands.cs
@@ -32,7 +32,11 @@ public class ForceSensorElasticBandsWindow
        [Widget] Gtk.Label label_header;
        //[Widget] Gtk.ScrolledWindow scrolled_window_treeview;
        [Widget] Gtk.TreeView treeview;
+       [Widget] Gtk.Image image_add;
+       [Widget] Gtk.Image image_delete;
        [Widget] Gtk.Image image_save;
+       [Widget] Gtk.Image image_cancel;
+       [Widget] Gtk.Image image_close;
        [Widget] Gtk.Button button_save;
        [Widget] Gtk.Button button_delete;
        [Widget] Gtk.Button button_close;
@@ -50,8 +54,6 @@ public class ForceSensorElasticBandsWindow
 
        [Widget] Gtk.Button fakeButton_stiffness_changed;
 
-       static ForceSensorElasticBandsWindow ForceSensorElasticBandsWindowBox;
-       
        private TreeStore store;
 
        public int TreeviewSelectedUniqueID;
@@ -68,29 +70,31 @@ public class ForceSensorElasticBandsWindow
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "force_sensor_elastic_bands.glade", 
"force_sensor_elastic_bands", "chronojump");
                gladeXML.Autoconnect(this);
 
-               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
+               Pixbuf pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_add.png");
+               image_add.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_delete.png");
+               image_delete.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
                image_save.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_cancel.png");
+               image_cancel.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_close_blue.png");
+               image_close.Pixbuf = pixbuf;
 
                //HideOnAccept = true;
                //DestroyOnAccept = false;
                fakeButton_stiffness_changed = new Gtk.Button();
        }
 
-       //for an array of widgets
-       static public ForceSensorElasticBandsWindow Show (string title, string textHeader)
+       public void Show (string title, string textHeader)
        {
-               if (ForceSensorElasticBandsWindowBox == null) {
-                       ForceSensorElasticBandsWindowBox = new ForceSensorElasticBandsWindow();
-               } else {
-                       ForceSensorElasticBandsWindowBox.setTitle(title);
-                       ForceSensorElasticBandsWindowBox.label_header.Text = textHeader;
-               }
+               setTitle(title);
+               label_header.Text = textHeader;
 
-               ForceSensorElasticBandsWindowBox.initializeGui(title, textHeader);
-               ForceSensorElasticBandsWindowBox.frame_add_edit.Sensitive = false;
-               ForceSensorElasticBandsWindowBox.force_sensor_elastic_bands.Show ();
-               
-               return ForceSensorElasticBandsWindowBox;
+               initializeGui(title, textHeader);
+               frame_add_edit.Sensitive = false;
+               force_sensor_elastic_bands.Show ();
        }
 
        private void setTitle(string title)
@@ -246,12 +250,14 @@ public class ForceSensorElasticBandsWindow
                }
        }
 
-       private void on_button_add_show_clicked (object o, EventArgs args)
+       private void on_button_add_clicked (object o, EventArgs args)
        {
                currentMode = modes.ADDING;
                empty_frame(); //empty all
-               label_edit_or_add.Text = Catalog.GetString("Add new");
+               label_edit_or_add.Text = Catalog.GetString("Add new elastic band/tube");
                frame_add_edit.Sensitive = true;
+               treeview.Selection.UnselectAll();
+               button_delete.Sensitive = false;
        }
        private void on_button_save_clicked (object o, EventArgs args)
        {
@@ -281,6 +287,9 @@ public class ForceSensorElasticBandsWindow
 
                        //update SQL
                        SqliteForceSensorElasticBand.Update(false, fseb);
+
+                       //unsensitivize frame_add_edit
+                       frame_add_edit.Sensitive = false;
                }
                
                //vbox_bands.Sensitive = true;
@@ -290,6 +299,13 @@ public class ForceSensorElasticBandsWindow
                setTreeview();
        }
 
+       private void on_button_cancel_clicked (object o, EventArgs args)
+       {
+               //unsensitivize frame_add_edit
+               frame_add_edit.Sensitive = false;
+               button_delete.Sensitive = false;
+       }
+
        private void on_button_delete_clicked (object o, EventArgs args)
        {
                //1) get selected just to know uniqueID and if it is active
@@ -347,8 +363,7 @@ public class ForceSensorElasticBandsWindow
 
        private void on_button_close_clicked (object o, EventArgs args)
        {
-               ForceSensorElasticBandsWindowBox.force_sensor_elastic_bands.Hide();
-               ForceSensorElasticBandsWindowBox = null;
+               force_sensor_elastic_bands.Hide();
        }
 
        private void on_delete_event (object o, DeleteEventArgs args)
@@ -357,8 +372,7 @@ public class ForceSensorElasticBandsWindow
 
                //args.RetVal = true;
                        
-               ForceSensorElasticBandsWindowBox.force_sensor_elastic_bands.Hide();
-               ForceSensorElasticBandsWindowBox = null;
+               force_sensor_elastic_bands.Hide();
        }
 
        public double TotalStiffness



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