Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::SnapPreferences Class Reference

Storing of snapping preferences. More...

#include <snap-preferences.h>

Public Member Functions

 SnapPreferences ()
 
void setTargetSnappable (Inkscape::SnapTargetType const target, bool enabled)
 
bool isTargetSnappable (Inkscape::SnapTargetType const target) const
 
bool isTargetSnappable (Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2) const
 
bool isTargetSnappable (Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3) const
 
bool isTargetSnappable (Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3, Inkscape::SnapTargetType const target4) const
 
bool isTargetSnappable (Inkscape::SnapTargetType const target1, Inkscape::SnapTargetType const target2, Inkscape::SnapTargetType const target3, Inkscape::SnapTargetType const target4, Inkscape::SnapTargetType const target5) const
 
bool isSnapButtonEnabled (Inkscape::SnapTargetType const target) const
 
bool get_simple_snap (Inkscape::SimpleSnap option) const
 
void set_simple_snap (Inkscape::SimpleSnap option, bool enable)
 
SnapTargetType source2target (SnapSourceType source) const
 
bool isSourceSnappable (Inkscape::SnapSourceType const source) const
 
bool isAnyDatumSnappable () const
 
bool isAnyCategorySnappable () const
 
void setSnapEnabledGlobally (bool enabled)
 
bool getSnapEnabledGlobally () const
 
void setSnapPostponedGlobally (bool postponed)
 
bool getSnapPostponedGlobally () const
 
bool getStrictSnapping () const
 
double getGridTolerance () const
 
double getGuideTolerance () const
 
double getObjectTolerance () const
 
double getAlignmentTolerance () const
 
double getDistributionTolerance () const
 
void setGridTolerance (double val)
 
void setGuideTolerance (double val)
 
void setObjectTolerance (double val)
 
void setAlignementTolerance (double val)
 
void setDistributionTolerance (double val)
 
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 clearTargetMask (int enabled=-1)
 Clear the target mask, this should be done in a four step process.
 

Private Member Functions

void _mapTargetToArrayIndex (Inkscape::SnapTargetType &target, bool &always_on, bool &group_on) const
 Map snap target to array index.
 

Private Attributes

int _active_snap_targets [Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
 
int _active_mask_targets [Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
 
bool _snap_enabled_globally
 
bool _snap_postponed_globally
 
bool _strict_snapping
 
bool _simple_snapping [static_cast< int >(Inkscape::SimpleSnap::_MaxEnumValue)]
 
double _grid_tolerance
 
double _guide_tolerance
 
double _object_tolerance
 
double _alignment_tolerance
 
double _distribution_tolerance
 

Detailed Description

Storing of snapping preferences.

Definition at line 22 of file snap-preferences.h.

Constructor & Destructor Documentation

◆ SnapPreferences()

Member Function Documentation

◆ _mapTargetToArrayIndex()

void Inkscape::SnapPreferences::_mapTargetToArrayIndex ( Inkscape::SnapTargetType target,
bool &  always_on,
bool &  group_on 
) const
private

Map snap target to array index.

The status of each snap toggle (in the snap toolbar) is stored as a boolean value in an array. This method returns the position of relevant boolean in that array, for any given type of snap target. For most snap targets, the enumerated value of that targets matches the position in the array (primary snap targets). This however does not hold for snap targets which don't have their own toggle button (secondary snap targets).

PS:

  • For snap sources, just pass the corresponding snap target instead (each snap source should have a twin snap target, but not vice versa)
  • All parameters are passed by reference, and will be overwritten
Parameters
targetStores the enumerated snap target, which can be modified to correspond to the array index of this snap target.
always_onIf true, then this snap target is always active and cannot be toggled.
group_onIf true, then this snap target is in a snap group that has been enabled (e.g. bbox group, nodes/paths group, or "others" group.

Definition at line 65 of file snap-preferences.cpp.

References Inkscape::SNAPTARGET_ALIGNMENT_CATEGORY, Inkscape::SNAPTARGET_BBOX_CATEGORY, Inkscape::SNAPTARGET_CONSTRAINED_ANGLE, Inkscape::SNAPTARGET_CONSTRAINT, Inkscape::SNAPTARGET_DATUMS_CATEGORY, Inkscape::SNAPTARGET_DISTRIBUTION_CATEGORY, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_GRID, Inkscape::SNAPTARGET_GRID_GUIDE_INTERSECTION, Inkscape::SNAPTARGET_GRID_INTERSECTION, Inkscape::SNAPTARGET_GRID_LINE, Inkscape::SNAPTARGET_GRID_PERPENDICULAR, Inkscape::SNAPTARGET_GUIDE, Inkscape::SNAPTARGET_GUIDE_INTERSECTION, Inkscape::SNAPTARGET_GUIDE_ORIGIN, Inkscape::SNAPTARGET_GUIDE_PERPENDICULAR, Inkscape::SNAPTARGET_IMG_CORNER, Inkscape::SNAPTARGET_NODE_CATEGORY, Inkscape::SNAPTARGET_NODE_CUSP, Inkscape::SNAPTARGET_NODE_SMOOTH, Inkscape::SNAPTARGET_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OTHERS_CATEGORY, Inkscape::SNAPTARGET_PAGE_BLEED_BORDER, Inkscape::SNAPTARGET_PAGE_BLEED_CORNER, Inkscape::SNAPTARGET_PAGE_EDGE_BORDER, Inkscape::SNAPTARGET_PAGE_EDGE_CENTER, Inkscape::SNAPTARGET_PAGE_EDGE_CORNER, Inkscape::SNAPTARGET_PAGE_MARGIN_BORDER, Inkscape::SNAPTARGET_PAGE_MARGIN_CENTER, Inkscape::SNAPTARGET_PAGE_MARGIN_CORNER, Inkscape::SNAPTARGET_PATH_GUIDE_INTERSECTION, Inkscape::SNAPTARGET_PATH_INTERSECTION, Inkscape::SNAPTARGET_RECT_CORNER, Inkscape::SNAPTARGET_ROTATION_CENTER, Inkscape::SNAPTARGET_TEXT_ANCHOR, Inkscape::SNAPTARGET_TEXT_BASELINE, and Inkscape::SNAPTARGET_UNDEFINED.

◆ clearTargetMask()

void Inkscape::SnapPreferences::clearTargetMask ( int  enabled = -1)

Clear the target mask, this should be done in a four step process.

snap_manager->snaprepfs->clearTargetMask(0); // Default all options to disabled snap_manager->snaprepfs->setTargetMask(SOME_TARGET, 1); snap_manager->freeSnap(...); snap_manager->snaprepfs->clearTargetMask(); // Turns off masking

Definition at line 257 of file snap-preferences.cpp.

Referenced by Inkscape::UI::Tools::PagesTool::moveTo(), and SnapPreferences().

◆ get_simple_snap()

bool Inkscape::SnapPreferences::get_simple_snap ( Inkscape::SimpleSnap  option) const

Definition at line 42 of file snap-preferences.cpp.

References Inkscape::_MaxEnumValue, index, and option.

Referenced by toggle_simple_snap_option().

◆ getAlignmentTolerance()

double Inkscape::SnapPreferences::getAlignmentTolerance ( ) const
inline

Definition at line 53 of file snap-preferences.h.

References _alignment_tolerance.

◆ getDistributionTolerance()

double Inkscape::SnapPreferences::getDistributionTolerance ( ) const
inline

Definition at line 54 of file snap-preferences.h.

References _distribution_tolerance.

◆ getGridTolerance()

double Inkscape::SnapPreferences::getGridTolerance ( ) const
inline

Definition at line 50 of file snap-preferences.h.

References _grid_tolerance.

Referenced by Inkscape::GridSnapper::getSnapperTolerance().

◆ getGuideTolerance()

double Inkscape::SnapPreferences::getGuideTolerance ( ) const
inline

Definition at line 51 of file snap-preferences.h.

References _guide_tolerance.

◆ getObjectTolerance()

double Inkscape::SnapPreferences::getObjectTolerance ( ) const
inline

Definition at line 52 of file snap-preferences.h.

References _object_tolerance.

Referenced by gr_knot_moved_handler().

◆ getSnapEnabledGlobally()

◆ getSnapPostponedGlobally()

bool Inkscape::SnapPreferences::getSnapPostponedGlobally ( ) const
inline

◆ getStrictSnapping()

bool Inkscape::SnapPreferences::getStrictSnapping ( ) const
inline

Definition at line 48 of file snap-preferences.h.

References _strict_snapping.

◆ isAnyCategorySnappable()

◆ isAnyDatumSnappable()

◆ isSnapButtonEnabled()

bool Inkscape::SnapPreferences::isSnapButtonEnabled ( Inkscape::SnapTargetType const  target) const

Definition at line 310 of file snap-preferences.cpp.

References index.

Referenced by canvas_snapping_toggle().

◆ isSourceSnappable()

bool Inkscape::SnapPreferences::isSourceSnappable ( Inkscape::SnapSourceType const  source) const

Definition at line 413 of file snap-preferences.cpp.

Referenced by SPShape::snappoints().

◆ isTargetSnappable() [1/5]

◆ isTargetSnappable() [2/5]

bool Inkscape::SnapPreferences::isTargetSnappable ( Inkscape::SnapTargetType const  target1,
Inkscape::SnapTargetType const  target2 
) const

Definition at line 294 of file snap-preferences.cpp.

◆ isTargetSnappable() [3/5]

bool Inkscape::SnapPreferences::isTargetSnappable ( Inkscape::SnapTargetType const  target1,
Inkscape::SnapTargetType const  target2,
Inkscape::SnapTargetType const  target3 
) const

Definition at line 298 of file snap-preferences.cpp.

◆ isTargetSnappable() [4/5]

bool Inkscape::SnapPreferences::isTargetSnappable ( Inkscape::SnapTargetType const  target1,
Inkscape::SnapTargetType const  target2,
Inkscape::SnapTargetType const  target3,
Inkscape::SnapTargetType const  target4 
) const

Definition at line 302 of file snap-preferences.cpp.

◆ isTargetSnappable() [5/5]

bool Inkscape::SnapPreferences::isTargetSnappable ( Inkscape::SnapTargetType const  target1,
Inkscape::SnapTargetType const  target2,
Inkscape::SnapTargetType const  target3,
Inkscape::SnapTargetType const  target4,
Inkscape::SnapTargetType const  target5 
) const

Definition at line 306 of file snap-preferences.cpp.

◆ set_simple_snap()

void Inkscape::SnapPreferences::set_simple_snap ( Inkscape::SimpleSnap  option,
bool  enable 
)

Definition at line 48 of file snap-preferences.cpp.

References Inkscape::_MaxEnumValue, index, and option.

Referenced by get_snapping_preferences(), and set_simple_snap().

◆ setAlignementTolerance()

void Inkscape::SnapPreferences::setAlignementTolerance ( double  val)
inline

Definition at line 59 of file snap-preferences.h.

References _alignment_tolerance.

Referenced by SPNamedView::set().

◆ setDistributionTolerance()

void Inkscape::SnapPreferences::setDistributionTolerance ( double  val)
inline

Definition at line 60 of file snap-preferences.h.

References _distribution_tolerance.

Referenced by SPNamedView::set().

◆ setGridTolerance()

void Inkscape::SnapPreferences::setGridTolerance ( double  val)
inline

Definition at line 56 of file snap-preferences.h.

References _grid_tolerance.

Referenced by SPNamedView::set().

◆ setGuideTolerance()

void Inkscape::SnapPreferences::setGuideTolerance ( double  val)
inline

Definition at line 57 of file snap-preferences.h.

References _guide_tolerance.

Referenced by SPNamedView::set().

◆ setObjectTolerance()

void Inkscape::SnapPreferences::setObjectTolerance ( double  val)
inline

Definition at line 58 of file snap-preferences.h.

References _object_tolerance.

Referenced by SPNamedView::set().

◆ setSnapEnabledGlobally()

void Inkscape::SnapPreferences::setSnapEnabledGlobally ( bool  enabled)
inline

◆ setSnapPostponedGlobally()

void Inkscape::SnapPreferences::setSnapPostponedGlobally ( bool  postponed)
inline

Definition at line 45 of file snap-preferences.h.

References _snap_postponed_globally.

◆ setTargetMask()

void Inkscape::SnapPreferences::setTargetMask ( Inkscape::SnapTargetType const  target,
int  enabled = 1 
)

Set a target mask, which will turn off all other targets except the masked ones.

target - The Snap Target to change the mask for. enabled - The mask setting to set. -1 means use user settings (turn off mask) 0 means mask with disabled, 1 means mask with enabled,

Definition at line 238 of file snap-preferences.cpp.

References index.

Referenced by Inkscape::UI::Tools::PagesTool::moveTo().

◆ setTargetSnappable()

void Inkscape::SnapPreferences::setTargetSnappable ( Inkscape::SnapTargetType const  target,
bool  enabled 
)

◆ source2target()

Inkscape::SnapTargetType Inkscape::SnapPreferences::source2target ( Inkscape::SnapSourceType  source) const

Definition at line 334 of file snap-preferences.cpp.

References Inkscape::SNAPSOURCE_ALIGNMENT_BBOX_CORNER, Inkscape::SNAPSOURCE_ALIGNMENT_BBOX_EDGE_MIDPOINT, Inkscape::SNAPSOURCE_ALIGNMENT_BBOX_MIDPOINT, Inkscape::SNAPSOURCE_ALIGNMENT_CATEGORY, Inkscape::SNAPSOURCE_ALIGNMENT_HANDLE, Inkscape::SNAPSOURCE_ALIGNMENT_PAGE_CENTER, Inkscape::SNAPSOURCE_ALIGNMENT_PAGE_CORNER, Inkscape::SNAPSOURCE_BBOX_CATEGORY, Inkscape::SNAPSOURCE_BBOX_CORNER, Inkscape::SNAPSOURCE_BBOX_EDGE_MIDPOINT, Inkscape::SNAPSOURCE_BBOX_MIDPOINT, Inkscape::SNAPSOURCE_CONVEX_HULL_CORNER, Inkscape::SNAPSOURCE_DATUMS_CATEGORY, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPSOURCE_GRID_PITCH, Inkscape::SNAPSOURCE_GUIDE, Inkscape::SNAPSOURCE_GUIDE_ORIGIN, Inkscape::SNAPSOURCE_IMG_CORNER, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPSOURCE_NODE_CATEGORY, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPSOURCE_NODE_HANDLE, Inkscape::SNAPSOURCE_NODE_SMOOTH, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPSOURCE_OTHER_HANDLE, Inkscape::SNAPSOURCE_OTHERS_CATEGORY, Inkscape::SNAPSOURCE_PAGE_CENTER, Inkscape::SNAPSOURCE_PAGE_CORNER, Inkscape::SNAPSOURCE_PATH_INTERSECTION, Inkscape::SNAPSOURCE_RECT_CORNER, Inkscape::SNAPSOURCE_ROTATION_CENTER, Inkscape::SNAPSOURCE_TEXT_ANCHOR, Inkscape::SNAPSOURCE_UNDEFINED, Inkscape::SNAPTARGET_ALIGNMENT_BBOX_CORNER, Inkscape::SNAPTARGET_ALIGNMENT_BBOX_EDGE_MIDPOINT, Inkscape::SNAPTARGET_ALIGNMENT_CATEGORY, Inkscape::SNAPTARGET_ALIGNMENT_HANDLE, Inkscape::SNAPTARGET_ALIGNMENT_PAGE_EDGE_CENTER, Inkscape::SNAPTARGET_ALIGNMENT_PAGE_EDGE_CORNER, Inkscape::SNAPTARGET_BBOX_CATEGORY, Inkscape::SNAPTARGET_BBOX_CORNER, Inkscape::SNAPTARGET_BBOX_EDGE_MIDPOINT, Inkscape::SNAPTARGET_BBOX_MIDPOINT, Inkscape::SNAPTARGET_DATUMS_CATEGORY, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_GRID, Inkscape::SNAPTARGET_GUIDE, Inkscape::SNAPTARGET_GUIDE_ORIGIN, Inkscape::SNAPTARGET_IMG_CORNER, Inkscape::SNAPTARGET_LINE_MIDPOINT, Inkscape::SNAPTARGET_NODE_CATEGORY, Inkscape::SNAPTARGET_NODE_CUSP, Inkscape::SNAPTARGET_NODE_SMOOTH, Inkscape::SNAPTARGET_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OTHERS_CATEGORY, Inkscape::SNAPTARGET_PAGE_EDGE_CENTER, Inkscape::SNAPTARGET_PAGE_EDGE_CORNER, Inkscape::SNAPTARGET_PATH_INTERSECTION, Inkscape::SNAPTARGET_RECT_CORNER, Inkscape::SNAPTARGET_ROTATION_CENTER, Inkscape::SNAPTARGET_TEXT_ANCHOR, and Inkscape::SNAPTARGET_UNDEFINED.

Member Data Documentation

◆ _active_mask_targets

int Inkscape::SnapPreferences::_active_mask_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
private

Definition at line 88 of file snap-preferences.h.

◆ _active_snap_targets

int Inkscape::SnapPreferences::_active_snap_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE]
private

Definition at line 84 of file snap-preferences.h.

Referenced by SnapPreferences().

◆ _alignment_tolerance

double Inkscape::SnapPreferences::_alignment_tolerance
private

Definition at line 104 of file snap-preferences.h.

Referenced by getAlignmentTolerance(), and setAlignementTolerance().

◆ _distribution_tolerance

double Inkscape::SnapPreferences::_distribution_tolerance
private

Definition at line 105 of file snap-preferences.h.

Referenced by getDistributionTolerance(), and setDistributionTolerance().

◆ _grid_tolerance

double Inkscape::SnapPreferences::_grid_tolerance
private

Definition at line 101 of file snap-preferences.h.

Referenced by getGridTolerance(), and setGridTolerance().

◆ _guide_tolerance

double Inkscape::SnapPreferences::_guide_tolerance
private

Definition at line 102 of file snap-preferences.h.

Referenced by getGuideTolerance(), and setGuideTolerance().

◆ _object_tolerance

double Inkscape::SnapPreferences::_object_tolerance
private

Definition at line 103 of file snap-preferences.h.

Referenced by getObjectTolerance(), and setObjectTolerance().

◆ _simple_snapping

bool Inkscape::SnapPreferences::_simple_snapping[static_cast< int >(Inkscape::SimpleSnap::_MaxEnumValue)]
private

Definition at line 99 of file snap-preferences.h.

Referenced by SnapPreferences().

◆ _snap_enabled_globally

bool Inkscape::SnapPreferences::_snap_enabled_globally
private

Definition at line 90 of file snap-preferences.h.

Referenced by getSnapEnabledGlobally(), and setSnapEnabledGlobally().

◆ _snap_postponed_globally

bool Inkscape::SnapPreferences::_snap_postponed_globally
private

Definition at line 91 of file snap-preferences.h.

Referenced by getSnapPostponedGlobally(), and setSnapPostponedGlobally().

◆ _strict_snapping

bool Inkscape::SnapPreferences::_strict_snapping
private

Definition at line 97 of file snap-preferences.h.

Referenced by getStrictSnapping().


The documentation for this class was generated from the following files: