зеркало из
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>
* dia/Dia.metadata: Use /api/namespace like gtk#

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

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

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

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

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

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

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

@ -2,7 +2,7 @@
*
* Author: Martin Willemoes Hansen
*
* Copyright (C) 2003 Martin Willemoes Hansen
* Copyright (C) 2003, 2004 Martin Willemoes Hansen
*
*/
@ -10,33 +10,31 @@
/* Forward declarations */
void diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
gdouble dash_on, gdouble dash_off);
gdouble dash_size);
/* */
void
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_off >= 0);
g_assert (dash_size >= 0);
g_free (line->dash);
line->dash = NULL;
line->n_dash = 0;
if (dash_off == 0) {
line->n_dash = 1;
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);
DiaDashStyle * style = dia_dash_style_new (1, dash_size);
g_object_set (line, "dash", style, NULL);
//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_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.Font = FontDescription.FromString ("sans 20");
text.Text = "Hi, im editable";
text.Width = 200;
text.Width = 205;
text.Height = 100;
Add (text);
text.EditingDone += new EditingDoneHandler (editing_done);

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

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