summaryrefslogtreecommitdiffstats
path: root/src/object/sp-conn-end-pair.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
commit35a96bde514a8897f6f0fcc41c5833bf63df2e2a (patch)
tree657d15a03cc46bd099fc2c6546a7a4ad43815d9f /src/object/sp-conn-end-pair.h
parentInitial commit. (diff)
downloadinkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.tar.xz
inkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.zip
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/object/sp-conn-end-pair.h')
-rw-r--r--src/object/sp-conn-end-pair.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/object/sp-conn-end-pair.h b/src/object/sp-conn-end-pair.h
new file mode 100644
index 0000000..8fc3259
--- /dev/null
+++ b/src/object/sp-conn-end-pair.h
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef SEEN_SP_CONN_END_PAIR
+#define SEEN_SP_CONN_END_PAIR
+
+/*
+ * A class for handling connector endpoint movement and libavoid interaction.
+ *
+ * Authors:
+ * Peter Moulder <pmoulder@mail.csse.monash.edu.au>
+ *
+ * * Copyright (C) 2004 Monash University
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#include <cstddef>
+#include <sigc++/sigc++.h>
+
+#include "3rdparty/adaptagrams/libavoid/connector.h"
+
+
+class SPConnEnd;
+class SPCurve;
+class SPPath;
+class SPItem;
+class SPObject;
+
+namespace Geom { class Point; }
+namespace Inkscape {
+namespace XML {
+class Node;
+}
+}
+
+extern void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, double curvature);
+
+class SPConnEndPair {
+public:
+ SPConnEndPair(SPPath *);
+ ~SPConnEndPair();
+ void release();
+ void setAttr(unsigned const key, char const *const value);
+ void writeRepr(Inkscape::XML::Node *const repr) const;
+ void getAttachedItems(SPItem *[2]) const;
+ void getEndpoints(Geom::Point endPts[]) const;
+ double getCurvature() const;
+ SPConnEnd** getConnEnds();
+ bool isOrthogonal() const;
+ friend void recreateCurve(SPCurve *curve, Avoid::ConnRef *connRef, double curvature);
+ void tellLibavoidNewEndpoints(bool const processTransaction = false);
+ bool reroutePathFromLibavoid();
+ void makePathInvalid();
+ void update();
+ bool isAutoRoutingConn();
+ void rerouteFromManipulation();
+
+private:
+ void _updateEndPoints();
+
+ SPConnEnd *_connEnd[2];
+
+ SPPath *_path;
+
+ // libavoid's internal representation of the item.
+ Avoid::ConnRef *_connRef;
+
+ int _connType;
+ double _connCurvature;
+
+ // A sigc connection for transformed signal.
+ sigc::connection _transformed_connection;
+};
+
+
+void sp_conn_end_pair_build(SPObject *object);
+
+
+// _connType options:
+enum {
+ SP_CONNECTOR_NOAVOID, // Basic connector - a straight line.
+ SP_CONNECTOR_POLYLINE, // Object avoiding polyline.
+ SP_CONNECTOR_ORTHOGONAL // Object avoiding orthogonal polyline (only horizontal and vertical segments).
+};
+
+
+#endif /* !SEEN_SP_CONN_END_PAIR */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :