Code

3b011ed173a6bb1b99b77be92d8436c5e4c582bb
[inkscape.git] / src / sp-conn-end-pair.h
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 }
31 extern void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature);
33 class SPConnEndPair {
34 public:
35     SPConnEndPair(SPPath *);
36     ~SPConnEndPair();
37     void release();
38     void setAttr(unsigned const key, gchar const *const value);
39     void writeRepr(Inkscape::XML::Node *const repr) const;
40     void getAttachedItems(SPItem *[2]) const;
41     void getEndpoints(Geom::Point endPts[]) const;
42     gdouble getCurvature(void) const;
43     SPConnEnd** getConnEnds(void);
44     bool isOrthogonal(void) const;
45     friend void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, gdouble curvature);
46     void tellLibavoidNewEndpoints(const bool processTransaction = false);
47     bool reroutePathFromLibavoid(void);
48     void makePathInvalid(void);
49     void update(void);
50     bool isAutoRoutingConn(void);
51     void rerouteFromManipulation(void);
53 private:
54     SPConnEnd *_connEnd[2];
55     
56     SPPath *_path;
58     // libavoid's internal representation of the item.
59     Avoid::ConnRef *_connRef;
61     int _connType;
62     gdouble _connCurvature;
63     
64     // A sigc connection for transformed signal.
65     sigc::connection _transformed_connection;
66     
67     void storeIds(void);
68 };
71 void sp_conn_end_pair_build(SPObject *object);
74 // _connType options:
75 enum {
76     SP_CONNECTOR_NOAVOID,     // Basic connector - a straight line.
77     SP_CONNECTOR_POLYLINE,    // Object avoiding polyline.
78     SP_CONNECTOR_ORTHOGONAL   // Object avoiding orthogonal polyline (only horizontal and verical segments).
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 :