* dia/CanvasItem.custom: Removed method to create CanvasImage
* sample/sample.cs: Added section for programatically canvas item creation. svn path=/trunk/diacanvas-sharp/; revision=16601
This commit is contained in:
Родитель
33eced1561
Коммит
584bd5bde6
|
@ -5,7 +5,10 @@
|
|||
* dia/CanvasLine.custom: Added, default ctor
|
||||
* dia/CanvasBox.custom: Added, default ctor
|
||||
* dia/CanvasImage.custom: Added, default ctor
|
||||
* dia/CanvasItem.custom: Removed method to create CanvasImage
|
||||
* sources/Dia.metadata: rule disable default constructor added
|
||||
* sample/sample.cs: Added section for programatically
|
||||
canvas item creation.
|
||||
|
||||
2003-07-22 Martin Willemoes Hansen <mwh@sysrq.dk>
|
||||
|
||||
|
|
50
PROBLEMS
50
PROBLEMS
|
@ -30,3 +30,53 @@ Property has unknown Type DiaCanvasItemHandles in Object Dia.CanvasItem
|
|||
Maybe make a real type in c or make a manual wrapper class in C#
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
Character encoding problem
|
||||
--------------------------
|
||||
|
||||
When calling DiaPlacementTool (DiaCanvasImage.GType ...) the following error
|
||||
occours:
|
||||
|
||||
(<unknown>:1938): GLib-GObject-WARNING **: gobject.c:663: object class `DiaCanvasImage' has no property named `'
|
||||
|
||||
(<unknown>:1938): GLib-GObject-WARNING **: gobject.c:663: object class `DiaCanvasImage' has no property named `'
|
||||
|
||||
(<unknown>:1938): GLib-GObject-WARNING **: gobject.c:663: object class `DiaCanvasImage' has no property named `'
|
||||
|
||||
(<unknown>:1938): GdkPixbuf-CRITICAL **: file gdk-pixbuf.c: line 389 (gdk_pixbuf_get_height): assertion `pixbuf != NULL' failed
|
||||
|
||||
(<unknown>:1938): GdkPixbuf-CRITICAL **: file gdk-pixbuf.c: line 373 (gdk_pixbuf_get_width): assertion `pixbuf != NULL' failed
|
||||
|
||||
** (<unknown>:1938): CRITICAL **: file dia-shape.c: line 1455 (dia_shape_image): assertion `GDK_IS_PIXBUF (image)' failed
|
||||
|
||||
Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required
|
||||
in (unmanaged) 06 Gtk.Application:gtk_main ()
|
||||
in <0x00004> 06 Gtk.Application:gtk_main ()
|
||||
in <0x00007> 00 Gtk.Application:Run ()
|
||||
in <0x0002b> 00 .Sample:Main ()
|
||||
|
||||
It probably is a character encoding problem from Uni16 to utf-8/ascii.
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
DiaPoint Boxing problem
|
||||
-----------------------
|
||||
|
||||
The following code:
|
||||
CanvasLine line = new CanvasLine();
|
||||
line.HeadPos = new Dia.Point (50, 50);
|
||||
produces this:
|
||||
|
||||
Unhandled Exception: System.NullReferenceException: A null value was found where an object instance was required
|
||||
in (unmanaged) 06 GLib.Object:g_object_set_property (intptr,string,intptr)
|
||||
in <0x00004> 06 GLib.Object:g_object_set_property (intptr,string,intptr)
|
||||
in <0x00040> 00 GLib.Object:SetProperty (string,GLib.Value)
|
||||
in <0x000bc> 00 Dia.CanvasLine:set_HeadPos (Dia.Point)
|
||||
in <0x000e5> 00 .Sample:CreateItemsProgramatically ()
|
||||
in <0x001a5> 00 .Sample:.ctor ()
|
||||
in <0x00023> 00 .Sample:Main ()
|
||||
|
||||
It might has something to do with how the DiaPoint is boxed .. the boxed version
|
||||
does not have a valid .Handle
|
||||
|
|
|
@ -12,18 +12,3 @@ extern static IntPtr dia_canvas_item_create (uint object_type, IntPtr dummy);
|
|||
public static CanvasItem ItemCreate (uint object_type) {
|
||||
return new CanvasItem (dia_canvas_item_create (object_type, IntPtr.Zero));
|
||||
}
|
||||
|
||||
[DllImport("diacanvas2")]
|
||||
extern static IntPtr dia_canvas_item_create (uint object_type,
|
||||
string pixbufs, IntPtr pixbuf,
|
||||
string widths, double width,
|
||||
string heights, double height,
|
||||
IntPtr dummy);
|
||||
|
||||
public static CanvasItem ItemCreate (uint object_type, Gdk.Pixbuf pixbuf) {
|
||||
return new CanvasItem (dia_canvas_item_create (object_type,
|
||||
"image", pixbuf.Handle,
|
||||
"width", pixbuf.Width,
|
||||
"height", pixbuf.Height,
|
||||
IntPtr.Zero));
|
||||
}
|
||||
|
|
|
@ -25,24 +25,6 @@
|
|||
</Interfaces>
|
||||
<Attributes />
|
||||
<Members>
|
||||
<Member MemberName="ItemCreate">
|
||||
<MemberSignature Language="C#" Value="public static Dia.CanvasItem ItemCreate (uint object_type, Gdk.Pixbuf pixbuf);" />
|
||||
<MemberType>Method</MemberType>
|
||||
<ReturnValue>
|
||||
<ReturnType>Dia.CanvasItem</ReturnType>
|
||||
</ReturnValue>
|
||||
<Parameters>
|
||||
<Parameter Name="object_type" Type="System.UInt32" />
|
||||
<Parameter Name="pixbuf" Type="Gdk.Pixbuf" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<summary>To be added</summary>
|
||||
<param name="object_type">a <see cref="T:System.UInt32" /></param>
|
||||
<param name="pixbuf">a <see cref="T:Gdk.Pixbuf" /></param>
|
||||
<returns>a <see cref="T:Dia.CanvasItem" /></returns>
|
||||
<remarks>To be added</remarks>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="ItemCreate">
|
||||
<MemberSignature Language="C#" Value="public static Dia.CanvasItem ItemCreate (uint object_type);" />
|
||||
<MemberType>Method</MemberType>
|
||||
|
|
|
@ -62,14 +62,15 @@ public class Sample {
|
|||
canvas.Root.Add (box);
|
||||
|
||||
CanvasImage image = new CanvasImage();
|
||||
|
||||
Pixbuf pixbuf = new Pixbuf (null, "pixmaps/logo.png");
|
||||
CanvasItem item = CanvasItem.ItemCreate (CanvasImage.GType, pixbuf);
|
||||
item.Move (50, 50);
|
||||
canvas.Root.Add (item);
|
||||
image.Image = pixbuf;
|
||||
image.Height = pixbuf.Height;
|
||||
image.Width = pixbuf.Width;
|
||||
image.Move (50, 50);
|
||||
canvas.Root.Add (image);
|
||||
|
||||
view.UnselectAll();
|
||||
CanvasViewItem vitem = view.FindViewItem (item);
|
||||
CanvasViewItem vitem = view.FindViewItem (image);
|
||||
view.Focus (vitem);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче