[chronojump] Implemented button_hscale_force_sensor_ai_a_pre/post_1s



commit 2fdadce523c7976256e1c287c27688ef4ab31064
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Nov 20 15:08:05 2020 +0100

    Implemented button_hscale_force_sensor_ai_a_pre/post_1s

 glade/app1.glade                   | 40 +++++++++++++++++++-------------------
 src/gui/app1/forceSensorAnalyze.cs | 34 +++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 21 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index df300534..7301b372 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -20790,12 +20790,6 @@ Concentric</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -20922,9 +20916,9 @@ Concentric</property>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_hscale_force_sensor_ai_a_pre_1s">
                                                             <property name="visible">True</property>
-                                                            <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_hscale_force_sensor_ai_a_pre_1s_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkLabel" id="label185">
                                                             <property name="visible">True</property>
@@ -20995,9 +20989,9 @@ Concentric</property>
                                                             <child>
                                                             <widget class="GtkButton" 
id="button_hscale_force_sensor_ai_a_post_1s">
                                                             <property name="visible">True</property>
-                                                            <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_hscale_force_sensor_ai_a_post_1s_clicked" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkLabel" id="label261">
                                                             <property name="visible">True</property>
@@ -23281,6 +23275,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28024,6 +28021,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>
@@ -28060,18 +28069,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>
@@ -36202,6 +36199,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 efbdd45e..23097cc9 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -1637,6 +1637,39 @@ public partial class ChronoJumpWindow
                hscale_force_sensor_ai_b.Value = fsAI.GetLength() -2;
        }
 
+       private void on_button_hscale_force_sensor_ai_a_pre_1s_clicked (object o, EventArgs args)
+       {
+               if(fsAI == null || fsAI.GetLength() == 0)
+                       return;
+
+               int startA = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+               double startAMs = fsAI.GetTimeMS(startA);
+               for(int i = startA; i > 0; i --)
+               {
+                       if(startAMs - fsAI.GetTimeMS(i) >= 1000)
+                       {
+                               hscale_force_sensor_ai_a.Value += i - startA;
+                               return;
+                       }
+               }
+       }
+       private void on_button_hscale_force_sensor_ai_a_post_1s_clicked (object o, EventArgs args)
+       {
+               if(fsAI == null || fsAI.GetLength() == 0)
+                       return;
+
+               int startA = Convert.ToInt32(hscale_force_sensor_ai_a.Value);
+               double startAMs = fsAI.GetTimeMS(startA);
+               for(int i = startA; i < fsAI.GetLength() -1; i ++)
+               {
+                       if(fsAI.GetTimeMS(i) - startAMs >= 1000)
+                       {
+                               hscale_force_sensor_ai_a.Value += i - startA;
+                               return;
+                       }
+               }
+       }
+
        private void on_button_hscale_force_sensor_ai_b_pre_1s_clicked (object o, EventArgs args)
        {
                if(fsAI == null || fsAI.GetLength() == 0)
@@ -1653,7 +1686,6 @@ public partial class ChronoJumpWindow
                        }
                }
        }
-
        private void on_button_hscale_force_sensor_ai_b_post_1s_clicked (object o, EventArgs args)
        {
                if(fsAI == null || fsAI.GetLength() == 0)


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