1 // SPDX-License-Identifier: GPL-2.0-or-later 2 #ifndef SNAPENUMS_H_ 3 #define SNAPENUMS_H_ 4 /* 5 * Authors: 6 * Diederik van Lierop <mail@diedenrezi.nl> 7 * 8 * Copyright (C) 2010 - 2012 Authors 9 * 10 * Released under GNU GPL v2+, read the file 'COPYING' for more information. 11 */ 12 13 namespace Inkscape { 14 15 /** 16 * enumerations of snap source types and snap target types. 17 */ 18 enum SnapSourceType { // When adding source types here, then also update Inkscape::SnapPreferences::source2target! 19 SNAPSOURCE_UNDEFINED = 0, 20 //------------------------------------------------------------------- 21 // Bbox points can be located at the edge of the stroke (for visual bboxes); they will therefore not snap 22 // to nodes because these are always located at the center of the stroke 23 SNAPSOURCE_BBOX_CATEGORY = 16, // will be used as a flag and must therefore be a power of two. Also, 24 // must be larger than the largest number of targets in a single group 25 SNAPSOURCE_BBOX_CORNER, 26 SNAPSOURCE_BBOX_MIDPOINT, 27 SNAPSOURCE_BBOX_EDGE_MIDPOINT, 28 //------------------------------------------------------------------- 29 // For the same reason, nodes will not snap to bbox points 30 SNAPSOURCE_NODE_CATEGORY = 32, // will be used as a flag and must therefore be a power of two 31 SNAPSOURCE_NODE_SMOOTH, // Symmetrical nodes are also considered to be smooth; there's no dedicated type for symm. nodes 32 SNAPSOURCE_NODE_CUSP, 33 SNAPSOURCE_LINE_MIDPOINT, 34 SNAPSOURCE_PATH_INTERSECTION, 35 SNAPSOURCE_RECT_CORNER, // of a rectangle, so at the center of the stroke 36 SNAPSOURCE_CONVEX_HULL_CORNER, 37 SNAPSOURCE_ELLIPSE_QUADRANT_POINT, 38 SNAPSOURCE_NODE_HANDLE, // eg. nodes in the path editor, handles of stars or rectangles, etc. (tied to a stroke) 39 //------------------------------------------------------------------- 40 // Other points (e.g. guides) will snap to both bounding boxes and nodes 41 SNAPSOURCE_DATUMS_CATEGORY = 64, // will be used as a flag and must therefore be a power of two 42 SNAPSOURCE_GUIDE, 43 SNAPSOURCE_GUIDE_ORIGIN, 44 //------------------------------------------------------------------- 45 // Other points (e.g. gradient knots, image corners) will snap to both bounding boxes and nodes 46 SNAPSOURCE_OTHERS_CATEGORY = 128, // will be used as a flag and must therefore be a power of two 47 SNAPSOURCE_ROTATION_CENTER, 48 SNAPSOURCE_OBJECT_MIDPOINT, // midpoint of rectangles, ellipses, polygon, etc. 49 SNAPSOURCE_IMG_CORNER, 50 SNAPSOURCE_TEXT_ANCHOR, 51 SNAPSOURCE_OTHER_HANDLE, // eg. the handle of a gradient or of a connector (ie not being tied to a stroke) 52 SNAPSOURCE_GRID_PITCH, // eg. when pasting or alt-dragging in the selector tool; not really a snap source 53 }; 54 55 enum SnapTargetType { 56 SNAPTARGET_UNDEFINED = 0, 57 //------------------------------------------------------------------- 58 SNAPTARGET_BBOX_CATEGORY = 16, // will be used as a flag and must therefore be a power of two. Also, 59 // must be larger than the largest number of targets in a single group 60 // i.e > 15 because that's the number of targets in the "others" group 61 SNAPTARGET_BBOX_CORNER, 62 SNAPTARGET_BBOX_EDGE, 63 SNAPTARGET_BBOX_EDGE_MIDPOINT, 64 SNAPTARGET_BBOX_MIDPOINT, 65 //------------------------------------------------------------------- 66 SNAPTARGET_NODE_CATEGORY = 32, // will be used as a flag and must therefore be a power of two 67 SNAPTARGET_NODE_SMOOTH, 68 SNAPTARGET_NODE_CUSP, 69 SNAPTARGET_LINE_MIDPOINT, 70 SNAPTARGET_PATH, // If path targets are added here, then also add them to the list in findBestSnap() 71 SNAPTARGET_PATH_PERPENDICULAR, 72 SNAPTARGET_PATH_TANGENTIAL, 73 SNAPTARGET_PATH_INTERSECTION, 74 SNAPTARGET_PATH_GUIDE_INTERSECTION, 75 SNAPTARGET_PATH_CLIP, 76 SNAPTARGET_PATH_MASK, 77 SNAPTARGET_ELLIPSE_QUADRANT_POINT, // this corner is at the center of the stroke 78 SNAPTARGET_RECT_CORNER, // of a rectangle, so this corner is at the center of the stroke 79 //------------------------------------------------------------------- 80 SNAPTARGET_DATUMS_CATEGORY = 64, // will be used as a flag and must therefore be a power of two 81 SNAPTARGET_GRID, 82 SNAPTARGET_GRID_INTERSECTION, 83 SNAPTARGET_GRID_PERPENDICULAR, 84 SNAPTARGET_GUIDE, 85 SNAPTARGET_GUIDE_INTERSECTION, 86 SNAPTARGET_GUIDE_ORIGIN, 87 SNAPTARGET_GUIDE_PERPENDICULAR, 88 SNAPTARGET_GRID_GUIDE_INTERSECTION, 89 SNAPTARGET_PAGE_BORDER, 90 SNAPTARGET_PAGE_CORNER, 91 //------------------------------------------------------------------- 92 SNAPTARGET_OTHERS_CATEGORY = 128, // will be used as a flag and must therefore be a power of two 93 SNAPTARGET_OBJECT_MIDPOINT, 94 SNAPTARGET_IMG_CORNER, 95 SNAPTARGET_ROTATION_CENTER, 96 SNAPTARGET_TEXT_ANCHOR, 97 SNAPTARGET_TEXT_BASELINE, 98 SNAPTARGET_CONSTRAINED_ANGLE, 99 SNAPTARGET_CONSTRAINT, 100 //------------------------------------------------------------------- 101 SNAPTARGET_MAX_ENUM_VALUE 102 }; 103 104 } 105 #endif /* SNAPENUMS_H_ */ 106