summaryrefslogtreecommitdiffstats
path: root/src/object-snapper.h
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-01-16 02:36:01 +0000
committermental <mental@users.sourceforge.net>2006-01-16 02:36:01 +0000
commit179fa413b047bede6e32109e2ce82437c5fb8d34 (patch)
treea5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/object-snapper.h
downloadinkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz
inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/object-snapper.h')
-rw-r--r--src/object-snapper.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/object-snapper.h b/src/object-snapper.h
new file mode 100644
index 000000000..189e96e3e
--- /dev/null
+++ b/src/object-snapper.h
@@ -0,0 +1,68 @@
+#ifndef SEEN_OBJECT_SNAPPER_H
+#define SEEN_OBJECT_SNAPPER_H
+
+/**
+ * \file object-snapper.h
+ * \brief Snapping things to objects.
+ *
+ * Authors:
+ * Carl Hetherington <inkscape@carlh.net>
+ *
+ * Copyright (C) 2005 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "snapper.h"
+
+struct SPNamedView;
+struct SPItem;
+struct SPObject;
+
+namespace Inkscape
+{
+
+class ObjectSnapper : public Snapper
+{
+public:
+ ObjectSnapper(SPNamedView const *nv, NR::Coord const d);
+
+ void setSnapToNodes(bool s) {
+ _snap_to_nodes = s;
+ }
+
+ bool getSnapToNodes() const {
+ return _snap_to_nodes;
+ }
+
+ void setSnapToPaths(bool s) {
+ _snap_to_paths = s;
+ }
+
+ bool getSnapToPaths() const {
+ return _snap_to_paths;
+ }
+
+private:
+ SnappedPoint _doFreeSnap(NR::Point const &p,
+ std::list<SPItem const *> const &it) const;
+
+ SnappedPoint _doConstrainedSnap(NR::Point const &p,
+ NR::Point const &c,
+ std::list<SPItem const *> const &it) const;
+
+ void _findCandidates(std::list<SPItem*>& c,
+ SPObject* r,
+ std::list<SPItem const *> const &it,
+ NR::Point const &p) const;
+
+ void _snapNodes(Inkscape::SnappedPoint &s, NR::Point const &p, std::list<SPItem*> const &cand) const;
+ void _snapPaths(Inkscape::SnappedPoint &s, NR::Point const &p, std::list<SPItem*> const &cand) const;
+
+ bool _snap_to_nodes;
+ bool _snap_to_paths;
+};
+
+}
+
+#endif