[Monodevelop-patches-list] r2624 - in trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets: . Commands

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Mon Jul 11 10:12:47 EDT 2005


Author: lluis
Date: 2005-07-11 10:12:47 -0400 (Mon, 11 Jul 2005)
New Revision: 2624

Added:
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandRouterContainer.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/ICommandDelegatorRouter.cs
Modified:
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandEntry.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandManager.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Makefile.am
Log:
2005-07-11  Lluis Sanchez Gual  <lluis at novell.com>

	* Commands/ICommandDelegatorRouter.cs: New command routing interface.
	* Commands/CommandRouterContainer: An implementation of
	ICommandDelegatorRouter.
	* Commands/CommandManager.cs: Implemented support for
	ICommandDelegatorRouter.



Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/ChangeLog	2005-07-11 14:12:47 UTC (rev 2624)
@@ -1,3 +1,11 @@
+2005-07-11  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* Commands/ICommandDelegatorRouter.cs: New command routing interface.
+	* Commands/CommandRouterContainer: An implementation of
+	ICommandDelegatorRouter.
+	* Commands/CommandManager.cs: Implemented support for
+	ICommandDelegatorRouter.
+
 2005-06-28  Raja R Harinath  <rharinath at novell.com>
 
 	* Makefile.am (FILES): Move AssemblyInfo.cs ...

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandEntry.cs	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandEntry.cs	2005-07-11 14:12:47 UTC (rev 2624)
@@ -59,6 +59,11 @@
 				Gtk.Widget child = (Gtk.Widget) Activator.CreateInstance (((CustomCommand)cmd).WidgetType);
 				Gtk.ToolItem ti = new Gtk.ToolItem ();
 				ti.Child = child;
+				if (cmd.Text != null && cmd.Text.Length > 0) {
+					Gtk.Tooltips tips = new Gtk.Tooltips ();
+					ti.SetTooltip (tips, cmd.Text, cmd.Text);
+					tips.Enable ();
+				}
 				return ti;
 			}
 			

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandManager.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandManager.cs	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandManager.cs	2005-07-11 14:12:47 UTC (rev 2624)
@@ -42,6 +42,7 @@
 		ArrayList toolbars = new ArrayList ();
 		ArrayList globalHandlers = new ArrayList ();
 		ArrayList commandUpdateErrors = new ArrayList ();
+		Stack delegatorStack = new Stack ();
 		
 		Gtk.AccelGroup accelGroup;
 		
@@ -320,7 +321,11 @@
 					return null;
 			}
 			
-			if (cmdTarget is ICommandRouter)
+			if (cmdTarget is ICommandDelegatorRouter) {
+				delegatorStack.Push (cmdTarget);
+				cmdTarget = ((ICommandDelegatorRouter)cmdTarget).GetDelegatedCommandTarget ();
+			}
+			else if (cmdTarget is ICommandRouter)
 				cmdTarget = ((ICommandRouter)cmdTarget).GetNextCommandTarget ();
 			else if (cmdTarget is Gtk.Widget)
 				cmdTarget = ((Gtk.Widget)cmdTarget).Parent;
@@ -328,6 +333,12 @@
 				cmdTarget = null;
 			
 			if (cmdTarget == null) {
+				if (delegatorStack.Count > 0) {
+					ICommandDelegatorRouter del = (ICommandDelegatorRouter) delegatorStack.Pop ();
+					cmdTarget = del.GetNextCommandTarget ();
+					if (cmdTarget != null)
+						return cmdTarget;
+				}
 				if (globalHandlers.Count == 0) return null;
 				globalPos = 0;
 				return globalHandlers [0];

Added: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandRouterContainer.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandRouterContainer.cs	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/CommandRouterContainer.cs	2005-07-11 14:12:47 UTC (rev 2624)
@@ -0,0 +1,56 @@
+//
+// CommandRouterContainer.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Commands
+{
+	public class CommandRouterContainer: Gtk.EventBox, ICommandDelegatorRouter
+	{
+		object endTarget;
+		object delegated;
+		
+		public CommandRouterContainer (Gtk.Widget child, object target, bool continueToParent)
+		{
+			Add (child);
+			delegated = target;
+			if (continueToParent)
+				endTarget = Parent;
+		}
+		
+		public object GetNextCommandTarget ()
+		{
+			return endTarget;
+		}
+		
+		public object GetDelegatedCommandTarget ()
+		{
+			return delegated;
+		}
+	}
+}

Added: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/ICommandDelegatorRouter.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/ICommandDelegatorRouter.cs	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Commands/ICommandDelegatorRouter.cs	2005-07-11 14:12:47 UTC (rev 2624)
@@ -0,0 +1,41 @@
+//
+// ICommandDelegatorRouter.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.Commands
+{
+	// Redirects the command route to the object returned by
+	// GetDelegatedCommandTarget and when done, continues with
+	// GetNextCommandTarget.
+	public interface ICommandDelegatorRouter
+	{
+		object GetNextCommandTarget (); 
+		object GetDelegatedCommandTarget (); 
+	}
+}

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Makefile.am	2005-07-08 20:42:34 UTC (rev 2623)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Gui.Widgets/Makefile.am	2005-07-11 14:12:47 UTC (rev 2624)
@@ -40,12 +40,14 @@
 Commands/CommandMenuBar.cs \
 Commands/CommandMenu.cs \
 Commands/CommandMenuItem.cs \
+Commands/CommandRouterContainer.cs \
 Commands/CommandSystemCommands.cs \
 Commands/CommandToggleToolButton.cs \
 Commands/CommandToolbar.cs \
 Commands/CommandToolButton.cs \
 Commands/CustomCommand.cs \
 Commands/CustomMenuItem.cs \
+Commands/ICommandDelegatorRouter.cs \
 Commands/ICommandMenuItem.cs \
 Commands/ICommandRouter.cs \
 Commands/ICommandUserItem.cs \




More information about the Monodevelop-patches-list mailing list