[chronojump] metric units on person win
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] metric units on person win
- Date: Fri, 28 May 2010 14:05:15 +0000 (UTC)
commit 5b1447ee99299040693251e58b3e69479b8ee4ab
Author: Xavier de Blas <xaviblas master gnome org>
Date: Fri May 28 22:00:05 2010 +0800
metric units on person win
chronojump_server/bin/chronojumpServer.dll | Bin 282624 -> 282624 bytes
glade/chronojump.glade | 292 ++++++++++++++++++++++------
po/ca.po | 3 +-
src/constants.cs | 3 +-
src/gui/chronojump.cs | 4 +-
src/gui/genericWindow.cs | 32 +++-
src/gui/person.cs | 27 +++
src/gui/stats.cs | 11 +-
src/util.cs | 8 +
9 files changed, 303 insertions(+), 77 deletions(-)
---
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 8a9916c..f8612e9 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 126df28..99b8e8e 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -29,12 +29,12 @@
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="spacing">8</property>
+ <property name="spacing">12</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="shadow_type">in</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
@@ -90,6 +90,7 @@
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
+ <property name="height_request">55</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -240,6 +241,7 @@
<property name="stock">gtk-no</property>
</widget>
<packing>
+ <property name="x_options"></property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@@ -251,7 +253,7 @@
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="x_options"></property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
@@ -343,7 +345,7 @@
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <property name="shadow_type">in</property>
<child>
<widget class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
@@ -356,39 +358,10 @@
<property name="column_spacing">6</property>
<property name="row_spacing">4</property>
<child>
- <widget class="GtkLabel" id="label47">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Height (cm)</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkSpinButton" id="spinbutton_height">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">0 0 250 0.10000000000000001 10 10</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
- <property name="numeric">True</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="label48">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes"><b>Weight</b> (Kg)</property>
+ <property name="label" translatable="yes"><b>Weight</b></property>
<property name="use_markup">True</property>
</widget>
<packing>
@@ -401,26 +374,6 @@
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="spinbutton_weight">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">0 0 300 0.10000000000000001 10 10</property>
- <property name="climb_rate">1</property>
- <property name="digits">1</property>
- <property name="numeric">True</property>
- <signal name="value_changed" handler="on_entries_required_changed"/>
- <signal name="activate" handler="on_entries_required_changed"/>
- </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"></property>
- </packing>
- </child>
- <child>
<widget class="GtkLabel" id="label498">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -545,6 +498,7 @@
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="height_request">55</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -627,11 +581,140 @@
</packing>
</child>
<child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Height</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_height">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">0 0 250 0.10000000000000001 10 10</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">cm</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_height_metric">
+ <property name="label" translatable="yes">Use metric units</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_height_metric_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkSpinButton" id="spinbutton_weight">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">0 0 300 0.10000000000000001 10 10</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <signal name="value_changed" handler="on_entries_required_changed"/>
+ <signal name="activate" handler="on_entries_required_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Kg</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_weight_metric">
+ <property name="label" translatable="yes">Use metric units</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_weight_metric_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</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>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -13494,7 +13577,7 @@ comments</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="spinbutton">
+ <widget class="GtkSpinButton" id="spin_int">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">10 0 300 1 10 10</property>
@@ -13509,6 +13592,103 @@ comments</property>
</packing>
</child>
<child>
+ <widget class="GtkSpinButton" id="spin_double">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">0 0 300 0.01 10 10</property>
+ <property name="digits">2</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">if-valid</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_height_metric">
+ <property name="visible">True</property>
+ <property name="spacing">20</property>
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkSpinButton" id="spin_feet">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">0 0 8 1 1 1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">if-valid</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="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Feet</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkSpinButton" id="spin_inches">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">0 0 11 0.01 1 1</property>
+ <property name="digits">2</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">if-valid</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="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Inches</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -13523,7 +13703,7 @@ comments</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">4</property>
</packing>
</child>
</widget>
diff --git a/po/ca.po b/po/ca.po
index 1654e57..da0c089 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -475,7 +475,8 @@ msgstr "<b>Dades de la persona</b>"
#: ../glade/chronojump.glade.h:23
msgid "<b>Date of Birth</b>"
-msgstr "<b>Data de naixement</b>"
+msgstr "<b>Data de\n"
+"naixement</b>"
#: ../glade/chronojump.glade.h:24
msgid "<b>Detection</b>"
diff --git a/src/constants.cs b/src/constants.cs
index 4b651f5..8c59815 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -452,8 +452,9 @@ public class Constants
//public static string LowerOrEqualThanCode = "<=";
public static string HigherOrEqualThanCode = ">=";
+ //height mentric contains 2 spins
public enum GenericWindowShow {
- ENTRY, SPIN, TEXTVIEW
+ ENTRY, SPININT, SPINDOUBLE, HEIGHTMETRIC, TEXTVIEW
}
public const string PrefVersionAvailable = "versionAvailable";
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0457955..16454e9 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2041,14 +2041,14 @@ public class ChronoJumpWindow
//show spinbutton window asking for how many people to create
private void on_person_add_multiple_activate (object o, EventArgs args) {
- genericWin = GenericWindow.Show(Catalog.GetString("Select number of persons to add"), Constants.GenericWindowShow.SPIN);
+ genericWin = GenericWindow.Show(Catalog.GetString("Select number of persons to add"), Constants.GenericWindowShow.SPININT);
genericWin.SetSpinRange(1.0, 40.0);
genericWin.Button_accept.Clicked += new EventHandler(on_person_add_multiple_prepared);
}
private void on_person_add_multiple_prepared (object o, EventArgs args) {
genericWin.Button_accept.Clicked -= new EventHandler(on_person_add_multiple_prepared);
- personAddMultipleWin = PersonAddMultipleWindow.Show(app1, currentSession, genericWin.SpinSelected);
+ personAddMultipleWin = PersonAddMultipleWindow.Show(app1, currentSession, genericWin.SpinIntSelected);
personAddMultipleWin.Button_accept.Clicked += new EventHandler(on_person_add_multiple_accepted);
}
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 2e00399..deb025e 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -32,8 +32,12 @@ public class GenericWindow
[Widget] Gtk.Label label_header;
[Widget] Gtk.Label label_generic_name;
[Widget] Gtk.Entry entry;
- [Widget] Gtk.SpinButton spinbutton;
+ [Widget] Gtk.SpinButton spin_int;
+ [Widget] Gtk.SpinButton spin_double;
[Widget] Gtk.ScrolledWindow scrolled_window;
+ [Widget] Gtk.Box hbox_height_metric;
+ [Widget] Gtk.SpinButton spin_feet;
+ [Widget] Gtk.SpinButton spin_inches;
[Widget] Gtk.TextView textview;
[Widget] Gtk.Button button_accept;
@@ -64,19 +68,25 @@ public class GenericWindow
void showHideWidgets(Constants.GenericWindowShow stuff) {
entry.Hide();
- spinbutton.Hide();
+ spin_int.Hide();
+ spin_double.Hide();
+ hbox_height_metric.Hide();
scrolled_window.Hide();
if(stuff == Constants.GenericWindowShow.ENTRY)
entry.Show();
- else if(stuff == Constants.GenericWindowShow.SPIN)
- spinbutton.Show();
+ else if(stuff == Constants.GenericWindowShow.SPININT)
+ spin_int.Show();
+ else if(stuff == Constants.GenericWindowShow.SPINDOUBLE)
+ spin_double.Show();
+ else if(stuff == Constants.GenericWindowShow.HEIGHTMETRIC)
+ hbox_height_metric.Show();
else //if(stuff == Constants.GenericWindowShow.TEXTVIEW)
scrolled_window.Show();
}
public void SetSpinRange(double min, double max) {
- spinbutton.SetRange(min, max);
+ spin_int.SetRange(min, max);
}
public void SetTextview(string str) {
@@ -113,8 +123,16 @@ public class GenericWindow
get { return entry.Text.ToString(); }
}
- public int SpinSelected {
- get { return (int) spinbutton.Value; }
+ public int SpinIntSelected {
+ get { return (int) spin_int.Value; }
+ }
+
+ public double SpinDoubleSelected {
+ get { return (double) spin_double.Value; }
+ }
+
+ public string TwoSpinSelected {
+ get { return ((int) spin_feet.Value).ToString() + ":" + ((int) spin_inches.Value).ToString(); }
}
public string TextviewSelected {
diff --git a/src/gui/person.cs b/src/gui/person.cs
index d3814af..19d69f8 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -819,6 +819,8 @@ public class PersonAddModifyWindow
[Widget] Gtk.SpinButton spinbutton_height;
[Widget] Gtk.SpinButton spinbutton_weight;
+ [Widget] Gtk.Button button_height_metric;
+ [Widget] Gtk.Button button_weight_metric;
[Widget] Gtk.Box hbox_combo_sports;
[Widget] Gtk.ComboBox combo_sports;
@@ -1228,6 +1230,31 @@ public class PersonAddModifyWindow
label_date.Text = dateTime.ToLongDateString();
on_entries_required_changed(new object(), new EventArgs());
}
+
+ void on_button_height_metric_clicked(object obj, EventArgs args)
+ {
+ genericWin = GenericWindow.Show(Catalog.GetString("Select your height"), Constants.GenericWindowShow.HEIGHTMETRIC);
+ genericWin.Button_accept.Clicked += new EventHandler(on_button_height_metric_accepted);
+ }
+ void on_button_height_metric_accepted (object obj, EventArgs args)
+ {
+ string [] myStr = genericWin.TwoSpinSelected.Split(new char[] {':'});
+ spinbutton_height.Value = Util.ConvertFeetInchesToCm(
+ Convert.ToInt32(myStr[0]),
+ Convert.ToDouble(myStr[1])
+ );
+ }
+
+ void on_button_weight_metric_clicked(object obj, EventArgs args)
+ {
+ genericWin = GenericWindow.Show(Catalog.GetString("Select your weight in pounds"), Constants.GenericWindowShow.SPINDOUBLE);
+ genericWin.Button_accept.Clicked += new EventHandler(on_button_weight_metric_accepted);
+ }
+ void on_button_weight_metric_accepted (object obj, EventArgs args)
+ {
+ spinbutton_weight.Value = Util.ConvertPoundsToKg(genericWin.SpinDoubleSelected);
+ }
+
private void on_combo_sports_changed(object o, EventArgs args) {
ComboBox combo = o as ComboBox;
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 9934d6a..5e9650a 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -446,16 +446,7 @@ public class StatsWindow {
else
showGraphXYStuff(false);
- /*
- if(
- UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeHistogram ||
- UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
-*/
- showLineWidth(true);
-/* else
- showLineWidth(false);
-*/
-
+ showLineWidth(true);
if(
UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeDotchart ||
diff --git a/src/util.cs b/src/util.cs
index d9a0f29..49afd0b 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1137,4 +1137,12 @@ public class Util
return searchedValue;
}
+ public static double ConvertFeetInchesToCm(int feet, double inches) {
+ return feet * 30.48 + inches * 2.54;
+ }
+
+ public static double ConvertPoundsToKg(double pounds) {
+ return pounds * 0.45359237;
+ }
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]