Code

guides: switch from using one position coordinate to Geom::Point point_on_line
[inkscape.git] / src / sp-guide.h
1 #ifndef SP_GUIDE_H
2 #define SP_GUIDE_H
4 /*
5  * SPGuide
6  *
7  * A guideline
8  *
9  * Copyright (C) Lauris Kaplinski 2000
10  * Copyright (C) Johan Engelen 2007
11  *
12  */
14 #include <vector>
16 #include "display/display-forward.h"
17 #include "libnr/nr-point.h"
18 #include "sp-object.h"
19 #include "sp-guide-attachment.h"
21 #define SP_TYPE_GUIDE            (sp_guide_get_type())
22 #define SP_GUIDE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_GUIDE, SPGuide))
23 #define SP_GUIDE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_GUIDE, SPGuideClass))
24 #define SP_IS_GUIDE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_GUIDE))
25 #define SP_IS_GUIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GUIDE))
27 /* Represents the constraint on p that dot(g.direction, p) == g.position. */
28 struct SPGuide : public SPObject {
29     NR::Point normal_to_line;
30     Geom::Point point_on_line;
32     guint32 color;
33     guint32 hicolor;
34     GSList *views;
35     std::vector<SPGuideAttachment> attached_items;
36 };
38 struct SPGuideClass {
39     SPObjectClass parent_class;
40 };
42 GType sp_guide_get_type();
44 void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler);
45 void sp_guide_hide(SPGuide *guide, SPCanvas *canvas);
46 void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive);
48 Geom::Point sp_guide_position_from_pt(SPGuide const *guide, NR::Point const &pt);
49 double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt);
50 void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool const commit);
51 void sp_guide_remove(SPGuide *guide);
53 char *sp_guide_description(SPGuide const *guide);
56 #endif /* !SP_GUIDE_H */
58 /*
59   Local Variables:
60   mode:c++
61   c-file-style:"stroustrup"
62   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
63   indent-tabs-mode:nil
64   fill-column:99
65   End:
66 */
67 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :