[chronojump] Encoder capture realtime pointsplot done



commit bc09f8506107f06c827b2e7c533f305224099502
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 20 20:24:02 2013 +0100

    Encoder capture realtime pointsplot done

 glade/chronojump.glade |  108 ++++++++++++++++++++++++++++++-----------------
 src/gui/encoder.cs     |   31 +++++++++++---
 2 files changed, 93 insertions(+), 46 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 74a5f00..2e03cac 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12865,16 +12865,50 @@ on current Chronojump version.</property>
                                                 <property name="spacing">4</property>
                                                 <property name="homogeneous">True</property>
                                                 <child>
-                                                  <widget class="GtkNotebook" id="notebook3">
+                                                  <widget class="GtkHBox" id="hbox74">
                                                     <property name="visible">True</property>
-                                                    <property name="can_focus">True</property>
+                                                    <property name="can_focus">False</property>
                                                     <child>
-                                                      <widget class="GtkFrame" id="frame7">
+                                                      <widget class="GtkVBox" id="vbox7">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <child>
+                                                          <widget class="GtkSpinButton" 
id="spin_encoder_capture_height">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <property name="tooltip" translatable="yes">On 
capture: displayed positive and negative height in meters</property>
+                                                            <property name="invisible_char">●</property>
+                                                            <property name="width_chars">3</property>
+                                                            <property 
name="invisible_char_set">True</property>
+                                                            <property 
name="primary_icon_activatable">False</property>
+                                                            <property 
name="secondary_icon_activatable">False</property>
+                                                            <property 
name="primary_icon_sensitive">True</property>
+                                                            <property 
name="secondary_icon_sensitive">True</property>
+                                                            <property name="adjustment">1 0.5 3 0.5 1 
0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="digits">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</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="GtkNotebook" 
id="notebook_encoder_capture">
                                                         <property name="visible">True</property>
-                                                        <property name="sensitive">False</property>
                                                         <property name="can_focus">False</property>
-                                                        <property name="label_xalign">0</property>
-                                                        <property name="shadow_type">out</property>
+                                                        <property name="show_tabs">False</property>
                                                         <child>
                                                           <widget class="GtkDrawingArea" 
id="encoder_capture_drawingarea">
                                                             <property name="visible">True</property>
@@ -12885,56 +12919,52 @@ on current Chronojump version.</property>
                                                           </widget>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkLabel" 
id="label_encoder_capture_title">
+                                                          <widget class="GtkLabel" 
id="label_encoder_capture">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">capture</property>
                                                           </widget>
                                                           <packing>
-                                                            <property name="type">label_item</property>
+                                                            <property name="tab_fill">False</property>
+                                                            <property name="type">tab</property>
                                                           </packing>
                                                         </child>
-                                                      </widget>
-                                                    </child>
-                                                    <child>
-                                                      <widget class="GtkLabel" id="label114">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="label" translatable="yes">page 
1</property>
-                                                      </widget>
-                                                      <packing>
-                                                        <property name="tab_fill">False</property>
-                                                        <property name="type">tab</property>
-                                                      </packing>
-                                                    </child>
-                                                    <child>
-                                                      <widget class="GtkViewport" 
id="viewport_image_encoder_capture">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="resize_mode">queue</property>
                                                         <child>
-                                                          <widget class="GtkImage" 
id="image_encoder_capture">
+                                                          <widget class="GtkViewport" 
id="viewport_image_encoder_capture">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="resize_mode">queue</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_capture">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            </child>
                                                           </widget>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkLabel" id="label115">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">curves</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                            <property name="tab_fill">False</property>
+                                                            <property name="type">tab</property>
+                                                          </packing>
                                                         </child>
                                                       </widget>
                                                       <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">True</property>
                                                         <property name="position">1</property>
                                                       </packing>
                                                     </child>
-                                                    <child>
-                                                      <widget class="GtkLabel" id="label115">
-                                                        <property name="visible">True</property>
-                                                        <property name="can_focus">False</property>
-                                                        <property name="label" translatable="yes">page 
2</property>
-                                                      </widget>
-                                                      <packing>
-                                                        <property name="position">1</property>
-                                                        <property name="tab_fill">False</property>
-                                                        <property name="type">tab</property>
-                                                      </packing>
-                                                    </child>
                                                   </widget>
                                                   <packing>
                                                     <property name="expand">True</property>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 16364a8..4d4a1da 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -46,6 +46,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Viewport viewport_image_encoder_capture;
        [Widget] Gtk.Image image_encoder_bell;
        [Widget] Gtk.SpinButton spin_encoder_capture_time;
+       [Widget] Gtk.SpinButton spin_encoder_capture_height;
        [Widget] Gtk.SpinButton spin_encoder_capture_min_height;
        [Widget] Gtk.Image image_encoder_capture;
        [Widget] Gtk.TreeView treeview_encoder_curves;
@@ -59,6 +60,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_encoder_update_signal;
        [Widget] Gtk.Button button_encoder_delete_signal;
        
+       [Widget] Gtk.Notebook notebook_encoder_capture;
        [Widget] Gtk.DrawingArea encoder_capture_drawingarea;
        
        [Widget] Gtk.Box hbox_combo_encoder_exercise;
@@ -232,6 +234,9 @@ public partial class ChronoJumpWindow
                        calculeCurves();
                }
                else if (o == (object) button_encoder_capture_csharp) {
+                       if(notebook_encoder_capture.CurrentPage == 1)
+                               notebook_encoder_capture.PrevPage();
+
                        Log.WriteLine("AAAAAAAAAAAAAAA");
                        encoderThreadStart(encoderModes.CAPTURE);
 
@@ -255,7 +260,7 @@ public partial class ChronoJumpWindow
                                "  Disavantages: Open new window is slow and there are problems on some 
computers\n\n" +
                                "- <b>Safe</b>: Capture happens in this window\n" +
                                "  Advantages: Fast and without problems\n" + 
-                               "  Disavantages: Currently It doesn't plot graphs or calculates power at 
realtime\n\n" +
+                               "  Disavantages: Currently at realtime only plots a simple graph\n\n" +
                                "Conclusion: In next versions 'Safe' mode will be the only one\n" +
                                "Now it lacks features like realtime statistics and graphs\n" +
                                "<b>After</b> capturing, both methods show the same results" +
@@ -266,7 +271,7 @@ public partial class ChronoJumpWindow
                                "  Desventajas: Abrir una nueva ventana es lento y da problemas en algunos 
equipos\n\n" +
                                "- <b>Safe (seguro)</b>: Se captura en esta ventana\n" +
                                "  Ventajas: Rápido y no da problemas\n" + 
-                               "  Desventajas: Actualmente no calcula estadíticos ni pinta gráficos en 
tiempo real\n\n" +
+                               "  Desventajas: Actualmente en tiempo real sólo muestra un gráfico 
sencillo\n\n" +
                                "Conclusión: En las siguientes versiones el modo 'Seguro' será el único\n" +
                                "En este momento carece de las ventajas del modo externo\n" +
                                "<b>Después</b> de la captura, ambos métodos muestran los mismos resultados"
@@ -890,7 +895,8 @@ public partial class ChronoJumpWindow
        {
                int width=encoder_capture_drawingarea.Allocation.Width;
                int height=encoder_capture_drawingarea.Allocation.Height;
-               int yrange = height;
+               //int yrange = height;
+               double realHeight = 1000 * 2 * spin_encoder_capture_height.Value;
                
                Log.WriteLine("00a");
                SerialPort sp = new SerialPort(port);
@@ -911,8 +917,8 @@ public partial class ChronoJumpWindow
                
                int i =-20; //delete first records because there's encoder bug
                int msCount = 0;
-               int maxy = 1;
-               int miny = 1;
+               //int maxy = 1;
+               //int miny = 1;
                encoderCapturePoints = new Gdk.Point[recordingTime];
                do {
                        b = sp.ReadByte();
@@ -935,7 +941,8 @@ public partial class ChronoJumpWindow
 
                                encoderCapturePoints[i] = new Gdk.Point(
                                                Convert.ToInt32(width*i/recordingTime),
-                                               Convert.ToInt32( (height/2) - ( sum * height / 2000) ) //2m 
detection
+                                               //Convert.ToInt32( (height/2) - ( sum * height / 2000) ) //2m 
detection
+                                               Convert.ToInt32( (height/2) - ( sum * height / realHeight) )
                                                );
 
                                dataString += sep + b.ToString();
@@ -1902,7 +1909,7 @@ public partial class ChronoJumpWindow
        private void encoderButtonsSensitive(encoderSensEnum option) {
                //columns
                //c0 button_encoder_capture, button_encoder_capture_csharp, 
-               //      button_encoder_bells, spin_encoder_capture_time
+               //      button_encoder_bells, spin_encoder_capture_time, spin_encoder_capture_height
                //c1 button_encoder_recalculate
                //c2 button_encoder_load_signal
                //c3 button_encoder_save_all_curves, button_encoder_export_all_curves,
@@ -1966,6 +1973,7 @@ public partial class ChronoJumpWindow
                button_encoder_capture_csharp.Sensitive = Util.IntToBool(table[0]);
                button_encoder_bells.Sensitive = Util.IntToBool(table[0]);
                spin_encoder_capture_time.Sensitive = Util.IntToBool(table[0]);
+               spin_encoder_capture_height.Sensitive = Util.IntToBool(table[0]);
 
                button_encoder_recalculate.Sensitive = Util.IntToBool(table[1]);
                button_encoder_load_signal.Sensitive = Util.IntToBool(table[2]);
@@ -2255,7 +2263,16 @@ Log.WriteLine("RRR4");
                                //encoderButtonsSensitive(encoderSensEnum.DONEYESSIGNAL);
                                encoderButtonsSensitive(encoderSensEnumStored);
                                encoder_pulsebar_capture.Text = Catalog.GetString("Cancelled");
+                               if(notebook_encoder_capture.CurrentPage == 0 )
+                                       notebook_encoder_capture.NextPage();
                        }
+
+                       if(
+                               ( mode == encoderModes.CALCULECURVES || 
+                                 mode == encoderModes.RECALCULATE_OR_LOAD ) &&
+                               notebook_encoder_capture.CurrentPage == 0 )
+                                       notebook_encoder_capture.NextPage();
+
                        if(mode == encoderModes.CAPTURE && encoderProcessFinish) {
                                //encoderButtonsSensitive(encoderSensEnum.DONEYESSIGNAL);
                                encoderButtonsSensitive(encoderSensEnumStored);


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