[Monodevelop-patches-list] r2778 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Commands Gui Gui/Workbench/Layouts

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Mon Aug 22 11:10:31 EDT 2005


Author: lluis
Date: 2005-08-22 11:10:30 -0400 (Mon, 22 Aug 2005)
New Revision: 2778

Modified:
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
Log:
2005-08-22  Lluis Sanchez Gual  <lluis at novell.com>

	* Commands/ViewCommands.cs: Implemented delete layout command.
	* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Properly load saved
	layouts. Added DeleteLayout method.
	* Gui/IWorkbenchLayout.cs: Added DeleteLayout method.
	* MonoDevelopCore.addin.xml: Added Delete Layout command.



Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog	2005-08-22 05:36:33 UTC (rev 2777)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog	2005-08-22 15:10:30 UTC (rev 2778)
@@ -1,3 +1,11 @@
+2005-08-22  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* Commands/ViewCommands.cs: Implemented delete layout command.
+	* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: Properly load saved
+	layouts. Added DeleteLayout method.
+	* Gui/IWorkbenchLayout.cs: Added DeleteLayout method.
+	* MonoDevelopCore.addin.xml: Added Delete Layout command.
+
 2005-08-20  John Luke  <john.luke at gmail.com>
 
 	* Gui/Pads/OpenTaskView.cs:

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs	2005-08-22 05:36:33 UTC (rev 2777)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/ViewCommands.cs	2005-08-22 15:10:30 UTC (rev 2778)
@@ -24,6 +24,7 @@
 		ViewList,
 		LayoutList,
 		NewLayout,
+		DeleteCurrentLayout,
 		FullScreen,
 		Open,
 		TreeDisplayOptionList,
@@ -48,6 +49,23 @@
 		}
 	}
 	
+	internal class DeleteCurrentLayoutHandler: CommandHandler
+	{
+		protected override void Run ()
+		{
+			if (Runtime.MessageService.AskQuestion (GettextCatalog.GetString ("Are you sure you want to delete the active layout?"), "MonoDevelop")) {
+				string clayout = WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout;
+				WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout = "Default";
+				WorkbenchSingleton.Workbench.WorkbenchLayout.DeleteLayout (clayout);
+			}
+		}
+		
+		protected override void Update (CommandInfo info)
+		{
+			info.Enabled = WorkbenchSingleton.Workbench.WorkbenchLayout != null && WorkbenchSingleton.Workbench.WorkbenchLayout.CurrentLayout != "Default";
+		}
+	}
+	
 	internal class ViewListHandler: CommandHandler
 	{
 		protected override void Update (CommandArrayInfo info)

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs	2005-08-22 05:36:33 UTC (rev 2777)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/IWorkbenchLayout.cs	2005-08-22 15:10:30 UTC (rev 2778)
@@ -43,6 +43,8 @@
 		string[] Layouts {
 			get;
 		}
+		
+		void DeleteLayout (string name);
 
 		/// <summary>
 		/// Attaches this layout manager to a workbench object.

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2005-08-22 05:36:33 UTC (rev 2777)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2005-08-22 15:10:30 UTC (rev 2778)
@@ -178,7 +178,7 @@
 			workbenchContext = ctxt;
 			
 			// get the list of layouts
-			string ctxtPrefix = ctxt.ToString () + ".";
+			string ctxtPrefix = ctxt.Id + ".";
 			string[] list = dockLayout.GetLayouts (false);
 
 			layouts.Clear ();
@@ -252,7 +252,15 @@
 				return result;
 			}
 		}
+		
+		public void DeleteLayout (string name)
+		{
+			string layout = workbench.Context.Id + "." + name;
+			layouts.Remove (name);
+			dockLayout.DeleteLayout (layout);
+		}
 
+
 		// pad collection for the current workbench context
 		PadContentCollection activePadCollection;
 

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml	2005-08-22 05:36:33 UTC (rev 2777)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/MonoDevelopCore.addin.xml	2005-08-22 15:10:30 UTC (rev 2778)
@@ -364,6 +364,9 @@
 		<Command id = "MonoDevelop.Commands.ViewCommands.NewLayout"
 				defaultHandler = "MonoDevelop.Commands.NewLayoutHandler"
 				_label = "_New Layout" />
+		<Command id = "MonoDevelop.Commands.ViewCommands.DeleteCurrentLayout"
+				defaultHandler = "MonoDevelop.Commands.DeleteCurrentLayoutHandler"
+				_label = "_Delete Current Layout" />
 		<Command id = "MonoDevelop.Commands.ViewCommands.FullScreen"
 				defaultHandler = "MonoDevelop.Commands.FullScreenHandler"
 				_label = "_Full Screen" 
@@ -871,6 +874,7 @@
 				<CommandItem id = "MonoDevelop.Commands.ViewCommands.LayoutList" />
 				<SeparatorItem id = "ViewItemsSeparator" />
 				<CommandItem id = "MonoDevelop.Commands.ViewCommands.NewLayout" />
+				<CommandItem id = "MonoDevelop.Commands.ViewCommands.DeleteCurrentLayout" />
 			</ItemSet>
 			<SeparatorItem id = "ViewItemsSeparator2" />
 			<CommandItem id = "MonoDevelop.Commands.ViewCommands.FullScreen" />




More information about the Monodevelop-patches-list mailing list