[chronojump] Force sensor zoom out can be done with 'Escape'



commit 55dd78a25c433daa9da461c563ea6f7b83f74542
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 12 13:54:01 2020 +0100

    Force sensor zoom out can be done with 'Escape'

 glade/app1.glade                   | 45 +++++++++++++++++++++++++---------
 src/gui/app1/forceSensorAnalyze.cs | 50 +++++++++++++++++++++-----------------
 2 files changed, 61 insertions(+), 34 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ec84407d..d6d2bad6 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -22287,6 +22287,21 @@ Concentric</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_force_sensor_ai_zoom_out">
+                                                            <property name="label">Zoom out</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_force_sensor_ai_zoom_out_clicked" swapped="no"/>
+                                                            <accelerator key="Escape" signal="clicked"/>
+                                                           <accelerator key="Escape" signal="clicked"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">3</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">True</property>
@@ -23261,6 +23276,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -25532,6 +25550,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>
@@ -25568,18 +25598,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>
@@ -32929,6 +32947,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/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index 21bd4943..e81c6bf9 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -42,6 +42,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ScrolledWindow scrolledwindow_force_sensor_ai;
        [Widget] Gtk.Button button_force_sensor_analyze_AB_save;
        [Widget] Gtk.Button button_force_sensor_ai_zoom;
+       [Widget] Gtk.Button button_force_sensor_ai_zoom_out;
 
        [Widget] Gtk.SpinButton spin_force_duration_seconds;
        [Widget] Gtk.RadioButton radio_force_duration_seconds;
@@ -889,7 +890,7 @@ public partial class ChronoJumpWindow
                //if zoomed: unzoom and return
                if(forceSensorZoomApplied)
                {
-                       button_force_sensor_ai_zoom.Click();
+                       button_force_sensor_ai_zoom_out.Click();
                        return;
                }
 
@@ -943,39 +944,44 @@ public partial class ChronoJumpWindow
        private void forceSensorZoomDefaultValues()
        {
                forceSensorZoomApplied = false;
-               button_force_sensor_ai_zoom.Label = "Zoom [A-B]";
+               button_force_sensor_ai_zoom.Visible = true;
+               button_force_sensor_ai_zoom_out.Visible = false;
        }
+
        private int hscale_force_sensor_ai_a_BeforeZoom = 0;
        private int hscale_force_sensor_ai_a_AtZoom = 0;
        private int hscale_force_sensor_ai_b_BeforeZoom = 0;
        private int hscale_force_sensor_ai_b_AtZoom = 0;
+
        private void on_button_force_sensor_ai_zoom_clicked (object o, EventArgs args)
        {
-               forceSensorZoomApplied = ! forceSensorZoomApplied;
-
-               if(forceSensorZoomApplied)
-                       button_force_sensor_ai_zoom.Label = "Zoom out";
-               else
-                       button_force_sensor_ai_zoom.Label = "Zoom [A-B]";
+               forceSensorZoomApplied = true;
 
                //store hscale a to help return to position on unzoom
-               if(forceSensorZoomApplied) {
-                       hscale_force_sensor_ai_a_BeforeZoom = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
-                       hscale_force_sensor_ai_b_BeforeZoom = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+               hscale_force_sensor_ai_a_BeforeZoom = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+               hscale_force_sensor_ai_b_BeforeZoom = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
 
-                       forceSensorRepetition_lZoomApplied = fsAI.ForceSensorRepetition_l;
-               } else {
-                       hscale_force_sensor_ai_a_AtZoom = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
-                       hscale_force_sensor_ai_b_AtZoom = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
-               }
+               forceSensorRepetition_lZoomApplied = fsAI.ForceSensorRepetition_l;
 
                forceSensorDoGraphAI();
 
-               if(! forceSensorZoomApplied)
-               {
-                       hscale_force_sensor_ai_a.Value = hscale_force_sensor_ai_a_BeforeZoom + 
(hscale_force_sensor_ai_a_AtZoom -1);
-                       hscale_force_sensor_ai_b.Value = hscale_force_sensor_ai_a_BeforeZoom + 
(hscale_force_sensor_ai_b_AtZoom -1);
-               }
+               button_force_sensor_ai_zoom.Visible = false;
+               button_force_sensor_ai_zoom_out.Visible = true;
+       }
+       private void on_button_force_sensor_ai_zoom_out_clicked (object o, EventArgs args)
+       {
+               forceSensorZoomApplied = false;
+
+               hscale_force_sensor_ai_a_AtZoom = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+               hscale_force_sensor_ai_b_AtZoom = Convert.ToInt32(hscale_force_sensor_ai_b.Value);
+
+               forceSensorDoGraphAI();
+
+               hscale_force_sensor_ai_a.Value = hscale_force_sensor_ai_a_BeforeZoom + 
(hscale_force_sensor_ai_a_AtZoom -1);
+               hscale_force_sensor_ai_b.Value = hscale_force_sensor_ai_a_BeforeZoom + 
(hscale_force_sensor_ai_b_AtZoom -1);
+
+               button_force_sensor_ai_zoom.Visible = true;
+               button_force_sensor_ai_zoom_out.Visible = false;
        }
 
        private void forceSensorAnalyzeManualGraphDo(Rectangle allocation)
@@ -1329,7 +1335,7 @@ public partial class ChronoJumpWindow
                button_hscale_force_sensor_ai_b_last.Sensitive = hscale_force_sensor_ai_b.Value < 
fsAI.GetLength() -2;
                button_hscale_force_sensor_ai_b_post.Sensitive = hscale_force_sensor_ai_b.Value < 
fsAI.GetLength() -2;
 
-               button_force_sensor_ai_zoom.Sensitive = forceSensorZoomApplied || 
hscale_force_sensor_ai_a.Value != hscale_force_sensor_ai_b.Value;
+               button_force_sensor_ai_zoom.Sensitive = hscale_force_sensor_ai_a.Value != 
hscale_force_sensor_ai_b.Value;
        }
 
        private void on_button_hscale_force_sensor_ai_a_first_clicked (object o, EventArgs args)


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