snap.h revision 700fe8603c02a9d683dd7b1ccdfae489b61ea2c2
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * \brief SnapManager class.
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Authors:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Lauris Kaplinski <lauris@kaplinski.com>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Frank Felfe <innerspace@iname.com>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Carl Hetherington <inkscape@carlh.net>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Diederik van Lierop <mail@diedenrezi.nl>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Copyright (C) 2006-2007 Johan Engelen <johan@shouraizou.nl>
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Copyright (C) 2000-2002 Lauris Kaplinski
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Copyright (C) 2000-2008 Authors
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Released under GNU GPL, read the file 'COPYING' for more information
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm/// Class to coordinate snapping operations
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * Each SPNamedView has one of these. It offers methods to snap points to whatever
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * snappers are defined (e.g. grid, guides etc.). It also allows callers to snap
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm * points which have undergone some transformation (e.g. translation, scaling etc.)
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm typedef std::list<const Inkscape::Snapper*> SnapperList;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void setup(SPDesktop const *desktop, bool snapindicator = true, SPItem const *item_to_ignore = NULL, std::vector<Geom::Point> *unselected_nodes = NULL);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void setup(SPDesktop const *desktop, bool snapindicator, std::vector<SPItem const *> &items_to_ignore, std::vector<Geom::Point> *unselected_nodes = NULL);
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // freeSnapReturnByRef() is preferred over freeSnap(), because it only returns a
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // point if snapping has occured (by overwriting p); otherwise p is untouched
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool first_point = true,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm boost::optional<Geom::Rect> const &bbox_to_snap = boost::optional<Geom::Rect>()) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint freeSnap(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool first_point = true,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm boost::optional<Geom::Rect> const &bbox_to_snap = boost::optional<Geom::Rect>() ) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Geom::Point multipleOfGridPitch(Geom::Point const &t) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // constrainedSnapReturnByRef() is preferred over constrainedSnap(), because it only returns a
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // point, by overwriting p, if snapping has occured; otherwise p is untouched
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void constrainedSnapReturnByRef(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool first_point = true,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm boost::optional<Geom::Rect> const &bbox_to_snap = boost::optional<Geom::Rect>()) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint constrainedSnap(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool first_point = true,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm boost::optional<Geom::Rect> const &bbox_to_snap = boost::optional<Geom::Rect>()) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void guideSnap(Geom::Point &p, Geom::Point const &guide_normal) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint freeSnapTranslation(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint constrainedSnapTranslation(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint freeSnapScale(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint constrainedSnapScale(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool uniform) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint constrainedSnapSkew(Inkscape::Snapper::PointType point_type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Geom::Point const &s, // s[0] = skew factor, s[1] = scale factor
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::ObjectSnapper object; ///< snapper to other objects
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool getSnapModeBBox() const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool getSnapModeNode() const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool getSnapModeGuide() const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void setSnapIntersectionGG(bool enabled) {_intersectionGG = enabled;}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm void setSnapIntersectionCS(bool enabled) {_intersectionCS = enabled;}
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm // also store a local copy in the object-snapper instead of passing it through many functions
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool getIncludeItemCenter() const {
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool _include_item_center; //If true, snapping nodes will also snap the item's center
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint _snapTransformed(Inkscape::Snapper::PointType type,
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm bool uniform) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Inkscape::SnappedPoint findBestSnap(Geom::Point const &p, SnappedConstraints &sc, bool constrained) const;
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm#endif /* !SEEN_SNAP_H */
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm Local Variables:
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm c-file-style:"stroustrup"
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm indent-tabs-mode:nil
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm fill-column:99
da58597f9f9ecb17c4f545c4483a844a363bcc27pjrm// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :