diff --git a/src/sp-guide.h b/src/sp-guide.h
index 5349921747bd69761053eedccdc27f020127c890..4fc4032db44b2b08cff27a78fededf4ffa91553b 100644 (file)
--- a/src/sp-guide.h
+++ b/src/sp-guide.h
-#ifndef SP_GUIDE_H
-#define SP_GUIDE_H
+#ifndef SEEN_SP_GUIDE_H
+#define SEEN_SP_GUIDE_H
/*
* SPGuide
*
* Copyright (C) Lauris Kaplinski 2000
* Copyright (C) Johan Engelen 2007
+ * Abhishek Sharma
+ * Jon A. Cruz <jon@joncruz.org>
*
*/
#include <vector>
#include "display/display-forward.h"
-#include "libnr/nr-point.h"
+#include <2geom/point.h>
#include "sp-object.h"
#include "sp-guide-attachment.h"
#define SP_IS_GUIDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_GUIDE))
/* Represents the constraint on p that dot(g.direction, p) == g.position. */
-struct SPGuide : public SPObject {
- NR::Point normal;
- gdouble position;
+class SPGuide : public SPObject {
+public:
+ Geom::Point normal_to_line;
+ Geom::Point point_on_line;
+
guint32 color;
guint32 hicolor;
GSList *views;
std::vector<SPGuideAttachment> attached_items;
+
+ inline bool isHorizontal() const { return (normal_to_line[Geom::X] == 0.); };
+ inline bool isVertical() 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] ); };
+ static SPGuide *createSPGuide(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2);
+ void showSPGuide(SPCanvasGroup *group, GCallback handler);
+ void hideSPGuide(SPCanvas *canvas);
+ void sensitize(SPCanvas *canvas, gboolean sensitive);
+ Geom::Point getPositionFrom(Geom::Point const &pt) const;
+ double getDistanceFrom(Geom::Point const &pt) const;
};
-struct SPGuideClass {
- SPObjectClass parent_class;
+class SPGuideClass {
+public:
+ SPObjectClass parent_class;
};
GType sp_guide_get_type();
-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, gboolean sensitive);
+void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts);
+void sp_guide_create_guides_around_page(SPDesktop *dt);
-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);
+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 */
+#endif // SEEN_SP_GUIDE_H
/*
Local Variables:
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :