/** @file
* Cartesian grid item for the Inkscape canvas.
*/
/* Copyright (C) Johan Engelen 2006-2007 <johan@shouraizou.nl>
* Copyright (C) Lauris Kaplinski 2000
*/
#ifndef INKSCAPE_CANVAS_GRID_H
#define INKSCAPE_CANVAS_GRID_H
#include "sp-canvas-item.h"
#include "ui/widget/registry.h"
#include "line-snapper.h"
struct SPCanvasBuf;
}
}
}
enum GridType {
GRID_RECTANGULAR = 0,
};
#define INKSCAPE_GRID_CANVASITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem))
#define INKSCAPE_GRID_CANVASITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INKSCAPE_TYPE_GRID_CANVASITEM, GridCanvasItem))
#define INKSCAPE_IS_GRID_CANVASITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INKSCAPE_TYPE_GRID_CANVASITEM))
#define INKSCAPE_IS_GRID_CANVASITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INKSCAPE_TYPE_GRID_CANVASITEM))
/** All the variables that are tracked for a grid specific canvas item. */
};
struct GridCanvasItemClass {
};
/* Standard Gtk function */
GType grid_canvasitem_get_type (void);
virtual ~CanvasGrid();
// TODO: see effect.h and effect.cpp from live_effects how to link enums to SVGname to typename properly. (johan)
const char * getName() const;
const char * getSVGName() const;
GridType getGridType() const;
static CanvasGrid* NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument *doc, GridType gridtype);
virtual void onReprAttrChanged (Inkscape::XML::Node * /*repr*/, char const */*key*/, char const */*oldval*/, char const */*newval*/, bool /*is_interactive*/) = 0;
void setOrigin(Geom::Point const &origin_px); /**< writes new origin (specified in px units) to SVG */
Inkscape::Util::Unit const* gridunit; /**< points to Unit object in UnitTable (so don't delete it) */
static void on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data);
bool isEnabled() const;
bool visible;
CanvasGrid(const CanvasGrid&);
};
virtual ~CanvasXYGrid();
virtual void onReprAttrChanged (Inkscape::XML::Node * repr, char const *key, char const *oldval, char const *newval, bool is_interactive);
be different in the X or Y direction, hence two
variables */
CanvasXYGrid(const CanvasXYGrid&);
void updateWidgets();
bool render_dotted;
};
{
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
void _addSnappedLine(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, Geom::Point const &normal_to_line, const Geom::Point &point_on_line) const;
void _addSnappedPoint(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const;
void _addSnappedLinePerpendicularly(IntermSnapResults &isr, Geom::Point const &snapped_point, Geom::Coord const &snapped_distance, SnapSourceType const &source, long source_num, bool constrained_snap) const;
};
}; /* namespace Inkscape */
#endif