[chronojump] Run simple track distance with button and genericWin
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Run simple track distance with button and genericWin
- Date: Wed, 7 Feb 2018 16:20:56 +0000 (UTC)
commit 674e9b4484e20bf9411ea3ef3bcf1b0530a72d0a
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Feb 7 17:19:41 2018 +0100
Run simple track distance with button and genericWin
glade/app1.glade | 88 +++++++++++++-------
glade/generic_window.glade | 1 +
images/md/ic_directions_run_track_blue_24dp_1x.png | Bin 0 -> 358 bytes
.../xcf/ic_directions_run_track_blue_24dp_1x.xcf | Bin 0 -> 5073 bytes
src/Makefile.am | 1 +
src/gui/chronojump.cs | 4 +-
src/gui/chronojumpIcons.cs | 6 ++
src/gui/genericWindow.cs | 3 +
src/gui/run.cs | 60 +++++++++----
9 files changed, 113 insertions(+), 50 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index e786b8f..3102ab4 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1533,6 +1533,15 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <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>
@@ -5582,7 +5591,7 @@ EncoderInertialCapture</property>
<child>
<widget class="GtkHBox" id="hbox_options_top">
<property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">25</property>
<child>
<widget class="GtkButton"
id="button_image_test_zoom">
<property name="visible">True</property>
@@ -6545,55 +6554,53 @@ EncoderInertialCapture</property>
<property name="can_focus">False</property>
<property name="spacing">25</property>
<child>
- <widget class="GtkHBox" id="hbox28">
+ <widget class="GtkButton"
id="button_runs_simple_track_distance">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_runs_simple_track_distance_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox246">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">4</property>
<child>
- <widget class="GtkLabel"
id="extra_window_runs_label_distance">
+ <widget class="GtkImage"
id="image_runs_simple_track_distance">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
+ <property
name="stock">gtk-missing-image</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton"
id="extra_window_runs_spinbutton_distance">
- <property name="can_focus">True</property>
- <property name="invisible_char">●</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">100 0 10000
0.10000000000000001 10 0</property>
- <property name="digits">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
- <property
name="update_policy">if-valid</property>
+ <widget class="GtkLabel"
id="label_runs_simple_track_distance_value">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
- <property name="padding">12</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="extra_window_runs_label_distance_units">
+ <widget class="GtkLabel"
id="label_runs_simple_track_distance_units">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
</widget>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</widget>
+ </child>
+ </widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
@@ -6604,7 +6611,7 @@ EncoderInertialCapture</property>
<widget class="GtkHBox" id="hbox239">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">8</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkCheckButton"
id="check_run_simple_with_reaction_time">
<property name="label"
translatable="yes">Measure reaction time</property>
@@ -6685,7 +6692,7 @@ EncoderInertialCapture</property>
<widget class="GtkHBox" id="hbox104">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkLabel"
id="extra_window_runs_interval_label_distance">
<property name="can_focus">False</property>
@@ -6705,6 +6712,17 @@ EncoderInertialCapture</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
+ <widget class="GtkImage"
id="image_runs_interval_track_distance">
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkSpinButton"
id="extra_window_runs_interval_spinbutton_distance">
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
@@ -6714,6 +6732,7 @@ EncoderInertialCapture</property>
<property
name="primary_icon_sensitive">True</property>
<property
name="secondary_icon_sensitive">True</property>
<property name="adjustment">10 0 1000
0.10000000000000001 10 0</property>
+ <property name="climb_rate">0.5</property>
<property name="digits">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
@@ -6722,7 +6741,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -6734,7 +6753,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -6755,7 +6774,7 @@ EncoderInertialCapture</property>
<widget class="GtkHBox" id="hbox68">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkLabel"
id="extra_window_runs_interval_label_limit">
<property name="can_focus">False</property>
@@ -6823,7 +6842,7 @@ EncoderInertialCapture</property>
<widget class="GtkHBox" id="hbox245">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">8</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkCheckButton"
id="check_run_interval_with_reaction_time">
<property name="label"
translatable="yes">Measure reaction time</property>
@@ -22742,6 +22761,15 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/glade/generic_window.glade b/glade/generic_window.glade
index 2f83e46..2020957 100644
--- a/glade/generic_window.glade
+++ b/glade/generic_window.glade
@@ -445,6 +445,7 @@
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
<property name="adjustment">0 0 2 0 0.10000000000000001 0</property>
+ <property name="climb_rate">0.5</property>
<property name="digits">3</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
diff --git a/images/md/ic_directions_run_track_blue_24dp_1x.png
b/images/md/ic_directions_run_track_blue_24dp_1x.png
new file mode 100644
index 0000000..844727b
Binary files /dev/null and b/images/md/ic_directions_run_track_blue_24dp_1x.png differ
diff --git a/images/xcf/ic_directions_run_track_blue_24dp_1x.xcf
b/images/xcf/ic_directions_run_track_blue_24dp_1x.xcf
new file mode 100644
index 0000000..0b910ed
Binary files /dev/null and b/images/xcf/ic_directions_run_track_blue_24dp_1x.xcf differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 89d9ea8..cfcb36c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -421,6 +421,7 @@ RESOURCES = \
../images/md/ic_directions_run_blue_24dp_2x.png,run.png \
../images/md/ic_directions_run_simple_blue_24dp_1x.png,image_run_simple.png \
../images/md/ic_directions_run_multiple_blue_24dp_1x.png,image_run_multiple.png \
+ ../images/md/ic_directions_run_track_blue_24dp_1x.png,run_track_distance.png \
../images/md/ic_build_blue_24dp_1x.png,image_build.png \
../images/md/ic_edit_blue_24dp_1x.png,image_edit.png \
../images/md/ic_add_blue_24dp_1x.png,image_add.png \
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index cae9808..7137953 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3881,8 +3881,8 @@ public partial class ChronoJumpWindow
else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSSIMPLE)
{
LogB.Debug("radio_menuitem_mode_runs_simple");
- extra_window_runs_distance = (double) extra_window_runs_spinbutton_distance.Value;
-
+ extra_window_runs_distance =
Convert.ToDouble(label_runs_simple_track_distance_value.Text);
+
on_normal_run_activate(canCaptureC);
}
else if(current_menuitem_mode == Constants.Menuitem_modes.RUNSINTERVALLIC)
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 4947b12..c23b396 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -68,6 +68,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_add_test2;
[Widget] Gtk.Image image_add_test3;
[Widget] Gtk.Image image_add_test4;
+ [Widget] Gtk.Image image_runs_simple_track_distance;
+ [Widget] Gtk.Image image_runs_interval_track_distance;
[Widget] Gtk.Image image_selector_start_jumps;
[Widget] Gtk.Image image_selector_start_runs;
@@ -154,6 +156,10 @@ public partial class ChronoJumpWindow
image_quit2.Pixbuf = pixbuf;
image_quit_from_app1.Pixbuf = pixbuf;
+ pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "run_track_distance.png");
+ image_runs_simple_track_distance.Pixbuf = pixbuf;
+ image_runs_interval_track_distance.Pixbuf = pixbuf;
+
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "muscle-concentric.png");
image_top_eccon.Pixbuf = pixbuf;
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 98d126b..5fce578 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -378,6 +378,9 @@ public class GenericWindow
public void SetSpinDouble2Range(double min, double max) {
spin_double2.SetRange(min, max);
}
+ public void SetSpinDouble2Digits(uint digits) {
+ spin_double2.Digits = digits;
+ }
public void SetComboValues(string [] values, string current) {
combo = ComboBox.NewText ();
diff --git a/src/gui/run.cs b/src/gui/run.cs
index 744a5b3..e80b714 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -898,11 +898,11 @@ public class RepairRunIntervalWindow
public partial class ChronoJumpWindow
{
//options runs
- [Widget] Gtk.Label extra_window_runs_label_distance;
- [Widget] Gtk.SpinButton extra_window_runs_spinbutton_distance;
- [Widget] Gtk.Label extra_window_runs_label_distance_units;
[Widget] Gtk.CheckButton check_run_simple_with_reaction_time;
-
+ [Widget] Gtk.Button button_runs_simple_track_distance;
+ [Widget] Gtk.Label label_runs_simple_track_distance_value;
+ [Widget] Gtk.Label label_runs_simple_track_distance_units;
+
//options runs interval
[Widget] Gtk.Label extra_window_runs_interval_label_distance;
[Widget] Gtk.SpinButton extra_window_runs_interval_spinbutton_distance;
@@ -980,19 +980,17 @@ public partial class ChronoJumpWindow
currentEventType = myRunType;
changeTestImage(EventType.Types.RUN.ToString(), myRunType.Name, myRunType.ImageFileName);
- extra_window_runs_label_distance.Text = Catalog.GetString("Lap distance (between barriers)");
- extra_window_runs_label_distance_units.Text = Catalog.GetString("meters");
+ label_runs_simple_track_distance_units.Text = "m";
if(myRunType.Distance > 0) {
- extra_window_runs_spinbutton_distance.Value = myRunType.Distance;
+ label_runs_simple_track_distance_value.Text = myRunType.Distance.ToString();
extra_window_showDistanceData(myRunType, true, false); //visible, sensitive
} else {
if(myRunType.Name == "Margaria") {
- extra_window_runs_label_distance.Text = Catalog.GetString("Vertical distance
between\nstairs third and nine.");
- extra_window_runs_label_distance_units.Text =
Catalog.GetString("Millimeters.");
- extra_window_runs_spinbutton_distance.Value = 1050;
+ label_runs_simple_track_distance_value.Text = "1050";
+ label_runs_simple_track_distance_units.Text = "mm";
} else {
- extra_window_runs_spinbutton_distance.Value = extra_window_runs_distance;
+ label_runs_simple_track_distance_value.Text =
extra_window_runs_distance.ToString();
}
extra_window_showDistanceData(myRunType, true, true); //visible, sensitive
}
@@ -1134,13 +1132,8 @@ public partial class ChronoJumpWindow
extra_window_runs_interval_spinbutton_distance.Sensitive = sensitive;
extra_window_runs_interval_label_distance_units.Sensitive = sensitive;
} else {
- extra_window_runs_label_distance.Visible = show;
- extra_window_runs_spinbutton_distance.Visible = show;
- extra_window_runs_label_distance_units.Visible = show;
-
- extra_window_runs_label_distance.Sensitive = sensitive;
- extra_window_runs_spinbutton_distance.Sensitive = sensitive;
- extra_window_runs_label_distance_units.Sensitive = sensitive;
+ button_runs_simple_track_distance.Visible = show;
+ button_runs_simple_track_distance.Sensitive = sensitive;
}
}
@@ -1154,6 +1147,37 @@ public partial class ChronoJumpWindow
extra_window_runs_interval_label_limit_units.Sensitive = sensitive;
}
+ private void on_button_runs_simple_track_distance_clicked (object o, EventArgs args)
+ {
+ string text = Catalog.GetString("Lap distance (between barriers)");
+ string labelAtLeft = Catalog.GetString("Distance in meters");
+ if(currentRunType.Name == "Margaria")
+ {
+ text = Catalog.GetString("Vertical distance between stairs third and nine.");
+ labelAtLeft = Catalog.GetString("Distance in millimeters");
+ }
+
+ genericWin = GenericWindow.Show(Catalog.GetString("Track distance"), text,
Constants.GenericWindowShow.HBOXSPINDOUBLE2);
+
+ genericWin.LabelSpinDouble2 = labelAtLeft;
+ genericWin.SetSpinDouble2Increments(0.1, 1);
+ genericWin.SetSpinDouble2Range(0, 100000.0);
+ genericWin.SetSpinDouble2Digits(1);
+ genericWin.SetSpinDouble2Value(Convert.ToDouble(label_runs_simple_track_distance_value.Text));
+
+ genericWin.Button_accept.Clicked -= new
EventHandler(on_button_runs_simple_track_distance_accepted);
+ genericWin.Button_accept.Clicked += new
EventHandler(on_button_runs_simple_track_distance_accepted);
+ }
+
+ void on_button_runs_simple_track_distance_accepted (object obj, EventArgs args)
+ {
+ genericWin.Button_accept.Clicked -= new
EventHandler(on_button_runs_simple_track_distance_accepted);
+
+ label_runs_simple_track_distance_value.Text =
Util.TrimDecimals(genericWin.SpinDouble2Selected.ToString(),
+ preferences.digitsNumber);
+ }
+
+
private bool changingCheckboxesRunWithReactionTime = false;
private void on_check_run_simple_with_reaction_time_clicked (object o, EventArgs args)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]