[Monodevelop-patches-list] r790 - in trunk/MonoDevelop/src: AddIns/DisplayBindings/SourceEditor/Gui AddIns/Misc/StartPage Main/Base/Commands Main/Base/Gui Main/Base/Gui/Workbench Main/Base/Gui/Workbench/Layouts

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Thu Feb 5 01:40:03 EST 2004


Author: tberman
Date: 2004-02-05 01:40:03 -0500 (Thu, 05 Feb 2004)
New Revision: 790

Modified:
   trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
   trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs
   trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
   trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchLayout.cs
   trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchWindow.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
Log:
adding a close button to the tabs to handle window closing.
also fixing that infinite resize out the side on the window.

its kinda ugly, we really need a better tabcontrol, but frig reimplementing
a gtk.notebook at this stage.


Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -150,7 +150,7 @@
 		public void InitializeFormatter()
 		{
 			IFormattingStrategy[] formater = (IFormattingStrategy[])(AddInTreeSingleton.AddInTree.GetTreeNode("/AddIns/DefaultTextEditor/Formater").BuildChildItems(this)).ToArray(typeof(IFormattingStrategy));
-			//Console.WriteLine("SET FORMATTER : " + formater[0]);
+			Console.WriteLine("SET FORMATTER : " + formater[0]);
 			if (formater != null && formater.Length > 0) {
 //					formater[0].Document = Document;
 				se.View.fmtr = formater[0];

Modified: trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -99,7 +99,7 @@
 		
 		void HandleCombineOpened(object sender, CombineEventArgs e)
 		{
-			WorkbenchWindow.CloseWindow(true);
+			WorkbenchWindow.CloseWindow(true, false, 0);
 		}
 		
 		void HtmlControlBeforeNavigate (object sender, OpenUriArgs e)

Modified: trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -56,7 +56,7 @@
 		public override void Run()
 		{
 			if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
-				WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false);
+				WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false, true, 0);
 			}
 		}
 	}

Modified: trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchLayout.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchLayout.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -71,7 +71,9 @@
 		/// Shows a new <see cref="IViewContent"/>.
 		/// </summary>
 		IWorkbenchWindow ShowView(IViewContent content);
-		
+
+		void RemoveTab (int pageNum);	
+
 		/// <summary>
 		/// Is called, when the workbench window which the user has into
 		/// the foreground (e.g. editable) changed to a new one.

Modified: trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchWindow.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchWindow.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Gui/IWorkbenchWindow.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -46,7 +46,7 @@
 		/// Closes the window, if force == true it closes the window
 		/// without ask, even the content is dirty.
 		/// </summary>
-		void CloseWindow(bool force);
+		void CloseWindow(bool force, bool fromMenu, int pageNum);
 		
 		/// <summary>
 		/// Brings this window to front and sets the user focus to this

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/DefaultWorkbench.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -236,7 +236,7 @@
 				ViewContentCollection fullList = new ViewContentCollection(workbenchContentCollection);
 				foreach (IViewContent content in fullList) {
 					IWorkbenchWindow window = content.WorkbenchWindow;
-					window.CloseWindow(false);
+					window.CloseWindow(false, true, 0);
 				}
 			} finally {
 				closeAll = false;
@@ -406,7 +406,7 @@
 			if (e.IsDirectory) {
 				foreach (IViewContent content in ViewContentCollection) {
 					if (content.ContentName.StartsWith(e.FileName)) {
-						content.WorkbenchWindow.CloseWindow(true);
+						content.WorkbenchWindow.CloseWindow(true, true, 0);
 					}
 				}
 			} else {
@@ -414,7 +414,7 @@
 					// WINDOWS DEPENDENCY : ToUpper
 					if (content.ContentName != null &&
 					    content.ContentName.ToUpper() == e.FileName.ToUpper()) {
-						content.WorkbenchWindow.CloseWindow(true);
+						content.WorkbenchWindow.CloseWindow(true, true, 0);
 						return;
 					}
 				}
@@ -483,7 +483,7 @@
 				while (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0) 
 				{
 					IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[0];
-					content.WorkbenchWindow.CloseWindow(false);
+					content.WorkbenchWindow.CloseWindow(false, true, 0);
 					if (WorkbenchSingleton.Workbench.ViewContentCollection.Contains(content)) 
 					{
 						return false;

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -79,6 +79,7 @@
 			
 			Gtk.VBox mainBox = new VBox (false, 2);
 			tabControl = new Notebook();
+			tabControl.Scrollable = true;
 			
 			Gtk.VBox vbox = new VBox (false, 0);
 			rootWidget = vbox;
@@ -369,7 +370,17 @@
 			}
 			
 			Label label = new Label(title);
-			tabControl.AppendPage (content.Control, label);
+			HBox hbox = new HBox (false, 0);
+			hbox.PackStart (label, false, false, 0);
+			Button btn = new Button ();
+			btn.Child = new Gtk.Image (Gtk.Stock.Close, Gtk.IconSize.Menu);
+			btn.Relief = ReliefStyle.None;
+			btn.RequestSize = new Size (16, 16);
+			btn.Clicked += new EventHandler (closeClicked);
+			
+			hbox.PackStart (btn, false, false, 0);
+			hbox.ShowAll ();
+			tabControl.AppendPage (content.Control, hbox);
 
 			SdiWorkspaceWindow sdiWorkspaceWindow = new SdiWorkspaceWindow(content, tabControl, label);
 
@@ -380,6 +391,26 @@
 			tabControl.ShowAll();
 			return sdiWorkspaceWindow;
 		}
+
+		void closeClicked (object o, EventArgs e)
+		{
+			int pageNum = -1;
+			Widget parent = ((Widget)o).Parent;
+			foreach (Widget child in tabControl.Children) {
+				if (tabControl.GetTabLabel (child) == parent) {
+					pageNum = tabControl.PageNum (child);
+					break;
+				}
+			}
+			if (pageNum != -1) {
+				((SdiWorkspaceWindow)_windows [pageNum]).CloseWindow (false, false, pageNum);
+			}
+		}
+
+		public void RemoveTab (int pageNum) {
+			tabControl.RemovePage (pageNum);
+			_windows.RemoveAt (pageNum);
+		}
 		
 		void ActiveMdiChanged(object sender, EventArgs e)
 		{

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs	2004-02-05 04:42:53 UTC (rev 789)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs	2004-02-05 06:40:03 UTC (rev 790)
@@ -217,7 +217,7 @@
 			content.BeforeSave         -= new EventHandler(BeforeSave);
 		}
 		
-		public void CloseWindow(bool force)
+		public void CloseWindow(bool force, bool fromMenu, int pageNum)
 		{
 			if (!force && ViewContent != null && ViewContent.IsDirty) {
 				ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
@@ -254,7 +254,12 @@
 						return;
 				}
 			}
-			tabControl.RemovePage (tabControl.CurrentPage);
+			//tabControl.RemovePage (tabControl.CurrentPage);
+			if (fromMenu == true) {
+				WorkbenchSingleton.Workbench.WorkbenchLayout.RemoveTab (tabControl.CurrentPage);
+			} else {
+				WorkbenchSingleton.Workbench.WorkbenchLayout.RemoveTab (pageNum);
+			}
 			OnWindowDeselected(EventArgs.Empty);
 			OnCloseEvent(null);
 		}




More information about the Monodevelop-patches-list mailing list