[Monodevelop-patches-list] r2343 - trunk/MonoDevelop/Core/src/MonoDevelop.Dock
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Sun Mar 13 18:53:22 EST 2005
Author: jluke
Date: 2005-03-13 18:53:22 -0500 (Sun, 13 Mar 2005)
New Revision: 2343
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockBar.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockMaster.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockNotebook.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockObject.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Makefile.am
Log:
a step towards retoring position correctly
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/ChangeLog 2005-03-13 23:53:22 UTC (rev 2343)
@@ -1,5 +1,15 @@
2005-03-13 John Luke <john.luke at gmail.com>
+ * DockNotebook.cs: not Automatic
+ * DockPlaceholder.cs: port detach_cb and dock_cb
+ is Automatic
+ use Stack instead of ArrayList
+ * DockMaster.cs: restore IsAutomatic code
+ * DockItem.cs: not Automatic
+ * DockObject.cs: small null check fix
+
+2005-03-13 John Luke <john.luke at gmail.com>
+
* DockPaned.cs: fix little orientaion bug when
loading the layout
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockBar.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockBar.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockBar.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -78,7 +78,7 @@
// item.DockBarButton = null;
}
else {
- Console.WriteLine ("WARNING: Item has not been added to the dockbar");
+ Console.WriteLine ("WARNING: {0} has not been added to the dockbar", item.Name);
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockItem.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -48,6 +48,7 @@
{
// remove NoWindow flag
WidgetFlags &= ~(WidgetFlags.NoWindow);
+ DockObjectFlags &= ~(DockObjectFlags.Automatic);
if (HasGrip) {
grip = new DockItemGrip (this);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockMaster.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockMaster.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockMaster.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -114,8 +114,7 @@
if (obj == null)
return;
- // FIXME: this is possibly wrong
- //if (!obj.IsAutomatic) {
+ if (!obj.IsAutomatic) {
/* create a name for the object if it doesn't have one */
if (obj.Name == null)
obj.Name = "__dock_" + number++;
@@ -125,7 +124,7 @@
Console.WriteLine ("Unable to add object, name \"{0}\" taken", obj.Name);
else
dockObjects.Add (obj.Name, obj);
- //}
+ }
if (obj is Dock) {
/* if this is the first toplevel we are adding, name it controller */
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockNotebook.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockNotebook.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockNotebook.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -46,7 +46,7 @@
//((Notebook)Child).ButtonReleaseEvent += new ButtonReleaseEvent (ButtonReleaseCb);
((Notebook)Child).Scrollable = true;
Child.Show ();
- DockObjectFlags &= DockObjectFlags.Automatic;
+ DockObjectFlags &= ~(DockObjectFlags.Automatic);
}
protected void SwitchPageHandler (object o, SwitchPageArgs e)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockObject.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockObject.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockObject.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -216,7 +216,7 @@
element.SetAttribute (p.Name.ToLower (), p.GetValue (this, null).ToString ().ToLower ());
else if (p.PropertyType == typeof (bool))
element.SetAttribute (p.Name.ToLower (), ((bool) p.GetValue (this, null)) ? "yes" : "no");
- else
+ else if (p.GetValue (this, null) != null)
element.SetAttribute (p.Name.ToLower (), p.GetValue (this, null).ToString ());
}
return element;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/DockPlaceholder.cs 2005-03-13 23:53:22 UTC (rev 2343)
@@ -11,7 +11,7 @@
{
private DockObject host;
private bool sticky;
- private ArrayList placementStack;
+ private Stack placementStack;
protected DockPlaceholder (IntPtr raw) : base (raw) { }
@@ -20,7 +20,6 @@
{
WidgetFlags |= WidgetFlags.NoWindow;
WidgetFlags &= ~(WidgetFlags.CanFocus);
- DockObjectFlags &= ~(DockObjectFlags.Automatic);
Sticky = sticky;
Name = name;
@@ -60,13 +59,13 @@
public DockPlacement NextPlacement {
get {
if (placementStack != null && placementStack.Count != 0)
- return (DockPlacement)placementStack[0];
+ return (DockPlacement)placementStack.Pop ();
return DockPlacement.Center;
}
set {
if (placementStack == null)
- placementStack = new ArrayList ();
- placementStack.Insert (0, value);
+ placementStack = new Stack ();
+ placementStack.Push (value);
}
}
@@ -95,7 +94,7 @@
// default position
DockPlacement position = DockPlacement.Center;
if (placementStack != null && placementStack.Count > 0)
- position = (DockPlacement) placementStack[0];
+ position = (DockPlacement) placementStack.Pop ();
Dock ((DockItem)widget, position, null);
}
@@ -156,7 +155,8 @@
host.ChildPlacement (item, ref pos);
if (pos == stack_pos) {
// remove the stack position
- placementStack.RemoveAt (0);
+ if (placementStack.Count > 1)
+ placementStack.Pop ();
DisconnectHost ();
// connect to the new host
@@ -176,8 +176,8 @@
if (host == null)
return;
- //this.Detach -= OnDetached;
- //this.Dock -= OnDock;
+ host.Detached -= OnHostDetached;
+ host.Docked -= OnHostDocked;
host = null;
}
@@ -189,8 +189,8 @@
host = newHost;
- //this.Detach += OnDetached;
- //this.Dock += OnDock;
+ host.Detached += OnHostDetached;
+ host.Docked += OnHostDocked;
}
public void Attach (DockObject objekt)
@@ -216,5 +216,55 @@
DockObjectFlags |= DockObjectFlags.Attached;
Thaw ();
}
+
+ void OnHostDetached (object sender, DetachedArgs a)
+ {
+ // skip sticky objects
+ if (sticky)
+ return;
+
+ // go up in the hierarchy
+ DockObject newHost = host.ParentObject;
+
+ while (newHost != null) {
+ DockPlacement pos = DockPlacement.None;
+
+ // get a placement hint from the new host
+ if (newHost.ChildPlacement (host, ref pos))
+ placementStack.Push (pos);
+ else
+ Console.WriteLine ("Something weird happened while getting the child placement for {0} from parent {1}", host, newHost);
+
+ // we found a "stable" dock object
+ if (newHost.InDetach)
+ break;
+
+ newHost = newHost.ParentObject;
+ }
+
+ // disconnect host
+ DisconnectHost ();
+
+ // the toplevel was detached: we attach ourselves to the
+ // controller with an initial placement of floating
+ if (newHost == null) {
+ newHost = this.Master.Controller;
+ placementStack.Push (DockPlacement.Floating);
+ }
+
+ if (newHost != null)
+ ConnectHost (newHost);
+ }
+
+ 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 (obj.ChildPlacement (a.Requestor, ref pos))
+ DoExcursion ();
+ }
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Makefile.am 2005-03-13 22:05:18 UTC (rev 2342)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Dock/Makefile.am 2005-03-13 23:53:22 UTC (rev 2343)
@@ -50,5 +50,5 @@
$(CSC) -out:$@ -r:$(DOCK) -pkg:gtk-sharp-2.0 $(TEST_FILES) -codepage:utf8
run-test: $(TEST)
- $(RUNTIME) $(TEST)
+ MONO_PATH=../../../build/bin $(RUNTIME) $(TEST)
More information about the Monodevelop-patches-list
mailing list