[chronojump] Force sensor analyze manual AB can move both hscales together
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor analyze manual AB can move both hscales together
- Date: Fri, 15 Jun 2018 10:19:23 +0000 (UTC)
commit 3b176b9cb03ffd9d66b2df2a69a9630f49148fab
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jun 15 12:16:37 2018 +0200
Force sensor analyze manual AB can move both hscales together
glade/app1.glade | 312 ++++++++++++++++++++++++------------------
src/gui/forceSensorAnalyze.cs | 28 ++++
2 files changed, 210 insertions(+), 130 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ccfde745..8ae554c8 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1756,6 +1756,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -18404,24 +18407,18 @@ Concentric</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">6</property>
- <property name="n_columns">4</property>
+ <property name="n_columns">6</property>
<property name="column_spacing">8</property>
<property name="row_spacing">4</property>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel"
id="label_force_sensor_ai_force_a">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"/>
@@ -18434,8 +18431,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
@@ -18448,8 +18445,8 @@ Concentric</property>
<property name="can_focus">False</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"/>
@@ -18462,8 +18459,8 @@ Concentric</property>
<property name="can_focus">False</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
@@ -18476,30 +18473,6 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
- <widget class="GtkLabel" id="label359">
- <property name="width_request">30</property>
- <property name="visible">True</property>
- <property name="can_focus">False</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="label360">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">A</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<widget class="GtkHScale"
id="hscale_force_sensor_ai_a">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -18511,7 +18484,7 @@ Concentric</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -18565,11 +18538,13 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
<packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"/>
@@ -18581,35 +18556,6 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
<child>
- <widget class="GtkCheckButton"
id="checkbutton_force_sensor_ai_b">
- <property name="width_request">30</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property
name="receives_default">False</property>
- <property name="xalign">1</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled"
handler="on_checkbutton_force_sensor_ai_b_toggled" swapped="no"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label361">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label">B</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<widget class="GtkHScale"
id="hscale_force_sensor_ai_b">
<property name="can_focus">True</property>
<property name="adjustment">1 1 300 1 10
0</property>
@@ -18620,7 +18566,7 @@ Concentric</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -18673,11 +18619,13 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
<packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"/>
@@ -18689,8 +18637,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"/>
@@ -18703,8 +18651,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options"/>
@@ -18717,8 +18665,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"/>
@@ -18726,25 +18674,14 @@ Concentric</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_force_sensor_ai_diff">
- <property name="can_focus">False</property>
- <property name="xalign">1</property>
- <property name="label"
translatable="yes">Difference</property>
- </widget>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
<widget class="GtkLabel"
id="label_force_sensor_ai_average">
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label"
translatable="yes">Average</property>
</widget>
<packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
@@ -18758,6 +18695,8 @@ Concentric</property>
<property name="label"
translatable="yes">Maximum</property>
</widget>
<packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
@@ -18770,8 +18709,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"/>
@@ -19571,35 +19510,14 @@ Concentric</property>
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel"
id="label_force_sensor_ai_rfd_a">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"/>
@@ -19612,8 +19530,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options"/>
@@ -19625,8 +19543,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"/>
@@ -19639,8 +19557,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"/>
@@ -19653,8 +19571,8 @@ Concentric</property>
<property name="width_chars">8</property>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options"/>
@@ -19692,8 +19610,8 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="x_options"/>
<property name="y_options"/>
</packing>
@@ -19738,8 +19656,8 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="x_options"/>
</packing>
</child>
@@ -19774,8 +19692,139 @@ Concentric</property>
</child>
</widget>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox297">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkHScale"
id="hscale_force_sensor_ai_ab">
+ <property name="can_focus">True</property>
+ <property name="adjustment">1 1 300 1 10
0</property>
+ <property name="digits">0</property>
+ <property name="draw_value">False</property>
+ <signal name="value_changed"
handler="on_hscale_force_sensor_ai_ab_value_changed" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_force_sensor_ai_diff">
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label"
translatable="yes">Difference</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </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>
+ <widget class="GtkCheckButton"
id="checkbutton_force_sensor_ai_b">
+ <property name="width_request">30</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="xalign">1</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_checkbutton_force_sensor_ai_b_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label360">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">A</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label361">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">B</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label380">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">A+B</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options"/>
</packing>
</child>
@@ -27989,6 +28038,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 11eea99f..d44b0dd4 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -469,6 +469,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.DrawingArea force_sensor_ai_drawingarea;
[Widget] Gtk.HScale hscale_force_sensor_ai_a;
[Widget] Gtk.HScale hscale_force_sensor_ai_b;
+ [Widget] Gtk.HScale hscale_force_sensor_ai_ab;
[Widget] Gtk.CheckButton checkbutton_force_sensor_ai_b;
[Widget] Gtk.Label label_force_sensor_ai_time_a;
[Widget] Gtk.Label label_force_sensor_ai_force_a;
@@ -535,6 +536,7 @@ public partial class ChronoJumpWindow
//ranges should have max value the number of the lines of csv file minus the header
hscale_force_sensor_ai_a.SetRange(1, fsAI.GetLength() -2);
hscale_force_sensor_ai_b.SetRange(1, fsAI.GetLength() -2);
+ hscale_force_sensor_ai_ab.SetRange(1, fsAI.GetLength() -2);
//to update values
on_hscale_force_sensor_ai_a_value_changed (new object (), new EventArgs ());
@@ -884,6 +886,7 @@ public partial class ChronoJumpWindow
}
bool forceSensorAIChanged = false;
+ bool updateForceSensorHScales = true;
private void on_hscale_force_sensor_ai_a_value_changed (object o, EventArgs args)
{
if(fsAI == null || fsAI.GetLength() == 0)
@@ -899,7 +902,12 @@ public partial class ChronoJumpWindow
label_force_sensor_ai_rfd_a.Text = "";
if(checkbutton_force_sensor_ai_b.Active)
+ {
force_sensor_analyze_instant_calculate_params();
+ updateForceSensorHScales = false;
+ hscale_force_sensor_ai_ab.Value = Convert.ToInt32(hscale_force_sensor_ai_a.Value +
hscale_force_sensor_ai_b.Value) / 2;
+ updateForceSensorHScales = true;
+ }
forceSensorAIChanged = true;
force_sensor_ai_drawingarea.QueueDraw(); //will fire ExposeEvent
@@ -919,10 +927,29 @@ public partial class ChronoJumpWindow
label_force_sensor_ai_rfd_b.Text = "";
force_sensor_analyze_instant_calculate_params();
+ updateForceSensorHScales = false;
+ hscale_force_sensor_ai_ab.Value = Convert.ToInt32(hscale_force_sensor_ai_a.Value +
hscale_force_sensor_ai_b.Value) / 2;
+ updateForceSensorHScales = true;
forceSensorAIChanged = true;
force_sensor_ai_drawingarea.QueueDraw(); //will fire ExposeEvent
}
+ int force_sensor_last_ab = 0;
+ private void on_hscale_force_sensor_ai_ab_value_changed (object o, EventArgs args)
+ {
+ if(fsAI == null || fsAI.GetLength() == 0)
+ return;
+
+ //avoid circular calls
+ if(updateForceSensorHScales)
+ {
+ int difference = Convert.ToInt32(hscale_force_sensor_ai_ab.Value) -
force_sensor_last_ab;
+ hscale_force_sensor_ai_a.Value += difference;
+ hscale_force_sensor_ai_b.Value += difference;
+ }
+
+ force_sensor_last_ab = Convert.ToInt32(hscale_force_sensor_ai_ab.Value);
+ }
private void on_button_hscale_force_sensor_ai_a_pre_clicked (object o, EventArgs args)
{
@@ -945,6 +972,7 @@ public partial class ChronoJumpWindow
bool visible = checkbutton_force_sensor_ai_b.Active;
hscale_force_sensor_ai_b.Visible = visible;
hbox_buttons_scale_force_sensor_ai_b.Visible = visible;
+ hscale_force_sensor_ai_ab.Visible = visible;
label_force_sensor_ai_diff.Visible = visible;
label_force_sensor_ai_average.Visible = visible;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]