summaryrefslogtreecommitdiffstats
path: root/src/knotholder.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/knotholder.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/knotholder.h')
-rw-r--r--src/knotholder.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/knotholder.h b/src/knotholder.h
new file mode 100644
index 0000000..f3951b7
--- /dev/null
+++ b/src/knotholder.h
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#ifndef SEEN_SP_KNOTHOLDER_H
+#define SEEN_SP_KNOTHOLDER_H
+
+/*
+ * KnotHolder - Hold SPKnot list and manage signals
+ *
+ * Author:
+ * Mitsuru Oka <oka326@parkcity.ne.jp>
+ * Maximilian Albert <maximilian.albert@gmail.com>
+ *
+ * Copyright (C) 1999-2001 Lauris Kaplinski
+ * Copyright (C) 2000-2001 Ximian, Inc.
+ * Copyright (C) 2001 Mitsuru Oka
+ * Copyright (C) 2008 Maximilian Albert
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ *
+ */
+
+#include <2geom/forward.h>
+#include <2geom/affine.h>
+#include <list>
+#include <sigc++/connection.h>
+
+namespace Inkscape {
+namespace UI {
+class ShapeEditor;
+}
+namespace XML {
+class Node;
+}
+namespace LivePathEffect {
+class PowerStrokePointArrayParamKnotHolderEntity;
+class SatellitesArrayParam;
+class FilletChamferKnotHolderEntity;
+}
+}
+
+class KnotHolderEntity;
+class SPItem;
+class SPDesktop;
+class SPKnot;
+
+/* fixme: Think how to make callbacks most sensitive (Lauris) */
+typedef void (* SPKnotHolderReleasedFunc) (SPItem *item);
+
+class KnotHolder {
+public:
+ KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
+ virtual ~KnotHolder();
+
+ KnotHolder() = delete; // declared but not defined
+
+ void update_knots();
+ void unselect_knots();
+ void knot_mousedown_handler(SPKnot *knot, unsigned int state);
+ void knot_moved_handler(SPKnot *knot, Geom::Point const &p, unsigned int state);
+ void knot_clicked_handler(SPKnot *knot, unsigned int state);
+ void knot_ungrabbed_handler(SPKnot *knot, unsigned int state);
+ void transform_selected(Geom::Affine transform);
+ void add(KnotHolderEntity *e);
+
+ void add_pattern_knotholder();
+ void add_hatch_knotholder();
+ void add_filter_knotholder();
+
+ void setEditTransform(Geom::Affine edit_transform);
+ Geom::Affine getEditTransform() const { return _edit_transform; }
+
+ bool knot_mouseover() const;
+
+ friend class Inkscape::UI::ShapeEditor; // FIXME why?
+ friend class Inkscape::LivePathEffect::SatellitesArrayParam; // why?
+ friend class Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity; // why?
+ friend class Inkscape::LivePathEffect::FilletChamferKnotHolderEntity; // why?
+
+protected:
+
+ void updateControlSizes();
+
+ SPDesktop *desktop;
+ SPItem *item; // TODO: Remove this and keep the actual item (e.g., SPRect etc.) in the item-specific knotholders
+ Inkscape::XML::Node *repr; ///< repr of the item, for setting and releasing listeners.
+ std::list<KnotHolderEntity *> entity;
+
+ sigc::connection sizeUpdatedConn;
+
+ SPKnotHolderReleasedFunc released;
+
+ bool local_change; ///< if true, no need to recreate knotholder if repr was changed.
+
+ bool dragging;
+
+ Geom::Affine _edit_transform;
+};
+
+/**
+void knot_clicked_handler(SPKnot *knot, guint state, gpointer data);
+void knot_moved_handler(SPKnot *knot, Geom::Point const *p, guint state, gpointer data);
+void knot_ungrabbed_handler(SPKnot *knot, unsigned int state, KnotHolder *kh);
+**/
+
+#endif // SEEN_SP_KNOTHOLDER_H
+
+/*
+ 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:fileencoding=utf-8:textwidth=99 :