Code

Indent support for XSLT extensions output.
[inkscape.git] / src / conn-avoid-ref.h
1 #ifndef SEEN_CONN_AVOID_REF
2 #define SEEN_CONN_AVOID_REF
4 /** \file
5  * A class for handling shape interaction with libavoid.
6  */
7 /*
8  * Authors:
9  *   Michael Wybrow <mjwybrow@users.sourceforge.net>
10  *
11  * Copyright (C) 2005 Michael Wybrow
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <glib/gslist.h>
17 #include <sigc++/connection.h>
19 struct SPDesktop;
20 struct SPItem;
21 struct ConnectionPoint;
22 typedef std::map<int, ConnectionPoint> IdConnectionPointMap;
23 namespace Avoid { class ShapeRef; }
25 class SPAvoidRef {
26 public:
27     SPAvoidRef(SPItem *spitem);
28     virtual ~SPAvoidRef();
30     // libavoid's internal representation of the item.
31     Avoid::ShapeRef *shapeRef;
33     // Used for holding connection points for item
34     IdConnectionPointMap connection_points;
36     void setAvoid(char const *value);
37     void setConnectionPoints(gchar const *value);
38     void addConnectionPoint(ConnectionPoint &cp);
39     void updateConnectionPoint(ConnectionPoint &cp);
40     void deleteConnectionPoint(ConnectionPoint &cp);
41     void handleSettingChange(void);
43     // Returns a list of SPItems of all connectors/shapes attached to
44     // this object.  Pass one of the following for 'type':
45     //     Avoid::runningTo
46     //     Avoid::runningFrom
47     //     Avoid::runningToAndFrom
48     GSList *getAttachedShapes(const unsigned int type);
49     GSList *getAttachedConnectors(const unsigned int type);
50     Geom::Point getConnectionPointPos(const int type, const int id);
52     bool isValidConnPointId( const int type, const int id );
54 private:
55     SPItem *item;
57     // true if avoiding, false if not.
58     bool setting;
59     bool new_setting;
61     // A sigc connection for transformed signal.
62     sigc::connection _transformed_connection;
63     void setConnectionPointsAttrUndoable(const gchar* value, const gchar* action);
64 };
66 extern GSList *get_avoided_items(GSList *list, SPObject *from,
67         SPDesktop *desktop, bool initialised = true);
68 extern void avoid_item_move(Geom::Matrix const *mp, SPItem *moved_item);
69 extern void init_avoided_shape_geometry(SPDesktop *desktop);
71 static const double defaultConnSpacing = 3.0;
72 static const double defaultConnCurvature = 3.0;
74 #endif /* !SEEN_CONN_AVOID_REF */
76 /*
77   Local Variables:
78   mode:c++
79   c-file-style:"stroustrup"
80   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
81   indent-tabs-mode:nil
82   fill-column:99
83   End:
84 */
85 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :