зеркало из
1
0
Форкнуть 0

* dia/Point.custom: Added, convenience ctor

and ToString()
        * dia/CanvasLine.custom: Added, default ctor
        * dia/CanvasBox.custom: Added, default ctor
        * dia/CanvasImage.custom: Added, default ctor
        * sources/Dia.metadata: rule disable default constructor added

svn path=/trunk/diacanvas-sharp/; revision=16600
This commit is contained in:
Martin Willemoes Hansen 2003-07-24 10:11:21 +00:00
Родитель 59d24feeed
Коммит 33eced1561
16 изменённых файлов: 150 добавлений и 22 удалений

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

@ -1,3 +1,12 @@
2003-07-23 Martin Willemoes Hansen <mwh@sysrq.dk>
* dia/Point.custom: Added, convenience ctor
and ToString()
* dia/CanvasLine.custom: Added, default ctor
* dia/CanvasBox.custom: Added, default ctor
* dia/CanvasImage.custom: Added, default ctor
* sources/Dia.metadata: rule disable default constructor added
2003-07-22 Martin Willemoes Hansen <mwh@sysrq.dk>
* PROBLEMS: Added

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

@ -7,6 +7,7 @@ warning: array field Dia.DashStyle.dash probably incorrectly generated
warning: array field Dia.ShapeImage.affine probably incorrectly generated
This seems to be a problem with the generator.
Array marshalling is not implemented in mono yet.
The xml has a format of:
<field cname="dash" array_len="1" type="gdouble"/>

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

@ -366,7 +366,7 @@
<return-type type="void"/>
</method>
</object>
<object name="CanvasBox" cname="DiaCanvasBox" parent="DiaCanvasElement">
<object name="CanvasBox" cname="DiaCanvasBox" parent="DiaCanvasElement" disabledefaultconstructor="1">
<field cname="color" type="DiaColor"/>
<field cname="bg_color" type="DiaColor"/>
<field cname="line_width" type="gdouble"/>
@ -440,7 +440,7 @@
</parameters>
</method>
</object>
<object name="CanvasImage" cname="DiaCanvasImage" parent="DiaCanvasElement">
<object name="CanvasImage" cname="DiaCanvasImage" parent="DiaCanvasElement" disabledefaultconstructor="1">
<field cname="pixbuf" type="GdkPixbuf*"/>
<field cname="clip" type="//DiaShape*"/>
<field cname="image" type="DiaShape*"/>
@ -706,7 +706,7 @@
<return-type type="void"/>
</method>
</object>
<object name="CanvasLine" cname="DiaCanvasLine" parent="DiaCanvasItem">
<object name="CanvasLine" cname="DiaCanvasLine" parent="DiaCanvasItem" disabledefaultconstructor="1">
<field cname="line_width" type="gdouble"/>
<field cname="color" type="DiaColor"/>
<field cname="cap" type="DiaCapStyle"/>

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

@ -1,4 +1,4 @@
// Dia.CanvasItem.Custom - Dia CanvasItem class customizations
// Canvas.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//

12
dia/CanvasBox.custom Normal file
Просмотреть файл

@ -0,0 +1,12 @@
// CanvasBox.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//
// Copyright (C) 2003 Martin Willemoes Hansen
//
// This code is inserted after the automatically generated code.
public CanvasBox() {
Raw = CanvasItem.ItemCreate (CanvasBox.GType).Handle;
}

12
dia/CanvasImage.custom Normal file
Просмотреть файл

@ -0,0 +1,12 @@
// CanvasImage.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//
// Copyright (C) 2003 Martin Willemoes Hansen
//
// This code is inserted after the automatically generated code.
public CanvasImage() {
Raw = CanvasItem.ItemCreate (CanvasImage.GType).Handle;
}

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

@ -1,4 +1,4 @@
// Dia.CanvasItem.Custom - Dia CanvasItem class customizations
// CanvasItem.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//

12
dia/CanvasLine.custom Normal file
Просмотреть файл

@ -0,0 +1,12 @@
// CanvasLine.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//
// Copyright (C) 2003 Martin Willemoes Hansen
//
// This code is inserted after the automatically generated code.
public CanvasLine() {
Raw = CanvasItem.ItemCreate (CanvasLine.GType).Handle;
}

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

@ -1,4 +1,4 @@
// Dia.PlacementTool.Custom - Dia PlacementTool class customizations
// PlacementTool.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//

18
dia/Point.custom Normal file
Просмотреть файл

@ -0,0 +1,18 @@
// Point.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
//
// Copyright (C) 2003 Martin Willemoes Hansen
//
// This code is inserted after the automatically generated code.
public Point (double x, double y)
{
this.x = x;
this.y = y;
}
public override string ToString()
{
return String.Format ("({0}, {1})", x, y);
}

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

@ -66,7 +66,7 @@
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CanvasBox ();" />
<MemberSignature Language="C#" Value="public CanvasBox ();" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters />

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

@ -66,7 +66,7 @@
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CanvasImage ();" />
<MemberSignature Language="C#" Value="public CanvasImage ();" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters />

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

@ -84,7 +84,7 @@
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected CanvasLine ();" />
<MemberSignature Language="C#" Value="public CanvasLine ();" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters />

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

@ -70,6 +70,35 @@
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="ToString">
<MemberSignature Language="C#" Value="public virtual string ToString ();" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>To be added</summary>
<returns>a <see cref="T:System.String" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Point (double x, double y);" />
<MemberType>Constructor</MemberType>
<ReturnValue />
<Parameters>
<Parameter Name="x" Type="System.Double" />
<Parameter Name="y" Type="System.Double" />
</Parameters>
<Docs>
<summary>To be added</summary>
<param name="x">a <see cref="T:System.Double" /></param>
<param name="y">a <see cref="T:System.Double" /></param>
<returns>a <see cref="T:Dia.Point" /></returns>
<remarks>To be added</remarks>
</Docs>
</Member>
<Member MemberName="GType">
<MemberSignature Language="C#" Value="public static uint GType { get; };" />
<MemberType>Property</MemberType>

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

@ -6,7 +6,6 @@ using Gtk;
using GtkSharp;
using Gdk;
using Glade;
using Gnome;
public class Sample {
@ -14,30 +13,22 @@ public class Sample {
[Glade.Widget] ScrolledWindow scrolledwindow;
CanvasView view;
Dia.Canvas canvas;
Canvas canvas;
public Sample()
{
XML gui = new XML (null, "glade/gui.glade", "main", null);
gui.Autoconnect (this);
canvas = new Dia.Canvas();
canvas = new Canvas();
canvas.AllowUndo = true;
view = new CanvasView (canvas, true);
main.KeyPressEvent += new KeyPressEventHandler (CtrlPressed);
main.KeyReleaseEvent += new KeyReleaseEventHandler (CtrlReleased);
scrolledwindow.Add (view);
SetupTools();
Pixbuf pixbuf = new Pixbuf (null, "pixmaps/logo.png");
Dia.CanvasItem item = Dia.CanvasItem.ItemCreate (CanvasImage.GType, pixbuf);
item.Move (200, 200);
canvas.Root.Add (item);
view.UnselectAll();
CanvasViewItem vitem = view.FindViewItem (item);
view.Focus (vitem);
CreateItemsProgramatically();
main.ShowAll();
}
@ -51,6 +42,37 @@ public class Sample {
image5.Pixbuf = new Pixbuf (null, "pixmaps/glade-image.png");
}
void CreateItemsProgramatically() {
CanvasLine line = new CanvasLine();
line.LineWidth = 5.2;
line.Color = 8327327;
Dia.Point p1 = new Dia.Point (50, 50);
Dia.Point p2 = new Dia.Point (100, 100);
//line.HeadPos = p1;
//line.TailPos = p2;
line.Move (200, 200);
canvas.Root.Add (line);
CanvasBox box = new CanvasBox();
box.Move (300, 200);
box.LineWidth = 8.5;
box.Color = 2134231;
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);
view.UnselectAll();
CanvasViewItem vitem = view.FindViewItem (item);
view.Focus (vitem);
}
void SelectionTool (object sender, EventArgs args)
{
ToolCleanUp();

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

@ -92,4 +92,17 @@
</data>
</rule>
<!-- disable default constructor -->
<rule>
<class name="DiaCanvasLine"/>
<class name="DiaCanvasBox"/>
<class name="DiaCanvasImage"/>
<data>
<attribute target="class">
<name>disabledefaultconstructor</name>
<value>1</value>
</attribute>
</data>
</rule>
</metadata>