* dia/CanvasLine.custom: Updated Dash property to use new
glue code. * dia/DashStyle.cs: Removed * dia/glue/dia-canvas-line.c: New glue code to handle dash property properly, fixed testcode * dia/glue/dia-canvas-line.c.new: Removed * sample/sample.cs: Use the new Dash property * NEWS: CanvasLine.Dash is working 100% * PROBLEMS: Added problems with CanvasClock, editable text and text problem svn path=/trunk/diacanvas-sharp/; revision=32236
This commit is contained in:
Родитель
288ab6853f
Коммит
f8936aaffa
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2004-08-11 Martin Willemoes Hansen <mwh@sysrq.dk>
|
||||
|
||||
* dia/CanvasLine.custom: Updated Dash property to use new
|
||||
glue code.
|
||||
* dia/DashStyle.cs: Removed
|
||||
* dia/glue/dia-canvas-line.c: New glue code to handle
|
||||
dash property properly, fixed testcode
|
||||
* dia/glue/dia-canvas-line.c.new: Removed
|
||||
* sample/sample.cs: Use the new Dash property
|
||||
* NEWS: CanvasLine.Dash is working 100%
|
||||
* PROBLEMS: Added problems with CanvasClock,
|
||||
editable text and text problem
|
||||
|
||||
2004-08-04 Mario Fuentes <mario@gnome.cl>
|
||||
|
||||
* sample/CanvasClock.cs: Fixed Clock's hand size.
|
||||
|
|
5
NEWS
5
NEWS
|
@ -1,3 +1,8 @@
|
|||
0.5.1
|
||||
=====
|
||||
|
||||
* CanvasLine.Dash can be exercised 100%
|
||||
|
||||
0.5.0
|
||||
=====
|
||||
|
||||
|
|
4
PROBLEMS
4
PROBLEMS
|
@ -15,7 +15,9 @@ Crashes
|
|||
-------
|
||||
|
||||
o Select all, then try to move stuff around.
|
||||
o Try adding a line
|
||||
o Drag the CanvasClock a couple of times.
|
||||
o Edit the editable text.
|
||||
o Drag the text.
|
||||
|
||||
================================================================================
|
||||
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
public CanvasLine() : base (GType) {}
|
||||
|
||||
[DllImport("diacanvassharpglue")]
|
||||
extern static void diasharp_canvas_line_set_dash_style_property (IntPtr line,
|
||||
double dash_size);
|
||||
extern static void
|
||||
diasharp_canvas_line_set_dash_style_property (IntPtr line, int n_dash,
|
||||
double [] dashes);
|
||||
|
||||
public DashStyle Dash {
|
||||
public double [] Dash {
|
||||
set {
|
||||
diasharp_canvas_line_set_dash_style_property (Handle,
|
||||
value.DashSize);
|
||||
value.Length,
|
||||
value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
// DashStyle.cs - custom version of DashStyle
|
||||
//
|
||||
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
|
||||
// Copyright (C) 2003 2004 Martin Willemoes Hansen <mwh@sysrq.dk>
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// This code is inserted after the automatically generated code.
|
||||
|
||||
namespace Dia {
|
||||
public class DashStyle {
|
||||
double dash_size;
|
||||
|
||||
public DashStyle (double dash_size)
|
||||
{
|
||||
this.dash_size = dash_size < 0 ? 0 : dash_size;
|
||||
}
|
||||
|
||||
public double DashSize { get { return dash_size; } }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/* diatypes.c : Glue to create DashStyle's
|
||||
/* dia-canvas-line.c : Glue to set the dash property of DiaCanvasLine
|
||||
*
|
||||
* Author: Martin Willemoes Hansen
|
||||
*
|
||||
|
@ -8,33 +8,51 @@
|
|||
|
||||
#include <diacanvas/dia-canvas-line.h>
|
||||
|
||||
#define DASH_SIZE(n_dash) (sizeof (DiaDashStyle) + sizeof (gdouble) * MAX (0, (n_dash) - 1))
|
||||
|
||||
/* Forward declarations */
|
||||
void diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gdouble dash_size);
|
||||
void
|
||||
diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gint n_dash,
|
||||
gdouble dashes []);
|
||||
/* */
|
||||
|
||||
void
|
||||
diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gdouble dash_size)
|
||||
void
|
||||
diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gint n_dash,
|
||||
gdouble dashes [])
|
||||
{
|
||||
g_assert (dash_size >= 0);
|
||||
/* Right now
|
||||
* DiaDashStyle * dia_dash_style_new (gint n_dash, gdouble dash1, ...)
|
||||
* do not support P/Invoke because of ... (ellipsis)
|
||||
* A va_list may work instead of simply a gdouble array.
|
||||
* For now I just borrowed the code to make a DiaDashStyle.
|
||||
*/
|
||||
|
||||
g_assert (n_dash >= 0);
|
||||
|
||||
g_free (line->dash);
|
||||
line->dash = NULL;
|
||||
line->n_dash = 0;
|
||||
|
||||
DiaDashStyle * style = dia_dash_style_new (1, dash_size);
|
||||
DiaDashStyle * style = g_malloc (DASH_SIZE (n_dash));
|
||||
style->n_dash = n_dash;
|
||||
|
||||
gint i = 0;
|
||||
while (i < n_dash) {
|
||||
style->dash[i] = dashes [i++];
|
||||
}
|
||||
|
||||
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));
|
||||
/*
|
||||
Test code, to see if DiaDashStyle is okay
|
||||
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));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/* diatypes.c : Glue to create DashStyle's
|
||||
*
|
||||
* Author: Martin Willemoes Hansen
|
||||
*
|
||||
* Copyright (C) 2003 Martin Willemoes Hansen
|
||||
*
|
||||
*/
|
||||
|
||||
#include <diacanvas/dia-canvas-line.h>
|
||||
|
||||
/* Forward declarations */
|
||||
void diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gdouble dash_on, gdouble dash_off);
|
||||
/* */
|
||||
|
||||
void
|
||||
diasharp_canvas_line_set_dash_style_property (DiaCanvasLine * line,
|
||||
gdouble dash_on, gdouble dash_off)
|
||||
{
|
||||
g_assert (dash_on >= 0);
|
||||
g_assert (dash_off >= 0);
|
||||
|
||||
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);
|
||||
|
||||
//g_object_set (line, "dash", style, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -84,10 +84,9 @@ public class Sample {
|
|||
Dia.CanvasLine line = new Dia.CanvasLine();
|
||||
line.LineWidth = 10;
|
||||
line.Color = 8327327;
|
||||
DashStyle style = new DashStyle (10);
|
||||
line.Dash = style;
|
||||
line.Dash = new double [] { 2, 4, 8, 16, 32 };
|
||||
line.HeadPos = new Dia.Point (50, 70);;
|
||||
line.TailPos = new Dia.Point (100, 170);
|
||||
line.TailPos = new Dia.Point (200, 250);
|
||||
line.Cap = Dia.CapStyle.Butt;
|
||||
line.Move (50, 150);
|
||||
canvas.Root.Add (line);
|
||||
|
|
Загрузка…
Ссылка в новой задаче