[Monodevelop-patches-list] r1785 - trunk/MonoDevelop/src/Libraries/Gdl
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sat Jun 19 12:09:18 EDT 2004
Author: jzwart
Date: 2004-06-19 12:09:18 -0400 (Sat, 19 Jun 2004)
New Revision: 1785
Modified:
trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs
Log:
Implement the DockMaster.Remove method. Simplify the GdlDockTest for now so we
can try and fix the Destroy () unref bug.
Modified: trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs 2004-06-19 05:07:23 UTC (rev 1784)
+++ trunk/MonoDevelop/src/Libraries/Gdl/Dock.cs 2004-06-19 16:09:18 UTC (rev 1785)
@@ -257,8 +257,10 @@
floating = false;
window = null;
}
+
if (xorGC != null)
xorGC = null;
+
base.OnDestroyed ();
}
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs 2004-06-19 05:07:23 UTC (rev 1784)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockMaster.cs 2004-06-19 16:09:18 UTC (rev 1785)
@@ -149,41 +149,40 @@
public void Remove (DockObject obj)
{
-#if false
if (obj == null)
return;
- if (obj is DockItem && ((DockItem)obj).HasGrip) {
+ /*if (obj is DockItem && ((DockItem)obj).HasGrip) {
int locked = Locked;
if (lockedItems.Contains (obj)) {
lockedItems.Remove (obj);
if (Locked != locked) {
- //g_object_notify (G_OBJECT (master /*this*/), "locked");
+ //g_object_notify (G_OBJECT (this), "locked");
}
}
if (unlockedItems.Contains (obj)) {
lockedItems.Remove (obj);
if (Locked != locked) {
- //g_object_notify (G_OBJECT( master /*this*/), "locked");
+ //g_object_notify (G_OBJECT (this), "locked");
}
}
- }
+ }*/
if (obj is Dock) {
- if (toplevelDocks.Contains (obj))
- toplevelDocks.Remove (obj);
+ toplevelDocks.Remove (obj);
+
if (obj == controller) {
- DockObject new_controller = null;
+ DockObject newController = null;
ArrayList reversed = toplevelDocks;
reversed.Reverse ();
foreach (DockObject item in reversed) {
if (!item.IsAutomatic) {
- new_controller = item;
+ newController = item;
break;
}
}
- if (new_controller != null) {
- controller = new_controller;
+ if (newController != null) {
+ controller = newController;
} else {
controller = null;
}
@@ -191,27 +190,21 @@
}
if (obj is DockItem) {
- DockItem dock_item = obj as DockItem;
- dock_item.DockItemDragBegin -= DragBegin;
- dock_item.DockItemDragEnd -= DragEnd;
- dock_item.DockItemMotion -= DragMotion;
+ DockItem item = obj as DockItem;
+ item.Detached -= OnItemDetached;
+ item.Docked -= OnItemDocked;
+ item.DockItemDragBegin -= OnDragBegin;
+ item.DockItemMotion -= OnDragMotion;
+ item.DockItemDragEnd -= OnDragEnd;
}
- /*PORT THIS:
- g_signal_handlers_disconnect_matched (object, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, master);*/
- if (obj.Name != null) {
- if (dockObjects.Contains (obj.Name)) {
- dockObjects.Remove (obj.Name);
- }
- }
+ if (obj.Name != null && dockObjects.Contains (obj.Name))
+ dockObjects.Remove (obj.Name);
- if (!obj.IsAutomatic) {
- if (idle_layout_changed_id == 0) {
- idle_layout_changed_id = 0; //g_idle_add (idle_emit_layout_changed);
- }
- }
-#endif
+ /* post a layout_changed emission if the item is not automatic
+ * (since it should be removed from the items model) */
+ if (!obj.IsAutomatic)
+ EmitLayoutChangedEvent ();
}
public DockObject GetObject (string name)
@@ -260,6 +253,7 @@
request.Applicant = item;
request.Target = item;
request.Position = DockPlacement.Floating;
+ request.Extra = IntPtr.Zero;
rectDrawn = false;
rectOwner = null;
@@ -308,8 +302,8 @@
Widget widget = GLib.Object.GetObject (window.UserData, false) as Widget;
while (widget != null && (!(widget is Dock) ||
(widget is DockObject && ((DockObject)widget).Master != this)))
- widget = widget.Parent;
-
+ widget = widget.Parent;
+
if (widget != null) {
int winW, winH, depth;
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs 2004-06-19 05:07:23 UTC (rev 1784)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockObject.cs 2004-06-19 16:09:18 UTC (rev 1785)
@@ -128,26 +128,28 @@
}
}
- private void ForeachDetach (Widget w)
+ protected override void OnDestroyed ()
{
- if (w is DockObject)
- ((DockObject)w).Detach (true);
- }
-
- /*protected override void OnDestroyed ()
- {
if (IsCompound) {
+ /* detach our dock object children if we have some, and even
+ if we are not attached, so they can get notification */
Freeze ();
- Foreach (new Gtk.Callback (ForeachDetach));
+ foreach (DockObject child in Children)
+ child.Detach (true);
reducePending = false;
Thaw ();
}
+
if (IsAttached)
+ /* detach ourselves */
Detach (false);
+
if (Master != null)
+ /* finally unbind us */
Unbind ();
+
base.OnDestroyed ();
- }*/
+ }
protected override void OnShown ()
{
Modified: trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs 2004-06-19 05:07:23 UTC (rev 1784)
+++ trunk/MonoDevelop/src/Libraries/Gdl/DockPaned.cs 2004-06-19 16:09:18 UTC (rev 1785)
@@ -175,8 +175,8 @@
Requisition my = PreferredSize;
/* Set docking indicator rectangle to the Dock size. */
- request.X = alloc.X + bw;
- request.Y = alloc.Y + bw;
+ request.X = bw;
+ request.Y = bw;
request.Width = alloc.Width - 2 * bw;
request.Height = alloc.Height - 2 * bw;
request.Target = this;
@@ -241,6 +241,9 @@
}
}
}
+
+ if (divider >= 0 && request.Position != DockPlacement.Center)
+ request.Extra = divider;
if (mayDock) {
/* adjust returned coordinates so they are
Modified: trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs 2004-06-19 05:07:23 UTC (rev 1784)
+++ trunk/MonoDevelop/src/Libraries/Gdl/GdlDockTest.cs 2004-06-19 16:09:18 UTC (rev 1785)
@@ -37,7 +37,8 @@
Gtk.Stock.Execute, DockItemBehavior.Normal);
di2.Add (new Button ("Button 2"));
dock.AddItem (di2, DockPlacement.Right);
-
+
+#if false
DockItem di3 = new DockItem ("item3", "Item #3 has accented characters",/* (áéíóúñ)",*/
Gtk.Stock.Convert, DockItemBehavior.Normal |
DockItemBehavior.CantClose);
@@ -63,6 +64,7 @@
di3.DockTo (di, DockPlacement.Top);
di2.DockTo (di3, DockPlacement.Right);
di2.DockTo (di3, DockPlacement.Left);
+#endif
di2.DockTo (null, DockPlacement.Floating);
box = new HBox (true, 5);
More information about the Monodevelop-patches-list
mailing list