Author: danw
Date: 2005-03-14 22:14:54 -0500 (Mon, 14 Mar 2005)
New Revision: 41820

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/WidgetSite.cs
   trunk/stetic/libstetic/editor/StockItem.cs
   trunk/stetic/libstetic/wrapper/Box.cs
Log:
        * libstetic/WidgetSite.cs (FindFault): fix another autoexpand
        buglet
        (Drop): fix the focus in the autoexpand case

        * libstetic/editor/StockItem.cs: sort the buttons by their Label,
        not their StockId

        * libstetic/wrapper/Box.cs (Wrap): Add 2 children to start out,
        rather than 3.
        (SiteOccupancyChanged): If a site is emptied, destroy it rather
        than leaving an empty site behind (since you can still drag a new
        widget there even without the empty site).


Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2005-03-15 02:16:46 UTC (rev 41819)
+++ trunk/stetic/ChangeLog      2005-03-15 03:14:54 UTC (rev 41820)
@@ -1,5 +1,20 @@
 2005-03-14  Dan Winship  <[EMAIL PROTECTED]>
 
+       * libstetic/WidgetSite.cs (FindFault): fix another autoexpand
+       buglet
+       (Drop): fix the focus in the autoexpand case
+
+       * libstetic/editor/StockItem.cs: sort the buttons by their Label,
+       not their StockId
+
+       * libstetic/wrapper/Box.cs (Wrap): Add 2 children to start out,
+       rather than 3.
+       (SiteOccupancyChanged): If a site is emptied, destroy it rather
+       than leaving an empty site behind (since you can still drag a new
+       widget there even without the empty site).
+
+2005-03-14  Dan Winship  <[EMAIL PROTECTED]>
+
        * libstetic/WidgetSite.cs: Make OccupancyChanged mean only
        "Occupancy changed", and add a new ShapeChanged event for when
        something else happens that may affect AutoSizing in its parent.

Modified: trunk/stetic/libstetic/WidgetSite.cs
===================================================================
--- trunk/stetic/libstetic/WidgetSite.cs        2005-03-15 02:16:46 UTC (rev 
41819)
+++ trunk/stetic/libstetic/WidgetSite.cs        2005-03-15 03:14:54 UTC (rev 
41820)
@@ -284,7 +284,8 @@
                                splitter.MoveResize (wx, wy, width, height);
                                splitter.ShowUnraised ();
                                GdkWindow.Lower ();
-                       }
+                       } else if (dragFault == null)
+                               return false;
 
                        Gdk.Drag.Status (ctx, Gdk.DragAction.Move, time);
                        return true;
@@ -337,9 +338,12 @@
                                Gdk.Window win;
                                FindFault (x, y, out faultId, out win);
                                DropOn (w, faultId);
-                       } else
+                               if (w.Parent is WidgetSite)
+                                       ((WidgetSite)w.Parent).Select ();
+                       } else {
                                Add (w);
-                       GrabFocus ();
+                               Select ();
+                       }
                }
 
                protected override bool OnDragDrop (DragContext ctx, int x, int 
y, uint time)

Modified: trunk/stetic/libstetic/editor/StockItem.cs
===================================================================
--- trunk/stetic/libstetic/editor/StockItem.cs  2005-03-15 02:16:46 UTC (rev 
41819)
+++ trunk/stetic/libstetic/editor/StockItem.cs  2005-03-15 03:14:54 UTC (rev 
41820)
@@ -4,7 +4,7 @@
 namespace Stetic.Editor {
 
        [PropertyEditor ("StockId", "Changed")]
-       public class StockItem : Gtk.ComboBox {
+       public class StockItem : Gtk.ComboBox, IComparer {
 
                const int IconColumn = 0;
                const int LabelColumn = 1;
@@ -15,19 +15,20 @@
                {
                        Gtk.ListStore store = new Gtk.ListStore (typeof 
(string), typeof (string));
 
+                       ArrayList stockItems = new ArrayList ();
+                       foreach (string id in Gtk.Stock.ListIds ()) {
+                               Gtk.StockItem item = Gtk.Stock.Lookup (id);
+                               if (item.StockId == null)
+                                       continue;
+                               stockItems.Add (item);
+                       }
+                       stockItems.Sort (this);
+
                        stockIds = new ArrayList ();
-
-                       string[] allIds = Gtk.Stock.ListIds ();
-                       Array.Sort (allIds);
-
-                       foreach (string id in allIds) {
-                               Gtk.StockItem item;
+                       foreach (Gtk.StockItem item in stockItems) {
                                string markup;
 
-                               item = Gtk.Stock.Lookup (id);
-                               if (item.StockId == null)
-                                       continue;
-                               stockIds.Add (id);
+                               stockIds.Add (item.StockId);
 
                                int uline = item.Label.IndexOf ('_');
                                if (uline != -1 && uline < item.Label.Length - 
2)
@@ -49,6 +50,14 @@
                        AddAttribute (labelRenderer, "markup", LabelColumn);
                }
 
+               public int Compare (object itemx, object itemy)
+               {
+                       Gtk.StockItem x = (Gtk.StockItem)itemx;
+                       Gtk.StockItem y = (Gtk.StockItem)itemy;
+
+                       return string.Compare (x.Label, y.Label);
+               }
+
                public string StockId {
                        get {
                                return (string)stockIds[Active];

Modified: trunk/stetic/libstetic/wrapper/Box.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Box.cs       2005-03-15 02:16:46 UTC (rev 
41819)
+++ trunk/stetic/libstetic/wrapper/Box.cs       2005-03-15 03:14:54 UTC (rev 
41820)
@@ -23,8 +23,8 @@
                {
                        base.Wrap (obj, initialized);
                        if (!initialized) {
-                               for (int i = 0; i < 3; i++)
-                                       box.PackStart (CreateWidgetSite ());
+                               box.PackStart (CreateWidgetSite ());
+                               box.PackStart (CreateWidgetSite ());
                        }
                        box.SizeAllocated += box_SizeAllocated;
                        box.ParentSet += box_ParentSet;
@@ -124,6 +124,14 @@
                        base.SiteShapeChanged (site);
                }
 
+               protected override void SiteOccupancyChanged (WidgetSite site) {
+                       if (!site.Occupied) {
+                               site.Destroy ();
+                               return;
+                       }
+                       base.SiteOccupancyChanged (site);
+               }
+
                void box_ParentSet (object obj, Gtk.ParentSetArgs args)
                {
                        WidgetSite site = box.Parent as WidgetSite;

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

Reply via email to