1 #ifndef SNAPPREFERENCES_H_
2 #define SNAPPREFERENCES_H_
4 /**
5 * \file snap-preferences.cpp
6 * \brief Storing of snapping preferences
7 *
8 * Authors:
9 * Diederik van Lierop <mail@diedenrezi.nl>
10 *
11 * Copyright (C) 2008 Authors
12 *
13 * Released under GNU GPL, read the file 'COPYING' for more information
14 */
16 namespace Inkscape
17 {
19 class SnapPreferences
20 {
21 public:
22 SnapPreferences();
24 /// Point types to snap.
25 typedef int PointType;
26 static const PointType SNAPPOINT_NODE;
27 static const PointType SNAPPOINT_BBOX;
28 static const PointType SNAPPOINT_GUIDE;
30 void setSnapModeBBox(bool enabled);
31 void setSnapModeNode(bool enabled);
32 void setSnapModeGuide(bool enabled);
33 bool getSnapModeBBox() const;
34 bool getSnapModeNode() const;
35 bool getSnapModeBBoxOrNodes() const;
36 bool getSnapModeAny() const;
37 bool getSnapModeGuide() const;
39 void setSnapIntersectionGG(bool enabled) {_intersectionGG = enabled;}
40 void setSnapIntersectionCS(bool enabled) {_intersectionCS = enabled;}
41 void setSnapSmoothNodes(bool enabled) {_smoothNodes = enabled;}
42 void setSnapMidpoints(bool enabled) {_midpoints = enabled;}
43 bool getSnapIntersectionGG() const {return _intersectionGG;}
44 bool getSnapIntersectionCS() const {return _intersectionCS;}
45 bool getSnapSmoothNodes() const {return _smoothNodes;}
46 bool getSnapMidpoints() const {return _midpoints;}
48 void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;}
49 bool getIncludeItemCenter() const {return _include_item_center;}
51 void setSnapEnabledGlobally(bool enabled) {_snap_enabled_globally = enabled;}
52 bool getSnapEnabledGlobally() const {return _snap_enabled_globally;}
54 void setSnapPostponedGlobally(bool postponed) {_snap_postponed_globally = postponed;}
55 bool getSnapPostponedGlobally() const {return _snap_postponed_globally;}
57 void setSnapFrom(PointType t, bool s);
58 bool getSnapFrom(PointType t) const;
60 private:
61 bool _include_item_center; //If true, snapping nodes will also snap the item's center
62 bool _intersectionGG; //Consider snapping to intersections of grid and guides
63 bool _intersectionCS; //Consider snapping to intersections of curves
64 bool _smoothNodes;
65 bool _midpoints;
66 bool _snap_enabled_globally; // Toggles ALL snapping
67 bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
68 PointType _snap_from; ///< bitmap of point types that we will snap from
70 };
72 }
73 #endif /*SNAPPREFERENCES_H_*/
75 /*
76 Local Variables:
77 mode:c++
78 c-file-style:"stroustrup"
79 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
80 indent-tabs-mode:nil
81 fill-column:99
82 End:
83 */
84 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :