~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/snap.h

  • Committer: Diederik van Lierop
  • Date: 2009-12-24 20:10:43 UTC
  • Revision ID: diederik_van_lierop_mail_at-sign_diedenrezi_dot_nl-20091224201043-txzqbq2uvs8334ei
refactoring the snapping code (laying the groundwork for my next commit which reduces snap jitter)

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
class SnapManager
53
53
{
54
54
public:
55
 
        enum Transformation {
 
55
    enum Transformation {
56
56
        TRANSLATION,
57
57
        SCALE,
58
58
        STRETCH,
59
59
        SKEW
60
60
    };
61
61
 
62
 
        SnapManager(SPNamedView const *v);
 
62
    SnapManager(SPNamedView const *v);
63
63
 
64
64
    typedef std::list<const Inkscape::Snapper*> SnapperList;
65
65
 
67
67
    bool gridSnapperMightSnap() const;
68
68
 
69
69
    void setup(SPDesktop const *desktop,
70
 
                        bool snapindicator = true,
71
 
                        SPItem const *item_to_ignore = NULL,
72
 
                        std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
73
 
                        SPGuide *guide_to_ignore = NULL);
 
70
            bool snapindicator = true,
 
71
            SPItem const *item_to_ignore = NULL,
 
72
            std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
 
73
            SPGuide *guide_to_ignore = NULL);
74
74
 
75
75
    void setup(SPDesktop const *desktop,
76
 
                bool snapindicator,
77
 
                std::vector<SPItem const *> &items_to_ignore,
78
 
                std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
79
 
                SPGuide *guide_to_ignore = NULL);
 
76
            bool snapindicator,
 
77
            std::vector<SPItem const *> &items_to_ignore,
 
78
            std::vector<std::pair<Geom::Point, int> > *unselected_nodes = NULL,
 
79
            SPGuide *guide_to_ignore = NULL);
80
80
 
81
81
    // freeSnapReturnByRef() is preferred over freeSnap(), because it only returns a
82
82
    // point if snapping has occurred (by overwriting p); otherwise p is untouched
83
83
    void freeSnapReturnByRef(Inkscape::SnapPreferences::PointType point_type,
84
 
                                                        Geom::Point &p,
85
 
                                                        Inkscape::SnapSourceType const source_type,
86
 
                                                        bool first_point = true,
87
 
                                                        Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
 
84
                                Geom::Point &p,
 
85
                                Inkscape::SnapSourceType const source_type,
 
86
                                long source_num = 0,
 
87
                                Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
88
88
 
89
89
 
90
90
    Inkscape::SnappedPoint freeSnap(Inkscape::SnapPreferences::PointType point_type,
91
 
                                                                        Geom::Point const &p,
92
 
                                                            Inkscape::SnapSourceType const &source_type,
93
 
                                        bool first_point = true,
 
91
                                    Geom::Point const &p,
 
92
                                    Inkscape::SnapSourceType const &source_type,
 
93
                                    long source_num = 0,
94
94
                                    Geom::OptRect const &bbox_to_snap = Geom::OptRect() ) const;
95
95
 
96
96
    Geom::Point multipleOfGridPitch(Geom::Point const &t) const;
98
98
    // constrainedSnapReturnByRef() is preferred over constrainedSnap(), because it only returns a
99
99
    // point, by overwriting p, if snapping has occurred; otherwise p is untouched
100
100
    void constrainedSnapReturnByRef(Inkscape::SnapPreferences::PointType point_type,
101
 
                                                                        Geom::Point &p,
102
 
                                                                        Inkscape::SnapSourceType const source_type,
103
 
                                                                        Inkscape::Snapper::ConstraintLine const &constraint,
104
 
                                                                        bool first_point = true,
105
 
                                                                        Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
 
101
                                    Geom::Point &p,
 
102
                                    Inkscape::SnapSourceType const source_type,
 
103
                                    Inkscape::Snapper::ConstraintLine const &constraint,
 
104
                                    long source_num = 0,
 
105
                                    Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
106
106
 
107
107
    Inkscape::SnappedPoint constrainedSnap(Inkscape::SnapPreferences::PointType point_type,
108
 
                                                                                   Geom::Point const &p,
109
 
                                                                                   Inkscape::SnapSourceType const &source_type,
110
 
                                                                                   Inkscape::Snapper::ConstraintLine const &constraint,
111
 
                                                                                   bool first_point = true,
 
108
                                           Geom::Point const &p,
 
109
                                           Inkscape::SnapSourceType const &source_type,
 
110
                                           Inkscape::Snapper::ConstraintLine const &constraint,
 
111
                                           long source_num = 0,
112
112
                                           Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const;
113
113
 
114
114
    void guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, SPGuideDragType drag_type) const;