[Monodevelop-patches-list] r2330 - trunk/MonoDevelop/Unused/Gdl

John Luke <jluke@cfl.rr.com> jluke at mono-cvs.ximian.com
Fri Mar 11 14:07:30 EST 2005


Author: jluke
Date: 2005-03-11 14:07:30 -0500 (Fri, 11 Mar 2005)
New Revision: 2330

Modified:
   trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs
   trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
   trunk/MonoDevelop/Unused/Gdl/TODO
Log:
add some comments for these two


Modified: trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs	2005-03-11 18:01:18 UTC (rev 2329)
+++ trunk/MonoDevelop/Unused/Gdl/DockNotebook.cs	2005-03-11 19:07:30 UTC (rev 2330)
@@ -40,6 +40,7 @@
 			Child = new Notebook ();
 			Child.Parent = this;
 			((Notebook)Child).TabPos = PositionType.Bottom;
+			// FIXME: enable these if we do a DockTabLabel
 			//((Notebook)Child).SwitchPage += new SwitchPageHandler (SwitchPageCb);
 			//((Notebook)Child).ButtonPressEvent += new ButtonPressEvent (ButtonPressCb);
 			//((Notebook)Child).ButtonReleaseEvent += new ButtonReleaseEvent (ButtonReleaseCb);
@@ -50,12 +51,15 @@
 		
 		protected void SwitchPageHandler (object o, SwitchPageArgs e)
 		{
-			//Does this code need to be ported at all?
+			// FIXME: port this if we do a DockTabLabel
 		}
 
 		protected override void OnDestroyed ()
 		{
+			// this first
 			base.OnDestroyed ();
+
+			// after that we can remove the GtkNotebook
 			if (Child != null) {
 				Child.Unparent ();
 				Child = null;

Modified: trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs	2005-03-11 18:01:18 UTC (rev 2329)
+++ trunk/MonoDevelop/Unused/Gdl/DockPlaceholder.cs	2005-03-11 19:07:30 UTC (rev 2330)
@@ -12,8 +12,6 @@
 		private DockObject host;
 		private bool sticky;
 		private ArrayList placementStack;
-		private int hostDetachHandler;
-		private int hostDockHandler;
 
 		protected DockPlaceholder (IntPtr raw) : base (raw) { }
 		
@@ -21,7 +19,8 @@
 					DockPlacement position, bool sticky)
 		{
 			WidgetFlags |= WidgetFlags.NoWindow;
-			WidgetFlags &= ~WidgetFlags.CanFocus;
+			WidgetFlags &= ~(WidgetFlags.CanFocus);
+			DockObjectFlags &= ~(DockObjectFlags.Automatic);
 
 			Sticky = sticky;
 			Name = name;
@@ -33,9 +32,12 @@
 					position = DockPlacement.Center;
 
 				NextPlacement = position;
+
+				//the top placement will be consumed by the toplevel dock, so add a dummy placement
 				if (obj is Dock)
 					NextPlacement = DockPlacement.Center;
 
+				// try a recursion
 				DoExcursion ();
 			}
 		}
@@ -90,37 +92,56 @@
 			if (!(widget is DockItem))
 				return;
 
-			Dock ((DockItem)widget, NextPlacement, null);
+			// default position
+			DockPlacement position = DockPlacement.Center;
+			if (placementStack != null && placementStack.Count > 0)
+				position = (DockPlacement) placementStack[0];
+
+			Dock ((DockItem)widget, position, null);
 		}
 		
 		public override void OnDetached (bool recursive)
 		{
+			// disconnect handlers
 			DisconnectHost ();
+
+			// free the placement stack
 			placementStack = null;
+
 			DockObjectFlags &= ~(DockObjectFlags.Attached);
 		}
 		
 		public override void OnReduce ()
 		{
+			// placeholders are not reduced
 		}
 		
 		public override void OnDocked (DockObject requestor, DockPlacement position, object data)
 		{
 			if (host != null) {
+				// we simply act as a placeholder for our host
 				host.Dock (requestor, position, data);
 			} else {
 				if (!IsBound) {
 					Console.WriteLine ("Attempt to dock a dock object to an unbound placeholder");
 					return;
 				}
+				// dock the item as a floating of the controller
 				Master.Controller.Dock (requestor, DockPlacement.Floating, null);
 			}
 		}
 		
 		public override void OnPresent (DockObject child)
 		{
+			// do nothing
 		}
 		
+		/*
+		* Tries to shrink the placement stack by examining the host's
+		* children and see if any of them matches the placement which is at
+		* the top of the stack.  If this is the case, it tries again with the
+		* new host.
+		*/
 		public void DoExcursion ()
 		{
 			if (host != null && !Sticky && placementStack != null && placementStack.Count > 0 && host.IsCompound) {
@@ -134,10 +155,14 @@
 					
 					host.ChildPlacement (item, ref pos);
 					if (pos == stack_pos) {
+						// remove the stack position
 						placementStack.RemoveAt (0);
 						DisconnectHost ();
+
+						// connect to the new host
 						ConnectHost (item);
 						
+						// recurse ...
 						if (!item.InReflow)
 							DoExcursion ();
 						break;
@@ -148,16 +173,24 @@
 		
 		private void DisconnectHost ()
 		{
-			//Disconnect from host detach and dock events here.
+			if (host == null)
+				return;
+
+			//this.Detach -= OnDetached;
+			//this.Dock -= OnDock;
+
 			host = null;
 		}
 		
-		private void ConnectHost (DockObject new_host)
+		private void ConnectHost (DockObject newHost)
 		{
 			if (host != null)
 				DisconnectHost ();
-			host = new_host;
-			//Connect to host detach and dock events here.
+
+			host = newHost;
+
+			//this.Detach += OnDetached;
+			//this.Dock += OnDock;
 		}
 		
 		public void Attach (DockObject objekt)
@@ -165,6 +198,7 @@
 			if (objekt == null)
 				return;
 			
+			// object binding
 			if (!IsBound)
 				Bind(objekt.Master);
 			
@@ -173,6 +207,7 @@
 			
 			Freeze ();
 			
+			// detach from previous host first
 			if (host != null)
 				Detach (false);
 			

Modified: trunk/MonoDevelop/Unused/Gdl/TODO
===================================================================
--- trunk/MonoDevelop/Unused/Gdl/TODO	2005-03-11 18:01:18 UTC (rev 2329)
+++ trunk/MonoDevelop/Unused/Gdl/TODO	2005-03-11 19:07:30 UTC (rev 2330)
@@ -2,6 +2,10 @@
  - fix notebook.Position after
  - placeholders in layout store/restore
  - docs
+ - when we can use pango 1.6, use the built-in ellipsizing
+ - audit event emitting frequency
+ - use less ArrayLists
 
 potential new features
  - restore size/position on de-iconify?
+ - autohide, bug 54686




More information about the Monodevelop-patches-list mailing list