зеркало из
1
0
Форкнуть 0
svn path=/trunk/diacanvas-sharp/; revision=16932
This commit is contained in:
Martin Willemoes Hansen 2003-07-31 09:18:15 +00:00
Родитель ca69a875b3
Коммит 29032d0098
9 изменённых файлов: 118 добавлений и 54 удалений

Просмотреть файл

@ -1,3 +1,7 @@
2003-07-31 Martin Willemoes Hansen <mwh@sysrq.dk>
* Upgraded to latest gtk# cvs
2003-07-28 Martin Willemoes Hansen <mwh@sysrq.dk>
* dia/CanvasBox.custom

Просмотреть файл

@ -64,10 +64,10 @@ It probably is a character encoding problem from Uni16 to utf-8/ascii.
DiaPoint Boxing problem
-----------------------
The following code:
The following code (DiaCanvas#):
CanvasLine line = new CanvasLine();
line.HeadPos = new Dia.Point (50, 50);
produces this:
produces this stacktrace:
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)
@ -78,8 +78,30 @@ 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
Dia.Point is a struct:
[StructLayout(LayoutKind.Sequential)]
public struct Point { ... }
It does not have a Handle and thus shall be marshalled to the c world.
The code of the set property of HeadPos:
SetProperty("head_pos", new GLib.Value(Handle, "head_pos", new GLib.Boxed (value)));
The boxed type: new GLib.Boxed (value), does not have a valid Handle.
The code for the ctor of the Value type:
public Value (IntPtr obj, string prop_name, Boxed val)
{
_val = gtksharp_value_create_from_property (obj, prop_name);
//g_value_set_boxed (_val, val.Handle);
}
This ctor looks halfbaked. val.Handle is 0, cause the Point does not have a
valid handle, it has not been marshalled yet.
So some kind of magic needs to be done, to marshall the Boxed value and keep
track of resources etc.
================================================================================

Просмотреть файл

@ -108,7 +108,7 @@
<callback name="ConstraintFunc" cname="DiaConstraintFunc">
<return-type type="void"/>
<parameters>
<parameter type="DiaConstraint*" name="constraint"/>
<parameter type="*" name=""/>
<parameter type="DiaVariable*" name="variable"/>
<parameter type="gdouble" name="constant"/>
<parameter type="gpointer" name="user_data"/>
@ -977,7 +977,7 @@
<signal name="NeedResolve" cname="need_resolve" when="LAST">
<return-type type="void"/>
<parameters>
<parameter type="DiaConstraint*" name="constraint"/>
<parameter type="*" name=""/>
<parameter type="DiaVariable*" name="var"/>
</parameters>
</signal>
@ -1264,7 +1264,7 @@
<method name="AddConstraint" cname="dia_solver_add_constraint">
<return-type type="void"/>
<parameters>
<parameter type="DiaConstraint*" name="constraint"/>
<parameter type="*" name=""/>
</parameters>
</method>
<method name="GetType" cname="dia_solver_get_type" shared="true">
@ -1274,7 +1274,7 @@
<method name="RemoveConstraint" cname="dia_solver_remove_constraint">
<return-type type="void"/>
<parameters>
<parameter type="DiaConstraint*" name="constraint"/>
<parameter type="*" name=""/>
</parameters>
</method>
<method name="Resolve" cname="dia_solver_resolve">
@ -2083,5 +2083,79 @@
</parameters>
</callback>
</struct>
<class name="Distance" cname="DiaDistance_">
<method name="LinePoint" cname="dia_distance_line_point" shared="true">
<return-type type="gdouble"/>
<parameters>
<parameter type="DiaPoint*" name="line_start"/>
<parameter type="DiaPoint*" name="line_end"/>
<parameter type="DiaPoint*" name="point"/>
<parameter type="gdouble" name="line_width"/>
<parameter type="DiaCapStyle" name="style"/>
<parameter type="DiaPoint*" name="point_on_line"/>
</parameters>
</method>
<method name="PointPoint" cname="dia_distance_point_point" shared="true">
<return-type type="gdouble"/>
<parameters>
<parameter type="DiaPoint*" name="p1"/>
<parameter type="DiaPoint*" name="p2"/>
</parameters>
</method>
<method name="PointPointManhattan" cname="dia_distance_point_point_manhattan" shared="true">
<return-type type="gdouble"/>
<parameters>
<parameter type="DiaPoint*" name="p1"/>
<parameter type="DiaPoint*" name="p2"/>
</parameters>
</method>
<method name="RectanglePoint" cname="dia_distance_rectangle_point" shared="true">
<return-type type="gdouble"/>
<parameters>
<parameter type="DiaRectangle*" name="rect"/>
<parameter type="DiaPoint*" name="point"/>
</parameters>
</method>
</class>
<class name="Global" cname="DiaGlobal">
<method name="EventGetType" cname="dia_event_get_type" shared="true">
<return-type type="GType"/>
</method>
<method name="ExportPrint" cname="dia_export_print" shared="true">
<return-type type="void"/>
<parameters>
<parameter type="gpointer" name="gpm"/>
<parameter type="DiaCanvas*" name="canvas"/>
</parameters>
</method>
</class>
<class name="Intersection" cname="DiaIntersection_">
<method name="LineLine" cname="dia_intersection_line_line" shared="true">
<return-type type="gboolean"/>
<parameters>
<parameter type="DiaPoint*" name="start1"/>
<parameter type="DiaPoint*" name="end1"/>
<parameter type="DiaPoint*" name="start2"/>
<parameter type="DiaPoint*" name="end2"/>
<parameter type="DiaPoint*" name="intersect"/>
</parameters>
</method>
<method name="LineRectangle" cname="dia_intersection_line_rectangle" shared="true">
<return-type type="gint"/>
<parameters>
<parameter type="DiaPoint*" name="start"/>
<parameter type="DiaPoint*" name="end"/>
<parameter type="DiaRectangle*" name="rect"/>
<parameter type="DiaPoint" array="true" name="intersect"/>
</parameters>
</method>
<method name="RectangleRectangle" cname="dia_intersection_rectangle_rectangle" shared="true">
<return-type type="gboolean"/>
<parameters>
<parameter type="DiaRectangle*" name="r1"/>
<parameter type="DiaRectangle*" name="r2"/>
</parameters>
</method>
</class>
</namespace>
</api>

Просмотреть файл

@ -200,15 +200,5 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="NeedResolve">
<MemberSignature Language="C#" Value="public event DiaSharp.NeedResolveHandler NeedResolve;" />
<MemberType>Event</MemberType>
<ReturnValue />
<Parameters />
<Docs>
<summary>To be added</summary>
<remarks>To be added</remarks>
</Docs>
</Member>
</Members>
</Type>

Просмотреть файл

@ -1,5 +1,5 @@
<Type Name="ConstraintFunc" FullName="Dia.ConstraintFunc">
<TypeSignature Language="C#" Value="public sealed delegate void ConstraintFunc (Dia.Constraint constraint, Dia.Variable variable, double constant);" Maintainer="auto" />
<TypeSignature Language="C#" Value="public sealed delegate void ConstraintFunc ();" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>dia-sharp</AssemblyName>
<AssemblyPublicKey></AssemblyPublicKey>

Просмотреть файл

@ -37,36 +37,6 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="RemoveConstraint">
<MemberSignature Language="C#" Value="public void RemoveConstraint (Dia.Constraint constraint);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="constraint" Type="Dia.Constraint" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="constraint">To be added: an object of type 'Dia.Constraint'</param>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="AddConstraint">
<MemberSignature Language="C#" Value="public void AddConstraint (Dia.Constraint constraint);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="constraint" Type="Dia.Constraint" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="constraint">To be added: an object of type 'Dia.Constraint'</param>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="Finalize">
<MemberSignature Language="C#" Value="protected virtual void Finalize ();" />
<MemberType>Method</MemberType>

Просмотреть файл

@ -1,5 +1,5 @@
<Type Name="ConstraintFuncNative" FullName="DiaSharp.ConstraintFuncNative">
<TypeSignature Language="C#" Value="public sealed delegate void ConstraintFuncNative (IntPtr constraint, ref Dia.Variable variable, double constant, IntPtr user_data);" Maintainer="auto" />
<TypeSignature Language="C#" Value="public sealed delegate void ConstraintFuncNative ();" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>dia-sharp</AssemblyName>
<AssemblyPublicKey></AssemblyPublicKey>

Просмотреть файл

@ -11,7 +11,7 @@ public class CanvasTextBox : CanvasBox {
public CanvasTextBox() : base()
{
text = new CanvasText();
AddConstruction (text);
//AddConstruction (text);
//text.Font = FontDescription.FromString ("sans 20");
text.Text = "Im a Canvas Text Box";
text.Width = Width - 20;

Просмотреть файл

@ -51,8 +51,12 @@ public class Sample {
Dia.Point p1 = new Dia.Point (50, 50);
Dia.Point p2 = new Dia.Point (100, 100);
//line.HeadPos = p1;
//line.TailPos = p2;
try {
line.HeadPos = p1;
line.TailPos = p2;
} catch (Exception ex) {
Console.WriteLine (ex);
}
line.Move (200, 200);
canvas.Root.Add (line);
@ -65,7 +69,7 @@ public class Sample {
CanvasText text = new CanvasText();
text.Move (250, 150);
text.Text = "Hello, World!";
text.Font = FontDescription.FromString ("sans 20");
//text.Font = FontDescription.FromString ("sans 20");
text.Height = 50;
text.Width = 100;
canvas.Root.Add (text);