[chronojump] forceSensorAnalyze manual can save image



commit 3d9f5862d87e051ff70a63bfd6048f5ce0d9b6c6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 7 16:43:27 2018 +0200

    forceSensorAnalyze manual can save image

 glade/app1.glade              |   22 +++++++++++++++-----
 src/constants.cs              |    2 +-
 src/gui/chronojump.cs         |    5 ++-
 src/gui/chronojumpIcons.cs    |    5 ++-
 src/gui/encoder.cs            |   27 +++++++++++++++++--------
 src/gui/forceSensor.cs        |   42 ++++++++++++++++++++++++++++++++++------
 src/gui/forceSensorAnalyze.cs |    6 ++++-
 7 files changed, 81 insertions(+), 28 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 7252fc5..e440b05 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1712,6 +1712,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -12052,7 +12055,7 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_image_save1">
+                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_save_signal">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
@@ -16116,20 +16119,20 @@ Concentric</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <child>
-                                                            <widget class="GtkButton" 
id="button_force_sensor_image_save_rfd">
+                                                            <widget class="GtkButton" 
id="button_force_sensor_image_save_rfd_auto">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="tooltip" translatable="yes">Save 
image</property>
-                                                            <signal name="clicked" 
handler="on_button_force_sensor_image_save_rfd_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_image_save_rfd_auto_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox114">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_image_save">
+                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_save_rfd_auto">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
@@ -19386,6 +19389,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -19409,19 +19415,20 @@ Concentric</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <child>
-                                                            <widget class="GtkButton" 
id="button_force_sensor_image_save_rfd1">
+                                                            <widget class="GtkButton" 
id="button_force_sensor_image_save_rfd_manual">
                                                             <property name="visible">True</property>
                                                             <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="tooltip" translatable="yes">Save 
image</property>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_image_save_rfd_manual_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox125">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_image_save4">
+                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_save_rfd_manual">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
@@ -27516,6 +27523,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/constants.cs b/src/constants.cs
index 4d3ae5d..4a20e45 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -807,7 +807,7 @@ public class Constants
                JUMPS_PROFILE_SAVE_IMAGE,
                ENCODER_CAPTURE_EXPORT_ALL, ENCODER_ANALYZE_SAVE_IMAGE,
                ENCODER_ANALYZE_SAVE_AB, ENCODER_ANALYZE_SAVE_TABLE,
-               FORCESENSOR_SAVE_IMAGE_SIGNAL, FORCESENSOR_SAVE_IMAGE_RFD
+               FORCESENSOR_SAVE_IMAGE_SIGNAL, FORCESENSOR_SAVE_IMAGE_RFD_AUTO, 
FORCESENSOR_SAVE_IMAGE_RFD_MANUAL
        }
 
        public static double EncoderErrorCode = -1;
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 52f6d94..05e346c 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -368,8 +368,9 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_gravitatory_vpf_propulsive;
 
        //forcesensor
-       [Widget] Gtk.Image image_forcesensor_analyze_image_save;
-       [Widget] Gtk.Image image_forcesensor_analyze_image_save1;
+       [Widget] Gtk.Image image_forcesensor_analyze_save_signal;
+       [Widget] Gtk.Image image_forcesensor_analyze_save_rfd_auto;
+       [Widget] Gtk.Image image_forcesensor_analyze_save_rfd_manual;
 
        Random rand;
 
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index fbc8a19..58b9323 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -516,8 +516,9 @@ public partial class ChronoJumpWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "gpm-statistics.png");
                image_encoder_analyze_stats.Pixbuf = pixbuf;
                image_encoder_analyze_image_save.Pixbuf = pixbuf;
-               image_forcesensor_analyze_image_save.Pixbuf = pixbuf;
-               image_forcesensor_analyze_image_save1.Pixbuf = pixbuf;
+               image_forcesensor_analyze_save_signal.Pixbuf = pixbuf;
+               image_forcesensor_analyze_save_rfd_auto.Pixbuf = pixbuf;
+               image_forcesensor_analyze_save_rfd_manual.Pixbuf = pixbuf;
                image_jumps_profile_save.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "stock_delete.png");
                image_encoder_signal_delete.Pixbuf = pixbuf;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index f3e9667..37ecbe0 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1967,7 +1967,8 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
-                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD )
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL )
                        exportString = Catalog.GetString ("Save image");
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        exportString = Catalog.GetString ("Export repetition in CSV format");
@@ -1984,8 +1985,9 @@ public partial class ChronoJumpWindow
                }
 
                //at force sensor we can graph a different person than selected person, so use graph-file 
loaded
-               if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
-                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD)
+               if( checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL )
                {
                        if(lastForceSensorFile == null || lastForceSensorFile == "")
                                nameString = "unnamed";
@@ -1999,7 +2001,8 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
-                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD )
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL )
                        nameString += ".png";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        nameString += "_encoder_repetition_export.csv";
@@ -2023,7 +2026,8 @@ public partial class ChronoJumpWindow
                                        checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB ||
                                        checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_TABLE)
                                exportFileName = Util.AddCsvIfNeeded(exportFileName);
-                       else //ENCODER_ANALYZE_SAVE_IMAGE, FORCESENSOR_SAVE_IMAGE_SIGNAL, 
FORCESENSOR_SAVE_IMAGE_RFD
+                       else    //ENCODER_ANALYZE_SAVE_IMAGE, FORCESENSOR_SAVE_IMAGE_SIGNAL,
+                               //FORCESENSOR_SAVE_IMAGE_RFD_AUTO, FORCESENSOR_SAVE_IMAGE_RFD_MANUAL
                                exportFileName = Util.AddPngIfNeeded(exportFileName);
                        try {
                                if (File.Exists(exportFileName)) {
@@ -2055,9 +2059,12 @@ public partial class ChronoJumpWindow
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_forcesensor_save_image_signal_accepted);
-                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD)
+                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO)
                                                confirmWin.Button_accept.Clicked +=
-                                                       new 
EventHandler(on_overwrite_file_forcesensor_save_image_rfd_accepted);
+                                                       new 
EventHandler(on_overwrite_file_forcesensor_save_image_rfd_auto_accepted);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_forcesensor_save_image_rfd_manual_accepted);
 
                                } else {
                                        if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
@@ -2072,8 +2079,10 @@ public partial class ChronoJumpWindow
                                                on_button_encoder_save_table_file_selected (exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL)
                                                on_button_forcesensor_save_image_signal_file_selected 
(exportFileName);
-                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD)
-                                               on_button_forcesensor_save_image_rfd_file_selected 
(exportFileName);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO)
+                                               on_button_forcesensor_save_image_rfd_auto_file_selected 
(exportFileName);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL)
+                                               on_button_forcesensor_save_image_rfd_manual_file_selected 
(exportFileName);
 
                                        string myString = string.Format(Catalog.GetString("Saved to {0}"), 
                                                        exportFileName);
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index a199097..7d36db9 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -724,7 +724,8 @@ LogB.Information(" fc C ");
                                        event_execute_label_message.Text = forceSensorNotConnectedString;
 
                                button_force_sensor_image_save_signal.Sensitive = false;
-                               button_force_sensor_image_save_rfd.Sensitive = false;
+                               button_force_sensor_image_save_rfd_auto.Sensitive = false;
+                               button_force_sensor_image_save_rfd_manual.Sensitive = false;
                                button_force_sensor_analyze_recalculate.Sensitive = false;
                        }
                        else
@@ -1067,7 +1068,7 @@ LogB.Information(" fc R ");
                                imagePath,
                                image_force_sensor_graph);
                image_force_sensor_graph.Sensitive = true;
-               button_force_sensor_image_save_rfd.Sensitive = true;
+               button_force_sensor_image_save_rfd_auto.Sensitive = true;
        }
 
        void forceSensorDoSignalGraph()
@@ -1259,9 +1260,13 @@ LogB.Information(" fc R ");
        {
                checkFile(Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL);
        }
-       private void on_button_force_sensor_image_save_rfd_clicked (object o, EventArgs args)
+       private void on_button_force_sensor_image_save_rfd_auto_clicked (object o, EventArgs args)
        {
-               checkFile(Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD);
+               checkFile(Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO);
+       }
+       private void on_button_force_sensor_image_save_rfd_manual_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL);
        }
 
        void on_button_forcesensor_save_image_signal_file_selected (string destination)
@@ -1287,13 +1292,36 @@ LogB.Information(" fc R ");
                new DialogMessage(Constants.MessageTypes.INFO, myString);
        }
 
-       void on_button_forcesensor_save_image_rfd_file_selected (string destination)
+       void on_button_forcesensor_save_image_rfd_auto_file_selected (string destination)
        {
                File.Copy(UtilEncoder.GetmifTempFileName(), destination, true);
        }
-       private void on_overwrite_file_forcesensor_save_image_rfd_accepted(object o, EventArgs args)
+       private void on_overwrite_file_forcesensor_save_image_rfd_auto_accepted(object o, EventArgs args)
+       {
+               on_button_forcesensor_save_image_rfd_auto_file_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
+       void on_button_forcesensor_save_image_rfd_manual_file_selected (string destination)
+       {
+               LogB.Information("CREATING PIXBUF");
+               LogB.Information("force_sensor_ai_pixmap is null == " + (force_sensor_ai_pixmap == null));
+               LogB.Information("colormapForceAI is null == " + (colormapForceAI == null));
+               LogB.Information("force_sensor_ai_drawingarea is null == " + (force_sensor_ai_drawingarea == 
null));
+               int pixmapW = 0;
+               int pixmapH = 0;
+               force_sensor_ai_pixmap.GetSize(out pixmapW, out pixmapH);
+               Gdk.Pixbuf pixbuf = Pixbuf.FromDrawable(force_sensor_ai_pixmap, colormapForceAI,
+                               0, 0, 0, 0, pixmapW, pixmapH);
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_forcesensor_save_image_rfd_manual_accepted(object o, EventArgs args)
        {
-               on_button_forcesensor_save_image_rfd_file_selected (exportFileName);
+               on_button_forcesensor_save_image_rfd_manual_file_selected (exportFileName);
 
                string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
                new DialogMessage(Constants.MessageTypes.INFO, myString);
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 8016420..26085ef 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -36,7 +36,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_force_sensor_analyze;
        [Widget] Gtk.Image image_force_sensor_graph;
        [Widget] Gtk.Viewport viewport_force_sensor_graph;
-       [Widget] Gtk.Button button_force_sensor_image_save_rfd;
+       [Widget] Gtk.Button button_force_sensor_image_save_rfd_auto;
+       [Widget] Gtk.Button button_force_sensor_image_save_rfd_manual;
 
        [Widget] Gtk.SpinButton spin_force_duration_seconds;
        [Widget] Gtk.RadioButton radio_force_duration_seconds;
@@ -669,6 +670,9 @@ public partial class ChronoJumpWindow
        private void forceSensorAnalyzeManualGraphDo(Rectangle allocation)
        {
                LogB.Information("forceSensorAnalyzeManualGraphDo() START");
+
+               button_force_sensor_image_save_rfd_manual.Sensitive = true;
+
                // 1) create paintPoints
                Gdk.Point [] paintPoints = new Gdk.Point[fsAI.FscAIPoints.Points.Count];
                for(int i = 0; i < fsAI.FscAIPoints.Points.Count; i ++)


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