[chronojump] force sensor analyze recalculated done!



commit 0f87d89ca012167a5fed25d295055be47f7bae88
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 15 11:05:42 2018 +0100

    force sensor analyze recalculated done!

 glade/app1.glade              |  177 ++++++++++++++++++++++++++--------------
 src/gui/chronojumpIcons.cs    |    2 +
 src/gui/forceSensor.cs        |   25 +++++-
 src/gui/forceSensorAnalyze.cs |   11 +++-
 4 files changed, 149 insertions(+), 66 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index cd40d95..4539091 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -15567,6 +15567,50 @@ Concentric</property>
                                                         <property name="can_focus">False</property>
                                                         <property name="spacing">20</property>
                                                         <child>
+                                                          <widget class="GtkButton" 
id="button_force_sensor_analyze_load">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_load_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox205">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_force_sensor_analyze_load">
+                                                            <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="label140">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Load 
file</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="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
                                                           <widget class="GtkButton" 
id="button_force_sensor_analyze_options">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
@@ -15607,22 +15651,23 @@ Concentric</property>
                                                           <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkButton" 
id="button_force_sensor_analyze_load">
+                                                          <widget class="GtkButton" 
id="button_force_sensor_analyze_recalculate">
                                                             <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_force_sensor_load_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_analyze_recalculate_clicked" swapped="no"/>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox205">
+                                                            <widget class="GtkHBox" id="hbox253">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_force_sensor_analyze_load">
+                                                            <widget class="GtkImage" 
id="image_force_sensor_analyze_recalculate">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
@@ -15634,10 +15679,10 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label140">
+                                                            <widget class="GtkLabel" id="label342">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Load 
file</property>
+                                                            <property name="label">Recalculate</property>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">True</property>
@@ -15651,7 +15696,7 @@ Concentric</property>
                                                           <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                           </packing>
                                                         </child>
                                                       </widget>
@@ -15804,68 +15849,27 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkVBox" id="vbox118">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="border_width">16</property>
-                                                            <property name="spacing">16</property>
-                                                            <child>
-                                                            <widget class="GtkHButtonBox" id="hbuttonbox13">
+                                                            <widget class="GtkAlignment" id="alignment37">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="layout_style">start</property>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_force_sensor_analyze_options_close">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property name="receives_default">True</property>
-                                                            <signal name="clicked" 
handler="on_button_force_sensor_analyze_options_close_clicked" swapped="no"/>
-                                                            <accelerator key="Escape" signal="clicked"/>
+                                                            <property name="top_padding">10</property>
                                                             <child>
-                                                            <widget class="GtkHBox" id="hbox251">
+                                                            <widget class="GtkFrame" id="frame6">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">none</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_force_sensor_analyze_options_close">
+                                                            <widget class="GtkAlignment" id="alignment39">
                                                             <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>
+                                                            <property name="left_padding">12</property>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label341">
+                                                            <widget class="GtkVBox" id="vbox122">
                                                             <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">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
+                                                            <property name="border_width">16</property>
+                                                            <property name="spacing">16</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox240">
                                                             <property name="visible">True</property>
@@ -15955,7 +15959,7 @@ Concentric</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -15965,7 +15969,7 @@ Concentric</property>
                                                             <property name="label_xalign">0</property>
                                                             <property name="shadow_type">in</property>
                                                             <child>
-                                                            <widget class="GtkAlignment" id="alignment37">
+                                                            <widget class="GtkAlignment" id="alignment40">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="left_padding">12</property>
@@ -17440,9 +17444,58 @@ Concentric</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">2</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_force_sensor_analyze_options_close">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_analyze_options_close_clicked" swapped="no"/>
+                                                            <accelerator key="Escape" signal="clicked"/>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox251">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_force_sensor_analyze_options_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="label341">
+                                                            <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="type">label_item</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">1</property>
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 810010e..fe41dca 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -125,6 +125,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_force_sensor_check_version;
        [Widget] Gtk.Image image_force_sensor_analyze_options;
        [Widget] Gtk.Image image_force_sensor_analyze_options_close;
