diff options
| author | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-01-23 13:36:56 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mailat-signdiedenrezidotnl> | 2010-01-23 13:36:56 +0000 |
| commit | c4aa590bedcf358acf15bdf0d8134ae99e3be167 (patch) | |
| tree | 6808d0d57dfb83e91d02762c3c12225f1053c83e /src/snap-preferences.h | |
| parent | Fix some of the LPE issues. (diff) | |
| download | inkscape-c4aa590bedcf358acf15bdf0d8134ae99e3be167.tar.gz inkscape-c4aa590bedcf358acf15bdf0d8134ae99e3be167.zip | |
Remove redundancy from snapping API (type of snapsource no longer has to be specified explicitly)
(bzr r9014)
Diffstat (limited to 'src/snap-preferences.h')
| -rw-r--r-- | src/snap-preferences.h | 93 |
1 files changed, 44 insertions, 49 deletions
diff --git a/src/snap-preferences.h b/src/snap-preferences.h index c88503e7d..49d52cdb2 100644 --- a/src/snap-preferences.h +++ b/src/snap-preferences.h @@ -8,12 +8,13 @@ * Authors: * Diederik van Lierop <mail@diedenrezi.nl> * - * Copyright (C) 2008 Authors + * Copyright (C) 2008 - 2010 Authors * * Released under GNU GPL, read the file 'COPYING' for more information */ #include "helper/units.h" +#include "snap-enums.h" namespace Inkscape { @@ -21,13 +22,7 @@ namespace Inkscape class SnapPreferences { public: - SnapPreferences(); - - /// Point types to snap. - typedef int PointType; // can be only one of the types below, never two or more at the same time - static const PointType SNAPPOINT_NODE; // will in general not snap to bounding boxes - static const PointType SNAPPOINT_BBOX; // will in general not snap to nodes - static const PointType SNAPPOINT_OTHER;// e.g. guides, gradient knots + SnapPreferences(); void setSnapModeBBox(bool enabled); void setSnapModeNode(bool enabled); @@ -44,20 +39,20 @@ public: void setSnapLineMidpoints(bool enabled) {_line_midpoints = enabled;} void setSnapObjectMidpoints(bool enabled) {_object_midpoints = enabled;} void setSnapBBoxEdgeMidpoints(bool enabled) {_bbox_edge_midpoints = enabled;} - void setSnapBBoxMidpoints(bool enabled) {_bbox_midpoints = enabled;} + void setSnapBBoxMidpoints(bool enabled) {_bbox_midpoints = enabled;} bool getSnapIntersectionGG() const {return _intersectionGG;} bool getSnapIntersectionCS() const {return _intersectionCS;} bool getSnapSmoothNodes() const {return _smoothNodes;} bool getSnapLineMidpoints() const {return _line_midpoints;} bool getSnapObjectMidpoints() const {return _object_midpoints;} bool getSnapBBoxEdgeMidpoints() const {return _bbox_edge_midpoints;} - bool getSnapBBoxMidpoints() const {return _bbox_midpoints;} + bool getSnapBBoxMidpoints() const {return _bbox_midpoints;} - void setSnapToGrids(bool enabled) {_snap_to_grids = enabled;} + void setSnapToGrids(bool enabled) {_snap_to_grids = enabled;} bool getSnapToGrids() const {return _snap_to_grids;} void setSnapToGuides(bool enabled) {_snap_to_guides = enabled;} - bool getSnapToGuides() const {return _snap_to_guides;} + bool getSnapToGuides() const {return _snap_to_guides;} void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;} bool getIncludeItemCenter() const {return _include_item_center;} @@ -68,29 +63,29 @@ public: void setSnapPostponedGlobally(bool postponed) {_snap_postponed_globally = postponed;} bool getSnapPostponedGlobally() const {return _snap_postponed_globally;} - void setSnapFrom(PointType t, bool s); - bool getSnapFrom(PointType t) const; + void setSnapFrom(Inkscape::SnapSourceType t, bool s); + bool getSnapFrom(Inkscape::SnapSourceType t) const; // These will only be used for the object snapper void setSnapToItemNode(bool s) {_snap_to_itemnode = s;} - bool getSnapToItemNode() const {return _snap_to_itemnode;} - void setSnapToItemPath(bool s) {_snap_to_itempath = s;} - bool getSnapToItemPath() const {return _snap_to_itempath;} - void setSnapToBBoxNode(bool s) {_snap_to_bboxnode = s;} - bool getSnapToBBoxNode() const {return _snap_to_bboxnode;} - void setSnapToBBoxPath(bool s) {_snap_to_bboxpath = s;} - bool getSnapToBBoxPath() const {return _snap_to_bboxpath;} - void setSnapToPageBorder(bool s) {_snap_to_page_border = s;} - bool getSnapToPageBorder() const {return _snap_to_page_border;} - bool getStrictSnapping() const {return _strict_snapping;} - - gdouble getGridTolerance() const {return _grid_tolerance;} - gdouble getGuideTolerance() const {return _guide_tolerance;} - gdouble getObjectTolerance() const {return _object_tolerance;} - - void setGridTolerance(gdouble val) {_grid_tolerance = val;} - void setGuideTolerance(gdouble val) {_guide_tolerance = val;} - void setObjectTolerance(gdouble val) {_object_tolerance = val;} + bool getSnapToItemNode() const {return _snap_to_itemnode;} + void setSnapToItemPath(bool s) {_snap_to_itempath = s;} + bool getSnapToItemPath() const {return _snap_to_itempath;} + void setSnapToBBoxNode(bool s) {_snap_to_bboxnode = s;} + bool getSnapToBBoxNode() const {return _snap_to_bboxnode;} + void setSnapToBBoxPath(bool s) {_snap_to_bboxpath = s;} + bool getSnapToBBoxPath() const {return _snap_to_bboxpath;} + void setSnapToPageBorder(bool s) {_snap_to_page_border = s;} + bool getSnapToPageBorder() const {return _snap_to_page_border;} + bool getStrictSnapping() const {return _strict_snapping;} + + gdouble getGridTolerance() const {return _grid_tolerance;} + gdouble getGuideTolerance() const {return _guide_tolerance;} + gdouble getObjectTolerance() const {return _object_tolerance;} + + void setGridTolerance(gdouble val) {_grid_tolerance = val;} + void setGuideTolerance(gdouble val) {_guide_tolerance = val;} + void setObjectTolerance(gdouble val) {_object_tolerance = val;} private: @@ -101,28 +96,28 @@ private: bool _line_midpoints; bool _object_midpoints; // the midpoint of shapes (e.g. a circle, rect, polygon) or of any other shape (at [h/2, w/2]) bool _bbox_edge_midpoints; - bool _bbox_midpoints; - bool _snap_to_grids; - bool _snap_to_guides; + bool _bbox_midpoints; + bool _snap_to_grids; + bool _snap_to_guides; bool _snap_enabled_globally; // Toggles ALL snapping bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast - PointType _snap_from; ///< bitmap of point types that we will snap from + SnapSourceType _snap_from; ///< bitmap of point types that we will snap from // These will only be used for the object snapper bool _snap_to_itemnode; - bool _snap_to_itempath; - bool _snap_to_bboxnode; - bool _snap_to_bboxpath; - bool _snap_to_page_border; - //If enabled, then bbox corners will only snap to bboxes, - //and nodes will only snap to nodes and paths. We will not - //snap bbox corners to nodes, or nodes to bboxes. - //(snapping to grids and guides is not affected by this) - bool _strict_snapping; - - gdouble _grid_tolerance; - gdouble _guide_tolerance; - gdouble _object_tolerance; + bool _snap_to_itempath; + bool _snap_to_bboxnode; + bool _snap_to_bboxpath; + bool _snap_to_page_border; + //If enabled, then bbox corners will only snap to bboxes, + //and nodes will only snap to nodes and paths. We will not + //snap bbox corners to nodes, or nodes to bboxes. + //(snapping to grids and guides is not affected by this) + bool _strict_snapping; + + gdouble _grid_tolerance; + gdouble _guide_tolerance; + gdouble _object_tolerance; }; } |
