Code

97ef3cec210081653894a629c926bf953e0bed4c
[inkscape.git] / src / snap-preferences.h
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 setSnapLineMidpoints(bool enabled) {_line_midpoints = enabled;}
43     void setSnapObjectMidpoints(bool enabled) {_object_midpoints = enabled;}
44     void setSnapBBoxEdgeMidpoints(bool enabled) {_bbox_edge_midpoints = enabled;}
45         void setSnapBBoxMidpoints(bool enabled) {_bbox_midpoints = enabled;}
46     bool getSnapIntersectionGG() const {return _intersectionGG;}
47     bool getSnapIntersectionCS() const {return _intersectionCS;}
48     bool getSnapSmoothNodes() const {return _smoothNodes;}
49     bool getSnapLineMidpoints() const {return _line_midpoints;}
50     bool getSnapObjectMidpoints() const {return _object_midpoints;}
51     bool getSnapBBoxEdgeMidpoints() const {return _bbox_edge_midpoints;}
52         bool getSnapBBoxMidpoints() const {return _bbox_midpoints;}
54     void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;}
55     bool getIncludeItemCenter() const {return _include_item_center;}
57     void setSnapEnabledGlobally(bool enabled) {_snap_enabled_globally = enabled;}
58     bool getSnapEnabledGlobally() const {return _snap_enabled_globally;}
60     void setSnapPostponedGlobally(bool postponed) {_snap_postponed_globally = postponed;}
61     bool getSnapPostponedGlobally() const {return _snap_postponed_globally;}
63     void setSnapFrom(PointType t, bool s);
64     bool getSnapFrom(PointType t) const;
66     // These will only be used for the object snapper
67     void setSnapToItemNode(bool s) {_snap_to_itemnode = s;}
68         bool getSnapToItemNode() const {return _snap_to_itemnode;}
69         void setSnapToItemPath(bool s) {_snap_to_itempath = s;}
70         bool getSnapToItemPath() const {return _snap_to_itempath;}
71         void setSnapToBBoxNode(bool s) {_snap_to_bboxnode = s;}
72         bool getSnapToBBoxNode() const {return _snap_to_bboxnode;}
73         void setSnapToBBoxPath(bool s) {_snap_to_bboxpath = s;}
74         bool getSnapToBBoxPath() const {return _snap_to_bboxpath;}
75         void setSnapToPageBorder(bool s) {_snap_to_page_border = s;}
76         bool getSnapToPageBorder() const {return _snap_to_page_border;}
77         bool getStrictSnapping() const {return _strict_snapping;}
79 private:
80     bool _include_item_center; //If true, snapping nodes will also snap the item's center
81     bool _intersectionGG; //Consider snapping to intersections of grid and guides
82     bool _intersectionCS; //Consider snapping to intersections of curves
83     bool _smoothNodes;
84     bool _line_midpoints;
85     bool _object_midpoints; // the midpoint of shapes (e.g. a circle, rect, polygon) or of any other shape (at [h/2, w/2])
86     bool _bbox_edge_midpoints;
87         bool _bbox_midpoints;
88     bool _snap_enabled_globally; // Toggles ALL snapping
89     bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
90     PointType _snap_from; ///< bitmap of point types that we will snap from
92     // These will only be used for the object snapper
93     bool _snap_to_itemnode;
94         bool _snap_to_itempath;
95         bool _snap_to_bboxnode;
96         bool _snap_to_bboxpath;
97         bool _snap_to_page_border;
98         //If enabled, then bbox corners will only snap to bboxes,
99         //and nodes will only snap to nodes and paths. We will not
100         //snap bbox corners to nodes, or nodes to bboxes.
101         //(snapping to grids and guides is not affected by this)
102         bool _strict_snapping;
103 };
106 #endif /*SNAPPREFERENCES_H_*/
108 /*
109   Local Variables:
110   mode:c++
111   c-file-style:"stroustrup"
112   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
113   indent-tabs-mode:nil
114   fill-column:99
115   End:
116 */
117 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :