[chronojump] On slCMJ distance/angle in app1 fixing weird bug



commit 37280a31cd9f82e48ceb67da69869120e98974be
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 5 21:18:18 2013 +0100

    On slCMJ distance/angle in app1 fixing weird bug

 glade/chronojump.glade |  186 ++++++++++++++++++++++++++++++++++++++++++++++++
 howto_new_version.txt  |    2 +-
 src/gui/chronojump.cs  |   58 ++++-----------
 src/gui/jump.cs        |   38 +++++++++-
 4 files changed, 239 insertions(+), 45 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4f6fb30..7785bcc 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -3633,6 +3633,11 @@ weight</property>
                                                             <widget class="GtkVBox" id="vbox_extra_window_jumps_single_leg">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox_extra_window_jumps_single_leg_radios">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox82">
@@ -3988,6 +3993,187 @@ weight</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkFrame" id="frame_extra_window_jumps_single_leg_input">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">in</property>
+                                                            <child>
+                                                            <widget class="GtkAlignment" id="alignment32">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="top_padding">6</property>
+                                                            <property name="bottom_padding">6</property>
+                                                            <property name="left_padding">6</property>
+                                                            <property name="right_padding">6</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="extra_window_jumps_hbox_single_leg_distance_angle">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">12</property>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox74">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="extra_window_jumps_label_single_leg_distance">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Distance</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" id="extra_window_jumps_spin_single_leg_distance">
+                                                            <property name="visible">True</property>
+                                                            <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">0 0 200 1 1 0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="snap_to_ticks">True</property>
+                                                            <property name="numeric">True</property>
+                                                            <property name="update_policy">if-valid</property>
+                                                            <signal name="value_changed" handler="on_spin_single_leg_changed" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label110">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">cm</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</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="GtkHBox" id="hbox75">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="extra_window_jumps_label_single_leg_angle">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Jump angle</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" id="extra_window_jumps_spin_single_leg_angle">
+                                                            <property name="visible">True</property>
+                                                            <property name="sensitive">False</property>
+                                                            <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">0 0 90 1 1 0</property>
+                                                            <property name="climb_rate">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">True</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label112">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">degrees</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkButton" id="extra_window_jumps_button_single_leg_apply">
+                                                            <property name="label">gtk-apply</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="use_action_appearance">False</property>
+                                                            <property name="use_stock">True</property>
+                                                            <signal name="clicked" handler="on_extra_window_jumps_button_single_leg_apply_clicked" swapped="no"/>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label109">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Input distance of jump</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="type">label_item</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
                                                             <property name="position">3</property>
                                                             </packing>
                                                             </child>
diff --git a/howto_new_version.txt b/howto_new_version.txt
index 9ccbd7c..e635225 100644
--- a/howto_new_version.txt
+++ b/howto_new_version.txt
@@ -26,7 +26,7 @@ upload the tarball
 
 scp Chronojump...exe xaviblas master gnome org:.
 ssh xaviblas master gnome org
-chmod +x Chrono...exe
+chmod +rx Chrono...exe
 mv Chrono...exe /ftp/pub/gnome/binaries/win32/chronojump
 signal-ftp-sync
 wait 5'
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index bcd737e..abde1cb 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3132,6 +3132,10 @@ Console.WriteLine("X");
 		string description = "";
 		if(currentJumpType.Name == "slCMJ") {
 			description = slCMJString(); 
+
+			frame_extra_window_jumps_single_leg_input.Sensitive = false;
+			extra_window_jumps_spin_single_leg_distance.Value = 0;
+			extra_window_jumps_spin_single_leg_angle.Value = 90;
 		}
 			
 		//used by cancel and finish
@@ -3190,45 +3194,16 @@ Console.WriteLine("X");
 			new EventHandler(on_event_execute_update_graph_in_progress_clicked);
 		currentEventExecute.FakeButtonEventEnded.Clicked += new EventHandler(on_event_execute_EventEnded);
 
-		//if jump is slCMJ and is not vertical, user has to input the length of jumpin cm
-		if(currentJumpType.Name == "slCMJ" && ! extra_window_jumps_radiobutton_single_leg_mode_vertical.Active)
-			currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished_ask_data);
-		else
-			currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished_no_ask_data);
+		currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished);
 	}	
 	
-	private void on_jump_finished_ask_data (object o, EventArgs args)
-	{
-Log.WriteLine("AAA");
-		currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_finished_ask_data);
-		genericWin = GenericWindow.Show(Catalog.GetString("Input length of jump in centimeters")
-				, Constants.GenericWindowShow.SPININT);
-
-		genericWin.LabelSpinInt = "";
-		genericWin.SetSpinRange(1.0, 200.0);
-		genericWin.Button_accept.Clicked += new EventHandler(on_jump_finished_ask_data_2);
-Log.WriteLine("AAA 2");
-	}
-	
-	private void on_jump_finished_ask_data_2 (object o, EventArgs args)
-	{
-Log.WriteLine("BBB");
-		genericWin.Button_accept.Clicked -= new EventHandler(on_jump_finished_ask_data_2);
-		on_jump_finished();
-Log.WriteLine("BBB 2");
-	}
-
-	private void on_jump_finished_no_ask_data (object o, EventArgs args)
-	{
-Log.WriteLine("CCC");
-		currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_finished_no_ask_data);
-		on_jump_finished();
-Log.WriteLine("CCC 2");
-	}
 
-	private void on_jump_finished ()
+	private void on_jump_finished (object o, EventArgs args)
 	{
 Log.WriteLine("DDD");
+		currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_finished);
+Log.WriteLine("DDD 1");
+
 		if ( ! currentEventExecute.Cancel ) {
 			currentJump = (Jump) currentEventExecute.EventDone;
 		
@@ -3236,14 +3211,12 @@ Log.WriteLine("DDD");
 				if(extra_window_jumps_radiobutton_single_leg_mode_vertical.Active)
 					currentJump.Description += " 0 90";
 				else {
-					int distance = Convert.ToInt32(genericWin.SpinIntSelected);
-					currentJump.Description += 
-						" " + distance.ToString() +
-						" " + Util.CalculateJumpAngle(
-								Convert.ToDouble(
-									Util.GetHeightInCentimeters(
-										currentJump.Tv.ToString()))
-								, distance ).ToString();
+					currentJump.Description += " 0 90";
+					
+					//unsensitive slCMJ options 
+					vbox_extra_window_jumps_single_leg_radios.Sensitive = false;
+					//but sensitive the input cm
+					frame_extra_window_jumps_single_leg_input.Sensitive = true;
 				}
 				SqliteJump.UpdateDescription(Constants.JumpTable, 
 						currentJump.UniqueID, currentJump.Description);
@@ -3286,6 +3259,7 @@ Log.WriteLine("DDD 2");
 	}
 
 
+
 	/* ---------------------------------------------------------
 	 * ----------------  JUMPS RJ EXECUTION  ------------------
 	 *  --------------------------------------------------------
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index 9a645bd..77538ec 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -1007,8 +1007,11 @@ partial class ChronoJumpWindow
 	[Widget] Gtk.Label extra_window_jumps_label_dj_arms;
 	[Widget] Gtk.CheckButton extra_window_jumps_check_dj_arms;
 	[Widget] Gtk.Label extra_window_label_jumps_no_options;
-	
+
+	//slCMJ	
 	[Widget] Gtk.Box vbox_extra_window_jumps_single_leg;
+	[Widget] Gtk.Box vbox_extra_window_jumps_single_leg_radios;
+	[Widget] Gtk.Frame frame_extra_window_jumps_single_leg_input;
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_mode_vertical;
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_mode_horizontal;
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_mode_lateral;
@@ -1020,6 +1023,8 @@ partial class ChronoJumpWindow
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_fall_this_limb;
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_fall_opposite;
 	[Widget] Gtk.RadioButton extra_window_jumps_radiobutton_single_leg_fall_both;
+	[Widget] Gtk.SpinButton extra_window_jumps_spin_single_leg_distance;
+	[Widget] Gtk.SpinButton extra_window_jumps_spin_single_leg_angle;
 	
 	//options jumps_rj
 	[Widget] Gtk.Label extra_window_jumps_rj_label_limit;
@@ -1198,8 +1203,12 @@ partial class ChronoJumpWindow
 		}
 
 		extra_window_showSingleLegStuff(myJumpType.Name == "slCMJ");
-		if(myJumpType.Name == "slCMJ")
+		if(myJumpType.Name == "slCMJ") {
 			hasOptions = true;
+			frame_extra_window_jumps_single_leg_input.Sensitive = false;
+			extra_window_jumps_spin_single_leg_distance.Value = 0;
+			extra_window_jumps_spin_single_leg_angle.Value = 90;
+		}
 
 		extra_window_jumps_showNoOptions(myJumpType, hasOptions);
 	}
@@ -1489,6 +1498,31 @@ partial class ChronoJumpWindow
 		return str;
 	}
 
+	private void on_spin_single_leg_changed(object o, EventArgs args) {
+		int distance = Convert.ToInt32(extra_window_jumps_spin_single_leg_distance.Value);
+		extra_window_jumps_spin_single_leg_angle.Value =
+			Util.CalculateJumpAngle(
+					Convert.ToDouble(Util.GetHeightInCentimeters(currentJump.Tv.ToString())), 
+					distance );
+	}
+
+	private void on_extra_window_jumps_button_single_leg_apply_clicked (object o, EventArgs args) {
+		string description = slCMJString();
+		int distance = Convert.ToInt32(extra_window_jumps_spin_single_leg_distance.Value);
+		int angle = Convert.ToInt32(extra_window_jumps_spin_single_leg_angle.Value);
+		currentJump.Description = description + 
+			" " + distance.ToString() +
+			" " + angle.ToString();
+		
+		SqliteJump.UpdateDescription(Constants.JumpTable, 
+			currentJump.UniqueID, currentJump.Description);
+		
+		myTreeViewJumps.Update(currentJump);
+		
+		//sensitive slCMJ options 
+		vbox_extra_window_jumps_single_leg_radios.Sensitive = true;
+	}
+
 }
 
 



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