[chronojump] Encoder automatic mode. First implementation



commit 9a710df24969ae673ed425be0d6c4e880e70fc91
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Jul 9 17:21:01 2016 +0200

    Encoder automatic mode. First implementation

 glade/chronojump.glade |  205 ++++++++++++++++++++++++++++++++++++++++--------
 src/encoderCapture.cs  |    7 +-
 src/gui/encoder.cs     |    7 ++
 3 files changed, 185 insertions(+), 34 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 1e71fd4..5f6b908 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12788,6 +12788,12 @@ low ressistance</property>
                                                 <child>
                                                   <placeholder/>
                                                 </child>
+                                                <child>
+                                                  <placeholder/>
+                                                </child>
+                                                <child>
+                                                  <placeholder/>
+                                                </child>
                                               </widget>
                                               <packing>
                                                 <property name="expand">False</property>
@@ -13288,31 +13294,6 @@ low ressistance</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkCheckButton" 
id="checkbutton_volume_encoder">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">True</property>
-                                                            <property 
name="receives_default">False</property>
-                                                            <property name="has_tooltip">True</property>
-                                                            <property name="tooltip" translatable="yes">Play 
sound (on / off)</property>
-                                                            <property name="draw_indicator">False</property>
-                                                            <signal name="clicked" 
handler="on_checkbutton_volume_encoder_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" 
id="image_volume_encoder">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property 
name="stock">gtk-missing-image</property>
-                                                            <property name="icon-size">2</property>
-                                                            </widget>
-                                                            </child>
-                                                          </widget>
-                                                          <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">3</property>
-                                                          </packing>
-                                                        </child>
-                                                        <child>
                                                           <widget class="GtkHBox" id="hbox_rfid">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">10</property>
@@ -13345,6 +13326,31 @@ low ressistance</property>
                                                           <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">True</property>
+                                                            <property name="position">3</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkCheckButton" 
id="checkbutton_volume_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Play 
sound (on / off)</property>
+                                                            <property name="draw_indicator">False</property>
+                                                            <signal name="clicked" 
handler="on_checkbutton_volume_encoder_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_volume_encoder">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
                                                             <property name="position">4</property>
                                                           </packing>
                                                         </child>
@@ -14043,6 +14049,33 @@ low ressistance</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <child>
+                                                            <widget class="GtkVBox" id="vbox83">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkCheckButton" 
id="checkbutton_encoder_auto">
+                                                            <property name="label">Auto</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property 
name="receives_default">False</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">Play 
sound (on / off)</property>
+                                                            <property name="draw_indicator">False</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</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="hbox168">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -14367,7 +14400,7 @@ low ressistance</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
-                                                            <property name="position">0</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                           </widget>
@@ -17601,6 +17634,12 @@ low ressistance</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22335,6 +22374,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -23550,6 +23595,12 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -25257,6 +25308,12 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -26021,6 +26078,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -39263,6 +39326,42 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -42086,6 +42185,30 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -43293,12 +43416,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -44513,6 +44630,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -48614,6 +48737,12 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -49493,6 +49622,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -50387,6 +50522,12 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index e376e8b..0b8c830 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -40,6 +40,7 @@ public abstract class EncoderCapture
        // ---- protected stuff ----
        protected int widthG;
        protected int heightG;
+       protected bool auto;
        protected string eccon;
 
        protected double realHeightG;
@@ -116,10 +117,12 @@ public abstract class EncoderCapture
                return true;
        }
 
-       public void InitGlobal (int widthG, int heightG, int time, int timeEnd, string eccon, string port)
+       //if auto (automatic mode), then will not end when too much time passed before start
+       public void InitGlobal (int widthG, int heightG, int time, int timeEnd, bool auto, string eccon, 
string port)
        {
                this.widthG = widthG;
                this.heightG = heightG;
+               this.auto = auto;
                this.eccon = eccon;
                
                //---- a) open port -----
@@ -237,7 +240,7 @@ public abstract class EncoderCapture
                                //when a curve has not been found and then there are 2*n seconds of inactivity
                                if(
                                                (Ecca.curvesAccepted > 0 && consecutiveZeros >= 
consecutiveZerosMax) ||
-                                               (Ecca.curvesAccepted == 0 && consecutiveZeros >= (2* 
consecutiveZerosMax)) )
+                                               (! auto && Ecca.curvesAccepted == 0 && consecutiveZeros >= 
(2* consecutiveZerosMax)) )
                                {
                                        finish = true;
                                        LogB.Information("SHOULD FINISH");
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 548988e..010eaf3 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -78,6 +78,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.MenuItem menuitem_export_encoder_signal;
        [Widget] Gtk.Label label_encoder_curve_action;
        [Widget] Gtk.Button button_encoder_delete_signal;
+       [Widget] Gtk.CheckButton checkbutton_encoder_auto;
        
        [Widget] Gtk.VPaned vpaned_encoder_main;
        [Widget] Gtk.VPaned vpaned_encoder_capture_video_and_set_graph;
@@ -2037,6 +2038,7 @@ public partial class ChronoJumpWindow
                                encoder_capture_signal_drawingarea.Allocation.Height,
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_time.Value, 
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_inactivity_end_time.Value,
+                               checkbutton_encoder_auto.Active,
                                findEccon(true),
                                chronopicWin.GetEncoderPort()
                                );
@@ -2070,6 +2072,7 @@ public partial class ChronoJumpWindow
                                encoder_capture_signal_drawingarea.Allocation.Height,
                                encoder_configuration_win.Spin_im_duration,
                                (int) encoderCaptureOptionsWin.spin_encoder_capture_inactivity_end_time.Value,
+                               false,
                                findEccon(true),
                                chronopicWin.GetEncoderPort()
                                );
@@ -5437,6 +5440,10 @@ public partial class ChronoJumpWindow
                        button_encoder_analyze_1RM_save.Visible = false;
                
                        encoderShowCaptureDoingButtons(false);
+               
+                       //redo if auto mode
+                       if(checkbutton_encoder_auto.Active)
+                               on_button_encoder_capture_clicked (new object (), new EventArgs ());
 
                } else { //ANALYZE
                        if(encoderProcessCancel) {


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