[chronojump] Added force_sensor_exercise windows WIP



commit 009014665bf00deed0ea14dd63e37d90f4a4bfac
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Sep 30 20:40:57 2019 +0200

    Added force_sensor_exercise windows WIP

 glade/force_sensor_exercise.glade | 683 ++++++++++++++++++++++++++++++++++++++
 src/Makefile.am                   |   2 +
 src/gui/forceSensor.cs            |   5 +
 src/gui/forceSensorExercise.cs    | 218 ++++++++++++
 4 files changed, 908 insertions(+)
---
diff --git a/glade/force_sensor_exercise.glade b/glade/force_sensor_exercise.glade
new file mode 100644
index 00000000..21ff7061
--- /dev/null
+++ b/glade/force_sensor_exercise.glade
@@ -0,0 +1,683 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<glade-interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <widget class="GtkWindow" id="force_sensor_exercise">
+    <property name="can_focus">False</property>
+    <property name="border_width">10</property>
+    <property name="title" translatable="yes">Chronojump</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <signal name="delete_event" handler="on_delete_event" swapped="no"/>
+    <child>
+      <widget class="GtkVBox" id="vbox_win">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">8</property>
+        <child>
+          <widget class="GtkLabel" id="label_header">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox_error">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">10</property>
+            <child>
+              <widget class="GtkImage" id="image_error">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="stock">gtk-no</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="label_error">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </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>
+        <child>
+          <widget class="GtkVBox" id="vbox_data">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">4</property>
+            <child>
+              <widget class="GtkEntry" id="entry_name">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">●</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">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="n_rows">7</property>
+                <property name="n_columns">3</property>
+                <property name="column_spacing">16</property>
+                <property name="row_spacing">10</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_force_sensor">
+                        <property name="label" translatable="yes">Sensor values</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="on_radio_force_toggled" swapped="no"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_force_resultant">
+                        <property name="label" translatable="yes">Resultant force</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_force_sensor</property>
+                        <signal name="toggled" handler="on_radio_force_toggled" swapped="no"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_string_rope">
+                        <property name="label" translatable="yes">Rope</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="on_radio_string_toggled" swapped="no"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_string_rubber_band">
+                        <property name="label" translatable="yes">Rubber band</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_string_rope</property>
+                        <signal name="toggled" handler="on_radio_string_toggled" swapped="no"/>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox5">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_cdg_displ_yes">
+                        <property name="label" translatable="yes">Yes</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_cdg_displ_no">
+                        <property name="label" translatable="yes">No</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_cdg_displ_yes</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</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>
+                <child>
+                  <widget class="GtkHBox" id="hbox6">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_sensor_affected_bw_yes">
+                        <property name="label" translatable="yes">Yes</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_sensor_affected_bw_no">
+                        <property name="label" translatable="yes">No</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_sensor_affected_bw_yes</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </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="GtkHBox" id="hbox7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">12</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_tare_before_capture_yes">
+                        <property name="label" translatable="yes">Yes</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radio_tare_before_capture_no">
+                        <property name="label" translatable="yes">No</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="active">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radio_tare_before_capture_yes</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <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>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_force">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Force displayed</property>
+                  </widget>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_force_resultant">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_force">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_string">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_string">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_cdg_displ">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_cdg_displ">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_sensor_affected_bw">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_sensor_affected_bw">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_tare_before_capture">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_tare_before_capture">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_bw_added">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_bw_added">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_help_angle">
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <widget class="GtkImage" id="image_help_angle">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="x_options"/>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_string">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">String type</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_cdg_displ">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">CdG has displacement</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_sensor_affected_bw">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Sensor is affected
+by body weight</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="GtkLabel" id="label_tare_before_capture">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Tare before capture</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_bw_added">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Body weight to be added</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label_angle">
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Default sensor angle</property>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox_bw_added">
+                    <property name="can_focus">False</property>
+                    <property name="spacing">8</property>
+                    <child>
+                      <widget class="GtkSpinButton" id="spin_bw_added">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">●</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>
+                        <property name="adjustment">0 0 100 1 10 0</property>
+                        <property name="snap_to_ticks">True</property>
+                        <property name="numeric">True</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="label1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">%</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">5</property>
+                    <property name="bottom_attach">6</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox_angle">
+                    <property name="can_focus">False</property>
+                    <property name="spacing">8</property>
+                    <child>
+                      <widget class="GtkSpinButton" id="spin_angle">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">●</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>
+                        <property name="adjustment">0 -90 90 1 10 0</property>
+                        <property name="snap_to_ticks">True</property>
+                        <property name="numeric">True</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="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">ΒΊ</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">6</property>
+                    <property name="bottom_attach">7</property>
+                  </packing>
+                </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">2</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkAlignment" id="alignment2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="top_padding">12</property>
+            <child>
+              <widget class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <widget class="GtkButton" id="button_cancel">
+                    <property name="label">gtk-cancel</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>
+                    <accelerator key="Escape" signal="clicked"/>
+                  </widget>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="button_accept">
+                    <property name="label">gtk-ok</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>
+                  </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">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index 700b9701..965441ca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,7 @@ SOURCES = \
        gui/executeAuto.cs\
        gui/exhibition.cs\
        gui/forceSensor.cs\
+       gui/forceSensorExercise.cs\
        gui/forceSensorAnalyze.cs\
        gui/guiTests.cs\
        gui/jump.cs\
@@ -248,6 +249,7 @@ RESOURCES = \
        ../glade/event_graph_configure.glade \
        ../glade/execute_auto.glade \
        ../glade/generic_window.glade \
+       ../glade/force_sensor_exercise.glade \
        ../glade/jump_type_add.glade \
        ../glade/jumps_runs_more.glade \
        ../glade/person_multiple_infinite.glade \
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 6755d23c..c5d21dfd 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -2221,9 +2221,14 @@ LogB.Information(" fs R ");
                        combo_force_sensor_exercise.Active = 
UtilGtk.ComboMakeActive(combo_force_sensor_exercise, name);
        }
 
+       ForceSensorExerciseWindow forceSensorExerciseWin; //TODO: clean
        //info is now info and edit (all values can be changed), and detete (there's delete button)
        void on_button_force_sensor_exercise_edit_clicked (object o, EventArgs args)
        {
+               //TODO: clean
+               forceSensorExerciseWin = ForceSensorExerciseWindow.Show(Catalog.GetString("Exercise"),
+                               Catalog.GetString("Force sensor exercise:"));
+
                if(UtilGtk.ComboGetActive(combo_force_sensor_exercise) == "")
                {
                        new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Need to 
create/select an exercise."));
diff --git a/src/gui/forceSensorExercise.cs b/src/gui/forceSensorExercise.cs
new file mode 100644
index 00000000..9976202f
--- /dev/null
+++ b/src/gui/forceSensorExercise.cs
@@ -0,0 +1,218 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2019   Xavier de Blas <xaviblas gmail com> 
+ */
+
+using System;
+//using Gdk;
+using Gtk;
+using Glade;
+//using Gnome;
+using GLib; //for Value
+using System.Collections.Generic; //List<T>
+//using Mono.Unix;
+
+
+public class ForceSensorExerciseWindow
+{
+       [Widget] Gtk.Window force_sensor_exercise;
+       [Widget] Gtk.Label label_header;
+       /*
+          [Widget] Gtk.Box hbox_error;
+          [Widget] Gtk.Label label_error;
+          */
+       [Widget] Gtk.Entry entry_name;
+
+       //each of the rows of the table
+       [Widget] Gtk.Label label_force;
+       [Widget] Gtk.RadioButton radio_force_sensor;
+       [Widget] Gtk.RadioButton radio_force_resultant; 
+       [Widget] Gtk.Button button_help_force;
+
+       [Widget] Gtk.Label label_string;
+       [Widget] Gtk.RadioButton radio_string_rope;
+       [Widget] Gtk.RadioButton radio_string_rubber_band;
+       [Widget] Gtk.Button button_help_string;
+
+       [Widget] Gtk.Label label_cdg_displ;
+       [Widget] Gtk.RadioButton radio_cdg_displ_yes;
+       [Widget] Gtk.RadioButton radio_cdg_displ_no;
+       [Widget] Gtk.Button button_help_cdg_displ;
+
+       [Widget] Gtk.Label label_sensor_affected_bw;
+       [Widget] Gtk.RadioButton radio_sensor_affected_bw_yes;
+       [Widget] Gtk.RadioButton radio_sensor_affected_bw_no;
+       [Widget] Gtk.Button button_help_sensor_affected_bw;
+
+       [Widget] Gtk.Label label_tare_before_capture;
+       [Widget] Gtk.RadioButton radio_tare_before_capture_yes;
+       [Widget] Gtk.RadioButton radio_tare_before_capture_no;
+       [Widget] Gtk.Button button_help_tare_before_capture;
+
+       [Widget] Gtk.Label label_bw_added;
+       [Widget] Gtk.HBox hbox_bw_added;
+       [Widget] Gtk.SpinButton spin_bw_added;
+       [Widget] Gtk.Button button_help_bw_added;
+
+       [Widget] Gtk.Label label_angle;
+       [Widget] Gtk.HBox hbox_angle;
+       [Widget] Gtk.SpinButton spin_angle;
+       [Widget] Gtk.Button button_help_angle;
+
+       //lists of widgets to play with visibility
+       List<Widget> lw_string;
+       List<Widget> lw_cdg_displ;
+       List<Widget> lw_sensor_affected_bw;
+       List<Widget> lw_tare_before_capture;
+       List<Widget> lw_bw_added;
+       List<Widget> lw_angle;
+
+       //      [Widget] Gtk.Image image_delete;
+
+       static ForceSensorExerciseWindow ForceSensorExerciseWindowBox;
+
+       /*
+          public int uniqueID;                         //used on encoder & forceSensor edit exercise
+          public string nameUntranslated;              //used on encoder edit exercise
+          */
+
+       public ForceSensorExerciseWindow (string title, string textHeader)
+       {
+               Glade.XML gladeXML;
+               gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "force_sensor_exercise.glade", 
"force_sensor_exercise", "chronojump");
+               gladeXML.Autoconnect(this);
+
+               //put an icon to window
+               UtilGtk.IconWindow(force_sensor_exercise);
+
+               force_sensor_exercise.Resizable = false;
+               setTitle(title);
+               label_header.Text = textHeader;
+
+               createListsOfWidgets();
+
+               //HideOnAccept = true;
+               //DestroyOnAccept = false;
+       }
+
+       static public ForceSensorExerciseWindow Show (string title, string textHeader)
+       {
+               if (ForceSensorExerciseWindowBox == null) {
+                       ForceSensorExerciseWindowBox = new ForceSensorExerciseWindow(title, textHeader);
+               } else {
+                       ForceSensorExerciseWindowBox.setTitle(title);
+                       ForceSensorExerciseWindowBox.label_header.Text = textHeader;
+               }
+
+               ForceSensorExerciseWindowBox.hideWidgets();
+               ForceSensorExerciseWindowBox.force_sensor_exercise.Show ();
+
+               return ForceSensorExerciseWindowBox;
+       }
+
+       private void setTitle(string title)
+       {
+               if(title != "")
+                       force_sensor_exercise.Title = "Chronojump - " + title;
+       }
+
+       private void createListsOfWidgets()
+       {
+               lw_string = new List<Widget> {
+                       label_string, radio_string_rope, radio_string_rubber_band, button_help_string };
+               lw_cdg_displ = new List<Widget> {
+                       label_cdg_displ, radio_cdg_displ_yes, radio_cdg_displ_no, button_help_cdg_displ };
+               lw_sensor_affected_bw = new List<Widget> {
+                       label_sensor_affected_bw, radio_sensor_affected_bw_yes, radio_sensor_affected_bw_no, 
button_help_sensor_affected_bw };
+               lw_tare_before_capture = new List<Widget> {
+                       label_tare_before_capture, radio_tare_before_capture_yes, 
radio_tare_before_capture_no, button_help_tare_before_capture };
+               lw_bw_added = new List<Widget> {
+                       label_bw_added, hbox_bw_added, button_help_bw_added }; 
+               lw_angle = new List<Widget> {
+                       label_angle, hbox_angle, button_help_angle }; 
+       }
+
+       private void hideWidgets()
+       {
+               showHideWidget(lw_string, false);
+               showHideWidget(lw_cdg_displ, false);
+               showHideWidget(lw_sensor_affected_bw, false);
+               showHideWidget(lw_tare_before_capture, false);
+               showHideWidget(lw_bw_added, false);
+               showHideWidget(lw_angle, false);
+       }
+
+       private void showHideWidget(List<Widget> lw, bool show)
+       {
+               foreach(Widget w in lw)
+                       w.Visible = show;
+
+               if(lw == lw_string && show)
+                       showHideWidget(lw_cdg_displ, radio_string_rubber_band.Active);
+       }
+
+       private void on_radio_force_toggled (object o, EventArgs args)
+       {
+               if (radio_force_resultant.Active)
+                       showHideWidget(lw_string, true);
+               else {
+                       showHideWidget(lw_string, false);
+                       showHideWidget(lw_cdg_displ, false);
+                       showHideWidget(lw_sensor_affected_bw, false);
+                       showHideWidget(lw_tare_before_capture, false);
+                       showHideWidget(lw_bw_added, false);
+                       showHideWidget(lw_angle, false);
+               }
+       }
+
+       private void on_radio_string_toggled (object o, EventArgs args)
+       {
+               if(radio_string_rubber_band.Active)
+                       showHideWidget(lw_cdg_displ, true);
+               else {
+                       showHideWidget(lw_cdg_displ, false);
+                       showHideWidget(lw_sensor_affected_bw, false);
+                       showHideWidget(lw_tare_before_capture, false);
+                       showHideWidget(lw_bw_added, false);
+                       showHideWidget(lw_angle, false);
+               }
+       }
+
+       private void on_entries_changed (object o, EventArgs args)
+       {
+               Gtk.Entry entry_name = o as Gtk.Entry;
+               if (o == null)
+                       return;
+
+               entry_name.Text = Util.MakeValidSQL(entry_name.Text);
+       }
+
+       private void on_delete_event (object o, DeleteEventArgs args)
+       {
+               LogB.Information("calling on_delete_event");
+
+               args.RetVal = true;
+
+               ForceSensorExerciseWindowBox.force_sensor_exercise.Hide();
+               ForceSensorExerciseWindowBox = null;
+       }
+
+
+       ~ForceSensorExerciseWindow() {}
+}
+



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