1 #ifndef SEEN_SP_CONN_END_PAIR
2 #define SEEN_SP_CONN_END_PAIR
4 /*
5 * A class for handling connector endpoint movement and libavoid interaction.
6 *
7 * Authors:
8 * Peter Moulder <pmoulder@mail.csse.monash.edu.au>
9 *
10 * * Copyright (C) 2004 Monash University
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
14 #include <glib/gtypes.h>
16 #include "forward.h"
17 #include "libnr/nr-point.h"
18 #include <sigc++/connection.h>
19 #include <sigc++/functors/slot.h>
20 #include <sigc++/signal.h>
21 #include "libavoid/connector.h"
24 class SPConnEnd;
25 namespace Inkscape {
26 namespace XML {
27 class Node;
28 }
29 }
32 class SPConnEndPair {
33 public:
34 SPConnEndPair(SPPath *);
35 ~SPConnEndPair();
36 void release();
37 void setAttr(unsigned const key, gchar const *const value);
38 void writeRepr(Inkscape::XML::Node *const repr) const;
39 void getAttachedItems(SPItem *[2]) const;
40 void getEndpoints(Geom::Point endPts[]) const;
41 void reroutePath(void);
42 void makePathInvalid(void);
43 void update(void);
44 bool isAutoRoutingConn(void);
45 void rerouteFromManipulation(void);
46 void reroute(void);
47 sigc::connection connectInvalidPath(sigc::slot<void, SPPath *> slot);
49 // A signal emited by a call back from libavoid. Used to let
50 // connectors know when they need to reroute themselves.
51 sigc::signal<void, SPPath *> _invalid_path_signal;
52 // A sigc connection to listen for connector path invalidation.
53 sigc::connection _invalid_path_connection;
55 private:
56 SPConnEnd *_connEnd[2];
58 SPPath *_path;
60 // libavoid's internal representation of the item.
61 Avoid::ConnRef *_connRef;
63 int _connType;
65 // A sigc connection for transformed signal.
66 sigc::connection _transformed_connection;
68 void storeIds(void);
69 };
72 void sp_conn_end_pair_build(SPObject *object);
75 // _connType options:
76 enum {
77 SP_CONNECTOR_NOAVOID, // Basic connector - a straight line.
78 SP_CONNECTOR_POLYLINE // Object avoiding polyline.
79 };
82 #endif /* !SEEN_SP_CONN_END_PAIR */
84 /*
85 Local Variables:
86 mode:c++
87 c-file-style:"stroustrup"
88 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
89 indent-tabs-mode:nil
90 fill-column:99
91 End:
92 */
93 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :