[chronojump] All GTK stuff related to runsEvolution



commit c7db41fe9bc396b754684e6371c0ae72ab44cd89
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 21 07:50:28 2021 +0200

    All GTK stuff related to runsEvolution

 glade/app1.glade                   | 239 +++++++++++++++++++++++++++++++++++--
 po/POTFILES.in                     |   2 +-
 src/Makefile.am                    |   2 +-
 src/gui/app1/chronojump.cs         |  45 ++++++-
 src/gui/app1/icons.cs              |   3 +
 src/gui/app1/jumpsRunsEvolution.cs | 145 +++++++++++++++++++++-
 src/gui/chronojumpImporter.cs      |   3 +-
 7 files changed, 426 insertions(+), 13 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ea232cfd..8ab7b0ff 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -17194,6 +17194,53 @@ Resisted race analyzer</property>
                                                         <property name="position">1</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkRadioButton" 
id="radio_mode_contacts_runs_evolution">
+                                                        <property name="can_focus">True</property>
+                                                        <property name="receives_default">False</property>
+                                                        <property name="relief">half</property>
+                                                        <property name="draw_indicator">False</property>
+                                                        <property 
name="group">radio_mode_contacts_advanced</property>
+                                                        <signal name="toggled" 
handler="on_radio_mode_contacts_runs_evolution_toggled" swapped="no"/>
+                                                        <child>
+                                                          <widget class="GtkHBox" id="hbox242">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_tab_runs_evolution">
+                                                            <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="GtkLabel" 
id="label_mode_contacts_runs_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">Races / time</property>
+                                                            <property name="justify">center</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="position">2</property>
+                                                      </packing>
+                                                    </child>
                                                     <child>
                                                       <widget class="GtkRadioButton" 
id="radio_mode_contacts_sprint">
                                                         <property name="can_focus">True</property>
@@ -17238,7 +17285,7 @@ Resisted race analyzer</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>
@@ -17286,7 +17333,7 @@ Resisted race analyzer</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>
@@ -21343,6 +21390,182 @@ Concentric</property>
                                                         <property name="type">tab</property>
                                                       </packing>
                                                     </child>
+                                                    <child>
+                                                      <widget class="GtkAlignment" id="alignment76">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="top_padding">6</property>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox_runs_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox505">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">20</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox514">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">12</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label636">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Run 
type</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" 
id="hbox_combo_select_runs_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </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">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkCheckButton" 
id="check_runs_evolution_only_best_in_session">
+                                                            <property name="label" translatable="yes">Only 
the best run on each session</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="draw_indicator">True</property>
+                                                            <signal name="clicked" 
handler="on_check_runs_evolution_only_best_in_session_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox515">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkDrawingArea" 
id="drawingarea_runs_evolution">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <signal name="expose_event" 
handler="on_drawingarea_runs_evolution_expose_event" swapped="no"/>
+                                                            <signal name="button_press_event" 
handler="on_drawingarea_runs_evolution_button_press_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="vbox257">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_runs_evolution_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_runs_evolution_save_image_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox258">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_runs_evolution_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_runs_evolution_analyze_image_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">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>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">6</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label635">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label">runs evolution</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">6</property>
+                                                        <property name="tab_fill">False</property>
+                                                        <property name="type">tab</property>
+                                                      </packing>
+                                                    </child>
                                                     <child>
                                                       <widget class="GtkAlignment" id="alignment_sprint">
                                                         <property name="visible">True</property>
@@ -22176,7 +22399,7 @@ Concentric</property>
                                                         </child>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">6</property>
+                                                        <property name="position">7</property>
                                                       </packing>
                                                     </child>
                                                     <child>
@@ -22186,7 +22409,7 @@ Concentric</property>
                                                         <property name="label">Sprint</property>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">6</property>
+                                                        <property name="position">7</property>
                                                         <property name="tab_fill">False</property>
                                                         <property name="type">tab</property>
                                                       </packing>
@@ -27926,7 +28149,7 @@ Concentric</property>
                                                         </child>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">7</property>
+                                                        <property name="position">8</property>
                                                       </packing>
                                                     </child>
                                                     <child>
@@ -27936,7 +28159,7 @@ Concentric</property>
                                                         <property name="label">force sensor</property>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">7</property>
+                                                        <property name="position">8</property>
                                                         <property name="tab_fill">False</property>
                                                         <property name="type">tab</property>
                                                       </packing>
@@ -29322,7 +29545,7 @@ Concentric</property>
                                                         </child>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">8</property>
+                                                        <property name="position">9</property>
                                                       </packing>
                                                     </child>
                                                     <child>
@@ -29332,7 +29555,7 @@ Concentric</property>
                                                         <property name="label">raceencoder</property>
                                                       </widget>
                                                       <packing>
-                                                        <property name="position">8</property>
+                                                        <property name="position">9</property>
                                                         <property name="tab_fill">False</property>
                                                         <property name="type">tab</property>
                                                       </packing>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 79d4537f..fbb8104f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -66,7 +66,7 @@ src/gui/app1/forceSensorAnalyze.cs
 src/gui/app1/forceSensor.cs
 src/gui/app1/jump.cs
 src/gui/app1/jumpsDjOptimalFall.cs
-src/gui/app1/jumpsEvolution.cs
+src/gui/app1/jumpsRunsEvolution.cs
 src/gui/app1/jumpsProfile.cs
 src/gui/app1/jumpsRjFatigue.cs
 src/gui/app1/jumpsWeightFVProfile.cs
diff --git a/src/Makefile.am b/src/Makefile.am
index 48edf509..dc0c5a49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,7 +12,7 @@ SOURCES = \
        gui/app1/icons.cs\
        gui/app1/jumpsProfile.cs\
        gui/app1/jumpsDjOptimalFall.cs\
-       gui/app1/jumpsEvolution.cs\
+       gui/app1/jumpsRunsEvolution.cs\
        gui/app1/jumpsRjFatigue.cs\
        gui/app1/jumpsWeightFVProfile.cs\
        gui/app1/contactsExercise.cs\
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 9d84c139..32c21094 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -129,6 +129,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_weight_fv_profile;
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_evolution;
        [Widget] Gtk.RadioButton radio_mode_contacts_jumps_rj_fatigue;
+       [Widget] Gtk.RadioButton radio_mode_contacts_runs_evolution;
        [Widget] Gtk.RadioButton radio_mode_contacts_sprint;
        [Widget] Gtk.RadioButton radio_mode_contacts_advanced;
 
@@ -490,7 +491,8 @@ public partial class ChronoJumpWindow
        private string progName;
        private enum notebook_start_pages { PROGRAM, SENDLOG, EXITCONFIRM }
        private enum notebook_sup_pages { START, CONTACTS, ENCODER, SESSION, NETWORKSPROBLEMS, HELP, NEWS }
-       private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, 
JUMPSWEIGHTFVPROFILE, JUMPSEVOLUTION, JUMPSRJFATIGUE, SPRINT, FORCESENSOR, RACEENCODER }
+       private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, 
JUMPSWEIGHTFVPROFILE, JUMPSEVOLUTION, JUMPSRJFATIGUE,
+               RUNSEVOLUTION, SPRINT, FORCESENSOR, RACEENCODER }
 
        private string runningFileName; //useful for knowing if there are two chronojump instances
 
@@ -649,6 +651,7 @@ public partial class ChronoJumpWindow
                createComboSelectJumpsRjFatigueNum(true);
                combo_jumps_rj_fatigue_divide_in.Active = 0;
                createComboSelectRuns(true);
+               createComboSelectRunsEvolution(true);
                createComboSelectRunsInterval(true);
                
                createComboResultJumps();
@@ -999,6 +1002,9 @@ public partial class ChronoJumpWindow
                        radio_jumps_weight_fv_profile_zoom_to_points.Active = true;
                check_jumps_evolution_only_best_in_session.Active = 
preferences.jumpsEvolutionOnlyBestInSession;
 
+               //---- runs ----
+               check_runs_evolution_only_best_in_session.Active = preferences.runsEvolutionOnlyBestInSession;
+
                //---- video ----
 
                UtilGtk.ColorsCheckOnlyPrelight(checkbutton_video_contacts);
@@ -1297,7 +1303,12 @@ public partial class ChronoJumpWindow
                                createComboSelectJumpsRjFatigueNum (false);
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSSIMPLE)
+               {
                        updateGraphRunsSimple();
+
+                       if(notebook_analyze.CurrentPage == 
Convert.ToInt32(notebook_analyze_pages.RUNSEVOLUTION))
+                               runsEvolutionDo(true); //calculate data
+               }
                else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
                {
                        updateGraphRunsInterval();
@@ -3130,6 +3141,7 @@ public partial class ChronoJumpWindow
                radio_mode_contacts_jumps_profile.Active = true;
                hbox_radio_mode_contacts_analyze_buttons.Visible = false;
                radio_mode_contacts_jumps_rj_fatigue.Visible = false;
+               radio_mode_contacts_runs_evolution.Visible = false;
                radio_mode_contacts_sprint.Visible = false;
                notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.STATISTICS);
                button_inspect_last_test_run_intervallic.Visible = false;
@@ -3598,6 +3610,7 @@ public partial class ChronoJumpWindow
                        hbox_radio_mode_contacts_analyze_buttons.Visible = true;
                        hbox_radio_mode_contacts_analyze_jump_simple_buttons.Visible = true;
                        radio_mode_contacts_jumps_rj_fatigue.Visible = false;
+                       radio_mode_contacts_runs_evolution.Visible = false;
                        radio_mode_contacts_sprint.Visible = false;
                }
                else if(m == Constants.Menuitem_modes.JUMPSREACTIVE)
@@ -3605,15 +3618,27 @@ public partial class ChronoJumpWindow
                        hbox_radio_mode_contacts_analyze_buttons.Visible = true;
                        hbox_radio_mode_contacts_analyze_jump_simple_buttons.Visible = false;
                        radio_mode_contacts_jumps_rj_fatigue.Visible = true;
+                       radio_mode_contacts_runs_evolution.Visible = false;
                        radio_mode_contacts_sprint.Visible = false;
 
                        radio_mode_contacts_jumps_rj_fatigue.Active = true;
                }
+               else if(m == Constants.Menuitem_modes.RUNSSIMPLE)
+               {
+                       hbox_radio_mode_contacts_analyze_buttons.Visible = true;
+                       hbox_radio_mode_contacts_analyze_jump_simple_buttons.Visible = false;
+                       radio_mode_contacts_jumps_rj_fatigue.Visible = false;
+                       radio_mode_contacts_runs_evolution.Visible = true;
+                       radio_mode_contacts_sprint.Visible = false;
+
+                       radio_mode_contacts_runs_evolution.Active = true;
+               }
                else if(m == Constants.Menuitem_modes.RUNSINTERVALLIC)
                {
                        hbox_radio_mode_contacts_analyze_buttons.Visible = true;
                        hbox_radio_mode_contacts_analyze_jump_simple_buttons.Visible = false;
                        radio_mode_contacts_jumps_rj_fatigue.Visible = false;
+                       radio_mode_contacts_runs_evolution.Visible = false;
                        radio_mode_contacts_sprint.Visible = true;
 
                        radio_mode_contacts_sprint.Active = true;
@@ -6567,6 +6592,7 @@ LogB.Debug("mc finished 5");
                LogB.Information("ACCEPTED Add new run type");
                if(runTypeAddWin.InsertedSimple) {
                        createComboSelectRuns(false);
+                       createComboSelectRunsEvolution(false);
 
                        UtilGtk.ComboUpdate(combo_result_runs, 
                                        SqliteRunType.SelectRunTypes(Constants.AllRunsNameStr(), true), ""); 
//without filter, only select name
@@ -7388,6 +7414,7 @@ LogB.Debug("mc finished 5");
 
                if(current_menuitem_mode == Constants.Menuitem_modes.JUMPSSIMPLE ||
                                current_menuitem_mode == Constants.Menuitem_modes.JUMPSREACTIVE ||
+                               current_menuitem_mode == Constants.Menuitem_modes.RUNSSIMPLE ||
                                current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
                {
                        radio_mode_contacts_analyze_buttons_visible (current_menuitem_mode);
@@ -7433,6 +7460,14 @@ LogB.Debug("mc finished 5");
                                                combo_select_jumps_rj_fatigue_num.Active = 
comboSelectJumpsRjFatigueNum.Count -1;
                                }
                        }
+                       else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSSIMPLE)
+                       {
+                               if(radio_mode_contacts_runs_evolution.Active)
+                               {
+                                       notebook_analyze.CurrentPage = 
Convert.ToInt32(notebook_analyze_pages.RUNSEVOLUTION);
+                                       runsEvolutionDo(true);
+                               }
+                       }
                }
                else if(current_menuitem_mode == Constants.Menuitem_modes.FORCESENSOR)
                        notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.FORCESENSOR);
@@ -7489,6 +7524,14 @@ LogB.Debug("mc finished 5");
                        createComboSelectJumpsRjFatigue (false);
                }
        }
