[chronojump] RaceAnalyzer capture tab graphs can be saved as a composed image



commit 1b0bc276474ac96035953b9f4139b00036477c1f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 11 13:24:47 2022 +0100

    RaceAnalyzer capture tab graphs can be saved as a composed image

 glade/app1.glade                  | 95 +++++++++++++++++++++++++++++++--------
 src/constants.cs                  |  1 +
 src/gui/app1/encoder.cs           | 16 +++++--
 src/gui/app1/icons.cs             |  4 ++
 src/gui/app1/runEncoder.cs        | 26 +++++++++++
 src/gui/app1/runEncoderAnalyze.cs |  6 +--
 6 files changed, 122 insertions(+), 26 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ead2f4fdc..02645637a 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -10341,12 +10341,12 @@ EncoderInertialCapture</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkVBox" 
id="vbox132_race_analyzer">
+                                                            <widget class="GtkHBox" 
id="hbox219_race_analyzer">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="border_width">8</property>
+                                                            <property name="spacing">2</property>
                                                             <child>
-                                                            <widget class="GtkVBox" id="vbox231">
+                                                            <widget class="GtkVBox" 
id="vbox_race_analyzer_capture_graphs">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <child>
@@ -10453,20 +10453,71 @@ EncoderInertialCapture</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox172">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_race_analyzer_capture_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_race_analyzer_capture_save_image_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox230">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_contacts_run_encoder_capture_save_image_chart">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
                                                             </widget>
                                                             <packing>
-                                                            <property name="position">8</property>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label371">
+                                                            <widget class="GtkImage" 
id="image_button_contacts_run_encoder_capture_save_image_disk">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">runs 
encoder</property>
+                                                            <property 
name="stock">gtk-missing-image</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="position">8</property>
-                                                            <property name="tab_fill">False</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            <packing>
                                                             <property name="type">tab</property>
                                                             </packing>
                                                             </child>
@@ -26164,6 +26215,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -32521,18 +32575,6 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -32569,6 +32611,18 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -42031,6 +42085,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 f714c9918..97f1e21f0 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1137,6 +1137,7 @@ public class Constants
                FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES,
                FORCESENSOR_EXPORT_INDIVIDUAL_ALL_SESSIONS_YES_IMAGES,
                FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES,
+               RUNENCODER_CAPTURE_SAVE_IMAGE,
                RUNENCODER_ANALYZE_SAVE_IMAGE, RUNENCODER_ANALYZE_SAVE_TABLE,
                RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES,
                RUNENCODER_EXPORT_INDIVIDUAL_ALL_SESSIONS_NO_IMAGES,
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 368f376b9..1392c3ac2 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2157,6 +2157,7 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL ||
+                               checkFileOp == Constants.CheckFileOp.RUNENCODER_CAPTURE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_IMAGE)
                        exportString = Catalog.GetString ("Save image");
                else if(
@@ -2281,8 +2282,10 @@ public partial class ChronoJumpWindow
                        nameString += "_force_sensor_rfd_auto.png";
                else if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL)
                        nameString += "_force_sensor_general_analysis.png";
+               else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_CAPTURE_SAVE_IMAGE)
+                       nameString += "_race_analyzer_capture.png";
                else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_IMAGE)
-                       nameString += "_race_analyzer.png";
+                       nameString += "_race_analyzer_analyze.png";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        nameString += "_encoder_repetition_export.csv";
                else if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
@@ -2437,9 +2440,12 @@ public partial class ChronoJumpWindow
                                                        checkFileOp == 
Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_runencoder_export_accepted);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_CAPTURE_SAVE_IMAGE)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_runencoder_capture_image_save_accepted);
                                        else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_IMAGE)
                                                confirmWin.Button_accept.Clicked +=
-                                                       new 
EventHandler(on_overwrite_file_runencoder_image_save_accepted);
+                                                       new 
EventHandler(on_overwrite_file_runencoder_analyze_image_save_accepted);
                                        else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_TABLE)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_raceAnalyzer_save_table_accepted);
@@ -2500,8 +2506,10 @@ public partial class ChronoJumpWindow
                                                        checkFileOp == 
Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_ALL_SESSIONS_NO_IMAGES ||
                                                        checkFileOp == 
Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
                                                on_button_run_encoder_export_file_selected (exportFileName);
+                                       else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_CAPTURE_SAVE_IMAGE)
+                                               on_button_run_encoder_capture_image_save_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_IMAGE)
-                                               on_button_run_encoder_image_save_selected (exportFileName);
+                                               on_button_run_encoder_analyze_image_save_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_TABLE)
                                                on_button_raceAnalyzer_save_table_file_selected 
(exportFileName);
 
@@ -4920,7 +4928,7 @@ public partial class ChronoJumpWindow
        
                button_encoder_analyze_sensitiveness();
        }
-       
+
        void on_button_encoder_capture_image_save_clicked (object o, EventArgs args)
        {
                checkFile(Constants.CheckFileOp.ENCODER_CAPTURE_SAVE_IMAGE);
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index db883307b..afd5fad6a 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -224,6 +224,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_hscale_force_sensor_ai_b_post_1s;
 
        //race encoder
+       [Widget] Gtk.Image image_button_contacts_run_encoder_capture_save_image_chart;
+       [Widget] Gtk.Image image_button_contacts_run_encoder_capture_save_image_disk;
        [Widget] Gtk.Image image_run_encoder_exercise_edit;
        [Widget] Gtk.Image image_run_encoder_exercise_add;
        [Widget] Gtk.Image image_run_encoder_exercise_delete;
@@ -857,6 +859,7 @@ public partial class ChronoJumpWindow
                image_runs_evolution_save.Pixbuf = pixbuf;
                image_jumps_rj_fatigue_save.Pixbuf = pixbuf;
                image_sprint_analyze_save.Pixbuf = pixbuf;
+               image_button_contacts_run_encoder_capture_save_image_chart.Pixbuf = pixbuf;
                image_encoder_analyze_image_compujump_send_email_image.Pixbuf = pixbuf;
                image_run_encoder_analyze_image_save_graph.Pixbuf = pixbuf;
 
@@ -884,6 +887,7 @@ public partial class ChronoJumpWindow
                image_forcesensor_analyze_image_save7.Pixbuf = pixbuf;
                image_runs_evolution_analyze_image_save.Pixbuf = pixbuf;
                image_force_sensor_analyze_table_save_1.Pixbuf = pixbuf;
+               image_button_contacts_run_encoder_capture_save_image_disk.Pixbuf = pixbuf;
                image_run_encoder_analyze_table_save_1.Pixbuf = pixbuf;
                image_sprint_analyze_image_save.Pixbuf = pixbuf;
                image_run_encoder_analyze_image_save_disk.Pixbuf = pixbuf;
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 702fc1717..136eed942 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -61,6 +61,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.DrawingArea drawingarea_race_analyzer_capture_position_time;
        [Widget] Gtk.DrawingArea drawingarea_race_analyzer_capture_speed_time;
        [Widget] Gtk.DrawingArea drawingarea_race_analyzer_capture_accel_time;
+       [Widget] Gtk.VBox vbox_race_analyzer_capture_graphs;
 
        [Widget] Gtk.Frame frame_run_encoder_exercise;
        [Widget] Gtk.Entry entry_run_encoder_exercise_name;
@@ -2284,4 +2285,29 @@ public partial class ChronoJumpWindow
                cairoGraphRaceAnalyzer_at.DoSendingList (preferences.fontType.ToString(),
                                cairoGraphRaceAnalyzerPoints_at_l, forceRedraw, CairoXY.PlotTypes.LINES);
        }
+
+       private void on_button_race_analyzer_capture_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.RUNENCODER_CAPTURE_SAVE_IMAGE);
+       }
+       private void on_button_run_encoder_capture_image_save_selected (string destination)
+       {
+               try {
+                       Gdk.Pixbuf pixbuf = UtilGtk.PixbufFromVBox(vbox_race_analyzer_capture_graphs);
+                       LogB.Information("Saving");
+                       pixbuf.Save(destination,"png");
+               } catch {
+                       string myString = string.Format(
+                                       Catalog.GetString("Cannot save file {0} "), destination);
+                       new DialogMessage(Constants.MessageTypes.WARNING, myString);
+               }
+       }
+       private void on_overwrite_file_runencoder_capture_image_save_accepted(object o, EventArgs args)
+       {
+               on_button_run_encoder_capture_image_save_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
 }
diff --git a/src/gui/app1/runEncoderAnalyze.cs b/src/gui/app1/runEncoderAnalyze.cs
index 217df2c72..979f8c9d2 100644
--- a/src/gui/app1/runEncoderAnalyze.cs
+++ b/src/gui/app1/runEncoderAnalyze.cs
@@ -212,7 +212,7 @@ public partial class ChronoJumpWindow
                checkFile(Constants.CheckFileOp.RUNENCODER_ANALYZE_SAVE_IMAGE);
        }
 
-       private void on_button_run_encoder_image_save_selected (string destination)
+       private void on_button_run_encoder_analyze_image_save_selected (string destination)
        {
                try {
                        File.Copy(UtilEncoder.GetSprintEncoderImage(), destination, true);
@@ -223,9 +223,9 @@ public partial class ChronoJumpWindow
                }
        }
 
-       private void on_overwrite_file_runencoder_image_save_accepted(object o, EventArgs args)
+       private void on_overwrite_file_runencoder_analyze_image_save_accepted(object o, EventArgs args)
        {
-               on_button_run_encoder_image_save_selected (exportFileName);
+               on_button_run_encoder_analyze_image_save_selected (exportFileName);
 
                string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
                new DialogMessage(Constants.MessageTypes.INFO, myString);


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