[chronojump] ForceSensor export can also export images, and other little improvements



commit 3d489e264f799ad97dd982a54451281219113b80
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Feb 22 16:51:16 2021 +0100

    ForceSensor export can also export images, and other little improvements

 glade/app1.glade                   | 48 +++++++++++++++++-------
 r-scripts/maximumIsometricForce.R  | 11 +++++-
 src/constants.cs                   |  3 +-
 src/forceSensor.cs                 | 64 +++++++++++++++++++++++++++----
 src/gui/app1/encoder.cs            | 77 ++++++++++++++++++++++++++------------
 src/gui/app1/forceSensorAnalyze.cs | 28 +++++++++++---
 6 files changed, 178 insertions(+), 53 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index bfc85d3b..b4fa93d4 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -24065,6 +24065,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24520,6 +24523,20 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkCheckButton" 
id="check_force_sensor_export_images">
+                                                            <property name="label" 
translatable="yes">Include images</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" id="hbox454">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -24681,7 +24698,7 @@ Concentric</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">2</property>
+                                                            <property name="position">3</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -24693,7 +24710,7 @@ Concentric</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">3</property>
+                                                            <property name="position">4</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -29228,6 +29245,18 @@ 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>
@@ -29264,18 +29293,6 @@ 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>
@@ -37594,6 +37611,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index 8342cad8..b89fbed3 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -59,7 +59,8 @@ assignOptions <- function(options)
         startEndOptimized      = options[28],  #bool
        singleOrMultiple        = options[29],          #bool (true is single)
        decimalCharAtExport     = options[30],
-        maxAvgWindowSeconds    = as.numeric(options[31])
+        maxAvgWindowSeconds    = as.numeric(options[31]),
+       includeImagesOnExport   = options[32]           #bool (true is single)
     ))
 }
 
@@ -1184,7 +1185,10 @@ start <- function(op)
                        exportNames = c(exportNames, paste("Impulse", impulseOptions$impulseFunction, 
impulseOptions$type,
                                        impulseOptions$start, impulseOptions$end, sep ="_"))
 
-               exportNames = c(exportNames, "comments (set)");
+               exportNames = c(exportNames, "Comments (set)")
+
+               if(op$includeImagesOnExport)
+                       exportNames = c(exportNames, "Image")
 
                #2) read the csv
                dataFiles = read.csv(file = paste(tempPath, "/maximumIsometricForceInputMulti.csv", sep=""), 
sep=";", stringsAsFactors=F)
@@ -1232,7 +1236,10 @@ start <- function(op)
                        exportSetDF = cbind (exportSetDF, dataFiles$maxAvgForceInWindow[i])
                        for(j in 1:length(exportModelVector))
                                exportSetDF = cbind (exportSetDF, exportModelVector[j])
+
                        exportSetDF = cbind (exportSetDF, dataFiles$comments[i])
+                       if(op$includeImagesOnExport)
+                               exportSetDF = cbind(exportSetDF, paste(i, ".png", sep=""))
 
                        colnames(exportSetDF) = exportNames
 
diff --git a/src/constants.cs b/src/constants.cs
index af33fe96..bc74822e 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1112,7 +1112,8 @@ public class Constants
                ENCODER_ANALYZE_SAVE_AB, ENCODER_ANALYZE_SAVE_TABLE,
                FORCESENSOR_SAVE_IMAGE_SIGNAL, FORCESENSOR_SAVE_IMAGE_RFD_AUTO,
                FORCESENSOR_SAVE_IMAGE_RFD_MANUAL, FORCESENSOR_ANALYZE_SAVE_AB,
-               FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION, FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION,
+               FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES, 
FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES,
+               FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES, 
FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES,
                RUNENCODER_SAVE_IMAGE, RUNENCODER_SAVE_TABLE
        }
 
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 8a226006..651f3a65 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1671,6 +1671,7 @@ public class ForceSensorGraph
        private bool decimalIsPointAtReadFile; //but on export this will be related to each set
        private char exportDecimalSeparator;
        private double forceSensorAnalyzeMaxAVGInWindowSeconds; //on export
+       private bool includeImagesOnExport;
 
        //private method to help on assigning params
        private void assignGenericParams(
@@ -1696,6 +1697,7 @@ public class ForceSensorGraph
                vline50fmax_fitted = false;
                hline50fmax_raw = false;
                hline50fmax_fitted = false;
+               includeImagesOnExport = false;
        }
 
        //constructor for analyze one graph of a set from startSample to endSample. singleOrMultiple = true
@@ -1730,13 +1732,15 @@ public class ForceSensorGraph
                        bool decimalIsPointAtReadFile, //this param is used here to print results. but to 
read data what id is used is in fsgAB_l
                        char exportDecimalSeparator,
                        List<ForceSensorGraphABExport> fsgABe_l,
-                       double forceSensorAnalyzeMaxAVGInWindowSeconds
+                       double forceSensorAnalyzeMaxAVGInWindowSeconds,
+                       bool includeImagesOnExport
                        )
        {
                assignGenericParams(rfdList, impulse, testLength, percentChange, startEndOptimized,
                                decimalIsPointAtReadFile, exportDecimalSeparator);
                        
                this.forceSensorAnalyzeMaxAVGInWindowSeconds = forceSensorAnalyzeMaxAVGInWindowSeconds;
+               this.includeImagesOnExport = includeImagesOnExport;
 
                writeMultipleFilesCSV(fsgABe_l);
        }
@@ -1829,7 +1833,8 @@ public class ForceSensorGraph
                        "#startEndOptimized\n" +        Util.BoolToRBool(startEndOptimized) + "\n" +
                        "#singleOrMultiple\n" +         Util.BoolToRBool(singleOrMultiple) + "\n" +
                        "#decimalCharAtExport\n" +      exportDecimalSeparator + "\n" +
-                       "#maxAvgInWindowSeconds\n" +    forceSensorAnalyzeMaxAVGInWindowSecondsStr + "\n";
+                       "#maxAvgInWindowSeconds\n" +    forceSensorAnalyzeMaxAVGInWindowSecondsStr + "\n" +
+                       "#includeImagesOnExport\n" +    Util.BoolToRBool(includeImagesOnExport) + "\n";
 
                /*
                #startEndOptimized on gui can be:
@@ -2560,7 +2565,8 @@ public class ForceSensorExport
        private Gtk.Notebook notebook;
        private Gtk.ProgressBar progressbar;
        private Gtk.Label labelResult;
-       private string exportFilename;
+       private bool includeImages;
+       private string exportURL; //folder or .csv depending on includeImages
        private bool isWindows;
        private int personID; // -1: all
        private int sessionID;
@@ -2579,6 +2585,7 @@ public class ForceSensorExport
        private static Thread thread;
        private static bool cancel;
        private static bool noData;
+       private static bool cannotCopy;
        private static string messageToProgressbar;
        //private static double pulseFraction; unused because its managed on pulse, better because on thread 
is working 100% on R call
 
@@ -2594,6 +2601,7 @@ public class ForceSensorExport
                        Gtk.Notebook notebook,
                        Gtk.ProgressBar progressbar,
                        Gtk.Label labelResult,
+                       bool includeImages,
                        bool isWindows, int personID, int sessionID,
                        List<ForceSensorRFD> rfdList, ForceSensorImpulse impulse,
                        double duration, int durationPercent,
@@ -2609,6 +2617,7 @@ public class ForceSensorExport
                this.notebook = notebook;
                this.progressbar = progressbar;
                this.labelResult = labelResult;
+               this.includeImages = includeImages;
                this.isWindows = isWindows;
                this.personID = personID;
                this.sessionID = sessionID;
@@ -2628,12 +2637,13 @@ public class ForceSensorExport
        }
 
        ///public method
-       public void Start(string exportFilename)
+       public void Start(string exportURL)
        {
-               this.exportFilename = exportFilename;
+               this.exportURL = exportURL;
 
                cancel = false;
                noData = false;
+               cannotCopy = false;
                progressbar.Fraction = 0;
                messageToProgressbar = "";
                notebook.CurrentPage = 1;
@@ -2681,8 +2691,10 @@ public class ForceSensorExport
                                labelResult.Text = Catalog.GetString("Cancelled.");
                        else if (noData)
                                labelResult.Text = Catalog.GetString("Missing data.");
+                       else if (cannotCopy)
+                               labelResult.Text = string.Format(Catalog.GetString("Cannot copy to {0} "), 
exportURL);
                        else
-                               labelResult.Text = string.Format(Catalog.GetString("Exported to {0}"), 
exportFilename);// +
+                               labelResult.Text = string.Format(Catalog.GetString("Exported to {0}"), 
exportURL);// +
                                                //Constants.GetSpreadsheetString(CSVExportDecimalSeparator)
                                                //);
 
@@ -2982,7 +2994,8 @@ public class ForceSensorExport
                                        true, //not used to read data, but used to print data
                                        CSVExportDecimalSeparatorChar, // at write file
                                        fsgABe_l,
-                                       forceSensorAnalyzeMaxAVGInWindowSeconds
+                                       forceSensorAnalyzeMaxAVGInWindowSeconds,
+                                       includeImages
                                        );
 
                        bool success = fsg.CallR(imageWidth -5, imageHeight -5, false);
@@ -2995,7 +3008,42 @@ public class ForceSensorExport
                if(cancel)
                        return false;
 
-               File.Copy(UtilEncoder.GetmifExportFileName(), exportFilename, true);
+               if(includeImages)
+               {
+                       LogB.Information("going to copy export files with images ...");
+                       if( ! Directory.Exists(exportURL))
+                                Directory.CreateDirectory (exportURL);
+
+                       try{
+                               // 1) rfd graphs
+                               string sourceFolder = Path.Combine(Path.GetTempPath(), 
"chronojump_mif_graphs_rfd");
+                               DirectoryInfo sourceDirInfo = new DirectoryInfo(sourceFolder);
+
+                               string destFolder = Path.Combine(exportURL, "chronojump_mif_graphs_rfd");
+                               Directory.CreateDirectory (destFolder);
+
+                               foreach (FileInfo file in sourceDirInfo.GetFiles())
+                                       file.CopyTo(destFolder, true);
+
+                               // 2) AB graphs
+                               sourceFolder = Path.Combine(Path.GetTempPath(), "chronojump_mif_graphs_ab");
+                               sourceDirInfo = new DirectoryInfo(sourceFolder);
+
+                               destFolder = Path.Combine(exportURL, "chronojump_mif_graphs_ab");
+                               Directory.CreateDirectory (destFolder);
+
+                               foreach (FileInfo file in sourceDirInfo.GetFiles())
+                                       file.CopyTo(destFolder, true);
+                       } catch {
+                               return false;
+                       }
+
+                       // 3) CSV
+                       File.Copy(UtilEncoder.GetmifExportFileName(), exportURL, true);
+
+                       LogB.Information("done copy export files with images!");
+               } else
+                       File.Copy(UtilEncoder.GetmifExportFileName(), exportURL, true);
 
                /*
                ForceSensorGraph fsg = new ForceSensorGraph(
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index ab7d557f..e1501334 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2066,7 +2066,7 @@ public partial class ChronoJumpWindow
        }
 
        string exportFileName;  
-       protected void checkFile (Constants.CheckFileOp checkFileOp)
+       protected bool checkFile (Constants.CheckFileOp checkFileOp)
        {
                string exportString = ""; 
                if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
@@ -2084,12 +2084,15 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL ||
                                checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
                        exportString = Catalog.GetString ("Save image");
-               else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
+               else if(
+                               checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES)
                        exportString = Catalog.GetString ("Export repetition in CSV format");
-               else if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB ||
-                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION ||
-                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
-                       exportString = Catalog.GetString ("Export data in CSV format");
+               else if(
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
+                       exportString = Catalog.GetString ("Export data and graphs");
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_TABLE ||
                                checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_TABLE)
                        exportString = Catalog.GetString ("Save table");
@@ -2098,7 +2101,9 @@ public partial class ChronoJumpWindow
 
                string nameString = currentPerson.Name + "_" + currentSession.DateShortAsSQL;
 
-               if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
+               if(
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
                        nameString = currentSession.DateShortAsSQL;
 
                //on encoder analyze save image, show analysis on filename
@@ -2131,7 +2136,7 @@ public partial class ChronoJumpWindow
                if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SEND_IMAGE)
                {
                        exportFileName = nameString;
-                       return;
+                       return true;
                }
 
                if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
@@ -2165,9 +2170,13 @@ public partial class ChronoJumpWindow
                else if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
                        nameString += "_forcesensor_analyze_AB_export.csv";
                else if(
-                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION ||
-                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES)
                        nameString += "_forcesensor_export.csv";
+               else if(
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
+                       nameString += "_forcesensor_export";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_TABLE)
                        nameString += "_encoder_curves_table.csv";
                else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_TABLE)
@@ -2175,10 +2184,16 @@ public partial class ChronoJumpWindow
 
                // 3) prepare and Run the dialog
 
+               FileChooserAction fcAction = FileChooserAction.Save;
+               if(
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
+                       fcAction = FileChooserAction.CreateFolder;
+
                Gtk.FileChooserDialog fc=
                        new Gtk.FileChooserDialog(exportString,
                                        app1,
-                                       FileChooserAction.Save,
+                                       fcAction,
                                        Catalog.GetString("Cancel"),ResponseType.Cancel,
                                        Catalog.GetString("Accept"),ResponseType.Accept
                                        );
@@ -2191,14 +2206,21 @@ public partial class ChronoJumpWindow
                        if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL ||
                                        checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB ||
                                        checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB ||
-                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION ||
-                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION ||
+                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
                                        checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_TABLE ||
                                        checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_TABLE)
                                exportFileName = Util.AddCsvIfNeeded(exportFileName);
-                       else    //ENCODER_ANALYZE_SAVE_IMAGE, FORCESENSOR_SAVE_IMAGE_SIGNAL,
+                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                               checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
+                               LogB.Information("");//do nothing
+                       else {
+                               //ENCODER_ANALYZE_SAVE_IMAGE, FORCESENSOR_SAVE_IMAGE_SIGNAL,
                                //FORCESENSOR_SAVE_IMAGE_RFD_AUTO, FORCESENSOR_SAVE_IMAGE_RFD_MANUAL
+                               //... and sure other modes
                                exportFileName = Util.AddPngIfNeeded(exportFileName);
+                       }
+
                        try {
                                if (File.Exists(exportFileName)) {
                                        LogB.Information(string.Format(
@@ -2256,8 +2278,11 @@ public partial class ChronoJumpWindow
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_forcesensor_save_AB_accepted);
-                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION ||
-                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
+                                       else if(
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_forcesensor_export_accepted);
                                        else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
@@ -2298,8 +2323,11 @@ public partial class ChronoJumpWindow
                                                on_button_forcesensor_save_image_rfd_manual_file_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
                                                on_button_force_sensor_save_AB_file_selected (exportFileName);
-                                       else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION ||
-                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
+                                       else if(
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+                                                       checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
                                                on_button_force_sensor_export_file_selected (exportFileName);
                                        else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
                                                on_button_run_encoder_image_save_selected (exportFileName);
@@ -2307,8 +2335,11 @@ public partial class ChronoJumpWindow
                                                on_button_raceAnalyzer_save_table_file_selected 
(exportFileName);
 
                                        //show message, but not in long processes managed by a thread
-                                       if(checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION &&
-                                                       checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION)
+                                       if(
+                                                       checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES &&
+                                                       checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES &&
+                                                       checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES &&
+                                                       checkFileOp != 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
                                        {
                                                string myString = string.Format(Catalog.GetString("Saved to 
{0}"), 
                                                                exportFileName);
@@ -2330,13 +2361,13 @@ public partial class ChronoJumpWindow
                        //report does not currently send the appBar reference
                        //new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Cancelled."));
                        fc.Hide ();
-                       return ;
+                       return false;
                }
                
                //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
                fc.Destroy();
                
-               return;
+               return true;
        }
        private void on_overwrite_file_export_all_curves_accepted(object o, EventArgs args)
        {
@@ -2385,7 +2416,7 @@ public partial class ChronoJumpWindow
        }
        private void on_overwrite_file_forcesensor_export_accepted(object o, EventArgs args)
        {
-               on_button_force_sensor_export_file_selected (exportFileName);
+               on_button_force_sensor_export_file_selected (exportFileName); //file or folder
 
                /*
                string myString = string.Format(Catalog.GetString("Saved to {0}"),
diff --git a/src/gui/app1/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index c06572ec..02a545de 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -156,6 +156,7 @@ public partial class ChronoJumpWindow
 
        [Widget] Gtk.Notebook notebook_force_sensor_export;
        [Widget] Gtk.Label label_force_sensor_export_data;
+       [Widget] Gtk.CheckButton check_force_sensor_export_images;
        [Widget] Gtk.ProgressBar progressbar_force_sensor_export;
        [Widget] Gtk.Label label_force_sensor_export_result;
 
@@ -755,6 +756,7 @@ public partial class ChronoJumpWindow
                                notebook_force_sensor_export,
                                progressbar_force_sensor_export,
                                label_force_sensor_export_result,
+                               check_force_sensor_export_images.Active,
                                UtilAll.IsWindows(), personID, currentSession.UniqueID,
                                rfdList, impulse,//getImpulseValue(),
                                duration, Convert.ToInt32(spin_force_rfd_duration_percent.Value),
@@ -770,14 +772,30 @@ public partial class ChronoJumpWindow
                forceSensorExport.Button_done.Clicked -= new EventHandler(force_sensor_export_done);
                forceSensorExport.Button_done.Clicked += new EventHandler(force_sensor_export_done);
 
-               if(personID == -1)
-                       checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION);
-               else
-                       checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION);
+               bool selectedFile = false;
+               if(check_force_sensor_export_images.Active)
+               {
+                       if(personID == -1)
+                               selectedFile = 
checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES);
+                       else
+                               selectedFile = 
checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES);
+               } else {
+                       if(personID == -1)
+                               selectedFile = 
checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES);
+                       else
+                               selectedFile = 
checkFile(Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES);
+               }
+
+               //restore the gui if cancelled
+               if(! selectedFile) {
+                       forceSensorButtonsSensitive(true);
+                       hbox_force_sensor_analyze_top_modes.Sensitive = true;
+                       button_force_sensor_analyze_options.Sensitive = true;
+               }
        }
        private void on_button_force_sensor_export_file_selected (string selectedFileName)
        {
-               forceSensorExport.Start(selectedFileName);
+               forceSensorExport.Start(selectedFileName); //file or folder
        }
 
        private void on_button_force_sensor_export_cancel_clicked (object o, EventArgs args)


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