diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-07-06 01:59:32 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-07-06 01:59:32 +0000 |
| commit | e65a02ed32b78534739aba24929ece7c44dd967f (patch) | |
| tree | 13cf022f18f6b5bae46aad4bc339e512f069a514 /src/snap-preferences.cpp | |
| parent | Pull 2Geom revision 2013 (extra constructors for Rect). (diff) | |
| parent | Text edit dialog: Apply button should grab default only after adding to window (diff) | |
| download | inkscape-e65a02ed32b78534739aba24929ece7c44dd967f.tar.gz inkscape-e65a02ed32b78534739aba24929ece7c44dd967f.zip | |
Merge from trunk
(bzr r10347.1.5)
Diffstat (limited to 'src/snap-preferences.cpp')
| -rw-r--r-- | src/snap-preferences.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/src/snap-preferences.cpp b/src/snap-preferences.cpp index 15c976466..4859b111e 100644 --- a/src/snap-preferences.cpp +++ b/src/snap-preferences.cpp @@ -1,5 +1,3 @@ -#define __SNAPPREFERENCES_CPP__ - /** * \file snap-preferences.cpp * \brief Storing of snapping preferences @@ -27,15 +25,16 @@ Inkscape::SnapPreferences::SnapPreferences() : _snap_to_page_border(false), _strict_snapping(true) { - setSnapFrom(SnapSourceType(SNAPSOURCE_BBOX_CATEGORY | SNAPSOURCE_NODE_CATEGORY | SNAPSOURCE_OTHER_CATEGORY), true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab + setSnapFrom(SnapSourceType(SNAPSOURCE_BBOX_CATEGORY | SNAPSOURCE_NODE_CATEGORY | SNAPSOURCE_OTHERS_CATEGORY), true); //Snap any point. In v0.45 and earlier, this was controlled in the preferences tab } /* * The snappers have too many parameters to adjust individually. Therefore only - * two snapping modes are presented to the user: snapping bounding box corners (to + * three snapping modes are presented to the user: snapping bounding box corners (to * other bounding boxes, grids or guides), and/or snapping nodes (to other nodes, - * paths, grids or guides). To select either of these modes (or both), use the - * methods defined below: setSnapModeBBox() and setSnapModeNode(). + * paths, grids or guides), and or snapping to/from others (e.g. grids, guide, text, etc) + * To select either of these three modes (or all), use the + * methods defined below: setSnapModeBBox(), setSnapModeNode(), or setSnapModeOthers() * * */ @@ -68,11 +67,26 @@ bool Inkscape::SnapPreferences::getSnapModeNode() const return (_snap_from & Inkscape::SNAPSOURCE_NODE_CATEGORY); } -bool Inkscape::SnapPreferences::getSnapModeBBoxOrNodes() const +void Inkscape::SnapPreferences::setSnapModeOthers(bool enabled) { - return (_snap_from & (Inkscape::SNAPSOURCE_BBOX_CATEGORY | Inkscape::SNAPSOURCE_NODE_CATEGORY) ); + if (enabled) { + _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHERS_CATEGORY); + } else { + _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHERS_CATEGORY); + } } +bool Inkscape::SnapPreferences::getSnapModeOthers() const +{ + return (_snap_from & Inkscape::SNAPSOURCE_OTHERS_CATEGORY); +} + + +//bool Inkscape::SnapPreferences::getSnapModeBBoxOrNodes() const +//{ +// return (_snap_from & (Inkscape::SNAPSOURCE_BBOX_CATEGORY | Inkscape::SNAPSOURCE_NODE_CATEGORY) ); +//} + bool Inkscape::SnapPreferences::getSnapModeAny() const { return (_snap_from != 0); @@ -81,15 +95,15 @@ bool Inkscape::SnapPreferences::getSnapModeAny() const void Inkscape::SnapPreferences::setSnapModeGuide(bool enabled) { if (enabled) { - _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHER_CATEGORY); + _snap_from = SnapSourceType(_snap_from | Inkscape::SNAPSOURCE_OTHERS_CATEGORY); } else { - _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHER_CATEGORY); + _snap_from = SnapSourceType(_snap_from & ~Inkscape::SNAPSOURCE_OTHERS_CATEGORY); } } bool Inkscape::SnapPreferences::getSnapModeGuide() const { - return (_snap_from & Inkscape::SNAPSOURCE_OTHER_CATEGORY); + return (_snap_from & Inkscape::SNAPSOURCE_OTHERS_CATEGORY); } /** |
