Code

remove extra Shape:: on new function definition in Shape class.
[inkscape.git] / src / object-snapper.h
1 #ifndef SEEN_OBJECT_SNAPPER_H
2 #define SEEN_OBJECT_SNAPPER_H
4 /**
5  *  \file object-snapper.h
6  *  \brief Snapping things to objects.
7  *
8  * Authors:
9  *   Carl Hetherington <inkscape@carlh.net>
10  *
11  * Copyright (C) 2005 Authors 
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include "snapper.h"
18 struct SPNamedView;
19 struct SPItem;
20 struct SPObject;
22 namespace Inkscape
23 {
25 class ObjectSnapper : public Snapper
26 {
27 public:
28   ObjectSnapper(SPNamedView const *nv, NR::Coord const d);
30   void setSnapToItemNode(bool s) {
31     _snap_to_itemnode = s;
32   }
34   bool getSnapToItemNode() const {
35     return _snap_to_itemnode;
36   }
38   void setSnapToItemPath(bool s) {
39     _snap_to_itempath = s;
40   }
42   bool getSnapToItemPath() const {
43     return _snap_to_itempath;
44   }
45   
46   void setSnapToBBoxNode(bool s) {
47     _snap_to_bboxnode = s;
48   }
50   bool getSnapToBBoxNode() const {
51     return _snap_to_bboxnode;
52   }
54   void setSnapToBBoxPath(bool s) {
55     _snap_to_bboxpath = s;
56   }
58   bool getSnapToBBoxPath() const {
59     return _snap_to_bboxpath;
60   }
61   
62   void setStrictSnapping(bool enabled) {
63         _strict_snapping = enabled;
64   }
65   
66   bool ThisSnapperMightSnap() const;
67   
68 private:
69   SnappedPoint _doFreeSnap(Inkscape::Snapper::PointType const &t,
70                                         NR::Point const &p,
71                                         std::list<SPItem const *> const &it) const;
73   SnappedPoint _doConstrainedSnap(Inkscape::Snapper::PointType const &t,
74                                         NR::Point const &p,
75                                         ConstraintLine const &c,
76                                         std::list<SPItem const *> const &it) const;
77   
78   void _findCandidates(std::list<SPItem*>& c,
79                                 SPObject* r,
80                                 std::list<SPItem const *> const &it,
81                                 NR::Point const &p) const;
82   
83   void _snapNodes(Inkscape::Snapper::PointType const &t,
84                                         Inkscape::SnappedPoint &s, 
85                                         NR::Point const &p, 
86                                         std::list<SPItem*> const &cand) const;
87                                         
88   void _snapPaths(Inkscape::Snapper::PointType const &t, 
89                                         Inkscape::SnappedPoint &s, 
90                                         NR::Point const &p, 
91                                         std::list<SPItem*> const &cand) const;
92   
93   bool _snap_to_itemnode;
94   bool _snap_to_itempath;
95   bool _snap_to_bboxnode;
96   bool _snap_to_bboxpath;
97   
98   //If enabled, then bbox corners will only snap to bboxes, 
99   //and nodes will only snap to nodes and paths. We will not
100   //snap bbox corners to nodes, or nodes to bboxes.
101   //(snapping to grids and guides is not affected by this)
102   bool _strict_snapping; 
103 };
107 #endif