From 179fa413b047bede6e32109e2ce82437c5fb8d34 Mon Sep 17 00:00:00 2001 From: MenTaLguY Date: Mon, 16 Jan 2006 02:36:01 +0000 Subject: moving trunk for module inkscape (bzr r1) --- src/object-snapper.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/object-snapper.h (limited to 'src/object-snapper.h') 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 + * + * 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 const &it) const; + + SnappedPoint _doConstrainedSnap(NR::Point const &p, + NR::Point const &c, + std::list const &it) const; + + void _findCandidates(std::list& c, + SPObject* r, + std::list const &it, + NR::Point const &p) const; + + void _snapNodes(Inkscape::SnappedPoint &s, NR::Point const &p, std::list const &cand) const; + void _snapPaths(Inkscape::SnappedPoint &s, NR::Point const &p, std::list const &cand) const; + + bool _snap_to_nodes; + bool _snap_to_paths; +}; + +} + +#endif -- cgit v1.2.3