1 #ifndef SEEN_CONNECTOR_CONTEXT_H
2 #define SEEN_CONNECTOR_CONTEXT_H
4 /*
5 * Connector creation tool
6 *
7 * Authors:
8 * Michael Wybrow <mjwybrow@users.sourceforge.net>
9 *
10 * Copyright (C) 2005 Michael Wybrow
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #include <sigc++/sigc++.h>
16 #include <sigc++/connection.h>
17 #include "display/curve.h"
18 #include "event-context.h"
19 #include <forward.h>
20 #include <display/display-forward.h>
21 #include <libnr/nr-point.h>
22 #include "libavoid/connector.h"
25 #define SP_TYPE_CONNECTOR_CONTEXT (sp_connector_context_get_type())
26 #define SP_CONNECTOR_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_CONNECTOR_CONTEXT, SPConnectorContext))
27 #define SP_CONNECTOR_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_CONNECTOR_CONTEXT, SPConnectorContextClass))
28 #define SP_IS_CONNECTOR_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_CONNECTOR_CONTEXT))
29 #define SP_IS_CONNECTOR_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_CONNECTOR_CONTEXT))
31 struct SPKnot;
32 namespace Inkscape
33 {
34 class Selection;
35 }
37 enum {
38 SP_CONNECTOR_CONTEXT_IDLE,
39 SP_CONNECTOR_CONTEXT_DRAGGING,
40 SP_CONNECTOR_CONTEXT_CLOSE,
41 SP_CONNECTOR_CONTEXT_STOP,
42 SP_CONNECTOR_CONTEXT_REROUTING
43 };
46 struct SPConnectorContext : public SPEventContext {
47 Inkscape::Selection *selection;
48 NR::Point p[5];
50 /** \invar npoints in {0, 2}. */
51 gint npoints;
53 unsigned int mode : 1;
54 unsigned int state : 4;
56 // Red curve
57 SPCanvasItem *red_bpath;
58 SPCurve *red_curve;
59 guint32 red_color;
61 // Green curve
62 SPCurve *green_curve;
64 // The new connector
65 SPItem *newconn;
66 Avoid::ConnRef *newConnRef;
68 // The active shape
69 SPItem *active_shape;
70 Inkscape::XML::Node *active_shape_repr;
71 Inkscape::XML::Node *active_shape_layer_repr;
73 // Same as above, but for the active connector
74 SPItem *active_conn;
75 Inkscape::XML::Node *active_conn_repr;
76 sigc::connection sel_changed_connection;
79 // The activehandle
80 SPKnot *active_handle;
82 SPItem *clickeditem;
83 SPKnot *clickedhandle;
85 SPKnot *connpthandle;
86 SPKnot *endpt_handle[2];
87 guint endpt_handler_id[2];
88 gchar *sid;
89 gchar *eid;
90 SPCanvasItem *c0, *c1, *cl0, *cl1;
91 };
93 struct SPConnectorContextClass : public SPEventContextClass { };
95 GType sp_connector_context_get_type();
97 void cc_selection_set_avoid(bool const set_ignore);
98 bool cc_item_is_connector(SPItem *item);
101 #endif /* !SEEN_CONNECTOR_CONTEXT_H */
103 /*
104 Local Variables:
105 mode:c++
106 c-file-style:"stroustrup"
107 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
108 indent-tabs-mode:nil
109 fill-column:99
110 End:
111 */
112 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :