Code

rationalize function names and remove spurious soft_ptr
[inkscape.git] / src / guide-snapper.cpp
1 /**
2  *  \file guide-snapper.cpp
3  *  \brief Snapping things to guides.
4  *
5  * Authors:
6  *   Lauris Kaplinski <lauris@kaplinski.com>
7  *   Frank Felfe <innerspace@iname.com>
8  *   Carl Hetherington <inkscape@carlh.net>
9  *
10  * Copyright (C) 1999-2002 Authors
11  *
12  * Released under GNU GPL, read the file 'COPYING' for more information
13  */
15 #include "libnr/nr-values.h"
16 #include "libnr/nr-point-fns.h"
17 #include "sp-namedview.h"
18 #include "sp-guide.h"
20 Inkscape::GuideSnapper::GuideSnapper(SPNamedView const *nv, NR::Coord const d) : LineSnapper(nv, d)
21 {
23 }
25 Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(NR::Point const &p) const
26 {
27     LineList s;
29     for (GSList const *l = _named_view->guides; l != NULL; l = l->next) {
30         SPGuide const *g = SP_GUIDE(l->data);
32         /* We assume here that guides are horizontal or vertical */
33         if (g->normal == component_vectors[NR::X]) {
34             s.push_back(std::make_pair(NR::X, g->position));
35         } else {
36             s.push_back(std::make_pair(NR::Y, g->position));
37         }
38     }
40     return s;
41 }
43 /*
44   Local Variables:
45   mode:c++
46   c-file-style:"stroustrup"
47   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
48   indent-tabs-mode:nil
49   fill-column:99
50   End:
51 */
52 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :