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

* dia/glue/dia-canvas-line.c: Added, more than one dash, test code.

Changed signature to only specify one dash size.
        * dia/CanvasLine.custom: Ditto
        * dia/DashStyle.cs: Ditto
        * TODO: Maybe remove DashStyle if support for more than one
          dashstyle is far out in the future.
        * sample/CanvasTextBox.cs: Make text fit
        * sample/sample.cs: Ditto

svn path=/trunk/diacanvas-sharp/; revision=31706
This commit is contained in:
Martin Willemoes Hansen 2004-08-01 10:29:21 +00:00
Родитель d9b4340faa
Коммит d22d8b27d9
7 изменённых файлов: 44 добавлений и 36 удалений

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

@ -1,3 +1,14 @@
2004-08-01 Martin Willemoes Hansen <mwh@sysrq.dk>
* dia/glue/dia-canvas-line.c: Added, more than one dash, test code.
Changed signature to only specify one dash size.
* dia/CanvasLine.custom: Ditto
* dia/DashStyle.cs: Ditto
* TODO: Maybe remove DashStyle if support for more than one
dashstyle is far out in the future.
* sample/CanvasTextBox.cs: Make text fit
* sample/sample.cs: Ditto
2004-07-28 Martin Willemoes Hansen <mwh@sysrq.dk> 2004-07-28 Martin Willemoes Hansen <mwh@sysrq.dk>
* dia/Dia.metadata: Use /api/namespace like gtk# * dia/Dia.metadata: Use /api/namespace like gtk#

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

@ -2,9 +2,14 @@
= DiaCanvas# = = DiaCanvas# =
============== ==============
Misc
----
Remove DashStyle if more than one dash size
is not posible soon.
Private API which should be hidden: Private API which should be hidden:
---------------------------------- ----------------------------------
Dia.CanvasViewItem.AddItems Method Dia.CanvasViewItem.AddItems Method
Dia.CanvasViewItem.RequestRedrawUta Dia.CanvasViewItem.RequestRedrawUta
Dia.CanvasViewItem.Foreach Method Dia.CanvasViewItem.Foreach Method

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

@ -23,12 +23,11 @@ public CanvasLine() : base (GType) {}
[DllImport("diacanvassharpglue")] [DllImport("diacanvassharpglue")]
extern static void diasharp_canvas_line_set_dash_style_property (IntPtr line, extern static void diasharp_canvas_line_set_dash_style_property (IntPtr line,
double dash_on, double dash_size);
double dash_off);
public DashStyle Dash { public DashStyle Dash {
set { set {
diasharp_canvas_line_set_dash_style_property (Handle, value.DashOn, diasharp_canvas_line_set_dash_style_property (Handle,
value.DashOff); value.DashSize);
} }
} }

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

@ -21,18 +21,13 @@
namespace Dia { namespace Dia {
public class DashStyle { public class DashStyle {
double dash_on; double dash_size;
double dash_off;
public DashStyle (double dash_on, double dash_off) public DashStyle (double dash_size)
{ {
this.dash_on = dash_on < 0 ? 0 : dash_on; this.dash_size = dash_size < 0 ? 0 : dash_size;
this.dash_off = dash_off < 0 ? 0 : dash_off;
} }
public DashStyle (double dash_on) : this (dash_on, 0) {} public double DashSize { get { return dash_size; } }
public double DashOn { get { return dash_on; } }
public double DashOff { get { return dash_off; } }
} }
} }

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

@ -2,7 +2,7 @@
* *
* Author: Martin Willemoes Hansen * Author: Martin Willemoes Hansen
* *
* Copyright (C) 2003 Martin Willemoes Hansen * Copyright (C) 2003, 2004 Martin Willemoes Hansen
* *
*/ */
@ -10,33 +10,31 @@
/* Forward declarations */ /* Forward declarations */
void diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line, void diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
gdouble dash_on, gdouble dash_off); gdouble dash_size);
/* */ /* */
void void
diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line, diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
gdouble dash_on, gdouble dash_off) gdouble dash_size)
{ {
g_assert (dash_on >= 0); g_assert (dash_size >= 0);
g_assert (dash_off >= 0);
g_free (line->dash);
line->dash = NULL; line->dash = NULL;
line->n_dash = 0; line->n_dash = 0;
if (dash_off == 0) { DiaDashStyle * style = dia_dash_style_new (1, dash_size);
line->n_dash = 1; g_object_set (line, "dash", style, NULL);
line->dash = g_new (gdouble, 1);
memcpy (line->dash, &dash_on, sizeof (gdouble) * 1);
}
// Use DiaDashStyle * dia_dash_style_new (gint n_dash, gdouble dash1, ...)
// When it has been fixed
//
//DiaDashStyle * old_style = NULL;
//g_object_get (line, "dash", old_style, NULL);
//dia_dash_style_free (old_style);
//Test code to see if DiaCanvasLine supports > 1 dashes.
//DiaDashStyle * style = dia_dash_style_new (3, 5, 10, 20);
//g_object_set (line, "dash", style, NULL); //g_object_set (line, "dash", style, NULL);
//g_print ("dash_n: %d\n", style->n_dash);
//g_print ("dash [0]: %f\n", style->dash [0]);
//g_print ("dash [1]: %f\n", style->dash [1]);
//g_print ("dash [2]: %f\n", style->dash [2]);
//g_print ("size of diadashstyle: %d\n", sizeof (style));
} }

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

@ -36,7 +36,7 @@ public class CanvasTextBox : CanvasGroup {
text = new CanvasText(); text = new CanvasText();
text.Font = FontDescription.FromString ("sans 20"); text.Font = FontDescription.FromString ("sans 20");
text.Text = "Hi, im editable"; text.Text = "Hi, im editable";
text.Width = 200; text.Width = 205;
text.Height = 100; text.Height = 100;
Add (text); Add (text);
text.EditingDone += new EditingDoneHandler (editing_done); text.EditingDone += new EditingDoneHandler (editing_done);

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

@ -65,8 +65,8 @@ public class Sample {
line.Color = 8327327; line.Color = 8327327;
DashStyle style = new DashStyle (10); DashStyle style = new DashStyle (10);
line.Dash = style; line.Dash = style;
line.HeadPos = new Dia.Point (50, 50);; line.HeadPos = new Dia.Point (50, 70);;
line.TailPos = new Dia.Point (100, 150); line.TailPos = new Dia.Point (100, 170);
line.Cap = Dia.CapStyle.Butt; line.Cap = Dia.CapStyle.Butt;
line.Move (100, 150); line.Move (100, 150);
canvas.Root.Add (line); canvas.Root.Add (line);
@ -82,11 +82,11 @@ public class Sample {
text.Text = "Hello, World!"; text.Text = "Hello, World!";
text.Font = FontDescription.FromString ("sans 20"); text.Font = FontDescription.FromString ("sans 20");
text.Height = 50; text.Height = 50;
text.Width = 200; text.Width = 190;
canvas.Root.Add (text); canvas.Root.Add (text);
CanvasTextBox textbox = new CanvasTextBox(); CanvasTextBox textbox = new CanvasTextBox();
textbox.Move (50, 150); textbox.Move (50, 120);
canvas.Root.Add (textbox); canvas.Root.Add (textbox);
//Exposes some bug //Exposes some bug