Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
snap-preferences.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SNAPPREFERENCES_H_
3#define SNAPPREFERENCES_H_
4
5/*
6 * Authors:
7 * Diederik van Lierop <mail@diedenrezi.nl>
8 *
9 * Copyright (C) 2008 - 2011 Authors
10 *
11 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
12 */
13
14#include "snap-enums.h"
15
16namespace Inkscape
17{
18
23{
24public:
26 void setTargetSnappable(Inkscape::SnapTargetType const target, bool enabled);
27 bool isTargetSnappable(Inkscape::SnapTargetType const target) const;
28 bool isTargetSnappable(Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2) const;
29 bool isTargetSnappable(Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3) const;
30 bool isTargetSnappable(Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3, Inkscape::SnapTargetType const target4) const;
31 bool isTargetSnappable(Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3, Inkscape::SnapTargetType const target4, Inkscape::SnapTargetType const target5) const;
32 bool isSnapButtonEnabled(Inkscape::SnapTargetType const target) const;
35
37 bool isSourceSnappable(Inkscape::SnapSourceType const source) const;
38
39 bool isAnyDatumSnappable() const; // Needed because we cannot toggle the datum snap targets as a group
40 bool isAnyCategorySnappable() const;
41
42 void setSnapEnabledGlobally(bool enabled) {_snap_enabled_globally = enabled;}
44
45 void setSnapPostponedGlobally(bool postponed) {_snap_postponed_globally = postponed;}
47
48 bool getStrictSnapping() const {return _strict_snapping;}
49
50 double getGridTolerance() const {return _grid_tolerance;}
51 double getGuideTolerance() const {return _guide_tolerance;}
52 double getObjectTolerance() const {return _object_tolerance;}
55
56 void setGridTolerance(double val) {_grid_tolerance = val;}
57 void setGuideTolerance(double val) {_guide_tolerance = val;}
58 void setObjectTolerance(double val) {_object_tolerance = val;}
61
62 void setTargetMask(Inkscape::SnapTargetType const target, int enabled = 1);
63 void clearTargetMask(int enabled = -1);
64private:
65
82 void _mapTargetToArrayIndex(Inkscape::SnapTargetType &target, bool &always_on, bool &group_on) const;
83
85
86 // Sometimes we want to mask the preferences for specific tools, this
87 // shadow preference allows the code to specify which targets should be used.
89
90 bool _snap_enabled_globally; // Toggles ALL snapping
91 bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
92
93 //If enabled, then bbox corners will only snap to bboxes,
94 //and nodes will only snap to nodes and paths. We will not
95 //snap bbox corners to nodes, or nodes to bboxes.
96 //(snapping to grids and guides is not affected by this)
98
100
106};
107
108}
109#endif /*SNAPPREFERENCES_H_*/
110
111/*
112 Local Variables:
113 mode:c++
114 c-file-style:"stroustrup"
115 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116 indent-tabs-mode:nil
117 fill-column:99
118 End:
119*/
120// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SimpleSnap option
Storing of snapping preferences.
int _active_mask_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
bool _simple_snapping[static_cast< int >(Inkscape::SimpleSnap::_MaxEnumValue)]
void setSnapEnabledGlobally(bool enabled)
double getObjectTolerance() const
bool isSourceSnappable(Inkscape::SnapSourceType const source) const
void setGridTolerance(double val)
void setTargetSnappable(Inkscape::SnapTargetType const target, bool enabled)
int _active_snap_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
void clearTargetMask(int enabled=-1)
Clear the target mask, this should be done in a four step process.
void setObjectTolerance(double val)
SnapTargetType source2target(SnapSourceType source) const
bool get_simple_snap(Inkscape::SimpleSnap option) const
bool getSnapPostponedGlobally() const
double getDistributionTolerance() const
void setGuideTolerance(double val)
bool isSnapButtonEnabled(Inkscape::SnapTargetType const target) const
void set_simple_snap(Inkscape::SimpleSnap option, bool enable)
void setAlignementTolerance(double val)
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
void setDistributionTolerance(double val)
double getAlignmentTolerance() const
void setSnapPostponedGlobally(bool postponed)
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.
Helper class to stream background task notifications as a series of messages.
SnapSourceType
enumerations of snap source types and snap target types.
Definition snap-enums.h:18
@ SNAPTARGET_MAX_ENUM_VALUE
Definition snap-enums.h:149