[chronojump] Jumps profile image can be saved to png



commit d92e85c1eeec460b01bd22ae12d6cd370c2bfd01
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Nov 9 20:58:51 2017 +0100

    Jumps profile image can be saved to png

 glade/app1.glade           |   85 ++++++++++++++++++++++++++++++++++++++++++-
 src/constants.cs           |    1 +
 src/gui/chronojump.cs      |   27 ++++++++++++++
 src/gui/chronojumpIcons.cs |    1 +
 src/gui/encoder.cs         |   25 +++++++++----
 5 files changed, 129 insertions(+), 10 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 9ba91a3..968207c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1454,6 +1454,12 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <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>
@@ -13681,10 +13687,79 @@ on current Chronojump version.</property>
                                                     <property name="visible">True</property>
                                                     <property name="can_focus">False</property>
                                                     <child>
-                                                      <widget class="GtkDrawingArea" 
id="drawingarea_jumps_profile">
+                                                      <widget class="GtkHBox" id="hbox191">
                                                         <property name="visible">True</property>
                                                         <property name="can_focus">False</property>
-                                                        <signal name="expose_event" 
handler="on_drawingarea_jumps_profile_expose_event" swapped="no"/>
+                                                        <property name="spacing">4</property>
+                                                        <child>
+                                                          <widget class="GtkDrawingArea" 
id="drawingarea_jumps_profile">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <signal name="expose_event" 
handler="on_drawingarea_jumps_profile_expose_event" swapped="no"/>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox115">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_profile_save_image">
+                                                            <property name="visible">True</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_jumps_profile_save_image_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox116">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_jumps_profile_save">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_forcesensor_analyze_image_save5">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-save</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</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">True</property>
@@ -21900,6 +21975,12 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/constants.cs b/src/constants.cs
index 75a3a22..88708ec 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -790,6 +790,7 @@ public class Constants
 
        public enum EncoderGI {ALL, GRAVITATORY, INERTIAL}
        public enum CheckFileOp {
+               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
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 2d40693..1f0ce36 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -243,6 +243,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ScrolledWindow scrolledwindow_jumps_profile_help;
        [Widget] Gtk.ScrolledWindow scrolledwindow_jumps_profile_training;
        [Widget] Gtk.Image image_tab_jumps_profile;
+       [Widget] Gtk.Image image_jumps_profile_save;
        
        
        //runs
@@ -6770,6 +6771,32 @@ LogB.Debug("X");
                //data is calculated on switch page (at notebook_capture_analyze) or on change person
        }
 
+       private void on_button_jumps_profile_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE);
+       }
+
+       private void on_button_jumps_profile_save_image_selected (string destination)
+       {
+               if(drawingarea_jumps_profile == null)
+                       return;
+
+               Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(drawingarea_jumps_profile.GdkWindow, 
Gdk.Colormap.System,
+                               0, 0, 0, 0,
+                               UtilGtk.WidgetWidth(drawingarea_jumps_profile),
+                               UtilGtk.WidgetHeight(drawingarea_jumps_profile) );
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_jumps_profile_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_jumps_profile_save_image_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
 
        private void on_radio_mode_contacts_capture_toggled (object o, EventArgs args)
        {
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 1e8780f..109a029 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -423,6 +423,7 @@ public partial class ChronoJumpWindow
                image_encoder_analyze_stats.Pixbuf = pixbuf;
                image_encoder_analyze_image_save.Pixbuf = pixbuf;
                image_forcesensor_analyze_image_save.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 0085146..17fedbd 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1912,9 +1912,11 @@ public partial class ChronoJumpWindow
                string exportString = ""; 
                if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                        exportString = Catalog.GetString ("Export set in CSV format");
-               else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
-                       checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
-                       checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD)
+               else if(
+                               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 )
                        exportString = Catalog.GetString ("Save image");
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        exportString = Catalog.GetString ("Export repetition in CSV format");
@@ -1935,9 +1937,11 @@ public partial class ChronoJumpWindow
 
                if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                        nameString += "_encoder_set_export.csv";
-               else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
-                       checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
-                       checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD)
+               else if(
+                               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 )
                        nameString += ".png";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        nameString += "_encoder_repetition_export.csv";
@@ -1975,7 +1979,10 @@ public partial class ChronoJumpWindow
                                                                "Are you sure you want to overwrite file: "), 
"", 
                                                        exportFileName);
 
-                                       if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
+                                       if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_jumps_profile_save_image_accepted);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                                                confirmWin.Button_accept.Clicked += 
                                                        new 
EventHandler(on_overwrite_file_export_all_curves_accepted);
                                        else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE)
@@ -1995,7 +2002,9 @@ public partial class ChronoJumpWindow
                                                        new 
EventHandler(on_overwrite_file_forcesensor_save_image_rfd_accepted);
 
                                } else {
-                                       if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
+                                       if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
+                                               on_button_jumps_profile_save_image_selected (exportFileName);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                                                on_button_encoder_export_all_curves_file_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE)
                                                on_button_encoder_save_image_file_selected (exportFileName);


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