+       private void on_radio_mode_contacts_runs_evolution_toggled (object o, EventArgs args)
+       {
+               if(radio_mode_contacts_runs_evolution.Active)
+               {
+                       notebook_analyze.CurrentPage = Convert.ToInt32(notebook_analyze_pages.RUNSEVOLUTION);
+                       runsEvolutionDo(true);
+               }
+       }
        private void on_radio_mode_contacts_sprint_toggled (object o, EventArgs args)
        {
                if(radio_mode_contacts_sprint.Active)
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 2c36e9ae..3b113dbd 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -812,6 +812,7 @@ public partial class ChronoJumpWindow
                image_jumps_dj_optimal_fall_save.Pixbuf = pixbuf;
                image_jumps_weight_fv_profile_save.Pixbuf = pixbuf;
                image_jumps_evolution_save.Pixbuf = pixbuf;
+               image_runs_evolution_save.Pixbuf = pixbuf;
                image_jumps_rj_fatigue_save.Pixbuf = pixbuf;
                image_sprint_analyze_save.Pixbuf = pixbuf;
                image_encoder_analyze_image_compujump_send_email_image.Pixbuf = pixbuf;
@@ -836,6 +837,7 @@ public partial class ChronoJumpWindow
                image_forcesensor_analyze_image_save5.Pixbuf = pixbuf;
                image_forcesensor_analyze_image_save6.Pixbuf = pixbuf;
                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_run_encoder_analyze_table_save_1.Pixbuf = pixbuf;
                image_sprint_analyze_image_save.Pixbuf = pixbuf;
@@ -884,6 +886,7 @@ public partial class ChronoJumpWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeIndividualAllSessionsIcon);
                image_encoder_analyze_individual_all_sessions.Pixbuf = pixbuf;
                image_tab_jumps_evolution.Pixbuf = pixbuf;
+               image_tab_runs_evolution.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
Constants.FileNameEncoderAnalyzeGroupalCurrentSessionIcon);
                image_sprint_analyze_groupal_current_session.Pixbuf = pixbuf;
diff --git a/src/gui/app1/jumpsRunsEvolution.cs b/src/gui/app1/jumpsRunsEvolution.cs
index fa2d66e0..80ecfcf4 100644
--- a/src/gui/app1/jumpsRunsEvolution.cs
+++ b/src/gui/app1/jumpsRunsEvolution.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com>
  */
 
 
@@ -26,6 +26,10 @@ using Mono.Unix;
 
 public partial class ChronoJumpWindow 
 {
+       /*
+          ---- jumpsEvolution ----
+          */
+
        [Widget] Gtk.DrawingArea drawingarea_jumps_evolution;
        [Widget] Gtk.Image image_tab_jumps_evolution;
        [Widget] Gtk.Image image_jumps_evolution_save;
@@ -160,4 +164,143 @@ public partial class ChronoJumpWindow
                new DialogMessage(Constants.MessageTypes.INFO, myString);
        }
 
+
+       /*
+          ---- runsEvolution ----
+          */
+
+       [Widget] Gtk.DrawingArea drawingarea_runs_evolution;
+       [Widget] Gtk.Image image_tab_runs_evolution;
+       [Widget] Gtk.Image image_runs_evolution_save;
+       [Widget] Gtk.Image image_runs_evolution_analyze_image_save;
+       [Widget] Gtk.HBox hbox_combo_select_runs_evolution;
+       [Widget] Gtk.ComboBox combo_select_runs_evolution;
+       [Widget] Gtk.Button button_runs_evolution_save_image;
+       [Widget] Gtk.CheckButton check_runs_evolution_only_best_in_session;
+
+       RunsEvolution runsEvolution;
+       RunsEvolutionGraph runsEvolutionGraph;
+       CjComboSelectRuns comboSelectRunsEvolution;
+
+       // combo (start)
+       private void createComboSelectRunsEvolution(bool create)
+       {
+               if(create)
+               {
+                       comboSelectRunsEvolution = new CjComboSelectRuns(combo_select_runs_evolution, 
hbox_combo_select_runs_evolution);
+                       combo_select_runs_evolution = comboSelectRunsEvolution.Combo;
+                       combo_select_runs_evolution.Changed += new EventHandler 
(on_combo_select_runs_evolution_changed);
+               } else {
+                       comboSelectRunsEvolution.Fill();
+                       combo_select_runs_evolution = comboSelectRunsEvolution.Combo;
+               }
+               combo_select_runs_evolution.Sensitive = true;
+       }
+       private void on_combo_select_runs_evolution_changed(object o, EventArgs args)
+       {
+               ComboBox combo = o as ComboBox;
+               if (o == null)
+                       return;
+
+               runsEvolutionDo(true);
+       }
+       // combo (end)
+
+       private void on_check_runs_evolution_only_best_in_session_clicked (object o, EventArgs args)
+       {
+               runsEvolutionDo(true);
+
+               SqlitePreferences.Update(SqlitePreferences.RunsEvolutionOnlyBestInSession,
+                               check_runs_evolution_only_best_in_session.Active, false);
+       }
+
+       private void runsEvolutionDo (bool calculateData)
+       {
+               if(currentPerson == null || currentSession == null ||
+                               drawingarea_runs_evolution == null || drawingarea_runs_evolution.GdkWindow == 
null) //it happens at start on click on analyze
+               {
+                       button_runs_evolution_save_image.Sensitive = false;
+                       return;
+               }
+
+               if(runsEvolution == null) {
+                       runsEvolution = new RunsEvolution();
+                       calculateData = true;
+               }
+
+               string runType = comboSelectRunsEvolution.GetSelectedNameEnglish();
+
+               if(calculateData)
+                       runsEvolution.Calculate(currentPerson.UniqueID, runType, 
check_runs_evolution_only_best_in_session.Active);
+
+               if(runsEvolution.Point_l.Count == 0)
+               {
+                       //constructor for showing blank screen with a message
+                       new RunsEvolutionGraph(drawingarea_runs_evolution, runType, 
preferences.fontType.ToString());
+                                       //currentPerson.Name, runType, currentSession.DateShort);
+
+                       button_runs_evolution_save_image.Sensitive = false;
+               } else {
+                       //regular constructor
+                       runsEvolutionGraph = new RunsEvolutionGraph(
+                                       runsEvolution.Point_l,
+                                       runsEvolution.Slope,
+                                       runsEvolution.Intercept,
+                                       drawingarea_runs_evolution,
+                                       currentPerson.Name, runType, currentSession.DateShort);
+                       runsEvolutionGraph.Do(preferences.fontType.ToString());
+
+                       button_runs_evolution_save_image.Sensitive = true;
+               }
+       }
+       private void on_drawingarea_runs_evolution_expose_event (object o, ExposeEventArgs args)
+       {
+               //needed to have mouse clicks at: on_drawingarea_runs_evolution_button_press_event ()
+//             drawingarea_runs_evolution.AddEvents((int) (Gdk.EventMask.ButtonPressMask | 
Gdk.EventMask.ButtonReleaseMask));
+               drawingarea_runs_evolution.AddEvents((int) Gdk.EventMask.ButtonPressMask);
+
+               runsEvolutionDo(false); //do not calculate data
+               //data is calculated on switch page (at notebook_capture_analyze) or on change person
+       }
+
+       private void on_drawingarea_runs_evolution_button_press_event (object o, ButtonPressEventArgs args)
+       {
+               //if there is no data and nothing to show, nothing to press, and also this is null
+               if(runsEvolutionGraph == null)
+                       return;
+
+               LogB.Information("Button press done!");
+
+               //redo the graph to delete previous rectangles of previous mouse clicks
+               runsEvolutionGraph.Do(preferences.fontType.ToString());
+               LogB.Information(string.Format("Mouse X: {0}; Mouse Y: {1}", args.Event.X, args.Event.Y));
+               runsEvolutionGraph.CalculateAndWriteRealXY(args.Event.X, args.Event.Y);
+       }
+
+       private void on_button_runs_evolution_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.RUNS_EVOLUTION_SAVE_IMAGE);
+       }
+
+       private void on_button_runs_evolution_save_image_selected (string destination)
+       {
+               if(drawingarea_runs_evolution == null)
+                       return;
+
+               Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(drawingarea_runs_evolution.GdkWindow, 
Gdk.Colormap.System,
+                               0, 0, 0, 0,
+                               UtilGtk.WidgetWidth(drawingarea_runs_evolution),
+                               UtilGtk.WidgetHeight(drawingarea_runs_evolution) );
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_runs_evolution_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_runs_evolution_save_image_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
 }
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 3bf5af55..acb797ab 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -15,7 +15,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2019-2020   Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2019-2021   Xavier de Blas <xaviblas gmail com>
  */
 
 using Gtk;
@@ -187,6 +187,7 @@ public partial class ChronoJumpWindow
 
                        //3) simple run
                        createComboSelectRuns(false);
+                       createComboSelectRunsEvolution(false);
                        UtilGtk.ComboUpdate(combo_result_runs,
                                        SqliteRunType.SelectRunTypes(Constants.AllRunsNameStr(), true), ""); 
//without filter, only select name
                        combo_select_runs.Active = 0;


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