5ac1a7d0978fe42a2d89eef2a563d4765f524dec
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 "event-context.h"
19 #include <forward.h>
20 #include <display/display-forward.h>
21 #include <libnr/nr-point.h>
23 /* Freehand context */
25 #define SP_TYPE_DRAW_CONTEXT (sp_draw_context_get_type())
26 #define SP_DRAW_CONTEXT(o) (GTK_CHECK_CAST((o), SP_TYPE_DRAW_CONTEXT, SPDrawContext))
27 #define SP_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), SP_TYPE_DRAW_CONTEXT, SPDrawContextClass))
28 #define SP_IS_DRAW_CONTEXT(o) (GTK_CHECK_TYPE((o), SP_TYPE_DRAW_CONTEXT))
29 #define SP_IS_DRAW_CONTEXT_CLASS(k) (GTK_CHECK_CLASS_TYPE((k), SP_TYPE_DRAW_CONTEXT))
31 struct SPDrawAnchor;
32 namespace Inkscape
33 {
34 class Selection;
35 }
37 struct SPDrawContext : public SPEventContext{
38 Inkscape::Selection *selection;
39 SPCanvasItem *grab;
41 guint attach : 1;
43 guint32 red_color;
44 guint32 blue_color;
45 guint32 green_color;
47 /* Red */
48 SPCanvasItem *red_bpath;
49 SPCurve *red_curve;
51 /* Blue */
52 SPCanvasItem *blue_bpath;
53 SPCurve *blue_curve;
55 /* Green */
56 GSList *green_bpaths;
57 SPCurve *green_curve;
58 SPDrawAnchor *green_anchor;
59 gboolean green_closed; // a flag meaning we hit the green anchor, so close the path on itself
61 /* White */
62 SPItem *white_item;
63 GSList *white_curves;
64 GSList *white_anchors;
66 /* Start anchor */
67 SPDrawAnchor *sa;
68 /* End anchor */
69 SPDrawAnchor *ea;
71 sigc::connection sel_changed_connection;
72 sigc::connection sel_modified_connection;
74 bool red_curve_is_valid;
76 bool anchor_statusbar;
77 };
79 struct SPDrawContextClass : public SPEventContextClass{};
81 GType sp_draw_context_get_type(void);
82 SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, NR::Point p);
83 void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed);
84 void spdc_endpoint_snap_rotation(SPEventContext const *const ec, NR::Point &p, NR::Point const o, guint state);
85 void spdc_endpoint_snap_free(SPEventContext const *ec, NR::Point &p, guint state);
88 #endif
90 /*
91 Local Variables:
92 mode:c++
93 c-file-style:"stroustrup"
94 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
95 indent-tabs-mode:nil
96 fill-column:99
97 End:
98 */
99 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :