Author: lluis
Date: 2007-05-16 10:30:34 -0400 (Wed, 16 May 2007)
New Revision: 77481

Modified:
   trunk/stetic/ChangeLog
   trunk/stetic/libstetic/ClassDescriptor.cs
   trunk/stetic/libstetic/GeneratorContext.cs
   trunk/stetic/libstetic/ImageInfo.cs
   trunk/stetic/libstetic/ProjectIconFactory.cs
   trunk/stetic/libstetic/wrapper/ActionGroup.cs
   trunk/stetic/libsteticui/ActionGroupComponent.cs
   trunk/stetic/libsteticui/Component.cs
   trunk/stetic/libsteticui/PaletteBackend.cs
   trunk/stetic/libsteticui/Project.cs
   trunk/stetic/libsteticui/ProjectBackend.cs
   trunk/stetic/libsteticui/WidgetComponent.cs
   trunk/stetic/libsteticui/WidgetEditSession.cs
Log:
* libsteticui/ProjectBackend.cs, libsteticui/WidgetEditSession.cs,
  libsteticui/PaletteBackend.cs, libsteticui/Project.cs: Added
  support for internal widgets and internal widget libraries.
  Internal widgets won't be shown in the palette unless the library
  to which they belong is internal to the project.
* libsteticui/Component.cs, libsteticui/ActionGroupComponent.cs,
  libsteticui/WidgetComponent.cs: Added properties for changing the
  GeneratePublic flag.
* libstetic/ImageInfo.cs, libstetic/ProjectIconFactory.cs,
  libstetic/GeneratorContext.cs: Added a GenerateLoadPixbuf method
  which creates a pixbuf from a stock image name in safe way (it
  won't crash if the image doesn't exist, but it will return a
  'missing image' icon).
* libstetic/wrapper/ActionGroup.cs: Allow generatic private action
  groups.
* libstetic/ClassDescriptor.cs: Added support for internal widgets.

Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog      2007-05-16 13:59:11 UTC (rev 77480)
+++ trunk/stetic/ChangeLog      2007-05-16 14:30:34 UTC (rev 77481)
@@ -1,3 +1,22 @@
+2007-05-16  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * libsteticui/ProjectBackend.cs, libsteticui/WidgetEditSession.cs,
+         libsteticui/PaletteBackend.cs, libsteticui/Project.cs: Added
+         support for internal widgets and internal widget libraries.
+         Internal widgets won't be shown in the palette unless the library
+         to which they belong is internal to the project.
+       * libsteticui/Component.cs, libsteticui/ActionGroupComponent.cs,
+         libsteticui/WidgetComponent.cs: Added properties for changing the
+         GeneratePublic flag.
+       * libstetic/ImageInfo.cs, libstetic/ProjectIconFactory.cs,
+         libstetic/GeneratorContext.cs: Added a GenerateLoadPixbuf method
+         which creates a pixbuf from a stock image name in safe way (it
+         won't crash if the image doesn't exist, but it will return a
+         'missing image' icon).
+       * libstetic/wrapper/ActionGroup.cs: Allow generatic private action
+         groups.
+       * libstetic/ClassDescriptor.cs: Added support for internal widgets.
+
 2007-05-15  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
 
        * libsteticui/ActionGroupDesigner.cs, libsteticui/ProjectBackend.cs,

Modified: trunk/stetic/libstetic/ClassDescriptor.cs
===================================================================
--- trunk/stetic/libstetic/ClassDescriptor.cs   2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libstetic/ClassDescriptor.cs   2007-05-16 14:30:34 UTC (rev 
77481)
@@ -19,6 +19,7 @@
                protected ItemGroup contextMenu;
                protected ItemGroup internalChildren;
                protected string baseType;
+               protected bool isInternal;
                
                WidgetLibrary library;
                PropertyDescriptor[] initializationProperties;
@@ -38,7 +39,7 @@
                                label = WrappedTypeName;
                        
                        if (elem.HasAttribute ("allow-children"))
-                               allowChildren = elem.GetAttribute 
("allow-children") == "yes";
+                               allowChildren = elem.GetAttribute 
("allow-children") == "yes" || elem.GetAttribute ("allow-children") == "true";
                                
                        category = elem.GetAttribute ("palette-category");
 
@@ -48,6 +49,8 @@
                                hexpandable = true;
                        if (elem.HasAttribute ("vexpandable"))
                                vexpandable = true;
+                       if (elem.GetAttribute ("internal") == "true")
+                               isInternal = true;
                        
                        contextMenu = ItemGroup.Empty;
                        
@@ -132,6 +135,10 @@
                                return WrappedTypeName;
                        }
                }
+               
+               public virtual bool IsInternal {
+                       get { return isInternal; }
+               }
 
                public abstract string WrappedTypeName {
                        get;

Modified: trunk/stetic/libstetic/GeneratorContext.cs
===================================================================
--- trunk/stetic/libstetic/GeneratorContext.cs  2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libstetic/GeneratorContext.cs  2007-05-16 14:30:34 UTC (rev 
77481)
@@ -134,7 +134,7 @@
                        }
                        
                        if (value is ImageInfo && 
typeof(Gdk.Pixbuf).IsAssignableFrom (type))
-                               return ((ImageInfo)value).ToCodeExpression ();
+                               return ((ImageInfo)value).ToCodeExpression 
(this);
                        
                        if (value is Wrapper.ActionGroup) {
                                return new CodeMethodInvokeExpression (
@@ -198,6 +198,217 @@
                        map = new WidgetMap (vars);
                        n = 0;
                }
+               
+               public CodeExpression GenerateLoadPixbuf (string name, int sz)
+               {
+                       bool found = false;
+                       foreach (CodeTypeDeclaration t in cns.Types) {
+                               if (t.Name == "IconLoader") {
+                                       found = true;
+                                       break;
+                               }
+                       }
+                       
+                       if (!found)
+                       {
+                               CodeTypeDeclaration cls = new 
CodeTypeDeclaration ("IconLoader");
+                               cls.Attributes = MemberAttributes.Assembly;
+                               cns.Types.Add (cls);
+                               
+                               CodeMemberMethod met = new CodeMemberMethod ();
+                               cls.Members.Add (met);
+                               met.Attributes = MemberAttributes.Public | 
MemberAttributes.Static;
+                               met.Name = "LoadIcon";
+                               met.Parameters.Add (new 
CodeParameterDeclarationExpression (typeof(string), "name"));
+                               met.Parameters.Add (new 
CodeParameterDeclarationExpression (typeof(int), "sz"));
+                               met.ReturnType = new CodeTypeReference 
(typeof(Gdk.Pixbuf));
+                               
+                               CodeExpression nameExp = new 
CodeVariableReferenceExpression ("name");
+                               CodeExpression szExp = new 
CodeVariableReferenceExpression ("sz");
+                               CodeExpression mgExp = new 
CodeBinaryOperatorExpression (szExp,  CodeBinaryOperatorType.Divide, new 
CodePrimitiveExpression (4));
+                               CodeExpression pmapExp = new 
CodeVariableReferenceExpression ("pmap");
+                               CodeExpression gcExp = new 
CodeVariableReferenceExpression ("gc");
+                               CodeExpression szM1Exp = new 
CodeBinaryOperatorExpression (szExp, CodeBinaryOperatorType.Subtract, new 
CodePrimitiveExpression (1));
+                               CodeExpression zeroExp = new 
CodePrimitiveExpression (0);
+                               
+                               CodeTryCatchFinallyStatement trycatch = new 
CodeTryCatchFinallyStatement ();
+                               met.Statements.Add (trycatch);
+                               trycatch.TryStatements.Add (
+                                       new CodeMethodReturnStatement (
+                                               new CodeMethodInvokeExpression (
+                                                       new 
CodePropertyReferenceExpression (
+                                                               new 
CodeTypeReferenceExpression (typeof(Gtk.IconTheme)),
+                                                               "Default"
+                                                       ),
+                                                       "LoadIcon",
+                                                       nameExp,
+                                                       szExp,
+                                                       zeroExp
+                                               )
+                                       )
+                               );
+                               
+                               CodeCatchClause ccatch = new CodeCatchClause ();
+                               trycatch.CatchClauses.Add (ccatch);
+                               
+                               CodeConditionStatement cond = new 
CodeConditionStatement ();
+                               ccatch.Statements.Add (cond);
+                               
+                               cond.Condition = new 
CodeBinaryOperatorExpression (
+                                       nameExp,
+                                       
CodeBinaryOperatorType.IdentityInequality,
+                                       new CodePrimitiveExpression 
("gtk-missing-image")
+                               );
+                               
+                               cond.TrueStatements.Add (
+                                       new CodeMethodReturnStatement (
+                                               new CodeMethodInvokeExpression (
+                                                       new 
CodeTypeReferenceExpression (cns.Name + "." + cls.Name),
+                                                       "LoadIcon", new 
CodePrimitiveExpression ("gtk-missing-image"), 
+                                                       szExp
+                                               )
+                                       )
+                               );
+                               
+                               CodeStatementCollection stms = 
cond.FalseStatements;
+                               
+                               stms.Add (
+                                       new CodeVariableDeclarationStatement 
(typeof(Gdk.Pixmap), "pmap", 
+                                               new CodeObjectCreateExpression (
+                                                       typeof(Gdk.Pixmap),
+                                                       new 
CodePropertyReferenceExpression (
+                                                               new 
CodePropertyReferenceExpression (
+                                                                       new 
CodeTypeReferenceExpression (typeof(Gdk.Screen)),
+                                                                       
"Default"
+                                                               ),
+                                                               "RootWindow"
+                                                       ),
+                                                       szExp,
+                                                       szExp
+                                               )
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeVariableDeclarationStatement 
(typeof(Gdk.GC), "gc", 
+                                               new CodeObjectCreateExpression 
(typeof(Gdk.GC), pmapExp)
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeAssignStatement (
+                                               new 
CodePropertyReferenceExpression (
+                                                       gcExp,
+                                                       "RgbFgColor"
+                                               ),
+                                               new CodeObjectCreateExpression (
+                                                       typeof(Gdk.Color),
+                                                       new 
CodePrimitiveExpression (255),
+                                                       new 
CodePrimitiveExpression (255),
+                                                       new 
CodePrimitiveExpression (255)
+                                               )
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodInvokeExpression (
+                                               pmapExp,
+                                               "DrawRectangle",
+                                               gcExp,
+                                               new CodePrimitiveExpression 
(true),
+                                               zeroExp,
+                                               zeroExp,
+                                               szExp,
+                                               szExp
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeAssignStatement (
+                                               new 
CodePropertyReferenceExpression (
+                                                       gcExp,
+                                                       "RgbFgColor"
+                                               ),
+                                               new CodeObjectCreateExpression (
+                                                       typeof(Gdk.Color),
+                                                       zeroExp, zeroExp, 
zeroExp
+                                               )
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodInvokeExpression (
+                                               pmapExp,
+                                               "DrawRectangle",
+                                               gcExp,
+                                               new CodePrimitiveExpression 
(false),
+                                               zeroExp,
+                                               zeroExp,
+                                               szM1Exp,
+                                               szM1Exp
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodInvokeExpression (
+                                               gcExp,
+                                               "SetLineAttributes",
+                                               new CodePrimitiveExpression (3),
+                                               new 
CodeFieldReferenceExpression (new CodeTypeReferenceExpression 
(typeof(Gdk.LineStyle)), "Solid"),
+                                               new 
CodeFieldReferenceExpression (new CodeTypeReferenceExpression 
(typeof(Gdk.CapStyle)), "Round"),
+                                               new 
CodeFieldReferenceExpression (new CodeTypeReferenceExpression 
(typeof(Gdk.JoinStyle)), "Round")
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeAssignStatement (
+                                               new 
CodePropertyReferenceExpression (
+                                                       gcExp,
+                                                       "RgbFgColor"
+                                               ),
+                                               new CodeObjectCreateExpression (
+                                                       typeof(Gdk.Color),
+                                                       new 
CodePrimitiveExpression (255),
+                                                       zeroExp,
+                                                       zeroExp
+                                               )
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodInvokeExpression (
+                                               pmapExp,
+                                               "DrawLine",
+                                               gcExp,
+                                               mgExp,
+                                               mgExp,
+                                               new 
CodeBinaryOperatorExpression (szM1Exp, CodeBinaryOperatorType.Subtract, mgExp),
+                                               new 
CodeBinaryOperatorExpression (szM1Exp, CodeBinaryOperatorType.Subtract, mgExp)
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodInvokeExpression (
+                                               pmapExp,
+                                               "DrawLine",
+                                               gcExp,
+                                               new 
CodeBinaryOperatorExpression (szM1Exp, CodeBinaryOperatorType.Subtract, mgExp),
+                                               mgExp,
+                                               mgExp,
+                                               new 
CodeBinaryOperatorExpression (szM1Exp, CodeBinaryOperatorType.Subtract, mgExp)
+                                       )
+                               );
+                               stms.Add (
+                                       new CodeMethodReturnStatement (
+                                               new CodeMethodInvokeExpression (
+                                                       new 
CodeTypeReferenceExpression (typeof(Gdk.Pixbuf)),
+                                                       "FromDrawable",
+                                                       pmapExp,
+                                                       new 
CodePropertyReferenceExpression (pmapExp, "Colormap"),
+                                                       zeroExp, zeroExp, 
zeroExp, zeroExp, szExp, szExp
+                                               )
+                                       )
+                               );
+                       }
+                       
+                       return new CodeMethodInvokeExpression (
+                               new CodeTypeReferenceExpression (cns.Name + 
".IconLoader"),
+                               "LoadIcon",
+                               new CodePrimitiveExpression (name),
+                               new CodePrimitiveExpression (sz)
+                       );
+               }
        }
 
        public class WidgetMap

Modified: trunk/stetic/libstetic/ImageInfo.cs
===================================================================
--- trunk/stetic/libstetic/ImageInfo.cs 2007-05-16 13:59:11 UTC (rev 77480)
+++ trunk/stetic/libstetic/ImageInfo.cs 2007-05-16 14:30:34 UTC (rev 77481)
@@ -190,7 +190,7 @@
                        return pix;
                }
                
-               public CodeExpression ToCodeExpression ()
+               public CodeExpression ToCodeExpression (GeneratorContext ctx)
                {
                        switch (source) {
                                case ImageSource.Resource:
@@ -203,16 +203,7 @@
                                case ImageSource.Theme:
                                        int w, h;
                                        Gtk.Icon.SizeLookup (size, out w, out 
h);
-                                       return new CodeMethodInvokeExpression (
-                                               new 
CodePropertyReferenceExpression (
-                                                       new 
CodeTypeReferenceExpression (typeof(Gtk.IconTheme)), 
-                                                       "Default"
-                                               ),
-                                               "LoadIcon",
-                                               new CodePrimitiveExpression 
(name),
-                                               new CodePrimitiveExpression (w),
-                                               new CodePrimitiveExpression (0)
-                                       );
+                                       return ctx.GenerateLoadPixbuf (name, w);
                                        
                                case ImageSource.File:
                                        return new CodeObjectCreateExpression (

Modified: trunk/stetic/libstetic/ProjectIconFactory.cs
===================================================================
--- trunk/stetic/libstetic/ProjectIconFactory.cs        2007-05-16 13:59:11 UTC 
(rev 77480)
+++ trunk/stetic/libstetic/ProjectIconFactory.cs        2007-05-16 14:30:34 UTC 
(rev 77481)
@@ -142,7 +142,7 @@
                        if (sources.Count == 1 && sources[0].AllWildcarded) {
                                varDec.InitExpression = new 
CodeObjectCreateExpression (
                                        typeof(Gtk.IconSet),
-                                       sources[0].Image.ToCodeExpression ()
+                                       sources[0].Image.ToCodeExpression (ctx)
                                );
                        } else {
                                varDec.InitExpression = new 
CodeObjectCreateExpression (typeof(Gtk.IconSet));
@@ -249,7 +249,7 @@
                        
                        ctx.Statements.Add (new CodeAssignStatement (
                                new CodePropertyReferenceExpression (var, 
"Pixbuf"),
-                               imageInfo.ToCodeExpression ()
+                               imageInfo.ToCodeExpression (ctx)
                        ));
                        
                        if (!SizeWildcarded) {

Modified: trunk/stetic/libstetic/wrapper/ActionGroup.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/ActionGroup.cs       2007-05-16 13:59:11 UTC 
(rev 77480)
+++ trunk/stetic/libstetic/wrapper/ActionGroup.cs       2007-05-16 14:30:34 UTC 
(rev 77481)
@@ -12,6 +12,7 @@
                string name;
                ActionCollection actions;
                ObjectWrapper owner;
+               bool generatePublic = true;
                
                public event ActionEventHandler ActionAdded;
                public event ActionEventHandler ActionRemoved;
@@ -46,6 +47,11 @@
                        }
                }
                
+               public bool GeneratePublic {
+                       get { return generatePublic; }
+                       set { generatePublic = value; }
+               }
+               
                public Action GetAction (string name)
                {
                        foreach (Action ac in actions)

Modified: trunk/stetic/libsteticui/ActionGroupComponent.cs
===================================================================
--- trunk/stetic/libsteticui/ActionGroupComponent.cs    2007-05-16 13:59:11 UTC 
(rev 77480)
+++ trunk/stetic/libsteticui/ActionGroupComponent.cs    2007-05-16 14:30:34 UTC 
(rev 77481)
@@ -24,6 +24,11 @@
                        }
                }
                
+               public override bool GeneratePublic {
+                       get { return 
((Wrapper.ActionGroup)backend).GeneratePublic; }
+                       set { ((Wrapper.ActionGroup)backend).GeneratePublic = 
value; }
+               }
+               
                protected override void OnChanged ()
                {
                        name = null;

Modified: trunk/stetic/libsteticui/Component.cs
===================================================================
--- trunk/stetic/libsteticui/Component.cs       2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libsteticui/Component.cs       2007-05-16 14:30:34 UTC (rev 
77481)
@@ -108,6 +108,11 @@
                        }
                }
                
+               public virtual bool GeneratePublic {
+                       get { return true; }
+                       set {}
+               }
+               
                internal object Backend {
                        get { return backend; }
                }

Modified: trunk/stetic/libsteticui/PaletteBackend.cs
===================================================================
--- trunk/stetic/libsteticui/PaletteBackend.cs  2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libsteticui/PaletteBackend.cs  2007-05-16 14:30:34 UTC (rev 
77481)
@@ -137,17 +137,19 @@
                        if (libraries == null) {
                                foreach (ClassDescriptor klass in 
Registry.AllClasses)
                                        classes.Add (klass);
-                       } else {
+                       } else if (project != null) {
                                foreach (WidgetLibrary lib in libraries) {
-                                       classes.AddRange (lib.AllClasses);
+                                       bool isInternalLib = 
project.IsInternalLibrary (lib.Name);
+                                       foreach (ClassDescriptor cd in 
lib.AllClasses) {
+                                               if (!cd.Deprecated && 
cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal))
+                                                       classes.Add (cd);
+                                       }
                                }
                        }
                        
                        classes.Sort (this);
 
                        foreach (ClassDescriptor klass in classes) {
-                               if (klass.Deprecated || klass.Category == "")
-                                       continue;
 
                                if (!groups.Contains (klass.Category))
                                        continue;

Modified: trunk/stetic/libsteticui/Project.cs
===================================================================
--- trunk/stetic/libsteticui/Project.cs 2007-05-16 13:59:11 UTC (rev 77480)
+++ trunk/stetic/libsteticui/Project.cs 2007-05-16 14:30:34 UTC (rev 77481)
@@ -351,6 +351,11 @@
 
                public void AddWidgetLibrary (string assemblyPath)
                {
+                       AddWidgetLibrary (assemblyPath, false);
+               }
+               
+               public void AddWidgetLibrary (string assemblyPath, bool 
isInternal)
+               {
                        reloadRequested = false;
                        ProjectBackend.AddWidgetLibrary (assemblyPath);
                        app.UpdateWidgetLibraries (false, false);
@@ -370,17 +375,27 @@
                public string[] WidgetLibraries {
                        get {
                                return (string[]) 
ProjectBackend.WidgetLibraries.ToArray (typeof(string));
-                       } set {
-                               reloadRequested = false;
-                               ArrayList libs = new ArrayList ();
-                               libs.AddRange (value);
-                               ProjectBackend.WidgetLibraries = libs;
-                               app.UpdateWidgetLibraries (false, false);
-                               if (!reloadRequested)
-                                       ProjectBackend.Reload ();
                        }
                }
                
+               public void SetWidgetLibraries (string[] libraries, string[] 
internalLibraries)
+               {
+                       reloadRequested = false;
+                       
+                       ArrayList libs = new ArrayList ();
+                       libs.AddRange (libraries);
+                       libs.AddRange (internalLibraries);
+                       ProjectBackend.WidgetLibraries = libs;
+                       
+                       libs = new ArrayList ();
+                       libs.AddRange (internalLibraries);
+                       ProjectBackend.InternalWidgetLibraries = libs;
+                       
+                       app.UpdateWidgetLibraries (false, false);
+                       if (!reloadRequested)
+                               ProjectBackend.Reload ();
+               }
+               
 /*             public bool CanCopySelection {
                        get { return Selection != null ? Selection.CanCopy : 
false; }
                }

Modified: trunk/stetic/libsteticui/ProjectBackend.cs
===================================================================
--- trunk/stetic/libsteticui/ProjectBackend.cs  2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libsteticui/ProjectBackend.cs  2007-05-16 14:30:34 UTC (rev 
77481)
@@ -30,6 +30,7 @@
                Project frontend;
                int componentIdCounter;
                ArrayList widgetLibraries;
+               ArrayList internalLibs;
                ApplicationBackend app;
                ImportContext importContext;
                
@@ -69,6 +70,7 @@
                        
                        iconFactory = new ProjectIconFactory ();
                        widgetLibraries = new ArrayList ();
+                       internalLibs = new ArrayList ();
                }
                
                public void Dispose ()
@@ -111,6 +113,16 @@
                        set { widgetLibraries = value; }
                }
                
+               internal ArrayList InternalWidgetLibraries {
+                       get { return internalLibs; }
+                       set { internalLibs = value; }
+               }
+               
+               public bool IsInternalLibrary (string lib)
+               {
+                       return internalLibs.Contains (lib);
+               }
+               
                public bool CanGenerateCode {
                        get {
                                // It can generate code if all libraries on 
which depend can generate code
@@ -125,21 +137,38 @@
                
                public void AddWidgetLibrary (string lib)
                {
+                       AddWidgetLibrary (lib, false);
+               }
+               
+               public void AddWidgetLibrary (string lib, bool isInternal)
+               {
                        if (!widgetLibraries.Contains (lib))
                                widgetLibraries.Add (lib);
+                       if (isInternal) {
+                               if (!internalLibs.Contains (lib))
+                                       internalLibs.Add (lib);
+                       }
+                       else {
+                               internalLibs.Remove (lib);
+                       }
                }
                
                public void RemoveWidgetLibrary (string lib)
                {
                        widgetLibraries.Remove (lib);
+                       internalLibs.Remove (lib);
                }
                
                public ArrayList GetComponentTypes ()
                {
                        ArrayList list = new ArrayList ();
                        foreach (WidgetLibrary lib in app.GetProjectLibraries 
(this)) {
+                               // Don't include in the list widgets which are 
internal (when the library is
+                               // not internal to the project), widgets not 
assigned to any category, and deprecated ones.
+                               bool isInternalLib = IsInternalLibrary 
(lib.Name);
+                               Console.WriteLine ("pp1: " + IsInternalLibrary 
(lib.Name) + " " + lib.Name);
                                foreach (ClassDescriptor cd in lib.AllClasses) {
-                                       if (!cd.Deprecated && 
cd.Category.Length > 0)
+                                       if (!cd.Deprecated && 
cd.Category.Length > 0 && (isInternalLib || !cd.IsInternal))
                                                list.Add (cd.Name);
                                }
                        }
@@ -273,6 +302,8 @@
                                                }
                                        }
                                        widgetLibraries.Add (libname);
+                                       if (libElem.GetAttribute ("internal") 
== "true")
+                                               internalLibs.Add (libname);
                                }
                                
                                app.LoadLibraries (importContext, 
widgetLibraries);
@@ -345,6 +376,8 @@
                                        }
 
                                        libElem.SetAttribute ("name", libName);
+                                       if (IsInternalLibrary (wlib))
+                                               libElem.SetAttribute 
("internal", "true");
                                        importElem.AppendChild (libElem);
                                }
                        }

Modified: trunk/stetic/libsteticui/WidgetComponent.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetComponent.cs 2007-05-16 13:59:11 UTC (rev 
77480)
+++ trunk/stetic/libsteticui/WidgetComponent.cs 2007-05-16 14:30:34 UTC (rev 
77481)
@@ -26,6 +26,11 @@
                        }
                }
                
+               public override bool GeneratePublic {
+                       get { return ((Wrapper.Widget)backend).GeneratePublic; }
+                       set { ((Wrapper.Widget)backend).GeneratePublic = value; 
}
+               }
+               
                internal void UpdateName (string name)
                {
                        this.name = name;

Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs       2007-05-16 13:59:11 UTC 
(rev 77480)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs       2007-05-16 14:30:34 UTC 
(rev 77481)
@@ -80,6 +80,7 @@
                                gproject.IconFactory = win.Project.IconFactory;
                                gproject.ResourceProvider = 
win.Project.ResourceProvider;
                                gproject.WidgetLibraries = (ArrayList) 
((ProjectBackend)win.Project).WidgetLibraries.Clone ();
+                               gproject.InternalWidgetLibraries = (ArrayList) 
((ProjectBackend)win.Project).InternalWidgetLibraries.Clone ();
                                sourceProject.ComponentTypesChanged += 
OnSourceProjectLibsChanged;
                                
                                rootWidget = editingBackend.GetTopLevelWrapper 
(sourceWidget, false);
@@ -174,12 +175,7 @@
                                XmlElement data = 
Stetic.WidgetUtils.ExportWidget (rootWidget.Wrapped);
                                
                                Wrapper.Widget sw = 
sourceProject.GetTopLevelWrapper (sourceWidget, false);
-                               
-                               // GeneratePublic can't be changed in the 
designer. Keep the vaule it
-                               // had in the source project
-                               bool generatePublic = sw.GeneratePublic;
                                sw.Read (new ObjectReader (gproject, 
FileFormat.Native), data);
-                               sw.GeneratePublic = generatePublic;
                                
                                sourceWidget = ((Gtk.Widget)sw.Wrapped).Name;
                                sw.NotifyChanged ();
@@ -267,6 +263,7 @@
                        // If component types have changed in the source 
project, they must also change
                        // in this project.
                        gproject.WidgetLibraries = (ArrayList) 
sourceProject.WidgetLibraries.Clone ();
+                       gproject.InternalWidgetLibraries = (ArrayList) 
sourceProject.InternalWidgetLibraries.Clone ();
                        gproject.NotifyComponentTypesChanged ();
                }
                
@@ -276,6 +273,7 @@
                        if (!autoCommitChanges) {
                                gproject.AttachActionGroups 
(sourceProject.ActionGroups);
                                gproject.WidgetLibraries = (ArrayList) 
sourceProject.WidgetLibraries.Clone ();
+                               gproject.InternalWidgetLibraries = (ArrayList) 
sourceProject.InternalWidgetLibraries.Clone ();
                        }
                        
                        Gtk.Widget[] tops = gproject.Toplevels;

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

Reply via email to