[chronojump/FS-TFT-Menu] Fixes on Race analyzer capture tab graphs with smoothing slider



commit ec729fa0dc974b71d60219afd82b238723b274bf
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 6 17:13:38 2022 +0200

    Fixes on Race analyzer capture tab graphs with smoothing slider

 glade/app1.glade           | 52 ++++++++++++++++++++++++++++++++--------------
 src/gui/app1/runEncoder.cs | 45 ++++++++++++++++++++++++++++++++-------
 2 files changed, 73 insertions(+), 24 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index a7388652a..eeef133b9 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -7933,11 +7933,25 @@ device</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkCheckButton" 
id="check_race_analyzer_capture_smooth_graphs">
+                                                            <property name="label" 
translatable="yes">Smooth</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_race_analyzer_capture_smooth_graphs_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHScale" 
id="hscale_race_analyzer_capture_smooth_graphs">
                                                             <property name="width_request">100</property>
-                                                            <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
-                                                            <property name="adjustment">0 0 7 1 1 
0</property>
+                                                            <property name="adjustment">1 1 7 1 1 
0</property>
                                                             <property name="round_digits">0</property>
                                                             <property name="digits">0</property>
                                                             <property name="draw_value">False</property>
@@ -7946,7 +7960,7 @@ device</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -7957,7 +7971,7 @@ device</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">1</property>
+                                                            <property name="position">2</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -26412,6 +26426,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -32820,18 +32837,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>
@@ -32868,6 +32873,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>
@@ -42175,6 +42192,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 35bc5ef9c..b452453fe 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -62,6 +62,7 @@ public partial class ChronoJumpWindow
        [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.CheckButton check_race_analyzer_capture_smooth_graphs;
        [Widget] Gtk.HScale hscale_race_analyzer_capture_smooth_graphs;
        [Widget] Gtk.Label label_race_analyzer_capture_smooth_graphs;
 
@@ -168,7 +169,10 @@ public partial class ChronoJumpWindow
                followSignals = true;
 
                manageRunEncoderCaptureViews();
-               label_race_analyzer_capture_smooth_graphs.Text = Catalog.GetString ("No smooth");
+
+               check_race_analyzer_capture_smooth_graphs.Active = false;
+               hscale_race_analyzer_capture_smooth_graphs.Visible = false;
+               label_race_analyzer_capture_smooth_graphs.Text = "";
 
                createRunEncoderExerciseCombo();
                createRunEncoderAnalyzeCombos();
@@ -2264,7 +2268,7 @@ public partial class ChronoJumpWindow
                cairoGraphRaceAnalyzer_dt.DoSendingList (preferences.fontType.ToString(),
                                cairoGraphRaceAnalyzerPoints_dt_l, triggerListRunEncoder,
                                forceRedraw, CairoXY.PlotTypes.LINES,
-                               getSmoothFrom_hscale_race_analyzer_capture_smooth_graphs ());
+                               getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ());
        }
        private void updateRaceAnalyzerCaptureSpeedTime(bool forceRedraw)
        {
@@ -2287,7 +2291,7 @@ public partial class ChronoJumpWindow
                cairoGraphRaceAnalyzer_st.DoSendingList (preferences.fontType.ToString(),
                                cairoGraphRaceAnalyzerPoints_st_l, triggerListRunEncoder,
                                forceRedraw, CairoXY.PlotTypes.LINES,
-                               getSmoothFrom_hscale_race_analyzer_capture_smooth_graphs ());
+                               getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ());
        }
        private void updateRaceAnalyzerCaptureAccelTime(bool forceRedraw)
        {
@@ -2313,12 +2317,36 @@ public partial class ChronoJumpWindow
                cairoGraphRaceAnalyzer_at.DoSendingList (preferences.fontType.ToString(),
                                cairoGraphRaceAnalyzerPoints_at_l, triggerListRunEncoder,
                                forceRedraw, CairoXY.PlotTypes.LINES,
-                               getSmoothFrom_hscale_race_analyzer_capture_smooth_graphs ());
+                               getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ());
+       }
+
+       private void on_check_race_analyzer_capture_smooth_graphs_clicked (object o, EventArgs args)
+       {
+               if(check_race_analyzer_capture_smooth_graphs.Active)
+               {
+                       hscale_race_analyzer_capture_smooth_graphs.Visible = true;
+                       label_race_analyzer_capture_smooth_graphs.Visible = true;
+
+                       int smooth = getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ();
+                       if(smooth == 0)
+                               label_race_analyzer_capture_smooth_graphs.Text = "";
+                       else
+                               label_race_analyzer_capture_smooth_graphs.Text = smooth.ToString();
+               } else {
+                       hscale_race_analyzer_capture_smooth_graphs.Visible = false;
+                       label_race_analyzer_capture_smooth_graphs.Visible = false;
+               }
+
+               updateRaceAnalyzerCapturePositionTime(true);
+               updateRaceAnalyzerCaptureSpeedTime(true);
+               updateRaceAnalyzerCaptureAccelTime(true);
        }
 
-       private int getSmoothFrom_hscale_race_analyzer_capture_smooth_graphs ()
+       private int getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ()
        {
-               if(hscale_race_analyzer_capture_smooth_graphs.Value == 0)
+               LogB.Information("hscale value: " + 
hscale_race_analyzer_capture_smooth_graphs.Value.ToString());
+
+               if(! check_race_analyzer_capture_smooth_graphs.Active)
                        return 0;
 
                //if 1,2,3,4,5,6,7  return 3,5,7,9,11,13,15
@@ -2326,9 +2354,10 @@ public partial class ChronoJumpWindow
        }
        private void on_hscale_race_analyzer_capture_smooth_graphs_value_changed (object o, EventArgs args)
        {
-               int smooth = getSmoothFrom_hscale_race_analyzer_capture_smooth_graphs ();
+               int smooth = getSmoothFrom_gui_at_race_analyzer_capture_smooth_graphs ();
+               LogB.Information("smooth: " + smooth.ToString());
                if(smooth == 0)
-                       label_race_analyzer_capture_smooth_graphs.Text = Catalog.GetString ("No smooth");
+                       label_race_analyzer_capture_smooth_graphs.Text = "";
                else
                        label_race_analyzer_capture_smooth_graphs.Text = smooth.ToString();
 


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