Author: lluis
Date: 2007-01-17 12:59:25 -0500 (Wed, 17 Jan 2007)
New Revision: 71221

Added:
   trunk/stetic/libstetic/wrapper/Fixed.cs
   trunk/stetic/libstetic/wrapper/pixmaps/fixed.png
Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/configure.in
   trunk/stetic/libstetic/DND.cs
   trunk/stetic/libstetic/IDesignArea.cs
   trunk/stetic/libstetic/Makefile.am
   trunk/stetic/libstetic/editor/ActionMenuItem.cs
   trunk/stetic/libstetic/editor/ActionToolItem.cs
   trunk/stetic/libstetic/wrapper/Button.cs
   trunk/stetic/libstetic/wrapper/ButtonBox.cs
   trunk/stetic/libstetic/wrapper/Container.cs
   trunk/stetic/libstetic/wrapper/Frame.cs
   trunk/stetic/libstetic/wrapper/Window.cs
   trunk/stetic/libstetic/wrapper/objects.xml
   trunk/stetic/libsteticui/ApplicationBackend.cs
   trunk/stetic/libsteticui/Clipboard.cs
   trunk/stetic/libsteticui/Makefile.am
   trunk/stetic/libsteticui/ProjectBackend.cs
   trunk/stetic/libsteticui/WidgetDesigner.cs
   trunk/stetic/libsteticui/WidgetDesignerBackend.cs
   trunk/stetic/libsteticui/WidgetEditSession.cs
   trunk/stetic/stetic/Makefile.am
Log:
* libsteticui/ApplicationBackend.cs: Fixed some warnings.
* libsteticui/WidgetDesignerBackend.cs,
  libsteticui/WidgetEditSession.cs, libstetic/IDesignArea.cs,
  libstetic/editor/ActionMenuItem.cs,
  libstetic/editor/ActionToolItem.cs: Provide information about the
  drag hot point when firing the drag event. Allow enabling/disabling
  drag support.
* libsteticui/ProjectBackend.cs: Fix cast exception when changing
  signals in actions.
* libsteticui/Clipboard.cs, libstetic/wrapper/Button.cs,
  libstetic/wrapper/Frame.cs, libstetic/wrapper/ButtonBox.cs: User
  the new ReplaceChild overload.
* libsteticui/WidgetDesigner.cs: Improve error message when the
  designet can't be loaded.
* libsteticui/Makefile.am, configure.in, stetic/Makefile.am: Build
  libstetic with mcs instead of gmcs, since that assembly may need to
  be linked with widget libraries based on .net 1.1.
* libstetic/wrapper/pixmaps/fixed.png: New bitmap for Gtk.Fixed.
* libstetic/wrapper/Container.cs: Added protected methods for notifying
  the add/remove child event, since some containers don't fire them.
  Added ReplaceChild overload which will explicitely destroy the
  replaced widget. Don't allow dragging top level widgets.
* libstetic/wrapper/Fixed.cs, libstetic/Makefile.am: Implemented
  support for Gtk.Fixed.
* libstetic/wrapper/Window.cs: Don't generate code for the Type
  property, since it's read-only.
* libstetic/wrapper/objects.xml: Implemented support for Gtk.Fixed.
  Hide the Type property, since code for that property can't be
  generated (it must be provided by the user in the window
  constructor.
* libstetic/DND.cs: Added properties for getting the hot drag point
  when dragging a widget.

Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2007-01-17 17:30:12 UTC (rev 71220)
+++ trunk/stetic/ChangeLog      2007-01-17 17:59:25 UTC (rev 71221)
@@ -1,3 +1,38 @@
+2007-01-17  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * libsteticui/ApplicationBackend.cs: Fixed some warnings.
+       * libsteticui/WidgetDesignerBackend.cs,
+         libsteticui/WidgetEditSession.cs, libstetic/IDesignArea.cs,
+         libstetic/editor/ActionMenuItem.cs,
+         libstetic/editor/ActionToolItem.cs: Provide information about the
+         drag hot point when firing the drag event. Allow enabling/disabling
+         drag support.
+       * libsteticui/ProjectBackend.cs: Fix cast exception when changing
+         signals in actions.
+       * libsteticui/Clipboard.cs, libstetic/wrapper/Button.cs,
+         libstetic/wrapper/Frame.cs, libstetic/wrapper/ButtonBox.cs: User
+         the new ReplaceChild overload.
+       * libsteticui/WidgetDesigner.cs: Improve error message when the
+         designet can't be loaded.
+       * libsteticui/Makefile.am, configure.in, stetic/Makefile.am: Build
+         libstetic with mcs instead of gmcs, since that assembly may need to
+         be linked with widget libraries based on .net 1.1.
+       * libstetic/wrapper/pixmaps/fixed.png: New bitmap for Gtk.Fixed.
+       * libstetic/wrapper/Container.cs: Added protected methods for notifying
+         the add/remove child event, since some containers don't fire them.
+         Added ReplaceChild overload which will explicitely destroy the
+         replaced widget. Don't allow dragging top level widgets.
+       * libstetic/wrapper/Fixed.cs, libstetic/Makefile.am: Implemented
+         support for Gtk.Fixed.
+       * libstetic/wrapper/Window.cs: Don't generate code for the Type
+         property, since it's read-only.
+       * libstetic/wrapper/objects.xml: Implemented support for Gtk.Fixed.
+         Hide the Type property, since code for that property can't be
+         generated (it must be provided by the user in the window
+         constructor.
+       * libstetic/DND.cs: Added properties for getting the hot drag point
+         when dragging a widget.
+
 2007-01-15  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * libsteticui/UndoQueue.cs: Removed debug messages.

Modified: trunk/stetic/configure.in
===================================================================
--- trunk/stetic/configure.in   2007-01-17 17:30:12 UTC (rev 71220)
+++ trunk/stetic/configure.in   2007-01-17 17:59:25 UTC (rev 71221)
@@ -14,7 +14,8 @@
 PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED_VERSION)
 
 AC_PATH_PROG(MONO, mono, no)
-AC_PATH_PROG(MCS, gmcs, no)
+AC_PATH_PROG(GMCS, gmcs, no)
+AC_PATH_PROG(MCS, mcs, no)
 
 CS="C#"
 if test "$MCS" = "no" ; then

Modified: trunk/stetic/libstetic/DND.cs
===================================================================
--- trunk/stetic/libstetic/DND.cs       2007-01-17 17:30:12 UTC (rev 71220)
+++ trunk/stetic/libstetic/DND.cs       2007-01-17 17:59:25 UTC (rev 71221)
@@ -47,9 +47,11 @@
                }
 
                static Gtk.Widget dragWidget;
+               static int dragHotX;
+               static int dragHotY;
 
                // Drag function for non-automatic sources, called from 
MotionNotifyEvent
-               public static void Drag (Gtk.Widget source, Gdk.EventMotion 
evt, Gtk.Widget dragWidget)
+               public static void Drag (Gtk.Widget source, Gdk.Event evt, 
Gtk.Widget dragWidget)
                {
                        Gdk.DragContext ctx;
 
@@ -81,6 +83,8 @@
                        else if (req.Height < 20)
                                dragWin.SetSizeRequest (-1, 20);
 
+                       req = dragWin.SizeRequest ();
+                       
                        int px, py, rx, ry;
                        Gdk.ModifierType pmask;
                        ctx.SourceWindow.GetPointer (out px, out py, out pmask);
@@ -88,7 +92,11 @@
 
                        dragWin.Move (rx + px, ry + py);
                        dragWin.Show ();
-                       Gtk.Drag.SetIconWidget (ctx, dragWin, 0, 0);
+                       
+                       dragHotX = req.Width / 2;
+                       dragHotY = -3;
+                       
+                       Gtk.Drag.SetIconWidget (ctx, dragWin, dragHotX, 
dragHotY);
 
                        if (source != null) {
                                source.DragDataGet += DragDataGet;
@@ -102,6 +110,18 @@
                        }
                }
 
+               public static int DragHotX {
+                       get {
+                               return dragHotX;
+                       }
+               }
+
+               public static int DragHotY {
+                       get {
+                               return dragHotY;
+                       }
+               }
+
                // Call this from a DragDrop event to receive the dragged widget
                public static Gtk.Widget Drop (Gdk.DragContext ctx, Gtk.Widget 
target, uint time)
                {

Modified: trunk/stetic/libstetic/IDesignArea.cs
===================================================================
--- trunk/stetic/libstetic/IDesignArea.cs       2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/IDesignArea.cs       2007-01-17 17:59:25 UTC (rev 
71221)
@@ -6,6 +6,7 @@
        public interface IDesignArea
        {
                IObjectSelection SetSelection (Gtk.Widget widget, object 
selectedInstance);
+               IObjectSelection SetSelection (Gtk.Widget widget, object 
selectedInstance, bool allowDrag);
                void ResetSelection (Gtk.Widget widget);
                bool IsSelected (Gtk.Widget widget);
                IObjectSelection GetSelection ();
@@ -19,7 +20,7 @@
                event EventHandler SelectionChanged;
        }
        
-       public delegate void DragDelegate (Gdk.EventMotion evt);
+       public delegate void DragDelegate (Gdk.EventMotion evt, int dx, int dy);
 
        public interface IObjectViewer
        {
@@ -30,6 +31,7 @@
        {
                Gtk.Widget Widget { get; }
                object DataObject { get; }
+               bool AllowDrag {get; set; }
                
                event DragDelegate Drag;
                event EventHandler Disposed;

Modified: trunk/stetic/libstetic/Makefile.am
===================================================================
--- trunk/stetic/libstetic/Makefile.am  2007-01-17 17:30:12 UTC (rev 71220)
+++ trunk/stetic/libstetic/Makefile.am  2007-01-17 17:59:25 UTC (rev 71221)
@@ -110,6 +110,7 @@
        wrapper/Dialog.cs               \
        wrapper/Entry.cs                \
        wrapper/Expander.cs             \
+       wrapper/Fixed.cs                \
        wrapper/FontButton.cs           \
        wrapper/FontSelectionDialog.cs  \
        wrapper/Frame.cs                \

Modified: trunk/stetic/libstetic/editor/ActionMenuItem.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionMenuItem.cs     2007-01-17 17:30:12 UTC 
(rev 71220)
+++ trunk/stetic/libstetic/editor/ActionMenuItem.cs     2007-01-17 17:59:25 UTC 
(rev 71221)
@@ -613,7 +613,7 @@
                        parentMenu.OpenSubmenu = null;
                }
                
-               void HandleItemDrag (Gdk.EventMotion evt)
+               void HandleItemDrag (Gdk.EventMotion evt, int dx, int dy)
                {
                        ActionPaletteItem item = new ActionPaletteItem (node);
                        DND.Drag (parentMenu.Widget, evt, item);

Modified: trunk/stetic/libstetic/editor/ActionToolItem.cs
===================================================================
--- trunk/stetic/libstetic/editor/ActionToolItem.cs     2007-01-17 17:30:12 UTC 
(rev 71220)
+++ trunk/stetic/libstetic/editor/ActionToolItem.cs     2007-01-17 17:59:25 UTC 
(rev 71221)
@@ -480,7 +480,7 @@
                        EndEditing ();
                }
                
-               void HandleItemDrag (Gdk.EventMotion evt)
+               void HandleItemDrag (Gdk.EventMotion evt, int dx, int dy)
                {
                        ActionPaletteItem item = new ActionPaletteItem (node);
                        DND.Drag (parentMenu, evt, item);

Modified: trunk/stetic/libstetic/wrapper/Button.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Button.cs    2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/Button.cs    2007-01-17 17:59:25 UTC (rev 
71221)
@@ -145,7 +145,7 @@
                                case ButtonType.Custom:
                                        button.UseStock = false;
                                        if (button.Child != null)
-                                               ReplaceChild (button.Child, 
CreatePlaceholder ());
+                                               ReplaceChild (button.Child, 
CreatePlaceholder (), true);
                                        break;
                                }
                        }

Modified: trunk/stetic/libstetic/wrapper/ButtonBox.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/ButtonBox.cs 2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/ButtonBox.cs 2007-01-17 17:59:25 UTC (rev 
71221)
@@ -14,7 +14,7 @@
                        base.Wrap (obj, initialized);
                        foreach (Gtk.Widget child in buttonbox.Children) {
                                if (child is Placeholder)
-                                       ReplaceChild (child, NewButton ());
+                                       ReplaceChild (child, NewButton (), 
true);
                        }
                }
                

Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2007-01-17 17:59:25 UTC (rev 
71221)
@@ -67,12 +67,17 @@
                
                void OnChildAdded (object o, Gtk.AddedArgs args)
                {
+                       NotifyChildAdded (args.Widget);
+               }
+               
+               protected void NotifyChildAdded (Gtk.Widget child)
+               {
                        // Make sure children's IDs don't conflict with other 
widgets
                        // in the parent container.
                        if (!Loading)
-                               ValidateChildNames ((Gtk.Widget)o);
+                               ValidateChildNames (Wrapped);
 
-                       ObjectWrapper w = ObjectWrapper.Lookup (args.Widget);
+                       ObjectWrapper w = ObjectWrapper.Lookup (child);
                        if (w != null) {
                                ((Widget)w).RequiresUndoStatusUpdate = true;
                                if (designer != null)
@@ -379,7 +384,8 @@
                                                        elem.AppendChild 
(child_elem);
                                        } else if (child is Stetic.Placeholder) 
{
                                                child_elem = 
writer.XmlDocument.CreateElement ("child");
-                                               child_elem.SetAttribute 
("undoId", ((Stetic.Placeholder)child).UndoId);
+                                               if (writer.CreateUndoInfo)
+                                                       child_elem.SetAttribute 
("undoId", ((Stetic.Placeholder)child).UndoId);
                                                child_elem.AppendChild 
(writer.XmlDocument.CreateElement ("placeholder"));
                                                elem.AppendChild (child_elem);
                                        }
@@ -440,7 +446,8 @@
                                        child_elem.AppendChild (packing_elem);
                        } else {
                                // There is no container child, so make up an 
id.
-                               child_elem.SetAttribute ("undoId", "0");
+                               if (writer.CreateUndoInfo)
+                                       child_elem.SetAttribute ("undoId", "0");
                        }
 
                        return child_elem;
@@ -721,8 +728,7 @@
                void PlaceholderDrop (Placeholder ph, Stetic.Wrapper.Widget 
wrapper)
                {
                        using (UndoManager.AtomicChange) {
-                               ReplaceChild (ph, wrapper.Wrapped);
-                               ph.Destroy ();
+                               ReplaceChild (ph, wrapper.Wrapped, true);
                                wrapper.Select ();
                        }
                }
@@ -753,17 +759,22 @@
 
                void ChildRemoved (object obj, Gtk.RemovedArgs args)
                {
+                       NotifyChildRemoved (args.Widget);
+               }
+               
+               protected void NotifyChildRemoved (Gtk.Widget child)
+               {
                        if (Loading)
                                return;
                                
-                       ObjectWrapper w = ObjectWrapper.Lookup (args.Widget);
+                       ObjectWrapper w = ObjectWrapper.Lookup (child);
                        if (w != null) {
                                if (w.Loading)
                                        return;
                                if (designer != null)
                                        w.OnDesignerDetach (designer);
                        }
-                       ChildRemoved (args.Widget);
+                       ChildRemoved (child);
                }
 
                protected virtual void ChildRemoved (Gtk.Widget w)
@@ -789,6 +800,13 @@
                        }
                }
 
+               public void ReplaceChild (Gtk.Widget oldChild, Gtk.Widget 
newChild, bool destroyOld)
+               {
+                       ReplaceChild (oldChild, newChild);
+                       if (destroyOld)
+                               oldChild.Destroy ();
+               }
+               
                public virtual void ReplaceChild (Gtk.Widget oldChild, 
Gtk.Widget newChild)
                {
                        using (UndoManager.AtomicChange)
@@ -813,7 +831,6 @@
                                        pinfo.SetValue (cc, props[pinfo], null);
 
                                Sync ();
-                               oldChild.Destroy ();
                                EmitContentsChanged ();
                                if (Project != null)
                                        Project.Selection = newChild;
@@ -828,7 +845,8 @@
                                Select (null, false);
                        } else {
                                Widget wrapper = Widget.Lookup (widget);
-                               Select (widget, wrapper != null && 
wrapper.InternalChildProperty == null);
+                               bool allowDrag = wrapper != null && 
wrapper.InternalChildProperty == null && !wrapper.IsTopLevel;
+                               Select (widget, allowDrag);
                        }
                }
 
@@ -903,7 +921,7 @@
 
                        IDesignArea designArea = GetDesignArea (widget);
                        if (designArea != null) {
-                               IObjectSelection sel = designArea.SetSelection 
(widget, widget);
+                               IObjectSelection sel = designArea.SetSelection 
(widget, widget, dragHandles);
                                sel.Drag += HandleWindowDrag;
                                return;
                        }
@@ -933,26 +951,27 @@
 
                Gtk.Widget dragSource;
 
-               void HandleWindowDrag (Gdk.EventMotion evt)
+               void HandleWindowDrag (Gdk.EventMotion evt, int dx, int dy)
                {
                        Gtk.Widget dragWidget = selection;
 
-                       Select ((Gtk.Widget)null);
+                       Project.Selection = null;
 
-                       dragSource = CreateDragSource (dragWidget);
+                       using (UndoManager.AtomicChange) {
+                               dragSource = CreateDragSource (dragWidget);
+                       }
+                       
                        DND.Drag (dragSource, evt, dragWidget);
                }
 
                protected virtual Gtk.Widget CreateDragSource (Gtk.Widget 
dragWidget)
                {
-                       using (UndoManager.AtomicChange) {
-                               Placeholder ph = CreatePlaceholder ();
-                               Gdk.Rectangle alloc = dragWidget.Allocation;
-                               ph.SetSizeRequest (alloc.Width, alloc.Height);
-                               ph.DragEnd += DragEnd;
-                               ReplaceChild (dragWidget, ph);
-                               return ph;
-                       }
+                       Placeholder ph = CreatePlaceholder ();
+                       Gdk.Rectangle alloc = dragWidget.Allocation;
+                       ph.SetSizeRequest (alloc.Width, alloc.Height);
+                       ph.DragEnd += DragEnd;
+                       ReplaceChild (dragWidget, ph, false);
+                       return ph;
                }
 
                void DragEnd (object obj, Gtk.DragEndArgs args)
@@ -969,7 +988,7 @@
                                                container.Remove (ph);
                                        Sync ();
                                } else
-                                       ReplaceChild (ph, DND.Cancel ());
+                                       ReplaceChild (ph, DND.Cancel (), true);
                        }
                }
 
@@ -977,7 +996,7 @@
                {
                        using (UndoManager.AtomicChange) {
                                if (AllowPlaceholders)
-                                       ReplaceChild (wrapper.Wrapped, 
CreatePlaceholder ());
+                                       ReplaceChild (wrapper.Wrapped, 
CreatePlaceholder (), true);
                                else
                                        container.Remove (wrapper.Wrapped);
                                wrapper.Wrapped.Destroy ();

Added: trunk/stetic/libstetic/wrapper/Fixed.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Fixed.cs     2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/Fixed.cs     2007-01-17 17:59:25 UTC (rev 
71221)
@@ -0,0 +1,91 @@
+
+using System;
+
+namespace Stetic.Wrapper
+{
+       public class Fixed: Container
+       {
+               public override void Wrap (object obj, bool initialized)
+               {
+                       base.Wrap (obj, initialized);
+                       
+                       DND.DestSet (gtkfixed, true);
+                       gtkfixed.DragDrop += FixedDragDrop;
+                       gtkfixed.DragDataReceived += FixedDragDataReceived;
+               }
+               
+               public override void Dispose ()
+               {
+                       gtkfixed.DragDrop -= FixedDragDrop;
+                       gtkfixed.DragDataReceived -= FixedDragDataReceived;
+               }
+               
+               Gtk.Fixed gtkfixed {
+                       get {
+                               return (Gtk.Fixed)Wrapped;
+                       }
+               }
+               
+               protected override bool AllowPlaceholders {
+                       get {
+                               return false;
+                       }
+               }
+               
+               void FixedDragDrop (object obj, Gtk.DragDropArgs args)
+               {
+                       Gtk.Widget w = DND.Drop (args.Context, gtkfixed, 
args.Time);
+                       Widget ww = Widget.Lookup (w);
+                       if (ww != null) {
+                               gtkfixed.Put (w, args.X - DND.DragHotX, args.Y 
- DND.DragHotY);
+                               NotifyChildAdded (w);
+                               args.RetVal = true;
+                               ww.Select ();
+                       }
+               }
+
+               void FixedDragDataReceived (object obj, 
Gtk.DragDataReceivedArgs args)
+               {
+                       Widget dropped = GladeUtils.Paste (proj, 
args.SelectionData);
+                       Gtk.Drag.Finish (args.Context, dropped != null, dropped 
!= null, args.Time);
+                       if (dropped != null) {
+                               gtkfixed.Put (dropped.Wrapped, 0, 0);
+                               NotifyChildAdded (dropped.Wrapped);
+                               dropped.Select ();
+                       }
+               }
+               
+               int dragX, dragY;
+
+               protected override Gtk.Widget CreateDragSource (Gtk.Widget 
dragWidget)
+               {
+                       Gtk.Fixed.FixedChild fc = (Gtk.Fixed.FixedChild) 
gtkfixed [dragWidget];
+                       if (fc == null)
+                               return null;
+                               
+                       dragX = fc.X;
+                       dragY = fc.Y;
+
+                       gtkfixed.Remove (dragWidget);
+                       gtkfixed.DragEnd += DragEnd;
+                       return gtkfixed;
+               }
+               
+               void DragEnd (object obj, Gtk.DragEndArgs args)
+               {
+                       using (UndoManager.AtomicChange) {
+                               gtkfixed.DragEnd -= DragEnd;
+                               if (DND.DragWidget != null) {
+                                       DND.DragWidget.Unparent ();
+                                       gtkfixed.Put (DND.DragWidget, dragX, 
dragY);
+                                       NotifyChildAdded (DND.DragWidget);
+                                       Widget ww = Widget.Lookup 
(DND.DragWidget);
+                                       ww.Select ();
+                               }
+                       }
+               }
+
+               public class FixedChild : Container.ContainerChild {
+               }
+       }
+}

Modified: trunk/stetic/libstetic/wrapper/Frame.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Frame.cs     2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/Frame.cs     2007-01-17 17:59:25 UTC (rev 
71221)
@@ -18,7 +18,7 @@
                                align.LeftPadding = 12;
                                Container align_wrapper = 
(Container)ObjectWrapper.Create (proj, align);
                                align_wrapper.AddPlaceholder ();
-                               ReplaceChild (frame.Child, 
(Gtk.Widget)align_wrapper.Wrapped);
+                               ReplaceChild (frame.Child, 
(Gtk.Widget)align_wrapper.Wrapped, true);
                        }
 
                        if (frame.LabelWidget != null)

Modified: trunk/stetic/libstetic/wrapper/Window.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Window.cs    2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/Window.cs    2007-01-17 17:59:25 UTC (rev 
71221)
@@ -120,5 +120,11 @@
                                );
                        }
                }
+               
+               protected override void GeneratePropertySet (GeneratorContext 
ctx, CodeExpression var, PropertyDescriptor prop)
+               {
+                       if (prop.Name != "Type")
+                               base.GeneratePropertySet (ctx, var, prop);
+               }
        }
 }

Modified: trunk/stetic/libstetic/wrapper/objects.xml
===================================================================
--- trunk/stetic/libstetic/wrapper/objects.xml  2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libstetic/wrapper/objects.xml  2007-01-17 17:59:25 UTC (rev 
71221)
@@ -162,12 +162,13 @@
     <object type="Gtk.Container+ContainerChild,gtk-sharp" 
wrapper="Stetic.Wrapper.Container+ContainerChild" />
 
     <object type="Gtk.Window,gtk-sharp" wrapper="Stetic.Wrapper.Window"
-           label="Window" icon="window.png" palette-category="window" 
init-properties="Title">
+           label="Window" icon="window.png" palette-category="window" 
init-properties="Type">
        <itemgroups>
            <itemgroup label="Window Properties">
                <property name="Title" init-with-name="true" 
translatable="true" />
                <property name="Icon" />
-               <property name="Type" glade-override="true" />
+               <property name="Type" glade-override="true" internal="true" />
+               <property name="TypeVisible" internal="true"/>
                <property name="TypeHint" glade-override="true" />
                <property name="WindowPosition" />
                <property name="Modal" glade-override="true" />
@@ -823,6 +824,30 @@
        </signals>
     </object>
 
+    <object type="Gtk.Fixed,gtk-sharp" wrapper="Stetic.Wrapper.Fixed"
+           label="Fixed" icon="fixed.png" palette-category="container">
+       <itemgroups>
+           <itemgroup label="Fixed Properties">
+               <property name="HasWindow" />
+           </itemgroup>
+           <itemgroup ref="Gtk.Widget" />
+           <itemgroup ref="Gtk.Container.Commands" />
+       </itemgroups>
+       <signals>
+           <itemgroup ref="Gtk.Widget" />
+           <itemgroup ref="Gtk.Container" />
+       </signals>
+    </object>
+
+    <object type="Gtk.Fixed+FixedChild,gtk-sharp" 
wrapper="Stetic.Wrapper.Fixed+FixedChild">
+       <itemgroups>
+           <itemgroup label="Fixed Child Layout">
+               <property name="X" />
+               <property name="Y" />
+           </itemgroup>
+       </itemgroups>
+    </object>
+    
     <object type="Gtk.FontButton,gtk-sharp" wrapper="Stetic.Wrapper.FontButton"
            label="Font Button" icon="fontbutton.png" palette-category="widget">
        <itemgroups>

Added: trunk/stetic/libstetic/wrapper/pixmaps/fixed.png
===================================================================
(Binary files differ)


Property changes on: trunk/stetic/libstetic/wrapper/pixmaps/fixed.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/stetic/libsteticui/ApplicationBackend.cs
===================================================================
--- trunk/stetic/libsteticui/ApplicationBackend.cs      2007-01-17 17:30:12 UTC 
(rev 71220)
+++ trunk/stetic/libsteticui/ApplicationBackend.cs      2007-01-17 17:59:25 UTC 
(rev 71221)
@@ -133,8 +133,6 @@
                                if (!Registry.ReloadWidgetLibraries () && 
allowBackendRestart)
                                        return false;
                                
-                               bool updated = false;
-                               
                                // Check which libraries need to be unloaded
                                
                                foreach (WidgetLibrary alib in 
Registry.RegisteredWidgetLibraries) {
@@ -142,7 +140,6 @@
                                                if (forceUnload && 
allowBackendRestart)
                                                        return false;
                                                
Registry.UnregisterWidgetLibrary (alib);
-                                               updated = true;
                                        }
                                }
                                
@@ -173,7 +170,6 @@
                                                        // FIXME: return the 
error somewhere
                                                        Console.WriteLine (ex);
                                                }
-                                               updated = true;
                                        }
                                }
                                

Modified: trunk/stetic/libsteticui/Clipboard.cs
===================================================================
--- trunk/stetic/libsteticui/Clipboard.cs       2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libsteticui/Clipboard.cs       2007-01-17 17:59:25 UTC (rev 
71221)
@@ -79,7 +79,7 @@
                                return;
 
                        using (wrapper.UndoManager.AtomicChange) {
-                               parent.ReplaceChild (target, wrapper.Wrapped);
+                               parent.ReplaceChild (target, wrapper.Wrapped, 
true);
                        }
                        target = null;
                }

Modified: trunk/stetic/libsteticui/Makefile.am
===================================================================
--- trunk/stetic/libsteticui/Makefile.am        2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libsteticui/Makefile.am        2007-01-17 17:59:25 UTC (rev 
71221)
@@ -67,7 +67,7 @@
        @rm -f sources.rsp
        @echo $(libsteticui_dll_sources:%=$(srcdir)/%) > sources.rsp
        @for resource in $(libsteticui_dll_resources); do echo 
-resource:$$resource,`basename $$resource` >> sources.rsp; done
-       $(MCS) -debug -unsafe -main:Stetic.ApplicationBackend -r:Mono.Posix 
-r:System.Runtime.Remoting -pkg:gnome-sharp-2.0 -pkg:gconf-sharp-2.0 
-r:../libstetic/libstetic.dll -out:$@ @sources.rsp
+       $(GMCS) -debug -unsafe -main:Stetic.ApplicationBackend -r:Mono.Posix 
-r:System.Runtime.Remoting -pkg:gnome-sharp-2.0 -pkg:gconf-sharp-2.0 
-r:../libstetic/libstetic.dll -out:$@ @sources.rsp
 
 CLEANFILES = libsteticui.dll libsteticui.dll.mdb sources.rsp
 

Modified: trunk/stetic/libsteticui/ProjectBackend.cs
===================================================================
--- trunk/stetic/libsteticui/ProjectBackend.cs  2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libsteticui/ProjectBackend.cs  2007-01-17 17:59:25 UTC (rev 
71221)
@@ -609,7 +609,7 @@
                protected virtual void OnSignalChanged (SignalChangedEventArgs 
args)
                {
                        if (frontend != null)
-                               frontend.NotifySignalChanged 
(Component.GetSafeReference (args.Wrapper), 
((Gtk.Widget)args.Wrapper.Wrapped).Name, args.OldSignal, args.Signal);
+                               frontend.NotifySignalChanged 
(Component.GetSafeReference (args.Wrapper), null, args.OldSignal, args.Signal);
                        if (SignalChanged != null)
                                SignalChanged (this, args);
                }

Modified: trunk/stetic/libsteticui/WidgetDesigner.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetDesigner.cs  2007-01-17 17:30:12 UTC (rev 
71220)
+++ trunk/stetic/libsteticui/WidgetDesigner.cs  2007-01-17 17:59:25 UTC (rev 
71221)
@@ -90,7 +90,11 @@
                                rootWidget = app.GetComponent 
(session.RootWidget, null, null);
                        } catch (Exception ex) {
                                Console.WriteLine (ex);
-                               AddCustomWidget (new Gtk.Label (ex.Message));
+                               Gtk.Label lab = new Gtk.Label ();
+                               lab.Text = Mono.Unix.Catalog.GetString ("The 
desginer could not be loaded.") + "\n\n" + ex.Message;
+                               lab.Wrap = true;
+                               lab.WidthRequest = 400;
+                               AddCustomWidget (lab);
                                session = null;
                        }
                }

Modified: trunk/stetic/libsteticui/WidgetDesignerBackend.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetDesignerBackend.cs   2007-01-17 17:30:12 UTC 
(rev 71220)
+++ trunk/stetic/libsteticui/WidgetDesignerBackend.cs   2007-01-17 17:59:25 UTC 
(rev 71221)
@@ -366,13 +366,20 @@
                
                public IObjectSelection SetSelection (Gtk.Widget widget, object 
obj)
                {
+                       return SetSelection (widget, obj, true);
+               }
+               
+               public IObjectSelection SetSelection (Gtk.Widget widget, object 
obj, bool allowDrag)
+               {
                        if (currentObjectSelection != null) {
                                currentObjectSelection.Dispose ();
                                currentObjectSelection = null;
                        }
 
-                       if (widget != null)
+                       if (widget != null) {
                                currentObjectSelection = new ObjectSelection 
(this, widget, obj);
+                               currentObjectSelection.AllowDrag = allowDrag;
+                       }
                        else
                                currentObjectSelection = null;
                        
@@ -736,11 +743,13 @@
        
        class SelectionHandleBox
        {
-               const int selectionHandleSize = 6;
+               const int selectionHandleSize = 4;
+               const int topSelectionHandleSize = 8;
                public const int selectionLineWidth = 2;
                
                ArrayList selection = new ArrayList ();
                Gdk.Rectangle allocation;
+               SelectionHandlePart dragHandlePart;
                public ObjectSelection ObjectSelection;
                
                public SelectionHandleBox (Gtk.Widget parent)
@@ -762,6 +771,9 @@
                        selection.Add (new SelectionHandlePart (BoxFill.Box, 
BoxPos.Start, BoxPos.Center, -selectionHandleSize, -selectionHandleSize/2, 
BoxPos.Start, BoxPos.Center, 0, selectionHandleSize/2));
                        selection.Add (new SelectionHandlePart (BoxFill.Box, 
BoxPos.End, BoxPos.Center, 0, -selectionHandleSize/2, BoxPos.End, 
BoxPos.Center, selectionHandleSize, selectionHandleSize/2));
                        
+                       dragHandlePart = new SelectionHandlePart (BoxFill.Box, 
BoxPos.Center, BoxPos.Start, -topSelectionHandleSize/2, 
-topSelectionHandleSize, BoxPos.Center, BoxPos.Start, topSelectionHandleSize/2, 
0);
+                       selection.Add (dragHandlePart);
+                       
                        foreach (SelectionHandlePart s in selection) {
                                s.Parent = parent;
                                s.ParentBox = this;
@@ -772,6 +784,7 @@
                {
                        foreach (Gtk.Widget s in selection)
                                s.Show ();
+                       dragHandlePart.Visible = (ObjectSelection != null && 
ObjectSelection.AllowDrag);
                }
                
                public void Hide ()
@@ -782,12 +795,16 @@
                
                public void Reposition (Gdk.Rectangle rect)
                {
-                       allocation = new Gdk.Rectangle ();
+                       bool firstRect = true;
                        
                        foreach (SelectionHandlePart s in selection) {
                                s.Reposition (rect);
                                Gdk.Rectangle r = s.Allocation;
-                               allocation = allocation.Union (r);
+                               if (firstRect) {
+                                       allocation = r;
+                                       firstRect = false;
+                               } else
+                                       allocation = allocation.Union (r);
                        }
                }
                
@@ -817,6 +834,8 @@
                BoxFill fill;
                public SelectionHandleBox ParentBox;
                int clickX, clickY;
+               int localClickX, localClickY;
+               int ox, oy;
                
                public SelectionHandlePart (BoxFill fill, BoxPos hpos, BoxPos 
vpos, int x, int y, BoxPos hposEnd, BoxPos vposEnd, int xEnd, int yEnd)
                {
@@ -846,6 +865,8 @@
                        pyEnd += yEnd;
                        
                        Allocation = new Gdk.Rectangle (px, py, pxEnd - px, 
pyEnd - py);
+                       ox = rect.X;
+                       oy = rect.Y;
                }
                
                void CalcPos (Gdk.Rectangle rect, BoxPos hp, BoxPos vp, out int 
px, out int py)
@@ -899,6 +920,8 @@
                        if (evb.Type == Gdk.EventType.ButtonPress && evb.Button 
== 1) {
                                clickX = (int)evb.XRoot;
                                clickY = (int)evb.YRoot;
+                               localClickX = (int) evb.X;
+                               localClickY = (int) evb.Y;
                        }
                        return true;
                }
@@ -911,8 +934,11 @@
                        if (!Gtk.Drag.CheckThreshold (this, clickX, clickY, 
(int)evm.XRoot, (int)evm.YRoot))
                                return false;
 
-                       if (ParentBox.ObjectSelection != null)
-                               ParentBox.ObjectSelection.FireDrag (evm);
+                       if (ParentBox.ObjectSelection != null && 
ParentBox.ObjectSelection.AllowDrag) {
+                               int dx = Allocation.X - ox + localClickX;
+                               int dy = Allocation.Y - oy + localClickY;
+                               ParentBox.ObjectSelection.FireDrag (evm, dx, 
dy);
+                       }
 
                        return true;
                }
@@ -923,6 +949,7 @@
                ResizableFixed box;
                Gtk.Widget widget;
                object dataObject;
+               bool allowDrag = true;
                
                public ObjectSelection (ResizableFixed box, Gtk.Widget widget, 
object dataObject)
                {
@@ -950,12 +977,17 @@
                                Disposed (this, EventArgs.Empty);
                }
                
-               internal void FireDrag (Gdk.EventMotion evt)
+               internal void FireDrag (Gdk.EventMotion evt, int dx, int dy)
                {
                        if (Drag != null)
-                               Drag (evt);
+                               Drag (evt, dx, dy);
                }
                
+               public bool AllowDrag {
+                       get { return allowDrag; }
+                       set { allowDrag = value; }
+               }
+               
                public event DragDelegate Drag;
                public event EventHandler Disposed;
        }

Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs       2007-01-17 17:30:12 UTC 
(rev 71220)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs       2007-01-17 17:59:25 UTC 
(rev 71221)
@@ -133,7 +133,7 @@
                                        designer.BorderWidth = 3;
                                        designer.PackStart (toolbar, false, 
false, 0);
                                        designer.PackStart (widget, true, true, 
3);
-                                       widget.DesignArea.SetSelection 
(gproject.Selection, gproject.Selection);
+                                       widget.DesignArea.SetSelection 
(gproject.Selection, gproject.Selection, false);
                                        widget.SelectionChanged += 
OnSelectionChanged;
                                
                                }

Modified: trunk/stetic/stetic/Makefile.am
===================================================================
--- trunk/stetic/stetic/Makefile.am     2007-01-17 17:30:12 UTC (rev 71220)
+++ trunk/stetic/stetic/Makefile.am     2007-01-17 17:59:25 UTC (rev 71221)
@@ -14,7 +14,7 @@
 RESOURCES = $(foreach file,$(RESOURCE_FILES),-resource:$(file)$(comma)$(notdir 
$(file)))
 
 stetic.exe: $(stetic_exe_sources) $(RESOURCE_FILES) ../libstetic/libstetic.dll
-       $(MCS) -debug -r:Mono.Posix -pkg:gnome-sharp-2.0 -pkg:glade-sharp-2.0 
-r:../libstetic/libstetic.dll -r:../libsteticui/libsteticui.dll -out:stetic.exe 
$(stetic_exe_sources:%=$(srcdir)/%) $(RESOURCES)
+       $(GMCS) -debug -r:Mono.Posix -pkg:gnome-sharp-2.0 -pkg:glade-sharp-2.0 
-r:../libstetic/libstetic.dll -r:../libsteticui/libsteticui.dll -out:stetic.exe 
$(stetic_exe_sources:%=$(srcdir)/%) $(RESOURCES)
 
 stetic: stetic.in
        sed -e "s:[EMAIL PROTECTED]@:$(MONO):" -e "s:[EMAIL 
PROTECTED]@:$(pkglibdir):" $< > $@

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

Reply via email to