+       [Widget] Gtk.Image image_force_sensor_analyze_recalculate;
 
        private void putNonStandardIcons()
        {
@@ -243,6 +244,7 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_recalculate.png");
                image_recalculate.Pixbuf = pixbuf;
+               image_force_sensor_analyze_recalculate.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_build.png");
                image_encoder_configuration.Pixbuf = pixbuf;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index c6da604..85b5292 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -89,6 +89,7 @@ public partial class ChronoJumpWindow
        static bool forceSensorOtherMessageShowSeconds;
        static DateTime forceSensorTimeStart;
        static string lastForceSensorFile = "";
+       static string lastForceSensorFullPath = "";
 
        int usbDisconnectedCount;
        int usbDisconnectedLastTime;
@@ -509,6 +510,7 @@ public partial class ChronoJumpWindow
                event_execute_button_finish.Sensitive = true;
                event_execute_button_cancel.Sensitive = true;
                button_force_sensor_image_save_signal.Sensitive = false;
+               button_force_sensor_analyze_recalculate.Sensitive = false;
                forceCaptureStartMark = false;
                //vscale_force_sensor.Value = 0;
                label_force_sensor_value_max.Text = "0";
@@ -717,6 +719,7 @@ LogB.Information(" fc C ");
 
                                button_force_sensor_image_save_signal.Sensitive = false;
                                button_force_sensor_image_save_rfd.Sensitive = false;
+                               button_force_sensor_analyze_recalculate.Sensitive = false;
                        }
                        else
                                event_execute_label_message.Text = "";
@@ -736,6 +739,7 @@ LogB.Information(" fc D ");
 
                        forceSensorButtonsSensitive(true);
                        button_force_sensor_image_save_signal.Sensitive = true;
+                       button_force_sensor_analyze_recalculate.Sensitive = true;
 
                        //finish, cancel: sensitive = false
                        hideButtons();
@@ -981,14 +985,28 @@ LogB.Information(" fc R ");
                if (filechooser.Run () == (int)ResponseType.Accept)
                {
                        lastForceSensorFile = 
Util.RemoveExtension(Util.GetLastPartOfPath(filechooser.Filename));
-                       File.Copy(filechooser.Filename, UtilEncoder.GetmifCSVFileName(), true); //can be 
overwritten
+                       lastForceSensorFullPath = filechooser.Filename; //used on recalculate
 
-                       forceSensorDoSignalGraph();
-                       forceSensorDoRFDGraph();
+                       forceSensorCopyTempAndDoGraphs();
                }
                filechooser.Destroy ();
        }
 
+       private void on_button_force_sensor_analyze_recalculate_clicked (object o, EventArgs args)
+       {
+               if(lastForceSensorFullPath != null && lastForceSensorFullPath != "")
+                       forceSensorCopyTempAndDoGraphs();
+       }
+
+       private void forceSensorCopyTempAndDoGraphs()
+       {
+               File.Copy(lastForceSensorFullPath, UtilEncoder.GetmifCSVFileName(), true); //can be 
overwritten
+
+               forceSensorDoSignalGraph();
+               forceSensorDoRFDGraph();
+       }
+
+
        void forceSensorDoRFDGraph()
        {
                string imagePath = UtilEncoder.GetmifTempFileName();
@@ -1122,6 +1140,7 @@ LogB.Information(" fc R ");
                label_force_sensor_value_max.Text = forceSensorValues.ForceMax.ToString();
                label_force_sensor_value_min.Text = forceSensorValues.ForceMin.ToString();
                button_force_sensor_image_save_signal.Sensitive = true;
+               button_force_sensor_analyze_recalculate.Sensitive = true;
        }
 
        private void forcePaintHVLines(double maxForce, double minForce, int lastTime)
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 9f14d85..49a6785 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -32,6 +32,7 @@ public partial class ChronoJumpWindow
 {
        //analyze tab
        [Widget] Gtk.Button button_force_sensor_analyze_load;
+       [Widget] Gtk.Button button_force_sensor_analyze_recalculate;
        [Widget] Gtk.Label label_force_sensor_analyze;
        [Widget] Gtk.Image image_force_sensor_graph;
        [Widget] Gtk.Viewport viewport_force_sensor_graph;
@@ -102,11 +103,19 @@ public partial class ChronoJumpWindow
         * analyze options -------------------------->
         */
 
-       private void forceSensorAnalyzeOptionsSensitivity(bool s) //s for sensitive
+       private bool button_force_sensor_analyze_recalculate_was_sensitive; //needed this temp variable
+       private void forceSensorAnalyzeOptionsSensitivity(bool s) //s for sensitive. When show options frame 
is ! s
        {
                button_force_sensor_analyze_options.Sensitive = s;
                button_force_sensor_analyze_load.Sensitive = s;
 
+               if(s)
+                       button_force_sensor_analyze_recalculate.Sensitive = 
button_force_sensor_analyze_recalculate_was_sensitive;
+               else {
+                       button_force_sensor_analyze_recalculate_was_sensitive = 
button_force_sensor_analyze_recalculate.Sensitive;
+                       button_force_sensor_analyze_recalculate.Sensitive = false;
+               }
+
                main_menu.Sensitive = s;
                notebook_session_person.Sensitive = s;
                hbox_contacts_sup_capture_analyze_two_buttons.Sensitive = s;


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