69
69
void setup(SPDesktop const *desktop,
70
70
bool snapindicator = true,
71
71
SPItem const *item_to_ignore = NULL,
72
std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
72
std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL,
73
73
SPGuide *guide_to_ignore = NULL);
75
75
void setup(SPDesktop const *desktop,
76
76
bool snapindicator,
77
77
std::vector<SPItem const *> &items_to_ignore,
78
std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
78
std::vector<Inkscape::SnapCandidatePoint> *unselected_nodes = NULL,
79
79
SPGuide *guide_to_ignore = NULL);
81
81
// freeSnapReturnByRef() is preferred over freeSnap(), because it only returns a
83
83
void freeSnapReturnByRef(Inkscape::SnapPreferences::PointType point_type,
85
85
Inkscape::SnapSourceType const source_type,
87
86
Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
90
Inkscape::SnappedPoint freeSnap(Inkscape::SnapPreferences::PointType point_type,
92
Inkscape::SnapSourceType const &source_type,
88
Inkscape::SnappedPoint freeSnap(Inkscape::SnapPreferences::PointType const point_type,
89
Inkscape::SnapCandidatePoint const &p,
94
90
Geom::OptRect const &bbox_to_snap = Geom::OptRect() ) const;
96
92
Geom::Point multipleOfGridPitch(Geom::Point const &t) const;
102
98
Inkscape::SnapSourceType const source_type,
103
99
Inkscape::Snapper::ConstraintLine const &constraint,
105
100
Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
107
Inkscape::SnappedPoint constrainedSnap(Inkscape::SnapPreferences::PointType point_type,
108
Geom::Point const &p,
109
Inkscape::SnapSourceType const &source_type,
102
Inkscape::SnappedPoint constrainedSnap(Inkscape::SnapPreferences::PointType const point_type,
103
Inkscape::SnapCandidatePoint const &p,
110
104
Inkscape::Snapper::ConstraintLine const &constraint,
112
105
Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
114
107
void guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, SPGuideDragType drag_type) const;
115
108
void guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) const;
117
110
Inkscape::SnappedPoint freeSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
118
std::vector<std::pair<Geom::Point, int> > const &p,
111
std::vector<Inkscape::SnapCandidatePoint> const &p,
119
112
Geom::Point const &pointer,
120
113
Geom::Point const &tr) const;
122
115
Inkscape::SnappedPoint constrainedSnapTranslation(Inkscape::SnapPreferences::PointType point_type,
123
std::vector<std::pair<Geom::Point, int> > const &p,
116
std::vector<Inkscape::SnapCandidatePoint> const &p,
124
117
Geom::Point const &pointer,
125
118
Inkscape::Snapper::ConstraintLine const &constraint,
126
119
Geom::Point const &tr) const;
128
121
Inkscape::SnappedPoint freeSnapScale(Inkscape::SnapPreferences::PointType point_type,
129
std::vector<std::pair<Geom::Point, int> > const &p,
122
std::vector<Inkscape::SnapCandidatePoint> const &p,
130
123
Geom::Point const &pointer,
131
124
Geom::Scale const &s,
132
125
Geom::Point const &o) const;
134
127
Inkscape::SnappedPoint constrainedSnapScale(Inkscape::SnapPreferences::PointType point_type,
135
std::vector<std::pair<Geom::Point, int> > const &p,
128
std::vector<Inkscape::SnapCandidatePoint> const &p,
136
129
Geom::Point const &pointer,
137
130
Geom::Scale const &s,
138
131
Geom::Point const &o) const;
140
133
Inkscape::SnappedPoint constrainedSnapStretch(Inkscape::SnapPreferences::PointType point_type,
141
std::vector<std::pair<Geom::Point, int> > const &p,
134
std::vector<Inkscape::SnapCandidatePoint> const &p,
142
135
Geom::Point const &pointer,
143
136
Geom::Coord const &s,
144
137
Geom::Point const &o,
146
139
bool uniform) const;
148
141
Inkscape::SnappedPoint constrainedSnapSkew(Inkscape::SnapPreferences::PointType point_type,
149
std::vector<std::pair<Geom::Point, int> > const &p,
142
std::vector<Inkscape::SnapCandidatePoint> const &p,
150
143
Geom::Point const &pointer,
151
144
Inkscape::Snapper::ConstraintLine const &constraint,
152
145
Geom::Point const &s, // s[0] = skew factor, s[1] = scale factor
168
161
bool getSnapIndicator() const {return _snapindicator;}
170
Inkscape::SnappedPoint findBestSnap(Geom::Point const &p, Inkscape::SnapSourceType const source_type, SnappedConstraints &sc, bool constrained, bool noCurves = false) const;
163
Inkscape::SnappedPoint findBestSnap(Inkscape::SnapCandidatePoint const &p, SnappedConstraints const &sc, bool constrained, bool noCurves = false) const;
173
166
SPNamedView const *_named_view;
178
171
SPGuide *_guide_to_ignore; ///< A guide that should not be snapped to, e.g. the guide that is currently being dragged
179
172
SPDesktop const *_desktop;
180
173
bool _snapindicator; ///< When true, an indicator will be drawn at the position that was being snapped to
181
std::vector<std::pair<Geom::Point, int> > *_unselected_nodes; ///< Nodes of the path that is currently being edited and which have not been selected and which will therefore be stationary. Only these nodes will be considered for snapping to. Of each unselected node both the position (Geom::Point) and the type (Inkscape::SnapTargetType) will be stored
174
std::vector<Inkscape::SnapCandidatePoint> *_unselected_nodes; ///< Nodes of the path that is currently being edited and which have not been selected and which will therefore be stationary. Only these nodes will be considered for snapping to. Of each unselected node both the position (Geom::Point) and the type (Inkscape::SnapTargetType) will be stored
182
175
//TODO: Make _unselected_nodes type safe; in the line above int is used for Inkscape::SnapTargetType, but if I remember
183
176
//correctly then in other cases the int is being used for Inkscape::SnapSourceType, or for both. How to make
184
177
//this type safe?
186
179
Inkscape::SnappedPoint _snapTransformed(Inkscape::SnapPreferences::PointType type,
187
std::vector<std::pair<Geom::Point, int> > const &points,
180
std::vector<Inkscape::SnapCandidatePoint> const &points,
188
181
Geom::Point const &pointer,
189
182
bool constrained,
190
183
Inkscape::Snapper::ConstraintLine const &constraint,
195
188
bool uniform) const;
197
Geom::Point _transformPoint(std::pair<Geom::Point, int> const &p,
190
Geom::Point _transformPoint(Inkscape::SnapCandidatePoint const &p,
198
191
Transformation const transformation_type,
199
192
Geom::Point const &transformation,
200
193
Geom::Point const &origin,
201
194
Geom::Dim2 const dim,
202
195
bool const uniform) const;
204
void _displaySnapsource(Inkscape::SnapPreferences::PointType point_type, std::pair<Geom::Point, int> const &p) const;
197
void _displaySnapsource(Inkscape::SnapPreferences::PointType point_type, Inkscape::SnapCandidatePoint const &p) const;
207
200
#endif /* !SEEN_SNAP_H */