[chronojump] When a selected test is deleted,returns to default



commit 674e61bafc6d7a06070d5740da72a99a85030b00
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 26 13:38:28 2014 +0100

    When a selected test is deleted,returns to default

 src/gui/chronojump.cs |   27 +++++++++++++++++++++++----
 src/gui/event.cs      |   18 +++++++++++++++---
 src/gui/jump.cs       |   20 +++++++++++---------
 src/gui/run.cs        |   18 ++++++++++--------
 4 files changed, 59 insertions(+), 24 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0db10f2..a307d8d 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -5168,19 +5168,38 @@ Console.WriteLine("X");
         */
 
        private void on_jump_type_delete_simple (object o, EventArgs args) {
-               jumpsMoreWin = JumpsMoreWindow.Show(app1, false); //delete jump type
+               jumpsMoreWin = JumpsMoreWindow.Show(app1, false, currentJumpType.Name); //delete jump type
+               jumpsMoreWin.Button_deleted_current_test.Clicked += new 
EventHandler(on_deleted_current_jump_type);
        }
        
        private void on_jump_type_delete_reactive (object o, EventArgs args) {
-               jumpsRjMoreWin = JumpsRjMoreWindow.Show(app1, false); //delete jump type
+               jumpsRjMoreWin = JumpsRjMoreWindow.Show(app1, false, currentJumpRjType.Name); //delete jump 
type
+               jumpsRjMoreWin.Button_deleted_current_test.Clicked += new 
EventHandler(on_deleted_current_jump_rj_type);
        }
        
        private void on_run_type_delete_simple (object o, EventArgs args) {
-               runsMoreWin = RunsMoreWindow.Show(app1, false); //delete run type
+               runsMoreWin = RunsMoreWindow.Show(app1, false, currentRunType.Name); //delete run type
+               runsMoreWin.Button_deleted_current_test.Clicked += new 
EventHandler(on_deleted_current_run_type);
        }
        
        private void on_run_type_delete_intervallic (object o, EventArgs args) {
-               runsIntervalMoreWin = RunsIntervalMoreWindow.Show(app1, false); //delete run type
+               runsIntervalMoreWin = RunsIntervalMoreWindow.Show(app1, false, currentRunIntervalType.Name); 
//delete run type
+               runsIntervalMoreWin.Button_deleted_current_test.Clicked += new 
EventHandler(on_deleted_current_run_i_type);
+       }
+       
+       //----
+       
+       private void on_deleted_current_jump_type (object o, EventArgs args) {
+               extra_window_jumps_toggle_desired_button_on_toolbar(new JumpType("Free"));
+       }
+       private void on_deleted_current_jump_rj_type (object o, EventArgs args) {
+               extra_window_jumps_rj_toggle_desired_button_on_toolbar(new JumpType("RJ(j)"));
+       }
+       private void on_deleted_current_run_type (object o, EventArgs args) {
+               extra_window_runs_toggle_desired_button_on_toolbar(new RunType("Custom"));
+       }
+       private void on_deleted_current_run_i_type (object o, EventArgs args) {
+               extra_window_runs_interval_toggle_desired_button_on_toolbar(new RunType("byLaps"));
        }
 
        /* ---------------------------------------------------------
diff --git a/src/gui/event.cs b/src/gui/event.cs
index db70057..986a2cb 100644
--- a/src/gui/event.cs
+++ b/src/gui/event.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2009   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -140,7 +140,7 @@ public class EditEventWindow
                if (EditEventWindowBox == null) {
                        EditEventWindowBox = new EditEventWindow (parent);
                }
-               
+       
                EditEventWindowBox.pDN = pDN;
                
                EditEventWindowBox.initializeValues();
@@ -591,13 +591,15 @@ public class EventMoreWindow
        protected string selectedEventName;
        protected string selectedDescription;
        public Gtk.Button button_selected;
+       public Gtk.Button button_deleted_current_test; //just to send a signal
        
        protected bool testOrDelete; //are we going to do a test or to delete a test type (test is true)
+       protected string selectedTestOnMainWindow;
 
        public EventMoreWindow () {
        }
 
-       public EventMoreWindow (Gtk.Window parent, bool testOrDelete) {
+       public EventMoreWindow (Gtk.Window parent, bool testOrDelete, string selectedTestOnMainWindow) {
                /*
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", 
"jumps_runs_more", null);
@@ -613,6 +615,7 @@ public class EventMoreWindow
        protected void initializeThings() 
        {
                button_selected = new Gtk.Button();
+               button_deleted_current_test = new Gtk.Button();
                
                createTreeView(treeview_more);
 
@@ -694,6 +697,10 @@ public class EventMoreWindow
        {
                deleteTestLine();
 
+               //if deleted test was the selected test, change selected test to default
+               if(selectedTestOnMainWindow == selectedEventName)
+                       button_deleted_current_test.Click();
+
                TreeModel model;
                TreeIter iter;
                if (treeview_more.Selection.GetSelected (out model, out iter)) 
@@ -714,6 +721,11 @@ public class EventMoreWindow
                get { return button_selected; }
        }
 
+       public Button Button_deleted_current_test
+       {
+               get { return button_deleted_current_test; }
+       }
+
        public Button Button_accept {
                set { button_accept = value; }
                get { return button_accept; }
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index 0d47af3..eb7404d 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2011   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2004-2014   Xavier de Blas <xaviblas gmail com> 
  */
 
 using System;
@@ -1123,7 +1123,7 @@ partial class ChronoJumpWindow
                previousJumpType = currentJumpType;
 
                if(extra_window_radio_jump_more.Active) {
-                       jumpsMoreWin = JumpsMoreWindow.Show(app1, true);
+                       jumpsMoreWin = JumpsMoreWindow.Show(app1, true, currentJumpType.Name);
                        jumpsMoreWin.Button_accept.Clicked += new EventHandler(on_more_jumps_accepted);
                        jumpsMoreWin.Button_cancel.Clicked += new EventHandler(on_more_jumps_cancelled);
                        jumpsMoreWin.Button_selected.Clicked += new 
EventHandler(on_more_jumps_draw_image_test);
@@ -1145,7 +1145,7 @@ partial class ChronoJumpWindow
                previousJumpRjType = currentJumpRjType;
 
                if(extra_window_radio_jump_rj_more.Active) {
-                       jumpsRjMoreWin = JumpsRjMoreWindow.Show(app1, true);
+                       jumpsRjMoreWin = JumpsRjMoreWindow.Show(app1, true, currentJumpRjType.Name);
                        jumpsRjMoreWin.Button_accept.Clicked += new EventHandler(on_more_jumps_rj_accepted);
                        jumpsRjMoreWin.Button_cancel.Clicked += new EventHandler(on_more_jumps_rj_cancelled);
                        jumpsRjMoreWin.Button_selected.Clicked += new 
EventHandler(on_more_jumps_rj_draw_image_test);
@@ -1537,12 +1537,13 @@ public class JumpsMoreWindow : EventMoreWindow
        private bool selectedStartIn;
        private bool selectedExtraWeight;
 
-       public JumpsMoreWindow (Gtk.Window parent, bool testOrDelete) {
+       public JumpsMoreWindow (Gtk.Window parent, bool testOrDelete, string selectedTestOnMainWindow) {
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", 
"jumps_runs_more", null);
                gladeXML.Autoconnect(this);
                this.parent = parent;
                this.testOrDelete = testOrDelete;
+               this.selectedTestOnMainWindow = selectedTestOnMainWindow;
                
                if(!testOrDelete)
                        jumps_runs_more.Title = Catalog.GetString("Delete test type defined by user");
@@ -1558,10 +1559,10 @@ public class JumpsMoreWindow : EventMoreWindow
                initializeThings();
        }
        
-       static public JumpsMoreWindow Show (Gtk.Window parent, bool testOrDelete)
+       static public JumpsMoreWindow Show (Gtk.Window parent, bool testOrDelete, string 
selectedTestOnMainWindow)
        {
                if (JumpsMoreWindowBox == null) {
-                       JumpsMoreWindowBox = new JumpsMoreWindow (parent, testOrDelete);
+                       JumpsMoreWindowBox = new JumpsMoreWindow (parent, testOrDelete, 
selectedTestOnMainWindow);
                }
                JumpsMoreWindowBox.jumps_runs_more.Show ();
                
@@ -1729,13 +1730,14 @@ public class JumpsRjMoreWindow : EventMoreWindow
        private double selectedLimitedValue;
        private bool selectedUnlimited;
        
-       public JumpsRjMoreWindow (Gtk.Window parent, bool testOrDelete) {
+       public JumpsRjMoreWindow (Gtk.Window parent, bool testOrDelete, string selectedTestOnMainWindow) {
                //the glade window is the same as jumps_more
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", 
"jumps_runs_more", null);
                gladeXML.Autoconnect(this);
                this.parent = parent;
                this.testOrDelete = testOrDelete;
+               this.selectedTestOnMainWindow = selectedTestOnMainWindow;
                
                if(!testOrDelete)
                        jumps_runs_more.Title = Catalog.GetString("Delete test type defined by user");
@@ -1755,10 +1757,10 @@ public class JumpsRjMoreWindow : EventMoreWindow
                initializeThings();
        }
        
-       static public JumpsRjMoreWindow Show (Gtk.Window parent, bool testOrDelete)
+       static public JumpsRjMoreWindow Show (Gtk.Window parent, bool testOrDelete, string 
selectedTestOnMainWindow)
        {
                if (JumpsRjMoreWindowBox == null) {
-                       JumpsRjMoreWindowBox = new JumpsRjMoreWindow (parent, testOrDelete);
+                       JumpsRjMoreWindowBox = new JumpsRjMoreWindow (parent, testOrDelete, 
selectedTestOnMainWindow);
                }
                JumpsRjMoreWindowBox.jumps_runs_more.Show ();
                
diff --git a/src/gui/run.cs b/src/gui/run.cs
index b12a86b..29e85c3 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -1009,7 +1009,7 @@ partial class ChronoJumpWindow
                previousRunType = currentRunType;
 
                if(extra_window_radio_run_more.Active) {
-                       runsMoreWin = RunsMoreWindow.Show(app1, true);
+                       runsMoreWin = RunsMoreWindow.Show(app1, true, currentRunType.Name);
                        runsMoreWin.Button_accept.Clicked += new EventHandler(on_more_runs_accepted);
                        runsMoreWin.Button_cancel.Clicked += new EventHandler(on_more_runs_cancelled);
                        runsMoreWin.Button_selected.Clicked += new EventHandler(on_more_runs_draw_image_test);
@@ -1033,7 +1033,7 @@ partial class ChronoJumpWindow
                previousRunIntervalType = currentRunIntervalType;
 
                if(extra_window_radio_run_interval_more.Active) {
-                       runsIntervalMoreWin = RunsIntervalMoreWindow.Show(app1, true);
+                       runsIntervalMoreWin = RunsIntervalMoreWindow.Show(app1, true, 
currentRunIntervalType.Name);
                        runsIntervalMoreWin.Button_accept.Clicked += new 
EventHandler(on_more_runs_interval_accepted);
                        runsIntervalMoreWin.Button_cancel.Clicked += new 
EventHandler(on_more_runs_interval_cancelled);
                        runsIntervalMoreWin.Button_selected.Clicked += new 
EventHandler(on_more_runs_interval_draw_image_test);
@@ -1312,12 +1312,13 @@ public class RunsMoreWindow : EventMoreWindow
        
        private double selectedDistance;
        
-       RunsMoreWindow (Gtk.Window parent, bool testOrDelete) {
+       RunsMoreWindow (Gtk.Window parent, bool testOrDelete, string selectedTestOnMainWindow) {
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", 
"jumps_runs_more", null);
                gladeXML.Autoconnect(this);
                this.parent = parent;
                this.testOrDelete = testOrDelete;
+               this.selectedTestOnMainWindow = selectedTestOnMainWindow;
                
                if(!testOrDelete)
                        jumps_runs_more.Title = Catalog.GetString("Delete test type defined by user");
@@ -1332,10 +1333,10 @@ public class RunsMoreWindow : EventMoreWindow
                initializeThings();
        }
        
-       static public RunsMoreWindow Show (Gtk.Window parent, bool testOrDelete)
+       static public RunsMoreWindow Show (Gtk.Window parent, bool testOrDelete, string 
selectedTestOnMainWindow)
        {
                if (RunsMoreWindowBox == null) {
-                       RunsMoreWindowBox = new RunsMoreWindow (parent, testOrDelete);
+                       RunsMoreWindowBox = new RunsMoreWindow (parent, testOrDelete, 
selectedTestOnMainWindow);
                }
                RunsMoreWindowBox.jumps_runs_more.Show ();
                
@@ -1479,13 +1480,14 @@ public class RunsIntervalMoreWindow : EventMoreWindow
        private bool selectedUnlimited;
        private string selectedDistancesString;
        
-       RunsIntervalMoreWindow (Gtk.Window parent, bool testOrDelete) {
+       RunsIntervalMoreWindow (Gtk.Window parent, bool testOrDelete, string selectedTestOnMainWindow) {
                //the glade window is the same as jumps_more
                Glade.XML gladeXML;
                gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", 
"jumps_runs_more", null);
                gladeXML.Autoconnect(this);
                this.parent = parent;
                this.testOrDelete = testOrDelete;
+               this.selectedTestOnMainWindow = selectedTestOnMainWindow;
                
                if(!testOrDelete)
                        jumps_runs_more.Title = Catalog.GetString("Delete test type defined by user");
@@ -1501,10 +1503,10 @@ public class RunsIntervalMoreWindow : EventMoreWindow
                initializeThings();
        }
        
-       static public RunsIntervalMoreWindow Show (Gtk.Window parent, bool testOrDelete)
+       static public RunsIntervalMoreWindow Show (Gtk.Window parent, bool testOrDelete, string 
selectedTestOnMainWindow)
        {
                if (RunsIntervalMoreWindowBox == null) {
-                       RunsIntervalMoreWindowBox = new RunsIntervalMoreWindow (parent, testOrDelete);
+                       RunsIntervalMoreWindowBox = new RunsIntervalMoreWindow (parent, testOrDelete, 
selectedTestOnMainWindow);
                }
                RunsIntervalMoreWindowBox.jumps_runs_more.Show ();
                


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