add EPA stuff from 2.X
[ardour.git] / libs / gnomecanvas / libgnomecanvas / gnome-canvas-line.h
1 /*
2  * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
3  * All rights reserved.
4  *
5  * This file is part of the Gnome Library.
6  *
7  * The Gnome Library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * The Gnome Library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
19  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22 /*
23   @NOTATION@
24  */
25
26 /* Line/curve item type for GnomeCanvas widget
27  *
28  * GnomeCanvas is basically a port of the Tk toolkit's most excellent canvas widget.  Tk is
29  * copyrighted by the Regents of the University of California, Sun Microsystems, and other parties.
30  *
31  *
32  * Author: Federico Mena <federico@nuclecu.unam.mx>
33  */
34
35 #ifndef GNOME_CANVAS_LINE_H
36 #define GNOME_CANVAS_LINE_H
37
38
39 #include <libgnomecanvas/gnome-canvas.h>
40
41
42 G_BEGIN_DECLS
43
44
45 /* Line item for the canvas.  This is a polyline with configurable width, cap/join styles, and arrowheads.
46  * If arrowheads are enabled, then three values are used to specify their shape:
47  *
48  *      arrow_shape_a:  Distance from tip of arrowhead to the center point.
49  *      arrow_shape_b:  Distance from tip of arrowhead to trailing point, measured along the shaft.
50  *      arrow_shape_c:  Distance of trailing point from outside edge of shaft.
51  *
52  * The following object arguments are available:
53  *
54  * name                 type                    read/write      description
55  * ------------------------------------------------------------------------------------------
56  * points               GnomeCanvasPoints*      RW              Pointer to a GnomeCanvasPoints structure.
57  *                                                              This can be created by a call to
58  *                                                              gnome_canvas_points_new() (in gnome-canvas-util.h).
59  *                                                              X coordinates are in the even indices of the
60  *                                                              points->coords array, Y coordinates are in
61  *                                                              the odd indices.
62  * fill_color           string                  W               X color specification for line
63  * fill_color_gdk       GdkColor*               RW              Pointer to an allocated GdkColor
64  * fill_stipple         GdkBitmap*              RW              Stipple pattern for the line
65  * width_pixels         uint                    R               Width of the line in pixels.  The line width
66  *                                                              will not be scaled when the canvas zoom factor changes.
67  * width_units          double                  R               Width of the line in canvas units.  The line width
68  *                                                              will be scaled when the canvas zoom factor changes.
69  * cap_style            GdkCapStyle             RW              Cap ("endpoint") style for the line.
70  * join_style           GdkJoinStyle            RW              Join ("vertex") style for the line.
71  * line_style           GdkLineStyle            RW              Line dash style
72  * first_arrowhead      boolean                 RW              Specifies whether to draw an arrowhead on the
73  *                                                              first point of the line.
74  * last_arrowhead       boolean                 RW              Specifies whether to draw an arrowhead on the
75  *                                                              last point of the line.
76  * smooth               boolean                 RW              Specifies whether to smooth the line using
77  *                                                              parabolic splines.
78  * spline_steps         uint                    RW              Specifies the number of steps to use when rendering curves.
79  * arrow_shape_a        double                  RW              First arrow shape specifier.
80  * arrow_shape_b        double                  RW              Second arrow shape specifier.
81  * arrow_shape_c        double                  RW              Third arrow shape specifier.
82  */
83
84
85 #define GNOME_TYPE_CANVAS_LINE            (gnome_canvas_line_get_type ())
86 #define GNOME_CANVAS_LINE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLine))
87 #define GNOME_CANVAS_LINE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass))
88 #define GNOME_IS_CANVAS_LINE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_CANVAS_LINE))
89 #define GNOME_IS_CANVAS_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_CANVAS_LINE))
90 #define GNOME_CANVAS_LINE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_LINE, GnomeCanvasLineClass))
91
92
93 typedef struct _GnomeCanvasLine GnomeCanvasLine;
94 typedef struct _GnomeCanvasLineClass GnomeCanvasLineClass;
95
96 struct _GnomeCanvasLine {
97         GnomeCanvasItem item;
98
99         double *coords;         /* Array of coordinates for the line's points.  X coords are in the
100                                  * even indices, Y coords are in the odd indices.  If the line has
101                                  * arrowheads then the first and last points have been adjusted to
102                                  * refer to the necks of the arrowheads rather than their tips.  The
103                                  * actual endpoints are stored in the first_arrow and last_arrow
104                                  * arrays, if they exist.
105                                  */
106
107         double *first_coords;   /* Array of points describing polygon for the first arrowhead */
108         double *last_coords;    /* Array of points describing polygon for the last arrowhead */
109
110         GdkGC *gc;              /* GC for drawing line */
111
112         GdkBitmap *stipple;     /* Stipple pattern */
113
114         ArtSVP *fill_svp;               /* The SVP for the outline shape */ /*AA*/
115         ArtSVP *first_svp;              /* The SVP for the first arrow */ /*AA*/
116         ArtSVP *last_svp;               /* The SVP for the last arrow */ /*AA*/
117
118         double width;           /* Width of the line */
119
120         double shape_a;         /* Distance from tip of arrowhead to center */
121         double shape_b;         /* Distance from tip of arrowhead to trailing point, measured along shaft */
122         double shape_c;         /* Distance of trailing points from outside edge of shaft */
123
124         GdkCapStyle cap;        /* Cap style for line */
125         GdkJoinStyle join;      /* Join style for line */
126         GdkLineStyle line_style;/* Style for the line */
127
128         gulong fill_pixel;      /* Color for line */
129
130         guint32 fill_rgba;              /* RGBA color for outline */ /*AA*/
131
132         int num_points;         /* Number of points in the line */
133         guint fill_color;       /* Fill color, RGBA */
134
135         int spline_steps;       /* Number of steps in each spline segment */
136
137         guint width_pixels : 1; /* Is the width specified in pixels or units? */
138         guint first_arrow : 1;  /* Draw first arrowhead? */
139         guint last_arrow : 1;   /* Draw last arrowhead? */
140         guint smooth : 1;       /* Smooth line (with parabolic splines)? */
141 };
142
143 struct _GnomeCanvasLineClass {
144         GnomeCanvasItemClass parent_class;
145 };
146
147
148 /* Standard Gtk function */
149 GType gnome_canvas_line_get_type (void) G_GNUC_CONST;
150
151
152 G_END_DECLS
153
154 #endif