Author: lluis Date: 2008-02-21 07:50:26 -0500 (Thu, 21 Feb 2008) New Revision: 96335
Modified: trunk/stetic/ChangeLog trunk/stetic/libstetic/wrapper/Box.cs trunk/stetic/libstetic/wrapper/Container.cs trunk/stetic/libstetic/wrapper/Expander.cs trunk/stetic/libstetic/wrapper/Frame.cs trunk/stetic/libstetic/wrapper/Notebook.cs trunk/stetic/libstetic/wrapper/Paned.cs trunk/stetic/libstetic/wrapper/ScrolledWindow.cs trunk/stetic/libstetic/wrapper/Table.cs trunk/stetic/libstetic/wrapper/objects.xml trunk/stetic/libsteticui/CecilClassDescriptor.cs trunk/stetic/libsteticui/ContextMenu.cs Log: * libsteticui/CecilClassDescriptor.cs: Don't create black boxes for custom widgets which allow children. Fixes bug #361650. * libsteticui/ContextMenu.cs: Dont show invisible commands. * libstetic/wrapper/Frame.cs, libstetic/wrapper/Table.cs, libstetic/wrapper/Paned.cs, libstetic/wrapper/Box.cs, libstetic/wrapper/ScrolledWindow.cs, libstetic/wrapper/Expander.cs, libstetic/wrapper/Notebook.cs: Don't add placeholders if they are not allowed. * libstetic/wrapper/Container.cs: Don't allow placeholders if a container can't have children. * libstetic/wrapper/objects.xml: Hide commands not allowed when containers does not allow children. Modified: trunk/stetic/ChangeLog =================================================================== --- trunk/stetic/ChangeLog 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/ChangeLog 2008-02-21 12:50:26 UTC (rev 96335) @@ -1,3 +1,18 @@ +2008-02-21 Lluis Sanchez Gual <[EMAIL PROTECTED]> + + * libsteticui/CecilClassDescriptor.cs: Don't create black boxes for + custom widgets which allow children. Fixes bug #361650. + * libsteticui/ContextMenu.cs: Dont show invisible commands. + * libstetic/wrapper/Frame.cs, libstetic/wrapper/Table.cs, + libstetic/wrapper/Paned.cs, libstetic/wrapper/Box.cs, + libstetic/wrapper/ScrolledWindow.cs, libstetic/wrapper/Expander.cs, + libstetic/wrapper/Notebook.cs: Don't add placeholders if they are + not allowed. + * libstetic/wrapper/Container.cs: Don't allow placeholders if a + container can't have children. + * libstetic/wrapper/objects.xml: Hide commands not allowed when + containers does not allow children. + 2008-02-20 Lluis Sanchez Gual <[EMAIL PROTECTED]> * libsteticui/ActionComponent.cs, libstetic/wrapper/Action.cs: Added wrapper Modified: trunk/stetic/libstetic/wrapper/Box.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Box.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Box.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -8,7 +8,7 @@ public override void Wrap (object obj, bool initialized) { base.Wrap (obj, initialized); - if (!initialized) { + if (!initialized && AllowPlaceholders) { Placeholder ph = CreatePlaceholder (); box.PackStart (ph); NotifyChildAdded (ph); Modified: trunk/stetic/libstetic/wrapper/Container.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Container.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Container.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -117,7 +117,7 @@ protected virtual bool AllowPlaceholders { get { - return true; + return true && this.ClassDescriptor.AllowChildren; } } @@ -144,6 +144,11 @@ container.BorderWidth = 0; } + internal bool ChildrenAllowed () + { + return this.ClassDescriptor.AllowChildren; + } + int freeze; protected void Freeze () { Modified: trunk/stetic/libstetic/wrapper/Expander.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Expander.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Expander.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -17,7 +17,8 @@ base.Wrap (obj, initialized); if (!initialized) { expander.Label = expander.Name; - AddPlaceholder (); + if (AllowPlaceholders) + AddPlaceholder (); } if (expander.LabelWidget != null) ObjectWrapper.Create (proj, expander.LabelWidget); Modified: trunk/stetic/libstetic/wrapper/Frame.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Frame.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Frame.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -14,11 +14,13 @@ frame.Label = "<b>" + frame.Name + "</b>"; ((Gtk.Label)frame.LabelWidget).UseMarkup = true; frame.Shadow = Gtk.ShadowType.None; - Gtk.Alignment align = new Gtk.Alignment (0, 0, 1, 1); - align.LeftPadding = 12; - Container align_wrapper = (Container)ObjectWrapper.Create (proj, align); - align_wrapper.AddPlaceholder (); - ReplaceChild (frame.Child, (Gtk.Widget)align_wrapper.Wrapped, true); + if (AllowPlaceholders) { + Gtk.Alignment align = new Gtk.Alignment (0, 0, 1, 1); + align.LeftPadding = 12; + Container align_wrapper = (Container)ObjectWrapper.Create (proj, align); + align_wrapper.AddPlaceholder (); + ReplaceChild (frame.Child, (Gtk.Widget)align_wrapper.Wrapped, true); + } } if (frame.LabelWidget != null) Modified: trunk/stetic/libstetic/wrapper/Notebook.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Notebook.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Notebook.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -12,7 +12,7 @@ public override void Wrap (object obj, bool initialized) { base.Wrap (obj, initialized); - if (!initialized) { + if (!initialized && AllowPlaceholders) { if (notebook.Children.Length != 0) { // Remove the dummy page Container.Wrap added notebook.Remove (notebook.Children[0]); Modified: trunk/stetic/libstetic/wrapper/Paned.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Paned.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Paned.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -7,7 +7,7 @@ public override void Wrap (object obj, bool initialized) { base.Wrap (obj, initialized); - if (!initialized) { + if (!initialized && AllowPlaceholders) { Placeholder ph = CreatePlaceholder (); paned.Pack1 (ph, true, false); NotifyChildAdded (ph); Modified: trunk/stetic/libstetic/wrapper/ScrolledWindow.cs =================================================================== --- trunk/stetic/libstetic/wrapper/ScrolledWindow.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/ScrolledWindow.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -13,7 +13,7 @@ { base.Wrap (obj, initialized); if (!initialized) { - if (scrolled.Child == null) + if (scrolled.Child == null && AllowPlaceholders) AddPlaceholder (); HscrollbarPolicy = VscrollbarPolicy = Gtk.PolicyType.Automatic; scrolled.ShadowType = Gtk.ShadowType.In; Modified: trunk/stetic/libstetic/wrapper/Table.cs =================================================================== --- trunk/stetic/libstetic/wrapper/Table.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/Table.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -37,6 +37,8 @@ protected override void DoSync () { + if (!AllowPlaceholders) + return; using (UndoManager.AtomicChange) { uint left, right, top, bottom; uint row, col; Modified: trunk/stetic/libstetic/wrapper/objects.xml =================================================================== --- trunk/stetic/libstetic/wrapper/objects.xml 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libstetic/wrapper/objects.xml 2008-02-21 12:50:26 UTC (rev 96335) @@ -333,9 +333,14 @@ </itemgroups> <contextmenu> <command name="InsertBefore" label="Insert Before" - description="Insert an empty row/column before the selected one" /> + description="Insert an empty row/column before the selected one"> + <invisible-if check="ChildrenAllowed" /> + </command> + <command name="InsertAfter" label="Insert After" - description="Insert an empty row/column after the selected one" /> + description="Insert an empty row/column after the selected one"> + <invisible-if check="ChildrenAllowed" /> + </command> </contextmenu> </object> @@ -371,9 +376,13 @@ </itemgroups> <contextmenu> <command name="InsertBefore" label="Insert Button Before" - description="Insert a new button before the selected one" /> + description="Insert a new button before the selected one" > + <invisible-if check="ChildrenAllowed" /> + </command> <command name="InsertAfter" label="Insert Button After" - description="Insert a new button after the selected one" /> + description="Insert a new button after the selected one"> + <invisible-if check="ChildrenAllowed" /> + </command> </contextmenu> </object> <object type="Gtk.ButtonBox+ButtonBoxChild,gtk-sharp" wrapper="Stetic.Wrapper.ButtonBox+ButtonBoxChild"> @@ -949,10 +958,13 @@ <property name="BorderWidth" /> <command name="InsertBefore" label="Insert Page Before" description="Insert a blank page before this one"> + <invisible-if check="ChildrenAllowed" /> <disabled-if check="CheckInsertBefore" /> </command> <command name="InsertAfter" label="Insert Page After" - description="Insert a blank page after this one" /> + description="Insert a blank page after this one" > + <invisible-if check="ChildrenAllowed" /> + </command> </itemgroup> </itemgroups> <signals> @@ -975,14 +987,17 @@ </command> <command name="DeletePage" label="Delete Page" description="Delete the current page"> + <invisible-if check="ChildrenAllowed" /> <disabled-if check="CheckDeletePage" /> </command> <command name="SwapPrevious" label="Swap with Previous Page" description="Swap the contents of this page with the contents of the previous page"> + <invisible-if check="ChildrenAllowed" /> <disabled-if check="CheckPreviousPage" /> </command> <command name="SwapNext" label="Swap with Next Page" description="Swap the contents of this page with the contents of the next page"> + <invisible-if check="ChildrenAllowed" /> <disabled-if check="CheckNextPage" /> </command> <command ref="InsertBefore" /> @@ -1256,17 +1271,29 @@ </itemgroups> <contextmenu> <command name="InsertRowBefore" label="Insert Row Before" - description="Insert an empty row above the selected row" /> + description="Insert an empty row above the selected row"> + <invisible-if check="ChildrenAllowed" /> + </command> <command name="InsertRowAfter" label="Insert Row After" - description="Insert an empty row below the selected row" /> + description="Insert an empty row below the selected row"> + <invisible-if check="ChildrenAllowed" /> + </command> <command name="InsertColumnBefore" label="Insert Column Before" - description="Insert an empty column before the selected column" /> + description="Insert an empty column before the selected column"> + <invisible-if check="ChildrenAllowed" /> + </command> <command name="InsertColumnAfter" label="Insert Column After" - description="Insert an empty column after the selected column" /> + description="Insert an empty column after the selected column"> + <invisible-if check="ChildrenAllowed" /> + </command> <command name="DeleteRow" label="Delete Row" - description="Delete the selected row" /> + description="Delete the selected row"> + <invisible-if check="ChildrenAllowed" /> + </command> <command name="DeleteColumn" label="Delete Column" - description="Delete the selected column" /> + description="Delete the selected column"> + <invisible-if check="ChildrenAllowed" /> + </command> </contextmenu> <glade-transform> Modified: trunk/stetic/libsteticui/CecilClassDescriptor.cs =================================================================== --- trunk/stetic/libsteticui/CecilClassDescriptor.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libsteticui/CecilClassDescriptor.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -40,7 +40,7 @@ wrapperClassDescriptor = typeClassDescriptor; } - if (steticDefinition == null && NeedsBlackBox (typeClassDescriptor.Name)) { + if (steticDefinition == null && !AllowChildren && NeedsBlackBox (typeClassDescriptor.Name)) { // It is not possible to create instances of that widget, instead we'll have // to create the typical custom widget black box. Modified: trunk/stetic/libsteticui/ContextMenu.cs =================================================================== --- trunk/stetic/libsteticui/ContextMenu.cs 2008-02-21 11:16:04 UTC (rev 96334) +++ trunk/stetic/libsteticui/ContextMenu.cs 2008-02-21 12:50:26 UTC (rev 96335) @@ -52,6 +52,8 @@ if (klass != null) { foreach (ItemDescriptor id in klass.ContextMenu) { CommandDescriptor cmd = (CommandDescriptor)id; + if (!cmd.VisibleFor (widget)) + continue; item = new MenuItem (cmd.Label); if (cmd.Enabled (widget, context)) { Gtk.Widget wdup = widget, cdup = context; // FIXME bxc 75689 _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches