Author: lluis
Date: 2007-03-26 09:31:14 -0500 (Mon, 26 Mar 2007)
New Revision: 74982
Removed:
trunk/stetic/libstetic/HandleWindow.cs
Modified:
trunk/stetic/ChangeLog
trunk/stetic/libstetic/ImageInfo.cs
trunk/stetic/libstetic/WidgetUtils.cs
trunk/stetic/libstetic/editor/StockItem.cs
trunk/stetic/libstetic/wrapper/Action.cs
trunk/stetic/libstetic/wrapper/ComboBox.cs
trunk/stetic/libstetic/wrapper/ImageMenuItem.cs
trunk/stetic/libstetic/wrapper/Widget.cs
trunk/stetic/libstetic/wrapper/objects.xml
trunk/stetic/libsteticui/CodeGeneratorPartialClass.cs
trunk/stetic/libsteticui/ComponentType.cs
trunk/stetic/libsteticui/WidgetEditSession.cs
Log:
* libsteticui/WidgetEditSession.cs,
libsteticui/CodeGeneratorPartialClass.cs,
libstetic/wrapper/Widget.cs, libstetic/wrapper/objects.xml: Support
generating private classes.
* libsteticui/ComponentType.cs, libstetic/ImageInfo.cs,
libstetic/wrapper/Action.cs, libstetic/wrapper/ImageMenuItem.cs,
libstetic/editor/StockItem.cs, libstetic/WidgetUtils.cs: Use the
new MissingIcon constant.
* libstetic/wrapper/ComboBox.cs: Made combo values translatable. Fixes
bug #81033.
* libstetic/HandleWindow.cs: Removed unused file.
Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog 2007-03-26 14:06:07 UTC (rev 74981)
+++ trunk/stetic/ChangeLog 2007-03-26 14:31:14 UTC (rev 74982)
@@ -1,3 +1,17 @@
+2007-03-26 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * libsteticui/WidgetEditSession.cs,
+ libsteticui/CodeGeneratorPartialClass.cs,
+ libstetic/wrapper/Widget.cs, libstetic/wrapper/objects.xml: Support
+ generating private classes.
+ * libsteticui/ComponentType.cs, libstetic/ImageInfo.cs,
+ libstetic/wrapper/Action.cs, libstetic/wrapper/ImageMenuItem.cs,
+ libstetic/editor/StockItem.cs, libstetic/WidgetUtils.cs: Use the
+ new MissingIcon constant.
+ * libstetic/wrapper/ComboBox.cs: Made combo values translatable. Fixes
+ bug #81033.
+ * libstetic/HandleWindow.cs: Removed unused file.
+
2007-03-08 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* libstetic/wrapper/Container.cs: Fix null ref.
Deleted: trunk/stetic/libstetic/HandleWindow.cs
===================================================================
--- trunk/stetic/libstetic/HandleWindow.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/HandleWindow.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -1,205 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Stetic {
-
- // This ought to be a subclass of Gdk.Window, but GdkWindow isn't
subclassable
-
- class HandleWindow : IDisposable {
-
- static Gdk.Color black, white;
- Gtk.Widget topLevel;
-
- const int handleSize = 6;
- const int borderSize = 3;
-
- static HandleWindow ()
- {
- black = new Gdk.Color (0, 0, 0);
- black.Pixel = 1;
- white = new Gdk.Color (255, 255, 255);
- white.Pixel = 0;
- }
-
- public HandleWindow (Gtk.Widget selection, bool dragHandles)
- {
- this.selection = selection;
- this.dragHandles = dragHandles;
-
- topLevel = selection;
- Gtk.Widget parent = topLevel;
- while (ObjectWrapper.Lookup (parent) != null) {
- topLevel = parent;
- parent = topLevel.Parent;
- }
-
- // If the window is embedded in a preview box, use
- // the gdk window of that box, which has more room
- // for drawing the handles.
- while (parent != null) {
- if (parent.Parent is WidgetDesigner ||
parent.Parent is Gtk.EventBox)
- break;
- parent = parent.Parent;
- }
- if (parent != null)
- topLevel = parent;
-
- selection.SizeAllocated += SelectionResized;
-
- invis = new Gtk.Invisible ();
- invis.WidgetEvent += HandleEvent;
-
- Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
- attributes.WindowType = Gdk.WindowType.Child;
- attributes.Wclass = Gdk.WindowClass.InputOutput;
- attributes.Visual = selection.Visual;
- attributes.Colormap = selection.Colormap;
- attributes.Mask = (Gdk.EventMask.ButtonPressMask |
- Gdk.EventMask.ButtonMotionMask |
- Gdk.EventMask.ButtonReleaseMask |
- Gdk.EventMask.ExposureMask);
- window = new Gdk.Window (topLevel.GdkWindow, attributes,
-
Gdk.WindowAttributesType.Visual |
-
Gdk.WindowAttributesType.Colormap);
- window.UserData = invis.Handle;
- selection.Style.Attach (window);
-
- Shape ();
- }
-
- public void Dispose ()
- {
- if (selection != null) {
- selection.SizeAllocated -= SelectionResized;
- selection = null;
- }
-
- if (invis != null) {
- invis.Destroy ();
- invis = null;
- }
-
- if (window != null) {
- window.Destroy ();
- window = null;
- }
- }
-
- Gtk.Widget selection, invis;
- bool dragHandles;
-
- Gdk.Window window;
- public Gdk.Window Window {
- get {
- return window;
- }
- }
-
- Gdk.Rectangle handleAllocation;
-
- public void Shape ()
- {
- Gdk.GC gc;
- Gdk.Pixmap pixmap;
- int tlx, tly;
-
- int margin = dragHandles ? 1 : -2;
-
- selection.TranslateCoordinates (topLevel, 0, 0, out
tlx, out tly);
- handleAllocation.X = tlx - handleSize / 2 - margin;
- handleAllocation.Y = tly - handleSize / 2 - margin;
- handleAllocation.Width = selection.Allocation.Width +
handleSize + margin*2;
- handleAllocation.Height = selection.Allocation.Height +
handleSize + margin*2;
-
- int width = handleAllocation.Width, height =
handleAllocation.Height;
-
- pixmap = new Gdk.Pixmap (window, width, height, 1);
- gc = new Gdk.GC (pixmap);
- gc.Background = white;
- gc.Foreground = white;
- pixmap.DrawRectangle (gc, true, 0, 0, width, height);
-
- gc.Foreground = black;
-
- // Draw border
- gc.SetDashes (0, new sbyte[] {1,1}, 2);
- gc.SetLineAttributes (borderSize,
Gdk.LineStyle.OnOffDash, Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
- pixmap.DrawRectangle (gc, false, handleSize / 2,
handleSize / 2,
- width - handleSize - 1, height -
handleSize - 1);
-
- if (dragHandles) {
- gc.SetLineAttributes (1, Gdk.LineStyle.Solid,
Gdk.CapStyle.NotLast, Gdk.JoinStyle.Miter);
- DrawHandle (pixmap, gc, 0, 0);
- DrawHandle (pixmap, gc, 0, height - handleSize);
- DrawHandle (pixmap, gc, width - handleSize, 0);
- DrawHandle (pixmap, gc, width - handleSize,
height - handleSize);
- }
-
- window.Hide ();
- window.MoveResize (handleAllocation);
- window.ShapeCombineMask (pixmap, 0, 0);
- window.Show ();
- }
-
- void DrawHandle (Gdk.Pixmap pixmap, Gdk.GC gc, int x, int y)
- {
- pixmap.DrawRectangle (gc, true, x, y, handleSize,
handleSize);
- }
-
- void SelectionResized (object obj, Gtk.SizeAllocatedArgs args)
- {
- Shape ();
- }
-
- int clickX, clickY;
-
- [GLib.ConnectBefore]
- void HandleEvent (object obj, Gtk.WidgetEventArgs args)
- {
- args.RetVal = true;
-
- switch (args.Event.Type) {
- case Gdk.EventType.ButtonPress:
- Gdk.EventButton evb =
(Gdk.EventButton)args.Event;
-
- if (evb.Type == Gdk.EventType.ButtonPress &&
evb.Button == 1) {
- clickX = (int)evb.XRoot;
- clickY = (int)evb.YRoot;
- }
- return;
-
- case Gdk.EventType.MotionNotify:
- Gdk.EventMotion evm =
(Gdk.EventMotion)args.Event;
-
- if (!dragHandles)
- return;
- if ((evm.State & Gdk.ModifierType.Button1Mask)
== 0)
- return;
- if (!Gtk.Drag.CheckThreshold (selection,
clickX, clickY, (int)evm.XRoot, (int)evm.YRoot))
- return;
-
- if (Drag != null)
- Drag (evm);
- return;
-
- case Gdk.EventType.Expose:
- // hack around bgo 316871 for gtk+ 2.8.0-2.8.3
- gdk_synthesize_window_state (window.Handle, 0,
1);
- topLevel.GdkWindow.InvalidateRect
(handleAllocation, true);
- gdk_synthesize_window_state (window.Handle, 1,
0);
- return;
-
- default:
- return;
- }
- }
-
- public delegate void DragDelegate (Gdk.EventMotion evt);
- public event DragDelegate Drag;
-
-
- [DllImport ("libgdk-win32-2.0-0.dll")]
- static extern void gdk_synthesize_window_state (IntPtr window,
uint unset_flags, uint set_flags);
- }
-}
-
Modified: trunk/stetic/libstetic/ImageInfo.cs
===================================================================
--- trunk/stetic/libstetic/ImageInfo.cs 2007-03-26 14:06:07 UTC (rev 74981)
+++ trunk/stetic/libstetic/ImageInfo.cs 2007-03-26 14:31:14 UTC (rev 74982)
@@ -116,7 +116,7 @@
return image = new Gdk.Pixbuf
(s);
} catch {
// Not a valid image
- return
Gtk.IconTheme.Default.LoadIcon (Gtk.Stock.MissingImage, 16, 0);
+ return WidgetUtils.MissingIcon;
}
case ImageSource.Theme:
@@ -126,7 +126,7 @@
return image =
Gtk.IconTheme.Default.LoadIcon (name, w, 0);
} catch {
// Icon not in theme
- return
Gtk.IconTheme.Default.LoadIcon (Gtk.Stock.MissingImage, 16, 0);
+ return WidgetUtils.MissingIcon;
}
case ImageSource.File:
@@ -138,7 +138,7 @@
}
return image = new Gdk.Pixbuf
(file);
} catch {
- return
Gtk.IconTheme.Default.LoadIcon (Gtk.Stock.MissingImage, 16, 0);
+ return WidgetUtils.MissingIcon;
}
}
return null;
Modified: trunk/stetic/libstetic/WidgetUtils.cs
===================================================================
--- trunk/stetic/libstetic/WidgetUtils.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/WidgetUtils.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -366,7 +366,7 @@
return (undoIdCount++).ToString ();
}
- internal static Gdk.Pixbuf MissingIcon {
+ public static Gdk.Pixbuf MissingIcon {
get {
if (missingIcon == null) {
try {
Modified: trunk/stetic/libstetic/editor/StockItem.cs
===================================================================
--- trunk/stetic/libstetic/editor/StockItem.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/editor/StockItem.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -26,16 +26,9 @@
Gtk.IconSet iset =
Gtk.IconFactory.LookupDefault (name);
if (iset == null)
- iset = Gtk.IconFactory.LookupDefault
(Gtk.Stock.MissingImage);
-
- Image = iset.RenderIcon (new Gtk.Style (),
Gtk.TextDirection.Ltr, Gtk.StateType.Normal, Gtk.IconSize.Menu, null, "");
-
-/* try {
- Image = Container.RenderIcon (name,
Gtk.IconSize.Menu, "");
- } catch (Exception ex) {
- Image = Container.RenderIcon
(Gtk.Stock.MissingImage, Gtk.IconSize.Menu, "");
- }
-*/
+ Image = WidgetUtils.MissingIcon;
+ else
+ Image = iset.RenderIcon (new Gtk.Style
(), Gtk.TextDirection.Ltr, Gtk.StateType.Normal, Gtk.IconSize.Menu, null, "");
} else {
Image = null;
label = "";
@@ -88,10 +81,8 @@
Gtk.Frame frame = new Gtk.Frame ();
entry = new Gtk.Entry ();
entry.Changed += OnTextChanged;
- frame.Shadow = Gtk.ShadowType.In;
- frame.BorderWidth = 2;
- frame.Add (entry);
- PackStart (frame, true, true, 0);
+ entry.HasFrame = false;
+ PackStart (entry, true, true, 0);
button = new Gtk.Button ();
button.Add (new Gtk.Arrow (Gtk.ArrowType.Down,
Gtk.ShadowType.Out));
Modified: trunk/stetic/libstetic/wrapper/Action.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Action.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/wrapper/Action.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -286,8 +286,9 @@
Gtk.IconSet iset = Gtk.IconFactory.LookupDefault
(GtkAction.StockId);
if (iset == null)
- iset = Gtk.IconFactory.LookupDefault
(Gtk.Stock.MissingImage);
- return iset.RenderIcon (new Gtk.Style (),
Gtk.TextDirection.Ltr, Gtk.StateType.Normal, size, null, "");
+ return WidgetUtils.MissingIcon;
+ else
+ return iset.RenderIcon (new Gtk.Style (),
Gtk.TextDirection.Ltr, Gtk.StateType.Normal, size, null, "");
}
internal protected override CodeExpression
GenerateObjectCreation (GeneratorContext ctx)
Modified: trunk/stetic/libstetic/wrapper/ComboBox.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/ComboBox.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/wrapper/ComboBox.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -89,7 +89,7 @@
ctx.Statements.Add (new
CodeMethodInvokeExpression (
var,
"AppendText",
- new CodePrimitiveExpression
(str)
+ ctx.GenerateValue (str,
typeof(string), true)
));
}
}
Modified: trunk/stetic/libstetic/wrapper/ImageMenuItem.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/ImageMenuItem.cs 2007-03-26 14:06:07 UTC
(rev 74981)
+++ trunk/stetic/libstetic/wrapper/ImageMenuItem.cs 2007-03-26 14:31:14 UTC
(rev 74982)
@@ -51,7 +51,7 @@
} else if (image.StartsWith ("file:"))
icon = new Gtk.Image (image.Substring
(5));
else
- icon = new Gtk.Image
(Gtk.Stock.MissingImage, Gtk.IconSize.Menu);
+ icon = new Gtk.Image
(WidgetUtils.MissingIcon);
((Gtk.ImageMenuItem)Wrapped).Image = icon;
Modified: trunk/stetic/libstetic/wrapper/Widget.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Widget.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/wrapper/Widget.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -14,6 +14,7 @@
string oldMemberName;
internal bool settingFocus;
bool hexpandable, vexpandable;
+ bool generatePublic = true;
bool window_visible = true;
bool hasDefault;
@@ -131,6 +132,11 @@
return base.GetUndoManagerInternal ();
}
+ public bool GeneratePublic {
+ get { return generatePublic; }
+ set { generatePublic = value; }
+ }
+
public bool Unselectable {
get {
return unselectable;
Modified: trunk/stetic/libstetic/wrapper/objects.xml
===================================================================
--- trunk/stetic/libstetic/wrapper/objects.xml 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libstetic/wrapper/objects.xml 2007-03-26 14:31:14 UTC (rev
74982)
@@ -20,6 +20,7 @@
<!-- <property name="HasFocus" /> -->
<property name="Events" />
<property name="ExtensionEvents" />
+ <property name="GeneratePublic" internal="true" default="true"/>
<property name="Name" internal="true"
min="1"
init-with-name="true"
Modified: trunk/stetic/libsteticui/CodeGeneratorPartialClass.cs
===================================================================
--- trunk/stetic/libsteticui/CodeGeneratorPartialClass.cs 2007-03-26
14:06:07 UTC (rev 74981)
+++ trunk/stetic/libsteticui/CodeGeneratorPartialClass.cs 2007-03-26
14:31:14 UTC (rev 74982)
@@ -80,6 +80,11 @@
);
Stetic.Wrapper.Widget wwidget =
Stetic.Wrapper.Widget.Lookup (w);
+ if (wwidget.GeneratePublic)
+ type.TypeAttributes = TypeAttributes.Public;
+ else
+ type.TypeAttributes = TypeAttributes.NotPublic;
+
Stetic.WidgetMap map =
Stetic.CodeGenerator.GenerateCreationCode (globalNs, type, w, new
CodeThisReferenceExpression (), met.Statements, options, warnings);
CodeGenerator.BindSignalHandlers (new
CodeThisReferenceExpression (), wwidget, map, met.Statements, options);
}
Modified: trunk/stetic/libsteticui/ComponentType.cs
===================================================================
--- trunk/stetic/libsteticui/ComponentType.cs 2007-03-26 14:06:07 UTC (rev
74981)
+++ trunk/stetic/libsteticui/ComponentType.cs 2007-03-26 14:31:14 UTC (rev
74982)
@@ -62,9 +62,7 @@
internal static ComponentType Unknown {
get {
if (unknown == null) {
- Gtk.IconSet iset =
Gtk.IconFactory.LookupDefault (Gtk.Stock.MissingImage);
- Gdk.Pixbuf px = iset.RenderIcon (new
Gtk.Style (), Gtk.TextDirection.Ltr, Gtk.StateType.Normal, Gtk.IconSize.Menu,
null, "");
- unknown = new ComponentType (null,
"Unknown", "Unknown", "", "", px);
+ unknown = new ComponentType (null,
"Unknown", "Unknown", "", "", WidgetUtils.MissingIcon);
}
return unknown;
}
Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs 2007-03-26 14:06:07 UTC
(rev 74981)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs 2007-03-26 14:31:14 UTC
(rev 74982)
@@ -174,7 +174,12 @@
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 ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches