Code

416307d58e6331154c7edf8acd757b98600a3413
[inkscape.git] / src / common-context.h
1 #ifndef COMMON_CONTEXT_H_SEEN
2 #define COMMON_CONTEXT_H_SEEN
4 /*
5  * Common drawing mode
6  *
7  * Authors:
8  *   Mitsuru Oka <oka326@parkcity.ne.jp>
9  *   Lauris Kaplinski <lauris@kaplinski.com>
10  *
11  * The original dynadraw code:
12  *   Paul Haeberli <paul@sgi.com>
13  *
14  * Copyright (C) 1998 The Free Software Foundation
15  * Copyright (C) 1999-2002 authors
16  * Copyright (C) 2001-2002 Ximian, Inc.
17  * Copyright (C) 2008 Jon A. Cruz
18  *
19  * Released under GNU GPL, read the file 'COPYING' for more information
20  */
22 #include "event-context.h"
23 #include "display/curve.h"
24 #include "display/display-forward.h"
25 #include <2geom/point.h>
27 #define SP_TYPE_COMMON_CONTEXT (sp_common_context_get_type())
28 #define SP_COMMON_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_COMMON_CONTEXT, SPCommonContext))
29 #define SP_COMMON_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_COMMON_CONTEXT, SPCommonContextClass))
30 #define SP_IS_COMMON_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_COMMON_CONTEXT))
31 #define SP_IS_COMMON_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_COMMON_CONTEXT))
33 class SPCommonContext;
34 class SPCommonContextClass;
36 #define SAMPLING_SIZE 8        /* fixme: ?? */
39 struct SPCommonContext : public SPEventContext {
40     /** accumulated shape which ultimately goes in svg:path */
41     SPCurve *accumulated;
43     /** canvas items for "comitted" segments */
44     GSList *segments;
46     /** canvas item for red "leading" segment */
47     SPCanvasItem *currentshape;
48     /** shape of red "leading" segment */
49     SPCurve *currentcurve;
51     /** left edge of the stroke; combined to get accumulated */
52     SPCurve *cal1;
54     /** right edge of the stroke; combined to get accumulated */
55     SPCurve *cal2;
57     /** left edge points for this segment */
58     Geom::Point point1[SAMPLING_SIZE];
60     /** right edge points for this segment */
61     Geom::Point point2[SAMPLING_SIZE];
63     /** number of edge points for this segment */
64     gint npoints;
66     /* repr */
67     Inkscape::XML::Node *repr;
69     /* common */
70     Geom::Point cur;
71     Geom::Point vel;
72     double vel_max;
73     Geom::Point acc;
74     Geom::Point ang;
75     Geom::Point last;
76     Geom::Point del;
78     /* extended input data */
79     gdouble pressure;
80     gdouble xtilt;
81     gdouble ytilt;
83     /* attributes */
84     guint dragging : 1;           /* mouse state: mouse is dragging */
85     guint usepressure : 1;
86     guint usetilt : 1;
87     double mass, drag;
88     double angle;
89     double width;
91     double vel_thin;
92     double flatness;
93     double tremor;
94     double cap_rounding;
96     Inkscape::MessageContext *_message_context;
98     bool is_drawing;
100     /** uses absolute width independent of zoom */
101     bool abs_width;
102 };
104 struct SPCommonContextClass : public SPEventContextClass{};
106 GType sp_common_context_get_type(void);
108 #endif // COMMON_CONTEXT_H_SEEN
110 /*
111   Local Variables:
112   mode:c++
113   c-file-style:"stroustrup"
114   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
115   indent-tabs-mode:nil
116   fill-column:99
117   End:
118 */
119 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :