summaryrefslogtreecommitdiffstats
path: root/src/snap-preferences.h
diff options
context:
space:
mode:
authorDiederik van Lierop <mail@diedenrezi.nl>2011-08-22 18:27:53 +0000
committerDiederik van Lierop <mail@diedenrezi.nl>2011-08-22 18:27:53 +0000
commitbabb7a67749cb691674bdd9758f0568d4b094b56 (patch)
treed1e71acda1562bf3d394aa76f44b96be1175ca61 /src/snap-preferences.h
parentsvgfont2layers extension: glyph layers (except the first one) are innitially ... (diff)
downloadinkscape-babb7a67749cb691674bdd9758f0568d4b094b56.tar.gz
inkscape-babb7a67749cb691674bdd9758f0568d4b094b56.zip
Refactoring of the snapping preferences; mainly about storing all toggles in a single array, instead of each having its own member variable
(bzr r10569)
Diffstat (limited to 'src/snap-preferences.h')
-rw-r--r--src/snap-preferences.h70
1 files changed, 13 insertions, 57 deletions
diff --git a/src/snap-preferences.h b/src/snap-preferences.h
index 35d05c40e..dac11b3aa 100644
--- a/src/snap-preferences.h
+++ b/src/snap-preferences.h
@@ -23,43 +23,23 @@ class SnapPreferences
{
public:
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 isAnyBBoxSnappable() const;
+ //bool isAnyNodeOrPathSnappable() const;
+ //bool isAnyOtherSnappable() const;
+ bool isSnapButtonEnabled(Inkscape::SnapTargetType const target) const;
void setSnapModeBBox(bool enabled);
void setSnapModeNode(bool enabled);
void setSnapModeOthers(bool enabled);
- void setSnapModeGuide(bool enabled);
bool getSnapModeBBox() const;
bool getSnapModeNode() const;
bool getSnapModeOthers() const;
- //bool getSnapModeBBoxOrNodes() const;
bool getSnapModeAny() const;
- bool getSnapModeGuide() const;
-
- void setSnapIntersectionGG(bool enabled) {_intersectionGG = enabled;}
- void setSnapIntersectionCS(bool enabled) {_intersectionCS = enabled;}
- void setSnapSmoothNodes(bool enabled) {_smoothNodes = enabled;}
- void setSnapLineMidpoints(bool enabled) {_line_midpoints = enabled;}
- void setSnapObjectMidpoints(bool enabled) {_object_midpoints = enabled;}
- void setSnapTextBaseline(bool enabled) {_text_baseline = enabled;}
- void setSnapBBoxEdgeMidpoints(bool enabled) {_bbox_edge_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 getSnapTextBaseline() const {return _text_baseline;}
- bool getSnapBBoxEdgeMidpoints() const {return _bbox_edge_midpoints;}
- bool getSnapBBoxMidpoints() const {return _bbox_midpoints;}
-
- 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;}
-
- void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;}
- bool getIncludeItemCenter() const {return _include_item_center;}
void setSnapEnabledGlobally(bool enabled) {_snap_enabled_globally = enabled;}
bool getSnapEnabledGlobally() const {return _snap_enabled_globally;}
@@ -70,17 +50,6 @@ public:
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;}
@@ -92,27 +61,14 @@ public:
void setObjectTolerance(gdouble val) {_object_tolerance = val;}
private:
- bool _include_item_center; //If true, snapping nodes will also snap the item's center
- bool _intersectionGG; //Consider snapping to intersections of grid and guides
- bool _intersectionCS; //Consider snapping to intersections of curves
- bool _smoothNodes;
- 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 _text_baseline; // both anchor point and baseline of the text
- bool _bbox_edge_midpoints;
- bool _bbox_midpoints;
- bool _snap_to_grids;
- bool _snap_to_guides;
+ void _mapTargetToArrayIndex(Inkscape::SnapTargetType &target, bool &always_on, bool &group_on) const;
+ int _active_snap_targets[Inkscape::SNAPTARGET_MAX_ENUM_VALUE];
+
bool _snap_enabled_globally; // Toggles ALL snapping
bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
+
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.