Code

Split SPCanvasItem and SPCanvasGroup to individual .h files. Removed forward header.
[inkscape.git] / src / draw-context.h
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 <libnr/nr-point.h>
21 #include "live_effects/effect.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     /* type of the LPE that is to be applied automatically to a finished path (if any) */
72     Inkscape::LivePathEffect::EffectType waiting_LPE_type;
74     sigc::connection sel_changed_connection;
75     sigc::connection sel_modified_connection;
77     bool red_curve_is_valid;
79     bool anchor_statusbar;
80 };
82 struct SPDrawContextClass : public SPEventContextClass{};
84 GType sp_draw_context_get_type(void);
85 SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, Geom::Point p);
86 void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed);
87 void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, Geom::Point const &o, guint state);
88 void spdc_endpoint_snap_free(SPEventContext const *ec, Geom::Point &p, guint state);
89 void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item);
90 void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char const *tool, guint event_state);
92 #endif
94 /*
95   Local Variables:
96   mode:c++
97   c-file-style:"stroustrup"
98   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
99   indent-tabs-mode:nil
100   fill-column:99
101   End:
102 */
103 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :