[Monodevelop-patches-list] r2344 - trunk/MonoDevelop/Core/src/MonoDevelop.Dock
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Sun Mar 13 19:24:12 EST 2005
Author: jluke
Date: 2005-03-13 19:24:12 -0500 (Sun, 13 Mar 2005)
New Revision: 2344
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs
Log:
simplify usage of the placement stack a bit
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs 2005-03-13 23:53:22 UTC (rev 2343)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs 2005-03-14 00:24:12 UTC (rev 2344)
@@ -58,8 +58,8 @@
[Export]
public DockPlacement NextPlacement {
get {
- if (placementStack != null && placementStack.Count != 0)
- return (DockPlacement)placementStack.Pop ();
+ if (placementStack != null && placementStack.Count > 0)
+ return (DockPlacement) placementStack.Pop ();
return DockPlacement.Center;
}
set {
@@ -91,12 +91,7 @@
if (!(widget is DockItem))
return;
- // default position
- DockPlacement position = DockPlacement.Center;
- if (placementStack != null && placementStack.Count > 0)
- position = (DockPlacement) placementStack.Pop ();
-
- Dock ((DockItem)widget, position, null);
+ Dock ((DockItem)widget, NextPlacement, null);
}
public override void OnDetached (bool recursive)
@@ -231,7 +226,7 @@
// get a placement hint from the new host
if (newHost.ChildPlacement (host, ref pos))
- placementStack.Push (pos);
+ NextPlacement = pos;
else
Console.WriteLine ("Something weird happened while getting the child placement for {0} from parent {1}", host, newHost);
@@ -249,22 +244,39 @@
// controller with an initial placement of floating
if (newHost == null) {
newHost = this.Master.Controller;
- placementStack.Push (DockPlacement.Floating);
+ NextPlacement = DockPlacement.Floating;
}
if (newHost != null)
ConnectHost (newHost);
+
+ #if DEBUG
+ PrintPlacementStack ();
+ #endif
}
void OnHostDocked (object sender, DockedArgs a)
{
DockObject obj = sender as DockObject;
// see if the given position is compatible for the stack's top element
- if (sticky && placementStack != null) {
- DockPlacement pos = (DockPlacement) placementStack.Pop ();
+ if (!sticky && placementStack != null) {
+ DockPlacement pos = NextPlacement;
if (obj.ChildPlacement (a.Requestor, ref pos))
DoExcursion ();
}
+
+ #if DEBUG
+ PrintPlacementStack ();
+ #endif
}
+
+ #if DEBUG
+ void PrintPlacementStack ()
+ {
+ Console.WriteLine ("-- {0} count {1}", host.Name, placementStack.Count);
+ foreach (object o in placementStack.ToArray ())
+ Console.WriteLine (o);
+ }
+ #endif
}
}
More information about the Monodevelop-patches-list
mailing list