[chronojump] Adaptative displayed height on capture
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Adaptative displayed height on capture
- Date: Mon, 25 May 2015 15:21:04 +0000 (UTC)
commit 06b58fa456e1d333d728f5f9c2a4ed06b38d1934
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 25 17:20:44 2015 +0200
Adaptative displayed height on capture
glade/chronojump.glade | 75 +++--------------------------------------------
src/gui/encoder.cs | 26 +++++++++++++++-
2 files changed, 29 insertions(+), 72 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 43c1e72..19cf12f 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -26163,7 +26163,7 @@ comments</property>
<widget class="GtkTable" id="table7">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">6</property>
+ <property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">8</property>
@@ -26345,71 +26345,6 @@ comments</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">4</property>
- <child>
- <widget class="GtkSpinButton" id="spin_encoder_capture_curves_height_range">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip" translatable="yes">Displayed positive and negative
height</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.10000000000000001 10 0.10000000000000001 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>
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">m</property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Displayed height</property>
- </widget>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -26417,8 +26352,8 @@ comments</property>
<property name="label" translatable="yes">Main variable</property>
</widget>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
</packing>
</child>
<child>
@@ -26432,8 +26367,8 @@ comments</property>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index dca2f90..ea1b86e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2039,7 +2039,12 @@ public partial class ChronoJumpWindow
LogB.Debug("runEncoderCaptureCsharp pre start");
int widthG = encoder_capture_signal_drawingarea.Allocation.Width;
int heightG = encoder_capture_signal_drawingarea.Allocation.Height;
- double realHeightG = 1000 * 2 *
encoderCaptureOptionsWin.spin_encoder_capture_curves_height_range.Value;
+
+ double realHeightG;
+ if(encoderConfigurationCurrent.has_inertia)
+ realHeightG = 2 * 5000 ; //5 meters up / 5 meters down
+ else
+ realHeightG = 2 * 1000 ; //1 meter up / 1 meter down
LogB.Debug("runEncoderCaptureCsharp start port:", port);
SerialPort sp = new SerialPort(port);
@@ -2212,6 +2217,24 @@ public partial class ChronoJumpWindow
}
}
+ //adaptative displayed height
+ //if points go outside the graph, duplicate size of graph
+ if(encoderCapturePoints[i].Y > heightG || encoderCapturePoints[i].Y < 0)
+ {
+ realHeightG *= 2;
+
+ double sum2=0;
+ for(int j=0; j <= i; j ++) {
+ sum2 += encoderReaded[j];
+ encoderCapturePoints[j] = new Gdk.Point(
+ Convert.ToInt32(widthG * j / recordingTime),
+ Convert.ToInt32( (heightG/2) - ( sum2 *
heightG / realHeightG) )
+ );
+ }
+ encoderCapturePointsCaptured = i;
+ encoderCapturePointsPainted = -1; //mark meaning screen should be
erased
+ }
+
/*
* calculate params with R (see explanation above)
*/
@@ -5365,7 +5388,6 @@ public class EncoderCaptureOptionsWindow {
[Widget] public Gtk.SpinButton spin_encoder_capture_time;
[Widget] public Gtk.SpinButton spin_encoder_capture_inactivity_end_time;
[Widget] public Gtk.SpinButton spin_encoder_capture_min_height;
- [Widget] public Gtk.SpinButton spin_encoder_capture_curves_height_range;
[Widget] Gtk.Box hbox_combo_main_variable;
[Widget] Gtk.ComboBox combo_main_variable;
[Widget] public Gtk.CheckButton check_show_start_and_duration;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]