1 #ifndef __SP_DRAW_CONTEXT_H__
2 #define __SP_DRAW_CONTEXT_H__
4 /*
5 * Generic drawing context
6 *
7 * Author:
8 * Lauris Kaplinski <lauris@kaplinski.com>
9 *
10 * Copyright (C) 2000 Lauris Kaplinski
11 * Copyright (C) 2000-2001 Ximian, Inc.
12 * Copyright (C) 2002 Lauris Kaplinski
13 *
14 * Released under GNU GPL
15 */
17 #include <sigc++/sigc++.h>
18 #include "display/curve.h"
19 #include "event-context.h"
20 #include <forward.h>
21 #include <display/display-forward.h>
22 #include <libnr/nr-point.h>
24 /* Freehand context */
26 #define SP_TYPE_DRAW_CONTEXT (sp_draw_context_get_type())
27 #define SP_DRAW_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_DRAW_CONTEXT, SPDrawContext))
28 #define SP_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_DRAW_CONTEXT, SPDrawContextClass))
29 #define SP_IS_DRAW_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_DRAW_CONTEXT))
30 #define SP_IS_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_DRAW_CONTEXT))
32 struct SPDrawAnchor;
33 namespace Inkscape
34 {
35 class Selection;
36 }
38 struct SPDrawContext : public SPEventContext{
39 Inkscape::Selection *selection;
40 SPCanvasItem *grab;
42 guint attach : 1;
44 guint32 red_color;
45 guint32 blue_color;
46 guint32 green_color;
48 /* Red */
49 SPCanvasItem *red_bpath;
50 SPCurve *red_curve;
52 /* Blue */
53 SPCanvasItem *blue_bpath;
54 SPCurve *blue_curve;
56 /* Green */
57 GSList *green_bpaths;
58 SPCurve *green_curve;
59 SPDrawAnchor *green_anchor;
60 gboolean green_closed; // a flag meaning we hit the green anchor, so close the path on itself
62 /* White */
63 SPItem *white_item;
64 GSList *white_curves;
65 GSList *white_anchors;
67 /* Start anchor */
68 SPDrawAnchor *sa;
69 /* End anchor */
70 SPDrawAnchor *ea;
72 sigc::connection sel_changed_connection;
73 sigc::connection sel_modified_connection;
75 bool red_curve_is_valid;
77 bool anchor_statusbar;
78 };
80 struct SPDrawContextClass : public SPEventContextClass{};
82 GType sp_draw_context_get_type(void);
83 SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, NR::Point p);
84 void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed);
85 void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, NR::Point const o, guint state);
86 void spdc_endpoint_snap_free(SPEventContext const *ec, NR::Point &p, guint state);
89 #endif
91 /*
92 Local Variables:
93 mode:c++
94 c-file-style:"stroustrup"
95 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96 indent-tabs-mode:nil
97 fill-column:99
98 End:
99 */
100 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :