Author: danw
Date: 2005-03-24 11:07:36 -0500 (Thu, 24 Mar 2005)
New Revision: 42221

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/DND.cs
   trunk/stetic/libstetic/Placeholder.cs
   trunk/stetic/libstetic/WidgetBox.cs
   trunk/stetic/libstetic/WidgetSite.cs
   trunk/stetic/libstetic/wrapper/Box.cs
   trunk/stetic/libstetic/wrapper/Button.cs
   trunk/stetic/libstetic/wrapper/Container.cs
   trunk/stetic/libstetic/wrapper/Table.cs
   trunk/stetic/stetic/Glade.cs
   trunk/stetic/stetic/Project.cs
   trunk/stetic/stetic/PropertyGrid.cs
Log:
        More code migration out of WidgetSite

        * libstetic/DND.cs (DragWidget): public accessor for dragWidget

        * libstetic/Placeholder.cs (Mimic, UnMimic): makes a Placeholder
        mimic the size and expandability of a given WidgetSite. (Replaces
        the old "PseudoOccupied" mode of WidgetSite).

        * libstetic/WidgetSite.cs (Contents): killed, was redundant with
        "Child".
        (ShapeChanged): gone, replaced by ChildContentsChanged on
        Wrapper.Container.
        (Occupancy, Empty): gone. pseudo-occupancy is now handled by
        Placeholder; all WidgetSites are now always actually occupied.
        (OnMotionNotifyEvent, OnDragDataDelete, OnDragEnd): handled by
        Wrapper.Container now
        
        * libstetic/wrapper/Button.cs: s/site.Contents/site.Child/

        * libstetic/wrapper/Box.cs (DoSync): do autosizing here
        (ReplaceChild): kill off the empty-placeholder-killing code for now

        * libstetic/wrapper/Container.cs (Freeze, Thaw, Sync, DoSync):
        move Freeze/Thaw here from Table, change the overridable method to
        "DoSync" and make Sync check frozenness and then call DoSync.
        (CreateWidgetSite): Set up DND on the site and if it contains a
        container, connect to its ContentsChanged method (to replace the
        old WidgetSite.ShapeChanged method).
        (SiteMotionNotify, PlaceholderDragEnd): handle DND.
        (ChildContentsChanged): Replaces SiteShapeChanged;
        
        * stetic/Glade.cs: 
        * stetic/Project.cs: 
        * stetic/PropertyGrid.cs: s/site.Contents/site.Child/


Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/ChangeLog      2005-03-24 16:07:36 UTC (rev 42221)
@@ -1,3 +1,40 @@
+2005-03-24  Dan Winship  <[EMAIL PROTECTED]>
+
+       More code migration out of WidgetSite
+
+       * libstetic/DND.cs (DragWidget): public accessor for dragWidget
+
+       * libstetic/Placeholder.cs (Mimic, UnMimic): makes a Placeholder
+       mimic the size and expandability of a given WidgetSite. (Replaces
+       the old "PseudoOccupied" mode of WidgetSite).
+
+       * libstetic/WidgetSite.cs (Contents): killed, was redundant with
+       "Child".
+       (ShapeChanged): gone, replaced by ChildContentsChanged on
+       Wrapper.Container.
+       (Occupancy, Empty): gone. pseudo-occupancy is now handled by
+       Placeholder; all WidgetSites are now always actually occupied.
+       (OnMotionNotifyEvent, OnDragDataDelete, OnDragEnd): handled by
+       Wrapper.Container now
+       
+       * libstetic/wrapper/Button.cs: s/site.Contents/site.Child/
+
+       * libstetic/wrapper/Box.cs (DoSync): do autosizing here
+       (ReplaceChild): kill off the empty-placeholder-killing code for now
+
+       * libstetic/wrapper/Container.cs (Freeze, Thaw, Sync, DoSync):
+       move Freeze/Thaw here from Table, change the overridable method to
+       "DoSync" and make Sync check frozenness and then call DoSync.
+       (CreateWidgetSite): Set up DND on the site and if it contains a
+       container, connect to its ContentsChanged method (to replace the
+       old WidgetSite.ShapeChanged method).
+       (SiteMotionNotify, PlaceholderDragEnd): handle DND.
+       (ChildContentsChanged): Replaces SiteShapeChanged;
+       
+       * stetic/Glade.cs: 
+       * stetic/Project.cs: 
+       * stetic/PropertyGrid.cs: s/site.Contents/site.Child/
+
 2005-03-23  Dan Winship  <[EMAIL PROTECTED]>
 
        Move IWidgetSite and WindowSite interfaces to

Modified: trunk/stetic/libstetic/DND.cs
===================================================================
--- trunk/stetic/libstetic/DND.cs       2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/libstetic/DND.cs       2005-03-24 16:07:36 UTC (rev 42221)
@@ -44,7 +44,7 @@
                        Gtk.Drag.DestUnset (dest);
                }
 
-               static Gtk.Widget clickWidget;
+               static Gtk.Widget dragWidget;
                static int clickX, clickY;
 
                [GLib.ConnectBefore]
@@ -52,7 +52,7 @@
                {
                        Gdk.EventButton evt = args.Event;
                        if (evt.Button == 1 && evt.Type == 
Gdk.EventType.ButtonPress) {
-                               clickWidget = obj as Gtk.Widget;
+                               dragWidget = obj as Gtk.Widget;
                                clickX = (int)evt.XRoot;
                                clickY = (int)evt.YRoot;
                        }
@@ -64,13 +64,11 @@
                {
                        if ((evt.State & Gdk.ModifierType.Button1Mask) == 0)
                                return false;
-                       if (source != clickWidget)
+                       if (source != dragWidget)
                                return false;
                        return Gtk.Drag.CheckThreshold (source, clickX, clickY, 
(int)evt.XRoot, (int)evt.YRoot);
                }
 
-               static Gtk.Widget dragWidget;
-
                // Drag function for non-automatic sources, called from 
MotionNotifyEvent
                public static void Drag (Gtk.Widget source, Gdk.EventMotion 
evt, Gtk.Widget dragWidget)
                {
@@ -115,6 +113,12 @@
                        source.DragEnd += DragEnded;
                }
 
+               public static Gtk.Widget DragWidget {
+                       get {
+                               return dragWidget;
+                       }
+               }
+
                // Call this from a DragDrop event to receive the dragged widget
                public static Gtk.Widget Drop (Gdk.DragContext ctx, uint time)
                {

Modified: trunk/stetic/libstetic/Placeholder.cs
===================================================================
--- trunk/stetic/libstetic/Placeholder.cs       2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/Placeholder.cs       2005-03-24 16:07:36 UTC (rev 
42221)
@@ -72,15 +72,31 @@
                        return true;
                }
 
+               public void Mimic (WidgetSite site)
+               {
+                       Gdk.Rectangle alloc = site.Allocation;
+                       SetSizeRequest (alloc.Width, alloc.Height);
+                       hexpandable = site.HExpandable;
+                       vexpandable = site.VExpandable;
+               }
+
+               public void UnMimic ()
+               {
+                       SetSizeRequest (-1, -1);
+                       hexpandable = vexpandable = true;
+               }
+
+               bool hexpandable = true;
                public override bool HExpandable {
                        get {
-                               return true;
+                               return hexpandable;
                        }
                }
 
+               bool vexpandable = true;
                public override bool VExpandable {
                        get {
-                               return true;
+                               return vexpandable;
                        }
                }
        }

Modified: trunk/stetic/libstetic/WidgetBox.cs
===================================================================
--- trunk/stetic/libstetic/WidgetBox.cs 2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/libstetic/WidgetBox.cs 2005-03-24 16:07:36 UTC (rev 42221)
@@ -26,7 +26,7 @@
                public abstract bool HExpandable { get; }
                public abstract bool VExpandable { get; }
 
-               protected Gdk.Window HandleWindow;
+               public Gdk.Window HandleWindow;
                bool showHandles;
                protected bool ShowHandles {
                        get { return showHandles; }
@@ -123,7 +123,7 @@
                protected override void OnSizeRequested (ref Requisition req)
                {
                        if (Child == null)
-                               req.Width = req.Height = 0;
+                               req.Width = req.Height = 10;
                        else
                                req = Child.SizeRequest ();
                }
@@ -143,20 +143,6 @@
                        }
                }
 
-               static private string[] placeholder_xpm = {
-                       "8 8 2 1",
-                       "  c #bbbbbb",
-                       ". c #d6d6d6",
-                       "   ..   ",
-                       "  .  .  ",
-                       " .    . ",
-                       ".      .",
-                       ".      .",
-                       " .    . ",
-                       "  .  .  ",
-                       "   ..   "
-               };
-
                protected Gdk.Window NewWindow (Gdk.Window parent, 
Gdk.WindowClass wclass)
                {
                        WindowAttr attributes;

Modified: trunk/stetic/libstetic/WidgetSite.cs
===================================================================
--- trunk/stetic/libstetic/WidgetSite.cs        2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/WidgetSite.cs        2005-03-24 16:07:36 UTC (rev 
42221)
@@ -5,52 +5,13 @@
 
 namespace Stetic {
 
-       public delegate void ChangedHandler (WidgetSite site);
-
        public class WidgetSite : WidgetBox {
 
                public WidgetSite (Widget child)
                {
-                       DND.SourceSet (this, false);
-
                        Add (child);
                }
 
-               public Widget Contents {
-                       get {
-                               return Child;
-                       }
-               }
-
-               public event ChangedHandler ShapeChanged;
-
-               private void ChildContentsChanged (Stetic.Wrapper.Container 
container)
-               {
-                       if (ShapeChanged != null)
-                               ShapeChanged (this);
-               }
-
-               protected override void OnAdded (Widget child)
-               {
-                       base.OnAdded (child);
-                       Occupancy = SiteOccupancy.Occupied;
-
-                       Stetic.Wrapper.Container container = 
Stetic.Wrapper.Container.Lookup (child);
-                       if (container != null)
-                               container.ContentsChanged += 
ChildContentsChanged;
-               }
-
-               protected override void OnRemoved (Widget w)
-               {
-                       Stetic.Wrapper.Container container = 
Stetic.Wrapper.Container.Lookup (w);
-                       if (container != null)
-                               container.ContentsChanged -= 
ChildContentsChanged;
-
-                       base.OnRemoved (w);
-                       if (Occupancy == SiteOccupancy.Occupied)
-                               EmitEmpty ();
-               }
-
                public override bool Internal {
                        get {
                                return base.Internal;
@@ -64,66 +25,17 @@
                        }
                }
 
-               public enum SiteOccupancy { Occupied, PseudoOccupied };
-
-               private SiteOccupancy state;
-               private SiteOccupancy Occupancy {
-                       get { return state; }
-                       set {
-                               state = value;
-                               switch (state) {
-                               case SiteOccupancy.Occupied:
-                                       SetSizeRequest (-1, -1);
-                                       if (faults != null && faults.Count > 0)
-                                               DND.DestSet (this, false);
-                                       else
-                                               DND.DestUnset (this);
-                                       break;
-
-                               case SiteOccupancy.PseudoOccupied:
-                                       SetSizeRequest 
(Child.ChildRequisition.Width,
-                                                       
Child.ChildRequisition.Height);
-                                       DND.DestSet (this, true);
-                                       break;
-                               }
-                       }
-               }
-
-               public event ChangedHandler Empty;
-
-               void EmitEmpty ()
-               {
-                       if (Empty != null)
-                               Empty (this);
-               }
-
                public override bool HExpandable {
                        get {
-                               Stetic.Wrapper.Widget child;
-                               if (Occupancy == SiteOccupancy.PseudoOccupied)
-                                       child = Stetic.Wrapper.Widget.Lookup 
(dragWidget);
-                               else
-                                       child = Stetic.Wrapper.Widget.Lookup 
(Child);
-
-                               if (child != null)
-                                       return child.HExpandable;
-                               else
-                                       return false;
+                               Stetic.Wrapper.Widget child = 
Stetic.Wrapper.Widget.Lookup (Child);
+                               return child.HExpandable;
                        }
                }
 
                public override bool VExpandable {
                        get {
-                               Stetic.Wrapper.Widget child;
-                               if (Occupancy == SiteOccupancy.PseudoOccupied)
-                                       child = Stetic.Wrapper.Widget.Lookup 
(dragWidget);
-                               else
-                                       child = Stetic.Wrapper.Widget.Lookup 
(Child);
-
-                               if (child != null)
-                                       return child.VExpandable;
-                               else
-                                       return false;
+                               Stetic.Wrapper.Widget child = 
Stetic.Wrapper.Widget.Lookup (Child);
+                               return child.VExpandable;
                        }
                }
 
@@ -152,8 +64,7 @@
                                        DND.DragBegin += ShowFaults;
                                        DND.DragEnd += HideFaults;
                                }
-                               if (Occupancy == SiteOccupancy.Occupied)
-                                       DND.DestSet (this, false);
+                               DND.DestSet (this, false);
                        }
 
                        faults[id] = win;
@@ -251,8 +162,7 @@
                                faults.Clear ();
                                hfaults.Clear ();
                        }
-                       if (Occupancy == SiteOccupancy.Occupied)
-                               DND.DestUnset (this);
+                       DND.DestUnset (this);
                }
 
                void ShowFaults ()
@@ -343,26 +253,6 @@
                        }
                }
 
-               Widget dragWidget;
-
-               protected override bool OnMotionNotifyEvent (Gdk.EventMotion 
evt)
-               {
-                       if (evt.Window != HandleWindow)
-                               return true;
-                       if (!DND.CanDrag (this, evt))
-                               return true;
-
-                       dragWidget = Child;
-                       if (dragWidget == null)
-                               return true;
-
-                       Occupancy = SiteOccupancy.PseudoOccupied;
-                       Remove (dragWidget);
-
-                       DND.Drag (this, evt, dragWidget);
-                       return false;
-               }
-
                public delegate void DropOnHandler (Widget w, object faultId);
                public event DropOnHandler DropOn;
 
@@ -391,42 +281,9 @@
                        return true;
                }
 
-               protected override void OnDragDataDelete (DragContext ctx)
-               {
-                       dragWidget = null;
-               }
-
-               protected override void OnDragEnd (DragContext ctx)
-               {
-                       if (dragWidget != null) {
-                               Container parent;
-
-                               parent = dragWidget.Parent as Container;
-                               if (parent != null)
-                                       parent.Remove (dragWidget);
-                               Drop (dragWidget, -1, -1);
-                               dragWidget = null;
-                       } else if (Child == null)
-                               EmitEmpty ();
-               }
-
-               protected override bool OnKeyReleaseEvent (Gdk.EventKey evt)
-               {
-                       if (evt.Key == Gdk.Key.Delete) {
-                               if (Child != null) {
-                                       Child.Destroy ();
-                                       EmitEmpty ();
-                               }
-                               return true;
-                       }
-                       return false;
-               }
-
                public override string ToString ()
                {
-                       if (Child == null)
-                               return "[Empty WidgetSite " + 
GetHashCode().ToString() + "]";
-                       else if (Child.Name == null)
+                       if (Child.Name == null)
                                return "[WidgetSite " + 
GetHashCode().ToString() + ": " + Child.ToString() + " " + 
Child.GetHashCode().ToString() + "]";
                        else
                                return "[WidgetSite " + 
GetHashCode().ToString() + ": " + Child.ToString() + " '" + Child.Name + "' " + 
Child.GetHashCode().ToString() + "]";

Modified: trunk/stetic/libstetic/wrapper/Box.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Box.cs       2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/wrapper/Box.cs       2005-03-24 16:07:36 UTC (rev 
42221)
@@ -37,7 +37,7 @@
                        }
                }
 
-               protected override void Sync ()
+               protected override void DoSync ()
                {
                        WidgetSite site = box.Parent as WidgetSite;
                        if (site == null)
@@ -52,11 +52,22 @@
                        WidgetSite[] sorted = new WidgetSite[children.Length];
 
                        foreach (Gtk.Widget child in children) {
-                               WidgetSite childsite = child as WidgetSite;
-                               if (childsite == null || childsite.Child == 
null)
+                               WidgetBox wbox = child as WidgetBox;
+                               if (wbox == null)
                                        continue;
+
                                Gtk.Box.BoxChild bc = box[child] as 
Gtk.Box.BoxChild;
-                               sorted[bc.Position] = childsite;
+                               if (AutoSize[wbox]) {
+                                       bool exp = (this is HBox) ? 
wbox.HExpandable : wbox.VExpandable;
+                                       if (bc.Expand != exp)
+                                               bc.Expand = exp;
+                                       if (bc.Fill != exp)
+                                               bc.Fill = exp;
+                               }
+
+                               WidgetSite childsite = child as WidgetSite;
+                               if (childsite != null)
+                                       sorted[bc.Position] = childsite;
                        }
 
                        if (this is HBox || this is HButtonBox) {
@@ -111,23 +122,26 @@
                        EmitContentsChanged ();
                }
 
-               protected override void SiteShapeChanged (WidgetSite site) {
-                       if (AutoSize[site]) {
-                               Gtk.Box.BoxChild bc = ((Gtk.Box)Wrapped)[site] 
as Gtk.Box.BoxChild;
+               protected override void ChildContentsChanged (Container child) {
+                       WidgetSite site = child.Wrapped.Parent as WidgetSite;
+
+                       if (site != null && AutoSize[site]) {
+                               Gtk.Box.BoxChild bc = box[site] as 
Gtk.Box.BoxChild;
                                bc.Expand = bc.Fill = (this is HBox) ? 
site.HExpandable : site.VExpandable;
                        }
-                       base.SiteShapeChanged (site);
+                       base.ChildContentsChanged (child);
                }
 
                protected override void ReplaceChild (Gtk.Widget oldChild, 
Gtk.Widget newChild)
                {
-                       if (newChild is Placeholder)
-                               newChild.Destroy ();
-                       else
-                               base.ReplaceChild (oldChild, newChild);
+                       base.ReplaceChild (oldChild, newChild);
 
-                       if (newChild is WidgetSite)
-                               SiteShapeChanged ((WidgetSite)newChild);
+                       WidgetSite newSite = newChild as WidgetSite;
+                       if (newSite != null) {
+                               Container container = 
Stetic.Wrapper.Container.Lookup (newSite.Child);
+                               if (container != null)
+                                       ChildContentsChanged (container);
+                       }
                }
 
                void box_ParentSet (object obj, Gtk.ParentSetArgs args)
@@ -147,6 +161,7 @@
                void DropOn (Gtk.Widget w, object faultId)
                {
                        WidgetSite site = CreateWidgetSite (w);
+                       AutoSize[site] = true;
                        box.PackStart (site);
                        box.ReorderChild (site, (int)faultId);
                        EmitContentsChanged ();

Modified: trunk/stetic/libstetic/wrapper/Button.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Button.cs    2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/wrapper/Button.cs    2005-03-24 16:07:36 UTC (rev 
42221)
@@ -89,12 +89,12 @@
                        stetic.GladeImportComplete -= FixupGladeChildren;
 
                        WidgetSite site = button.Child as WidgetSite;
-                       Gtk.Alignment alignment = (site == null) ? null : 
site.Contents as Gtk.Alignment;
+                       Gtk.Alignment alignment = (site == null) ? null : 
site.Child as Gtk.Alignment;
                        if (alignment == null)
                                return;
 
                        site = alignment.Child as WidgetSite;
-                       Gtk.HBox box = (site == null) ? null : site.Contents as 
Gtk.HBox;
+                       Gtk.HBox box = (site == null) ? null : site.Child as 
Gtk.HBox;
                        if (box == null)
                                return;
 
@@ -103,9 +103,9 @@
                                return;
 
                        site = children[0] as WidgetSite;
-                       Gtk.Image image = (site == null) ? null : site.Contents 
as Gtk.Image;
+                       Gtk.Image image = (site == null) ? null : site.Child as 
Gtk.Image;
                        site = children[1] as WidgetSite;
-                       Gtk.Label label = (site == null) ? null : site.Contents 
as Gtk.Label;
+                       Gtk.Label label = (site == null) ? null : site.Child as 
Gtk.Label;
                        if (image == null || label == null)
                                return;
                        Stetic.Wrapper.Image iwrap = 
Stetic.ObjectWrapper.Lookup (image) as Stetic.Wrapper.Image;

Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2005-03-24 16:07:36 UTC (rev 
42221)
@@ -29,11 +29,32 @@
                        } while (type != typeof (Stetic.Wrapper.Container));
                }
 
-               protected virtual void Sync ()
+               int freeze;
+               protected void Freeze ()
                {
+                       freeze++;
+               }
+
+               protected void Thaw ()
+               {
+                       if (--freeze == 0)
+                               Sync ();
+               }
+
+               protected virtual void DoSync ()
+               {
                        ;
                }
 
+               protected void Sync ()
+               {
+                       if (freeze > 0)
+                               return;
+                       freeze = 1;
+                       DoSync ();
+                       freeze = 0;
+               }
+
                Gtk.Container container {
                        get {
                                return (Gtk.Container)Wrapped;
@@ -171,26 +192,45 @@
                protected override WidgetSite CreateWidgetSite (Gtk.Widget w)
                {
                        WidgetSite site = base.CreateWidgetSite (w);
-                       site.ShapeChanged += SiteShapeChanged;
-                       site.Empty += SiteEmpty;
+                       site.MotionNotifyEvent += SiteMotionNotify;
+                       DND.SourceSet (site, false);
+
+                       Container childWrapper = Lookup (w);
+                       if (childWrapper != null)
+                               childWrapper.ContentsChanged += 
ChildContentsChanged;
+
                        return site;
                }
 
+               void SiteMotionNotify (object obj, Gtk.MotionNotifyEventArgs 
args)
+               {
+                       WidgetSite site = obj as WidgetSite;
+
+                       if (args.Event.Window != site.HandleWindow ||
+                           !DND.CanDrag (site, args.Event)) {
+                               args.RetVal = true;
+                               return;
+                       }
+
+                       Placeholder ph = CreatePlaceholder ();
+                       ph.Mimic (site);
+                       ReplaceChild (site, ph);
+
+                       Gtk.Widget dragWidget = site.Child;
+                       site.Remove (dragWidget);
+                       site.Destroy ();
+                       DND.Drag (ph, args.Event, dragWidget);
+               }
+
                protected override Placeholder CreatePlaceholder ()
                {
                        Placeholder ph = base.CreatePlaceholder ();
                        ph.Drop += PlaceholderDrop;
+                       ph.DragEnd += PlaceholderDragEnd;
                        AutoSize[ph] = true;
                        return ph;
                }
 
-               void SiteEmpty (WidgetSite site)
-               {
-                       ReplaceChild (site, CreatePlaceholder ());
-                       site.Destroy ();
-                       EmitContentsChanged ();
-               }
-
                void PlaceholderDrop (Placeholder ph, Gtk.Widget dropped)
                {
                        WidgetSite site = CreateWidgetSite (dropped);
@@ -202,7 +242,18 @@
                        EmitContentsChanged ();
                }
 
-               protected virtual void SiteShapeChanged (WidgetSite site) {
+               void PlaceholderDragEnd (object obj, Gtk.DragEndArgs args)
+               {
+                       Placeholder ph = obj as Placeholder;
+
+                       if (DND.DragWidget == null) {
+                               ph.UnMimic ();
+                               Sync ();
+                       } else
+                               ReplaceChild (ph, CreateWidgetSite 
(DND.DragWidget));
+               }
+
+               protected virtual void ChildContentsChanged (Container child) {
                        ;
                }
 
@@ -210,8 +261,10 @@
                {
                        WidgetSite site = args.Widget as WidgetSite;
                        if (site != null) {
-                               site.Empty -= SiteEmpty;
-                               site.ShapeChanged -= SiteShapeChanged;
+                               Container childWrapper = Lookup (site.Child);
+                               if (childWrapper != null)
+                                       childWrapper.ContentsChanged -= 
ChildContentsChanged;
+
                                SiteRemoved (site);
                        }
                }

Modified: trunk/stetic/libstetic/wrapper/Table.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Table.cs     2005-03-24 15:26:48 UTC (rev 
42220)
+++ trunk/stetic/libstetic/wrapper/Table.cs     2005-03-24 16:07:36 UTC (rev 
42221)
@@ -43,7 +43,7 @@
 
                protected override void GladeImport (string className, string 
id, Hashtable props)
                {
-                       stetic.GladeImportComplete += DoSync;
+                       stetic.GladeImportComplete += PostGladeSync;
                        base.GladeImport (className, id, props);
                }
 
@@ -57,10 +57,10 @@
                        return base.GladeImportChild (className, id, props, 
childprops);
                }
 
-               void DoSync ()
+               void PostGladeSync ()
                {
                        Sync ();
-                       stetic.GladeImportComplete -= DoSync;
+                       stetic.GladeImportComplete -= PostGladeSync;
                }
 
                private Gtk.Table table {
@@ -69,20 +69,8 @@
                        }
                }
 
-               int freeze;
-               void Freeze ()
+               protected override void DoSync ()
                {
-                       freeze++;
-               }
-
-               void Thaw ()
-               {
-                       if (--freeze == 0)
-                               Sync ();
-               }
-
-               protected override void Sync ()
-               {
                        uint left, right, top, bottom;
                        uint row, col;
                        WidgetBox wbox;
@@ -91,10 +79,6 @@
                        Gtk.Widget[] children;
                        bool addedPlaceholders = false;
 
-                       if (freeze > 0)
-                               return;
-                       freeze = 1;
-
                        children = table.Children;
                        grid = new WidgetBox[NRows,NColumns];
 
@@ -208,7 +192,6 @@
 
                         foreach (Gtk.Widget child in table.Children)
                                child.ThawChildNotify ();
-                       freeze = 0;
 
                        if (addedPlaceholders)
                                EmitContentsChanged ();
@@ -366,16 +349,19 @@
                public override bool HExpandable { get { return hexpandable; } }
                public override bool VExpandable { get { return vexpandable; } }
 
-               protected override void SiteShapeChanged (WidgetSite site)
+               protected override void ChildContentsChanged (Container child)
                {
-                       Freeze ();
-                       if (AutoSize[site]) {
-                               Gtk.Table.TableChild tc = table[site] as 
Gtk.Table.TableChild;
-                               tc.XOptions = 0;
-                               tc.YOptions = 0;
+                       WidgetSite site = child.Wrapped.Parent as WidgetSite;
+                       if (site != null) {
+                               Freeze ();
+                               if (AutoSize[site]) {
+                                       Gtk.Table.TableChild tc = table[site] 
as Gtk.Table.TableChild;
+                                       tc.XOptions = 0;
+                                       tc.YOptions = 0;
+                               }
+                               Thaw ();
                        }
-                       Thaw ();
-                       base.SiteShapeChanged (site);
+                       base.ChildContentsChanged (child);
                }
 
 #if NOT

Modified: trunk/stetic/stetic/Glade.cs
===================================================================
--- trunk/stetic/stetic/Glade.cs        2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/stetic/Glade.cs        2005-03-24 16:07:36 UTC (rev 42221)
@@ -174,7 +174,7 @@
                                        }
 #endif
 
-                                       child = ExportWidget (project, doc, 
container, site.Contents);
+                                       child = ExportWidget (project, doc, 
container, site.Child);
                                        if (child != null)
                                                widget.AppendChild (child);
                                }

Modified: trunk/stetic/stetic/Project.cs
===================================================================
--- trunk/stetic/stetic/Project.cs      2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/stetic/Project.cs      2005-03-24 16:07:36 UTC (rev 42221)
@@ -60,7 +60,7 @@
                        if (container != null) {
                                container.ContentsChanged += ContentsChanged;
                                foreach (WidgetSite site in container.Sites)
-                                       AddWidget (site.Contents, parent);
+                                       AddWidget (site.Child, parent);
                        }
                }
 
@@ -98,8 +98,8 @@
 
                        ArrayList children = new ArrayList ();
                        foreach (WidgetSite site in cwrap.Sites) {
-                               if (site.Contents != null)
-                                       children.Add (site.Contents);
+                               if (site.Child != null)
+                                       children.Add (site.Child);
                        }
 
                        int i = 0;
@@ -180,7 +180,7 @@
                        WidgetSite site = new WidgetSite (w);
                        site.PopupContextMenu += delegate (object obj, 
EventArgs args) {
                                if (m == null)
-                                       m = new ContextMenu 
(Stetic.Wrapper.Widget.Lookup (site.Contents));
+                                       m = new ContextMenu 
(Stetic.Wrapper.Widget.Lookup (site.Child));
                                m.Popup ();
                        };
                        site.Destroyed += delegate (object obj, EventArgs args) 
{

Modified: trunk/stetic/stetic/PropertyGrid.cs
===================================================================
--- trunk/stetic/stetic/PropertyGrid.cs 2005-03-24 15:26:48 UTC (rev 42220)
+++ trunk/stetic/stetic/PropertyGrid.cs 2005-03-24 16:07:36 UTC (rev 42221)
@@ -103,7 +103,7 @@
                                return;
                        }
 
-                       selection = Stetic.Wrapper.Widget.Lookup 
(site.Contents);
+                       selection = Stetic.Wrapper.Widget.Lookup (site.Child);
                        if (selection == null)
                                return;
                        selection.Notify += Notified;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to