Inkscape
Vector Graphics Editor
|
Storing of snapping preferences. More...
#include <snap-preferences.h>
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 |
Storing of snapping preferences.
Definition at line 22 of file snap-preferences.h.
Inkscape::SnapPreferences::SnapPreferences | ( | ) |
Definition at line 19 of file snap-preferences.cpp.
References _active_snap_targets, _simple_snapping, clearTargetMask(), Inkscape::SNAPTARGET_ALIGNMENT_CATEGORY, Inkscape::SNAPTARGET_BBOX_CATEGORY, Inkscape::SNAPTARGET_DATUMS_CATEGORY, Inkscape::SNAPTARGET_DISTRIBUTION_CATEGORY, Inkscape::SNAPTARGET_NODE_CATEGORY, and Inkscape::SNAPTARGET_OTHERS_CATEGORY.
|
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:
target | Stores the enumerated snap target, which can be modified to correspond to the array index of this snap target. |
always_on | If true, then this snap target is always active and cannot be toggled. |
group_on | If 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.
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().
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().
|
inline |
Definition at line 53 of file snap-preferences.h.
References _alignment_tolerance.
|
inline |
Definition at line 54 of file snap-preferences.h.
References _distribution_tolerance.
|
inline |
Definition at line 50 of file snap-preferences.h.
References _grid_tolerance.
Referenced by Inkscape::GridSnapper::getSnapperTolerance().
|
inline |
Definition at line 51 of file snap-preferences.h.
References _guide_tolerance.
|
inline |
Definition at line 52 of file snap-preferences.h.
References _object_tolerance.
Referenced by gr_knot_moved_handler().
|
inline |
Definition at line 43 of file snap-preferences.h.
References _snap_enabled_globally.
Referenced by SnapManager::displaySnapsource(), SnapManager::gridSnapperMightSnap(), SnapManager::guideConstrainedSnap(), SnapManager::guideFreeSnap(), SnapManager::multipleOfGridPitch(), SnapManager::someSnapperMightSnap(), and Inkscape::UI::Tools::spdc_endpoint_snap_rotation().
|
inline |
Definition at line 46 of file snap-preferences.h.
References _snap_postponed_globally.
Referenced by SnapManager::gridSnapperMightSnap(), SnapManager::guideConstrainedSnap(), SnapManager::guideFreeSnap(), SnapManager::multipleOfGridPitch(), and SnapManager::someSnapperMightSnap().
|
inline |
Definition at line 48 of file snap-preferences.h.
References _strict_snapping.
bool Inkscape::SnapPreferences::isAnyCategorySnappable | ( | ) | const |
Definition at line 59 of file snap-preferences.cpp.
References Inkscape::SNAPTARGET_BBOX_CATEGORY, Inkscape::SNAPTARGET_GRID, Inkscape::SNAPTARGET_GUIDE, Inkscape::SNAPTARGET_NODE_CATEGORY, Inkscape::SNAPTARGET_OTHERS_CATEGORY, Inkscape::SNAPTARGET_PAGE_BLEED_BORDER, Inkscape::SNAPTARGET_PAGE_EDGE_BORDER, and Inkscape::SNAPTARGET_PAGE_MARGIN_BORDER.
bool Inkscape::SnapPreferences::isAnyDatumSnappable | ( | ) | const |
Definition at line 54 of file snap-preferences.cpp.
References Inkscape::SNAPTARGET_GRID, Inkscape::SNAPTARGET_GUIDE, Inkscape::SNAPTARGET_PAGE_BLEED_BORDER, Inkscape::SNAPTARGET_PAGE_EDGE_BORDER, and Inkscape::SNAPTARGET_PAGE_MARGIN_BORDER.
Referenced by Inkscape::SelTrans::_keepClosestPointOnly().
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().
bool Inkscape::SnapPreferences::isSourceSnappable | ( | Inkscape::SnapSourceType const | source | ) | const |
Definition at line 413 of file snap-preferences.cpp.
Referenced by SPShape::snappoints().
bool Inkscape::SnapPreferences::isTargetSnappable | ( | Inkscape::SnapTargetType const | target | ) | const |
Definition at line 264 of file snap-preferences.cpp.
References index.
Referenced by SnapManager::_findCandidates(), Inkscape::SelTrans::_keepClosestPointOnly(), SnapManager::displaySnapsource(), SnapManager::findBestSnap(), SnapManager::getGridSnappers(), Inkscape::Selection::getSnapPoints(), SPItem::getSnappoints(), Inkscape::SelTrans::grab(), SnapManager::guideConstrainedSnap(), SnapManager::guideFreeSnap(), SPGenericEllipse::snappoints(), SPFlowtext::snappoints(), SPImage::snappoints(), SPRect::snappoints(), SPShape::snappoints(), SPSpiral::snappoints(), SPStar::snappoints(), SPText::snappoints(), and Inkscape::GridSnapper::ThisSnapperMightSnap().
bool Inkscape::SnapPreferences::isTargetSnappable | ( | Inkscape::SnapTargetType const | target1, |
Inkscape::SnapTargetType const | target2 | ||
) | const |
Definition at line 294 of file snap-preferences.cpp.
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.
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.
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.
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().
|
inline |
Definition at line 59 of file snap-preferences.h.
References _alignment_tolerance.
Referenced by SPNamedView::set().
|
inline |
Definition at line 60 of file snap-preferences.h.
References _distribution_tolerance.
Referenced by SPNamedView::set().
|
inline |
Definition at line 56 of file snap-preferences.h.
References _grid_tolerance.
Referenced by SPNamedView::set().
|
inline |
Definition at line 57 of file snap-preferences.h.
References _guide_tolerance.
Referenced by SPNamedView::set().
|
inline |
Definition at line 58 of file snap-preferences.h.
References _object_tolerance.
Referenced by SPNamedView::set().
|
inline |
Definition at line 42 of file snap-preferences.h.
References _snap_enabled_globally.
Referenced by get_snapping_preferences(), and Inkscape::UI::Tools::spdc_endpoint_snap_rotation().
|
inline |
Definition at line 45 of file snap-preferences.h.
References _snap_postponed_globally.
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().
void Inkscape::SnapPreferences::setTargetSnappable | ( | Inkscape::SnapTargetType const | target, |
bool | enabled | ||
) |
Definition at line 209 of file snap-preferences.cpp.
References index.
Referenced by get_snapping_preferences(), Inkscape::Selection::getSnapPoints(), set_canvas_snapping(), SPSpiral::snappoints(), and SPStar::snappoints().
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.
|
private |
Definition at line 88 of file snap-preferences.h.
|
private |
Definition at line 84 of file snap-preferences.h.
Referenced by SnapPreferences().
|
private |
Definition at line 104 of file snap-preferences.h.
Referenced by getAlignmentTolerance(), and setAlignementTolerance().
|
private |
Definition at line 105 of file snap-preferences.h.
Referenced by getDistributionTolerance(), and setDistributionTolerance().
|
private |
Definition at line 101 of file snap-preferences.h.
Referenced by getGridTolerance(), and setGridTolerance().
|
private |
Definition at line 102 of file snap-preferences.h.
Referenced by getGuideTolerance(), and setGuideTolerance().
|
private |
Definition at line 103 of file snap-preferences.h.
Referenced by getObjectTolerance(), and setObjectTolerance().
|
private |
Definition at line 99 of file snap-preferences.h.
Referenced by SnapPreferences().
|
private |
Definition at line 90 of file snap-preferences.h.
Referenced by getSnapEnabledGlobally(), and setSnapEnabledGlobally().
|
private |
Definition at line 91 of file snap-preferences.h.
Referenced by getSnapPostponedGlobally(), and setSnapPostponedGlobally().
|
private |
Definition at line 97 of file snap-preferences.h.
Referenced by getStrictSnapping().