X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdisplay%2Fcanvas-grid.h;h=58cfbf735d63b9a5cdb9a32c9ca987fe02b863fd;hb=5baec7f2ec5b05a6781f10a30890c65112eef76e;hp=20cb314730a366125c37be7567764c451a007359;hpb=f38d1b851669bf0fa14a2ca67d9bde7d3fb2dc9b;p=inkscape.git diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 20cb31473..58cfbf735 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -1,16 +1,13 @@ -#ifndef INKSCAPE_CANVAS_GRID_H -#define INKSCAPE_CANVAS_GRID_H - -/* - * Inkscape::CXYGrid - * - * Generic (and quite unintelligent) grid item for gnome canvas - * - * Copyright (C) Johan Engelen 2006-2007 +/** @file + * @brief Cartesian grid item for the Inkscape canvas + */ +/* Copyright (C) Johan Engelen 2006-2007 * Copyright (C) Lauris Kaplinski 2000 - * */ +#ifndef INKSCAPE_CANVAS_GRID_H +#define INKSCAPE_CANVAS_GRID_H + #include #include @@ -81,7 +78,7 @@ public: GridCanvasItem * createCanvasItem(SPDesktop * desktop); - virtual void Update (NR::Matrix const &affine, unsigned int flags) = 0; + virtual void Update (Geom::Matrix const &affine, unsigned int flags) = 0; virtual void Render (SPCanvasBuf *buf) = 0; virtual void readRepr() = 0; @@ -89,13 +86,13 @@ public: Gtk::Widget * newWidget(); - NR::Point origin; /**< Origin of the grid */ + Geom::Point origin; /**< Origin of the grid */ guint32 color; /**< Color for normal lines */ guint32 empcolor; /**< Color for emphasis lines */ gint empspacing; /**< Spacing between emphasis lines */ - + SPUnit const* gridunit; - + Inkscape::XML::Node * repr; SPDocument *doc; @@ -131,18 +128,18 @@ public: CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasXYGrid(); - void Update (NR::Matrix const &affine, unsigned int flags); + void Update (Geom::Matrix const &affine, unsigned int flags); void Render (SPCanvasBuf *buf); void readRepr(); void onReprAttrChanged (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive); - NR::Point spacing; /**< Spacing between elements of the grid */ + Geom::Point spacing; /**< Spacing between elements of the grid */ bool scaled[2]; /**< Whether the grid is in scaled mode, which can - be different in the X or Y direction, hense two + be different in the X or Y direction, hence two variables */ - NR::Point ow; /**< Transformed origin by the affine for the zoom */ - NR::Point sw; /**< Transformed spacing by the affine for the zoom */ + Geom::Point ow; /**< Transformed origin by the affine for the zoom */ + Geom::Point sw; /**< Transformed spacing by the affine for the zoom */ protected: virtual Gtk::Widget * newSpecificWidget(); @@ -161,12 +158,16 @@ private: class CanvasXYGridSnapper : public LineSnapper { public: - CanvasXYGridSnapper(CanvasXYGrid *grid, SnapManager const *sm, Geom::Coord const d); + CanvasXYGridSnapper(CanvasXYGrid *grid, SnapManager *sm, Geom::Coord const d); bool ThisSnapperMightSnap() const; + Geom::Coord getSnapperTolerance() const; //returns the tolerance of the snapper in screen pixels (i.e. independent of zoom) + bool getSnapperAlwaysSnap() const; //if true, then the snapper will always snap, regardless of its tolerance + private: LineList _getSnapLines(Geom::Point const &p) const; - void _addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, Geom::Point const normal_to_line, const Geom::Point point_on_line) const; + void _addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, Geom::Point const normal_to_line, const Geom::Point point_on_line) const; + void _addSnappedPoint(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source) const; CanvasXYGrid *grid; };