X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-guide.h;h=6bf541cd1e562a32287fd87c9655a196011e2e6f;hb=e5a27fd62c20932a7c888d6c58087032763f2dc5;hp=2a12225be40d4d64b015c7dfe44510c4c84f70c9;hpb=c87d0307348fcfdc65b6b4ab6999a3cb0de2431f;p=inkscape.git diff --git a/src/sp-guide.h b/src/sp-guide.h index 2a12225be..6bf541cd1 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -7,13 +7,14 @@ * A guideline * * Copyright (C) Lauris Kaplinski 2000 + * Copyright (C) Johan Engelen 2007 * */ #include #include "display/display-forward.h" -#include "libnr/nr-point.h" +#include <2geom/point.h> #include "sp-object.h" #include "sp-guide-attachment.h" @@ -25,29 +26,40 @@ /* Represents the constraint on p that dot(g.direction, p) == g.position. */ struct SPGuide : public SPObject { - NR::Point normal; - gdouble position; + Geom::Point normal_to_line; + Geom::Point point_on_line; + guint32 color; guint32 hicolor; GSList *views; std::vector attached_items; + + inline bool is_horizontal() const { return (normal_to_line[Geom::X] == 0.); }; + inline bool is_vertical() const { return (normal_to_line[Geom::Y] == 0.); }; + inline double angle() const { return std::atan2( - normal_to_line[Geom::X], normal_to_line[Geom::Y] ); }; }; struct SPGuideClass { - SPObjectClass parent_class; + SPObjectClass parent_class; }; GType sp_guide_get_type(); +SPGuide *sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2); +void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list > &pts); +void sp_guide_create_guides_around_page(SPDesktop *dt); + void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler); void sp_guide_hide(SPGuide *guide, SPCanvas *canvas); -void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, bool sensitive); +void sp_guide_sensitize(SPGuide *guide, SPCanvas *canvas, gboolean sensitive); -double sp_guide_position_from_pt(SPGuide const *guide, NR::Point const &pt); -void sp_guide_moveto(SPGuide const &guide, gdouble const position, bool const commit); +Geom::Point sp_guide_position_from_pt(SPGuide const *guide, Geom::Point const &pt); +double sp_guide_distance_from_pt(SPGuide const *guide, Geom::Point const &pt); +void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool const commit); +void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, bool const commit); void sp_guide_remove(SPGuide *guide); -char *sp_guide_description(SPGuide const *guide); +char *sp_guide_description(SPGuide const *guide, const bool verbose = true); #endif /* !SP_GUIDE_H */