1 #ifndef SEEN_PENCIL_CONTEXT_H
2 #define SEEN_PENCIL_CONTEXT_H
4 /** \file
5 * SPPencilContext: a context for pencil tool events
6 */
8 #include "draw-context.h"
11 #define SP_TYPE_PENCIL_CONTEXT (sp_pencil_context_get_type())
12 #define SP_PENCIL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_PENCIL_CONTEXT, SPPencilContext))
13 #define SP_PENCIL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_PENCIL_CONTEXT, SPPencilContextClass))
14 #define SP_IS_PENCIL_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_PENCIL_CONTEXT))
15 #define SP_IS_PENCIL_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_PENCIL_CONTEXT))
17 enum PencilState {
18 SP_PENCIL_CONTEXT_IDLE,
19 SP_PENCIL_CONTEXT_ADDLINE,
20 SP_PENCIL_CONTEXT_FREEHAND,
21 SP_PENCIL_CONTEXT_SKETCH
22 };
24 /**
25 * SPPencilContext: a context for pencil tool events
26 */
27 struct SPPencilContext : public SPDrawContext {
28 Geom::Point p[16];
29 gint npoints;
30 PencilState state;
31 Geom::Point req_tangent;
33 bool is_drawing;
34 bool prev_snap_was_succesful;
36 std::vector<Geom::Point> ps;
38 Geom::Piecewise<Geom::D2<Geom::SBasis> > sketch_interpolation; // the current proposal from the sketched paths
39 unsigned sketch_n; // number of sketches done
40 };
42 /// The SPPencilContext vtable (empty).
43 struct SPPencilContextClass : public SPEventContextClass { };
45 GType sp_pencil_context_get_type();
48 #endif /* !SEEN_PENCIL_CONTEXT_H */
50 /*
51 Local Variables:
52 mode:c++
53 c-file-style:"stroustrup"
54 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
55 indent-tabs-mode:nil
56 fill-column:99
57 End:
58 */
59 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :