20 _snap_enabled_globally(true),
21 _snap_postponed_globally(false),
22 _strict_snapping(true)
33 _active_snap_target = -1;
45 return _simple_snapping[
index];
51 _simple_snapping[
index] = enable;
152 g_warning(
"Snap-preferences warning: Undefined snap target (#%i)", target);
195 g_warning(
"Snap-preferences warning: Undefined snap target (#%i)", target);
203 g_warning(
"Snap-preferences warning: Undefined snaptarget (#%i)", target);
205 g_warning(
"Snap-preferences warning: Snaptarget not handled (#%i)", target);
211 bool always_on =
false;
212 bool group_on =
false;
215 _mapTargetToArrayIndex(
index, always_on, group_on);
219 g_warning(
"Snap-preferences warning: Trying to enable/disable a snap target (#%i) that's always on by definition",
index);
221 if (
index == target) {
222 _active_snap_targets[
index] = enabled;
224 g_warning(
"Snap-preferences warning: Trying to enable/disable a secondary snap target (#%i); only primary targets can be set",
index);
240 bool always_on =
false;
241 bool group_on =
false;
244 _mapTargetToArrayIndex(
index, always_on, group_on);
246 _active_mask_targets[
index] = enabled;
259 for (
int & _active_mask_targets : _active_mask_targets) {
260 _active_mask_targets = enabled;
266 bool always_on =
false;
267 bool group_on =
false;
270 _mapTargetToArrayIndex(
index, always_on, group_on);
273 if (_active_mask_targets[
index] != -1) {
274 return _active_mask_targets[
index];
281 if (_active_snap_targets[
index] == -1) {
283 g_warning(
"Snap-preferences warning: Using an uninitialized snap target setting (#%i)",
index);
287 return _active_snap_targets[
index];
295 return isTargetSnappable(target1) || isTargetSnappable(target2);
299 return isTargetSnappable(target1) || isTargetSnappable(target2) || isTargetSnappable(target3);
303 return isTargetSnappable(target1) || isTargetSnappable(target2) || isTargetSnappable(target3) || isTargetSnappable(target4);
307 return isTargetSnappable(target1) || isTargetSnappable(target2) || isTargetSnappable(target3) || isTargetSnappable(target4) || isTargetSnappable(target5);
312 bool always_on =
false;
313 bool group_on =
false;
316 _mapTargetToArrayIndex(
index, always_on, group_on);
318 if (_active_snap_targets[
index] == -1) {
320 g_warning(
"Snap-preferences warning: Using an uninitialized snap target setting (#%i)",
index);
324 if (
index == target) {
325 return _active_snap_targets[
index];
327 g_warning(
"Snap-preferences warning: Trying to determine the button status of a secondary snap target (#%i); However, only primary targets have a button",
index);
408 g_warning(
"Mapping of snap source to snap target undefined (#%i)", source);
415 return isTargetSnappable(source2target(source));
bool _simple_snapping[static_cast< int >(Inkscape::SimpleSnap::_MaxEnumValue)]
bool isSourceSnappable(Inkscape::SnapSourceType const source) const
void setTargetSnappable(Inkscape::SnapTargetType const target, bool enabled)
int _active_snap_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
bool isAnyDatumSnappable() const
void clearTargetMask(int enabled=-1)
Clear the target mask, this should be done in a four step process.
SnapTargetType source2target(SnapSourceType source) const
bool get_simple_snap(Inkscape::SimpleSnap option) const
bool isSnapButtonEnabled(Inkscape::SnapTargetType const target) const
void set_simple_snap(Inkscape::SimpleSnap option, bool enable)
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
void setTargetMask(Inkscape::SnapTargetType const target, int enabled=1)
Set a target mask, which will turn off all other targets except the masked ones.
void _mapTargetToArrayIndex(Inkscape::SnapTargetType &target, bool &always_on, bool &group_on) const
Map snap target to array index.
bool isAnyCategorySnappable() const
SnapSourceType
enumerations of snap source types and snap target types.
@ SNAPSOURCE_OTHERS_CATEGORY
@ SNAPSOURCE_ALIGNMENT_BBOX_MIDPOINT
@ SNAPSOURCE_BBOX_MIDPOINT
@ SNAPSOURCE_PATH_INTERSECTION
@ SNAPSOURCE_OTHER_HANDLE
@ SNAPSOURCE_ALIGNMENT_HANDLE
@ SNAPSOURCE_DATUMS_CATEGORY
@ SNAPSOURCE_GUIDE_ORIGIN
@ SNAPSOURCE_CONVEX_HULL_CORNER
@ SNAPSOURCE_ALIGNMENT_PAGE_CORNER
@ SNAPSOURCE_ALIGNMENT_PAGE_CENTER
@ SNAPSOURCE_ALIGNMENT_BBOX_CORNER
@ SNAPSOURCE_NODE_CATEGORY
@ SNAPSOURCE_OBJECT_MIDPOINT
@ SNAPSOURCE_LINE_MIDPOINT
@ SNAPSOURCE_BBOX_EDGE_MIDPOINT
@ SNAPSOURCE_ELLIPSE_QUADRANT_POINT
@ SNAPSOURCE_ALIGNMENT_CATEGORY
@ SNAPSOURCE_ROTATION_CENTER
@ SNAPSOURCE_BBOX_CATEGORY
@ SNAPSOURCE_ALIGNMENT_BBOX_EDGE_MIDPOINT
@ SNAPTARGET_GUIDE_ORIGIN
@ SNAPTARGET_DATUMS_CATEGORY
@ SNAPTARGET_BBOX_EDGE_MIDPOINT
@ SNAPTARGET_PATH_GUIDE_INTERSECTION
@ SNAPTARGET_PAGE_MARGIN_BORDER
@ SNAPTARGET_PAGE_MARGIN_CENTER
@ SNAPTARGET_ROTATION_CENTER
@ SNAPTARGET_LINE_MIDPOINT
@ SNAPTARGET_GUIDE_PERPENDICULAR
@ SNAPTARGET_ALIGNMENT_PAGE_EDGE_CENTER
@ SNAPTARGET_OTHERS_CATEGORY
@ SNAPTARGET_PAGE_BLEED_CORNER
@ SNAPTARGET_BBOX_MIDPOINT
@ SNAPTARGET_GRID_INTERSECTION
@ SNAPTARGET_ALIGNMENT_CATEGORY
@ SNAPTARGET_PAGE_EDGE_CENTER
@ SNAPTARGET_ELLIPSE_QUADRANT_POINT
@ SNAPTARGET_DISTRIBUTION_CATEGORY
@ SNAPTARGET_PAGE_EDGE_CORNER
@ SNAPTARGET_ALIGNMENT_BBOX_EDGE_MIDPOINT
@ SNAPTARGET_NODE_CATEGORY
@ SNAPTARGET_PAGE_EDGE_BORDER
@ SNAPTARGET_GRID_GUIDE_INTERSECTION
@ SNAPTARGET_ALIGNMENT_HANDLE
@ SNAPTARGET_TEXT_BASELINE
@ SNAPTARGET_GRID_PERPENDICULAR
@ SNAPTARGET_GUIDE_INTERSECTION
@ SNAPTARGET_ALIGNMENT_PAGE_EDGE_CORNER
@ SNAPTARGET_ALIGNMENT_BBOX_CORNER
@ SNAPTARGET_PAGE_MARGIN_CORNER
@ SNAPTARGET_OBJECT_MIDPOINT
@ SNAPTARGET_PATH_INTERSECTION
@ SNAPTARGET_PAGE_BLEED_BORDER
@ SNAPTARGET_BBOX_CATEGORY
@ SNAPTARGET_CONSTRAINED_ANGLE