Code

2nd attempt at fixing the crash introduced in rev. #9692. This should nail it!
[inkscape.git] / src / snap-candidate.h
index be0b2e49090b8ce4df6c505b6a3e711a18206bbf..5c283440305ce7570d7744457f43b5972886dfbb 100644 (file)
  */
 
 //#include "snapped-point.h"
+#include "snap-enums.h"
+
 struct SPItem; // forward declaration
 
 namespace Inkscape {
 
-enum SnapTargetType {
-    SNAPTARGET_UNDEFINED = 0,
-    SNAPTARGET_GRID,
-    SNAPTARGET_GRID_INTERSECTION,
-    SNAPTARGET_GUIDE,
-    SNAPTARGET_GUIDE_INTERSECTION,
-    SNAPTARGET_GUIDE_ORIGIN,
-    SNAPTARGET_GRID_GUIDE_INTERSECTION,
-    SNAPTARGET_NODE_SMOOTH,
-    SNAPTARGET_NODE_CUSP,
-    SNAPTARGET_LINE_MIDPOINT,
-    SNAPTARGET_OBJECT_MIDPOINT,
-    SNAPTARGET_ROTATION_CENTER,
-    SNAPTARGET_HANDLE,
-    SNAPTARGET_PATH,
-    SNAPTARGET_PATH_INTERSECTION,
-    SNAPTARGET_BBOX_CORNER,
-    SNAPTARGET_BBOX_EDGE,
-    SNAPTARGET_BBOX_EDGE_MIDPOINT,
-    SNAPTARGET_BBOX_MIDPOINT,
-    SNAPTARGET_PAGE_BORDER,
-    SNAPTARGET_PAGE_CORNER,
-    SNAPTARGET_CONVEX_HULL_CORNER,
-    SNAPTARGET_ELLIPSE_QUADRANT_POINT,
-    SNAPTARGET_CENTER, // of ellipse
-    SNAPTARGET_CORNER, // of image or of rectangle
-    SNAPTARGET_TEXT_BASELINE,
-    SNAPTARGET_CONSTRAINED_ANGLE
-};
-
-enum SnapSourceType {
-    SNAPSOURCE_UNDEFINED = 0,
-    SNAPSOURCE_BBOX_CORNER,
-    SNAPSOURCE_BBOX_MIDPOINT,
-    SNAPSOURCE_BBOX_EDGE_MIDPOINT,
-    SNAPSOURCE_NODE_SMOOTH,
-    SNAPSOURCE_NODE_CUSP,
-    SNAPSOURCE_LINE_MIDPOINT,
-    SNAPSOURCE_OBJECT_MIDPOINT,
-    SNAPSOURCE_ROTATION_CENTER,
-    SNAPSOURCE_HANDLE,
-    SNAPSOURCE_PATH_INTERSECTION,
-    SNAPSOURCE_GUIDE,
-    SNAPSOURCE_GUIDE_ORIGIN,
-    SNAPSOURCE_CONVEX_HULL_CORNER,
-    SNAPSOURCE_ELLIPSE_QUADRANT_POINT,
-    SNAPSOURCE_CENTER, // of ellipse
-    SNAPSOURCE_CORNER, // of image or of rectangle
-    SNAPSOURCE_TEXT_BASELINE
-};
-
 /// Class to store data for points which are snap candidates, either as a source or as a target
 class SnapCandidatePoint
 {
@@ -91,11 +42,11 @@ public:
         _target_bbox = Geom::OptRect();
     }
 
-    SnapCandidatePoint(Geom::Point const &point, Inkscape::SnapSourceType const source, long const source_num = 0)
+    SnapCandidatePoint(Geom::Point const &point, Inkscape::SnapSourceType const source)
         : _point(point),
         _source_type(source),
         _target_type(Inkscape::SNAPTARGET_UNDEFINED),
-        _source_num(source_num)
+        _source_num(0)
     {
         _target_bbox = Geom::OptRect();
     }
@@ -104,6 +55,7 @@ public:
     inline Inkscape::SnapSourceType getSourceType() const {return _source_type;}
     inline Inkscape::SnapTargetType getTargetType() const {return _target_type;}
     inline long getSourceNum() const {return _source_num;}
+    void setSourceNum(long num) {_source_num = num;}
     inline Geom::OptRect const getTargetBBox() const {return _target_bbox;}
 
 private: