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 "event-context.h"
18 #include <forward.h>
19 #include <display/display-forward.h>
20 #include <2geom/point.h>
21 #include "libavoid/connector.h"
24 #define SP_TYPE_CONNECTOR_CONTEXT (sp_connector_context_get_type())
25 #define SP_CONNECTOR_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_CONNECTOR_CONTEXT, SPConnectorContext))
26 #define SP_CONNECTOR_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), SP_TYPE_CONNECTOR_CONTEXT, SPConnectorContextClass))
27 #define SP_IS_CONNECTOR_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), SP_TYPE_CONNECTOR_CONTEXT))
28 #define SP_IS_CONNECTOR_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), SP_TYPE_CONNECTOR_CONTEXT))
30 struct SPKnot;
31 namespace Inkscape
32 {
33 class Selection;
34 }
36 enum {
37 SP_CONNECTOR_CONTEXT_IDLE,
38 SP_CONNECTOR_CONTEXT_DRAGGING,
39 SP_CONNECTOR_CONTEXT_CLOSE,
40 SP_CONNECTOR_CONTEXT_STOP,
41 SP_CONNECTOR_CONTEXT_REROUTING
42 };
45 struct SPConnectorContext : public SPEventContext {
46 Inkscape::Selection *selection;
47 Geom::Point p[5];
49 /** \invar npoints in {0, 2}. */
50 gint npoints;
52 unsigned int mode : 1;
53 unsigned int state : 4;
55 // Red curve
56 SPCanvasItem *red_bpath;
57 SPCurve *red_curve;
58 guint32 red_color;
60 // Green curve
61 SPCurve *green_curve;
63 // The new connector
64 SPItem *newconn;
65 Avoid::ConnRef *newConnRef;
67 // The active shape
68 SPItem *active_shape;
69 Inkscape::XML::Node *active_shape_repr;
70 Inkscape::XML::Node *active_shape_layer_repr;
72 // Same as above, but for the active connector
73 SPItem *active_conn;
74 Inkscape::XML::Node *active_conn_repr;
75 sigc::connection sel_changed_connection;
78 // The activehandle
79 SPKnot *active_handle;
81 SPItem *clickeditem;
82 SPKnot *clickedhandle;
84 SPKnot *connpthandle;
85 SPKnot *endpt_handle[2];
86 guint endpt_handler_id[2];
87 gchar *sid;
88 gchar *eid;
89 SPCanvasItem *c0, *c1, *cl0, *cl1;
90 };
92 struct SPConnectorContextClass : public SPEventContextClass { };
94 GType sp_connector_context_get_type();
96 void cc_selection_set_avoid(bool const set_ignore);
97 bool cc_item_is_connector(SPItem *item);
100 #endif /* !SEEN_CONNECTOR_CONTEXT_H */
102 /*
103 Local Variables:
104 mode:c++
105 c-file-style:"stroustrup"
106 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
107 indent-tabs-mode:nil
108 fill-column:99
109 End:
110 */
111 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :