Code

Node tool: fix handle retraction with non-cusp nodes
[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 - 2010 Authors
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include "helper/units.h"
17 #include "snap-enums.h"
19 namespace Inkscape
20 {
22 class SnapPreferences
23 {
24 public:
25     SnapPreferences();
27     void setSnapModeBBox(bool enabled);
28     void setSnapModeNode(bool enabled);
29     void setSnapModeGuide(bool enabled);
30     bool getSnapModeBBox() const;
31     bool getSnapModeNode() const;
32     bool getSnapModeBBoxOrNodes() const;
33     bool getSnapModeAny() const;
34     bool getSnapModeGuide() const;
36     void setSnapIntersectionGG(bool enabled) {_intersectionGG = enabled;}
37     void setSnapIntersectionCS(bool enabled) {_intersectionCS = enabled;}
38     void setSnapSmoothNodes(bool enabled) {_smoothNodes = enabled;}
39     void setSnapLineMidpoints(bool enabled) {_line_midpoints = enabled;}
40     void setSnapObjectMidpoints(bool enabled) {_object_midpoints = enabled;}
41     void setSnapBBoxEdgeMidpoints(bool enabled) {_bbox_edge_midpoints = enabled;}
42     void setSnapBBoxMidpoints(bool enabled) {_bbox_midpoints = enabled;}
43     bool getSnapIntersectionGG() const {return _intersectionGG;}
44     bool getSnapIntersectionCS() const {return _intersectionCS;}
45     bool getSnapSmoothNodes() const {return _smoothNodes;}
46     bool getSnapLineMidpoints() const {return _line_midpoints;}
47     bool getSnapObjectMidpoints() const {return _object_midpoints;}
48     bool getSnapBBoxEdgeMidpoints() const {return _bbox_edge_midpoints;}
49     bool getSnapBBoxMidpoints() const {return _bbox_midpoints;}
51     void setSnapToGrids(bool enabled) {_snap_to_grids = enabled;}
52     bool getSnapToGrids() const {return _snap_to_grids;}
54     void setSnapToGuides(bool enabled) {_snap_to_guides = enabled;}
55     bool getSnapToGuides() const {return _snap_to_guides;}
57     void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;}
58     bool getIncludeItemCenter() const {return _include_item_center;}
60     void setSnapEnabledGlobally(bool enabled) {_snap_enabled_globally = enabled;}
61     bool getSnapEnabledGlobally() const {return _snap_enabled_globally;}
63     void setSnapPostponedGlobally(bool postponed) {_snap_postponed_globally = postponed;}
64     bool getSnapPostponedGlobally() const {return _snap_postponed_globally;}
66     void setSnapFrom(Inkscape::SnapSourceType t, bool s);
67     bool getSnapFrom(Inkscape::SnapSourceType t) const;
69     // These will only be used for the object snapper
70     void setSnapToItemNode(bool s) {_snap_to_itemnode = s;}
71     bool getSnapToItemNode() const {return _snap_to_itemnode;}
72     void setSnapToItemPath(bool s) {_snap_to_itempath = s;}
73     bool getSnapToItemPath() const {return _snap_to_itempath;}
74     void setSnapToBBoxNode(bool s) {_snap_to_bboxnode = s;}
75     bool getSnapToBBoxNode() const {return _snap_to_bboxnode;}
76     void setSnapToBBoxPath(bool s) {_snap_to_bboxpath = s;}
77     bool getSnapToBBoxPath() const {return _snap_to_bboxpath;}
78     void setSnapToPageBorder(bool s) {_snap_to_page_border = s;}
79     bool getSnapToPageBorder() const {return _snap_to_page_border;}
80     bool getStrictSnapping() const {return _strict_snapping;}
82     gdouble getGridTolerance() const {return _grid_tolerance;}
83     gdouble getGuideTolerance() const {return _guide_tolerance;}
84     gdouble getObjectTolerance() const {return _object_tolerance;}
86     void setGridTolerance(gdouble val) {_grid_tolerance = val;}
87     void setGuideTolerance(gdouble val) {_guide_tolerance = val;}
88     void setObjectTolerance(gdouble val) {_object_tolerance = val;}
91 private:
92     bool _include_item_center; //If true, snapping nodes will also snap the item's center
93     bool _intersectionGG; //Consider snapping to intersections of grid and guides
94     bool _intersectionCS; //Consider snapping to intersections of curves
95     bool _smoothNodes;
96     bool _line_midpoints;
97     bool _object_midpoints; // the midpoint of shapes (e.g. a circle, rect, polygon) or of any other shape (at [h/2, w/2])
98     bool _bbox_edge_midpoints;
99     bool _bbox_midpoints;
100     bool _snap_to_grids;
101     bool _snap_to_guides;
102     bool _snap_enabled_globally; // Toggles ALL snapping
103     bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
104     SnapSourceType _snap_from; ///< bitmap of point types that we will snap from
106     // These will only be used for the object snapper
107     bool _snap_to_itemnode;
108     bool _snap_to_itempath;
109     bool _snap_to_bboxnode;
110     bool _snap_to_bboxpath;
111     bool _snap_to_page_border;
112     //If enabled, then bbox corners will only snap to bboxes,
113     //and nodes will only snap to nodes and paths. We will not
114     //snap bbox corners to nodes, or nodes to bboxes.
115     //(snapping to grids and guides is not affected by this)
116     bool _strict_snapping;
118     gdouble _grid_tolerance;
119     gdouble _guide_tolerance;
120     gdouble _object_tolerance;
121 };
124 #endif /*SNAPPREFERENCES_H_*/
126 /*
127   Local Variables:
128   mode:c++
129   c-file-style:"stroustrup"
130   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
131   indent-tabs-mode:nil
132   fill-column:99
133   End:
134 */
135 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :