index 0edcbd0ab0653480c2953016c44af1f51f514b7c..948b89e6afd03eb8a3099af51a89f5d500ad6e6a 100644 (file)
#include "desktop.h"
#include "../document.h"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "canvas-grid.h"
#include "canvas-axonomgrid.h"
if (!grid_canvasitem_type) {
GtkTypeInfo grid_canvasitem_info = {
- "GridCanvasItem",
+ (gchar *)"GridCanvasItem",
sizeof (GridCanvasItem),
sizeof (GridCanvasItemClass),
(GtkClassInitFunc) grid_canvasitem_class_init,
@@ -157,7 +157,7 @@ grid_canvasitem_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
};
CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type)
- : namelabel("", Gtk::ALIGN_CENTER), visible(true), gridtype(type)
+ : visible(true), gridtype(type)
{
repr = in_repr;
doc = in_doc;
@@ -167,22 +167,6 @@ CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocume
namedview = nv;
canvasitems = NULL;
-
- Glib::ustring str("<b>");
- str += getName();
- str += "</b>";
- namelabel.set_markup(str);
- vbox.pack_start(namelabel, true, true);
-
- _rcb_enabled.init ( _("_Enabled"),
- _("Determines whether to snap to this grid or not. Can be 'on' for invisible grids."),
- "enabled", _wr, false, repr, doc);
- vbox.pack_start(*dynamic_cast<Gtk::Widget*>(_rcb_enabled._button), true, true);
-
- _rcb_visible.init ( _("_Visible"),
- _("Determines whether the grid is displayed or not. Objects are still snapped to invisible grids."),
- "visible", _wr, true, repr, doc);
- vbox.pack_start(*dynamic_cast<Gtk::Widget*>(_rcb_visible._button), true, true);
}
CanvasGrid::~CanvasGrid()
return item;
}
+Gtk::Widget *
+CanvasGrid::newWidget()
+{
+ Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() );
+ Gtk::Label * namelabel = Gtk::manage(new Gtk::Label("", Gtk::ALIGN_CENTER) );
+
+ Glib::ustring str("<b>");
+ str += getName();
+ str += "</b>";
+ namelabel->set_markup(str);
+ vbox->pack_start(*namelabel, true, true);
+
+ Inkscape::UI::Widget::RegisteredCheckButton * _rcb_enabled = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredCheckButton( _("_Enabled"),
+ _("Determines whether to snap to this grid or not. Can be 'on' for invisible grids."),
+ "enabled", _wr, false, repr, doc) );
+ Inkscape::UI::Widget::RegisteredCheckButton * _rcb_visible = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredCheckButton( _("_Visible"),
+ _("Determines whether the grid is displayed or not. Objects are still snapped to invisible grids."),
+ "visible", _wr, true, repr, doc) );
+
+ vbox->pack_start(*_rcb_enabled, true, true);
+ vbox->pack_start(*_rcb_visible, true, true);
+ Gtk::Widget * gridwdg = newSpecificWidget();
+ vbox->pack_start(*gridwdg, true, true);
+
+ std::list<Gtk::Widget*> slaves;
+ slaves.push_back(_rcb_visible);
+ slaves.push_back(gridwdg);
+ _rcb_enabled->setSlaveWidgets(slaves);
+
+ // set widget values
+ _rcb_visible->setActive(visible);
+ if (snapper != NULL) {
+ _rcb_enabled->setActive(snapper->getEnabled());
+ }
+
+ return dynamic_cast<Gtk::Widget *> (vbox);
+}
+
void
CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar const *oldval, gchar const *newval, bool is_interactive, void *data)
{
@@ -389,80 +413,24 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int
}
CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc)
- : CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR), table(1, 1)
+ : CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR)
{
- gridunit = sp_unit_get_by_abbreviation( prefs_get_string_attribute("options.grids.xy", "units") );
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gridunit = sp_unit_get_by_abbreviation( prefs->getString("options.grids.xy", "units").data() );
if (!gridunit)
gridunit = &sp_unit_get_by_id(SP_UNIT_PX);
- origin[NR::X] = sp_units_get_pixels( prefs_get_double_attribute ("options.grids.xy", "origin_x", 0.0), *(gridunit) );
- origin[NR::Y] = sp_units_get_pixels( prefs_get_double_attribute ("options.grids.xy", "origin_y", 0.0), *(gridunit) );
- color = prefs_get_int_attribute("options.grids.xy", "color", 0x0000ff20);
- empcolor = prefs_get_int_attribute("options.grids.xy", "empcolor", 0x0000ff40);
- empspacing = prefs_get_int_attribute("options.grids.xy", "empspacing", 5);
- spacing[NR::X] = sp_units_get_pixels( prefs_get_double_attribute ("options.grids.xy", "spacing_x", 0.0), *(gridunit) );
- spacing[NR::Y] = sp_units_get_pixels( prefs_get_double_attribute ("options.grids.xy", "spacing_y", 0.0), *(gridunit) );
- render_dotted = prefs_get_int_attribute ("options.grids.xy", "dotted", 0) == 1;
-
- snapper = new CanvasXYGridSnapper(this, namedview, 0);
-
- // initialize widgets:
- vbox.set_border_width(2);
- table.set_spacings(2);
- vbox.pack_start(table, false, false, 0);
-
-_wr.setUpdating (true);
- Inkscape::UI::Widget::ScalarUnit * sutemp;
- _rumg.init (_("Grid _units:"), "units", _wr, repr, doc);
- _rsu_ox.init (_("_Origin X:"), _("X coordinate of grid origin"),
- "originx", _rumg, _wr, repr, doc);
- sutemp = _rsu_ox.getSU();
- sutemp->setDigits(4);
- sutemp->setIncrements(0.1, 1.0);
- _rsu_oy.init (_("O_rigin Y:"), _("Y coordinate of grid origin"),
- "originy", _rumg, _wr, repr, doc);
- sutemp = _rsu_oy.getSU();
- sutemp->setDigits(4);
- sutemp->setIncrements(0.1, 1.0);
- _rsu_sx.init (_("Spacing _X:"), _("Distance between vertical grid lines"),
- "spacingx", _rumg, _wr, repr, doc);
- sutemp = _rsu_sx.getSU();
- sutemp->setDigits(4);
- sutemp->setIncrements(0.1, 1.0);
- _rsu_sy.init (_("Spacing _Y:"), _("Distance between horizontal grid lines"),
- "spacingy", _rumg, _wr, repr, doc);
- sutemp = _rsu_sy.getSU();
- sutemp->setDigits(4);
- sutemp->setIncrements(0.1, 1.0);
- _rcp_gcol.init (_("Grid line _color:"), _("Grid line color"),
- _("Color of grid lines"), "color", "opacity", _wr, repr, doc);
- _rcp_gmcol.init (_("Ma_jor grid line color:"), _("Major grid line color"),
- _("Color of the major (highlighted) grid lines"),
- "empcolor", "empopacity", _wr, repr, doc);
- _rsi.init (_("_Major grid line every:"), _("lines"), "empspacing", _wr, repr, doc);
- _rcb_dotted.init ( _("_Show dots instead of lines"),
- _("If set, displays dots at gridpoints instead of gridlines"),
- "dotted", _wr, false, repr, doc);
-_wr.setUpdating (false);
+ origin[NR::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_x", 0.0), *gridunit);
+ origin[NR::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "origin_y", 0.0), *gridunit);
+ color = prefs->getInt("options.grids.xy", "color", 0x0000ff20);
+ empcolor = prefs->getInt("options.grids.xy", "empcolor", 0x0000ff40);
+ empspacing = prefs->getInt("options.grids.xy", "empspacing", 5);
+ spacing[NR::X] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_x", 0.0), *gridunit);
+ spacing[NR::Y] = sp_units_get_pixels(prefs->getDouble("options.grids.xy", "spacing_y", 0.0), *gridunit);
+ render_dotted = prefs->getBool("options.grids.xy", "dotted", false);
- Gtk::Widget const *const widget_array[] = {
- _rumg._label, _rumg._sel,
- 0, _rsu_ox.getSU(),
- 0, _rsu_oy.getSU(),
- 0, _rsu_sx.getSU(),
- 0, _rsu_sy.getSU(),
- _rcp_gcol._label, _rcp_gcol._cp,
- 0, 0,
- _rcp_gmcol._label, _rcp_gmcol._cp,
- _rsi._label, &_rsi._hbox,
- 0, _rcb_dotted._button,
- };
-
- attach_all (table, widget_array, sizeof(widget_array));
-
- vbox.show();
+ snapper = new CanvasXYGridSnapper(this, &namedview->snap_manager, 0);
if (repr) readRepr();
- updateWidgets();
}
CanvasXYGrid::~CanvasXYGrid ()
@param widget Widget associated with the scalar.
*/
static void validateScalar(double oldVal,
- double* pTarget,
- Inkscape::UI::Widget::RegisteredScalarUnit& widget)
+ double* pTarget)
{
// Avoid nullness.
if ( pTarget == NULL )
// Reset the scalar and associated widget to the old value.
*pTarget = oldVal;
- widget.setValue( *pTarget);
} //if
} //validateScalar
@param widget Widget associated with the int.
*/
static void validateInt(gint oldVal,
- gint* pTarget,
- Inkscape::UI::Widget::RegisteredSuffixedInteger& widget)
+ gint* pTarget)
{
// Avoid nullness.
if ( pTarget == NULL )
// Reset the int and associated widget to the old value.
*pTarget = oldVal;
- widget.setValue( *pTarget);
} //if
} //validateInt
if ( (value = repr->attribute("spacingx")) ) {
double oldVal = spacing[NR::X];
sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[NR::X], &gridunit);
- validateScalar( oldVal, &spacing[NR::X], _rsu_sx );
+ validateScalar( oldVal, &spacing[NR::X]);
spacing[NR::X] = sp_units_get_pixels(spacing[NR::X], *(gridunit));
}
if ( (value = repr->attribute("spacingy")) ) {
double oldVal = spacing[NR::Y];
sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &spacing[NR::Y], &gridunit);
- validateScalar( oldVal, &spacing[NR::Y], _rsu_sy );
+ validateScalar( oldVal, &spacing[NR::Y]);
spacing[NR::Y] = sp_units_get_pixels(spacing[NR::Y], *(gridunit));
}
if ( (value = repr->attribute("empspacing")) ) {
gint oldVal = empspacing;
empspacing = atoi(value);
- validateInt( oldVal, &empspacing, _rsi );
+ validateInt( oldVal, &empspacing);
}
if ( (value = repr->attribute("dotted")) ) {
- render_dotted = (strcmp(value,"true") == 0);
+ render_dotted = (strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
if ( (value = repr->attribute("visible")) ) {
- visible = (strcmp(value,"true") == 0);
+ visible = (strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
if ( (value = repr->attribute("enabled")) ) {
g_assert(snapper != NULL);
- snapper->setEnabled(strcmp(value,"true") == 0);
+ snapper->setEnabled(strcmp(value,"false") != 0 && strcmp(value, "0") != 0);
}
for (GSList *l = canvasitems; l != NULL; l = l->next) {
@@ -684,10 +648,97 @@ CanvasXYGrid::onReprAttrChanged(Inkscape::XML::Node */*repr*/, gchar const */*ke
-Gtk::Widget &
-CanvasXYGrid::getWidget()
+Gtk::Widget *
+CanvasXYGrid::newSpecificWidget()
{
- return vbox;
+ Gtk::Table * table = Gtk::manage( new Gtk::Table(1,1) );
+
+ Inkscape::UI::Widget::RegisteredUnitMenu *_rumg = Gtk::manage( new Inkscape::UI::Widget::RegisteredUnitMenu(
+ _("Grid _units:"), "units", _wr, repr, doc) );
+ Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_ox = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalarUnit(
+ _("_Origin X:"), _("X coordinate of grid origin"), "originx", *_rumg, _wr, repr, doc) );
+ Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_oy = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalarUnit(
+ _("O_rigin Y:"), _("Y coordinate of grid origin"), "originy", *_rumg, _wr, repr, doc) );
+ Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_sx = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalarUnit(
+ _("Spacing _X:"), _("Distance between vertical grid lines"), "spacingx", *_rumg, _wr, repr, doc) );
+ Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_sy = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalarUnit(
+ _("Spacing _Y:"), _("Distance between horizontal grid lines"), "spacingy", *_rumg, _wr, repr, doc) );
+
+ Inkscape::UI::Widget::RegisteredColorPicker *_rcp_gcol = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredColorPicker(
+ _("Grid line _color:"), _("Grid line color"), _("Color of grid lines"),
+ "color", "opacity", _wr, repr, doc));
+
+ Inkscape::UI::Widget::RegisteredColorPicker *_rcp_gmcol = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredColorPicker(
+ _("Ma_jor grid line color:"), _("Major grid line color"),
+ _("Color of the major (highlighted) grid lines"), "empcolor", "empopacity",
+ _wr, repr, doc));
+
+ Inkscape::UI::Widget::RegisteredSuffixedInteger *_rsi = Gtk::manage( new Inkscape::UI::Widget::RegisteredSuffixedInteger(
+ _("_Major grid line every:"), "", _("lines"), "empspacing", _wr, repr, doc) );
+
+ table->set_spacings(2);
+
+_wr.setUpdating (true);
+
+ _rsu_ox->setDigits(4);
+ _rsu_ox->setIncrements(0.1, 1.0);
+
+ _rsu_oy->setDigits(4);
+ _rsu_oy->setIncrements(0.1, 1.0);
+
+ _rsu_sx->setDigits(4);
+ _rsu_sx->setIncrements(0.1, 1.0);
+
+ _rsu_sy->setDigits(4);
+ _rsu_sy->setIncrements(0.1, 1.0);
+
+ Inkscape::UI::Widget::RegisteredCheckButton * _rcb_dotted = Gtk::manage(
+ new Inkscape::UI::Widget::RegisteredCheckButton( _("_Show dots instead of lines"),
+ _("If set, displays dots at gridpoints instead of gridlines"),
+ "dotted", _wr, false, repr, doc) );
+_wr.setUpdating (false);
+
+ Gtk::Widget const *const widget_array[] = {
+ 0, _rumg,
+ 0, _rsu_ox,
+ 0, _rsu_oy,
+ 0, _rsu_sx,
+ 0, _rsu_sy,
+ _rcp_gcol->_label, _rcp_gcol,
+ 0, 0,
+ _rcp_gmcol->_label, _rcp_gmcol,
+ 0, _rsi,
+ 0, _rcb_dotted,
+ };
+
+ attach_all (*table, widget_array, sizeof(widget_array));
+
+ // set widget values
+ _rumg->setUnit (gridunit);
+
+ gdouble val;
+ val = origin[NR::X];
+ val = sp_pixels_get_units (val, *(gridunit));
+ _rsu_ox->setValue (val);
+ val = origin[NR::Y];
+ val = sp_pixels_get_units (val, *(gridunit));
+ _rsu_oy->setValue (val);
+ val = spacing[NR::X];
+ double gridx = sp_pixels_get_units (val, *(gridunit));
+ _rsu_sx->setValue (gridx);
+ val = spacing[NR::Y];
+ double gridy = sp_pixels_get_units (val, *(gridunit));
+ _rsu_sy->setValue (gridy);
+
+ _rcp_gcol->setRgba32 (color);
+ _rcp_gmcol->setRgba32 (empcolor);
+ _rsi->setValue (empspacing);
+
+ _rcb_dotted->setActive(render_dotted);
+
+ return table;
}
void
CanvasXYGrid::updateWidgets()
{
+/*
if (_wr.isUpdating()) return;
_wr.setUpdating (true);
_wr.setUpdating (false);
return;
+*/
}
a = NR_RGBA32_A (rgba);
x0 = MAX (buf->rect.x0, xs);
x1 = MIN (buf->rect.x1, xe + 1);
- p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3;
+ p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4;
for (x = x0; x < x1; x++) {
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p[1] = NR_COMPOSEN11_1111 (g, a, p[1]);
p[2] = NR_COMPOSEN11_1111 (b, a, p[2]);
- p += 3;
+ p += 4;
}
}
}
a = NR_RGBA32_A (rgba);
y0 = MAX (buf->rect.y0, ys);
y1 = MIN (buf->rect.y1, ye + 1);
- p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3;
+ p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4;
for (y = y0; y < y1; y++) {
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p[1] = NR_COMPOSEN11_1111 (g, a, p[1]);
g = NR_RGBA32_G (rgba);
b = NR_RGBA32_B (rgba);
a = NR_RGBA32_A (rgba);
- p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3;
+ p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4;
p[0] = NR_COMPOSEN11_1111 (r, a, p[0]);
p[1] = NR_COMPOSEN11_1111 (g, a, p[1]);
p[2] = NR_COMPOSEN11_1111 (b, a, p[2]);
gdouble const syg = floor ((buf->rect.y0 - ow[NR::Y]) / sw[NR::Y]) * sw[NR::Y] + ow[NR::Y];
gint const ylinestart = (gint) Inkscape::round((syg - ow[NR::Y]) / sw[NR::Y]);
+ //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring)
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ guint32 _empcolor;
+ bool no_emp_when_zoomed_out = prefs->getBool("options.grids", "no_emphasize_when_zoomedout", false);
+ if( (scaled[NR::X] || scaled[NR::Y]) && no_emp_when_zoomed_out ) {
+ _empcolor = color;
+ } else {
+ _empcolor = empcolor;
+ }
+
if (!render_dotted) {
gint ylinenum;
gdouble y;
for (y = syg, ylinenum = ylinestart; y < buf->rect.y1; y += sw[NR::Y], ylinenum++) {
gint const y0 = (gint) Inkscape::round(y);
-
if (!scaled[NR::Y] && (ylinenum % empspacing) != 0) {
grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, color);
} else {
- grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, empcolor);
+ grid_hline (buf, y0, buf->rect.x0, buf->rect.x1 - 1, _empcolor);
}
}
if (!scaled[NR::X] && (xlinenum % empspacing) != 0) {
grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, color);
} else {
- grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, empcolor);
+ grid_vline (buf, ix, buf->rect.y0, buf->rect.y1, _empcolor);
}
}
} else {
gdouble x;
for (x = sxg, xlinenum = xlinestart; x < buf->rect.x1; x += sw[NR::X], xlinenum++) {
gint const ix = (gint) Inkscape::round(x);
- if ( (!scaled[NR::X] && (xlinenum % empspacing) == 0)
- || (!scaled[NR::Y] && (ylinenum % empspacing) == 0) )
+ if ( (!scaled[NR::X] && (xlinenum % empspacing) != 0)
+ || (!scaled[NR::Y] && (ylinenum % empspacing) != 0)
+ || ((scaled[NR::X] || scaled[NR::Y]) && no_emp_when_zoomed_out) )
{
- grid_dot (buf, ix, iy, empcolor | (guint32)0x000000FF); // put alpha to max value
+ grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value
} else {
- grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value
+ gint const pitch = 1;
+ grid_dot (buf, ix-pitch, iy, _empcolor);
+ grid_dot (buf, ix+pitch, iy, _empcolor);
+
+ grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value
+
+ grid_dot (buf, ix, iy-pitch, _empcolor);
+ grid_dot (buf, ix, iy+pitch, _empcolor);
}
}
}
}
-CanvasXYGridSnapper::CanvasXYGridSnapper(CanvasXYGrid *grid, SPNamedView const *nv, NR::Coord const d) : LineSnapper(nv, d)
+CanvasXYGridSnapper::CanvasXYGridSnapper(CanvasXYGrid *grid, SnapManager const *sm, NR::Coord const d) : LineSnapper(sm, d)
{
this->grid = grid;
}
LineSnapper::LineList
-CanvasXYGridSnapper::_getSnapLines(NR::Point const &p) const
+CanvasXYGridSnapper::_getSnapLines(Geom::Point const &p) const
{
LineList s;
for (unsigned int i = 0; i < 2; ++i) {
/* This is to make sure we snap to only visible grid lines */
- double scaled_spacing = grid->sw[i]; // this is spacing of visible lines if screen pixels
+ double scaled_spacing = grid->sw[i]; // this is spacing of visible lines in screen pixels
// convert screen pixels to px
// FIXME: after we switch to snapping dist in screen pixels, this will be unnecessary
scaled_spacing /= SP_ACTIVE_DESKTOP->current_zoom();
}
- NR::Coord rounded;
- NR::Point point_on_line;
+ Geom::Coord rounded;
+ Geom::Point point_on_line;
rounded = Inkscape::Util::round_to_upper_multiple_plus(p[i], scaled_spacing, grid->origin[i]);
- point_on_line = i ? NR::Point(0, rounded) : NR::Point(rounded, 0);
+ point_on_line = i ? Geom::Point(0, rounded) : Geom::Point(rounded, 0);
s.push_back(std::make_pair(component_vectors[i], point_on_line));
rounded = Inkscape::Util::round_to_lower_multiple_plus(p[i], scaled_spacing, grid->origin[i]);
- point_on_line = i ? NR::Point(0, rounded) : NR::Point(rounded, 0);
+ point_on_line = i ? Geom::Point(0, rounded) : Geom::Point(rounded, 0);
s.push_back(std::make_pair(component_vectors[i], point_on_line));
}
return s;
}
-void CanvasXYGridSnapper::_addSnappedLine(SnappedConstraints &sc, NR::Point const snapped_point, NR::Coord const snapped_distance, NR::Point const normal_to_line, NR::Point const point_on_line) const
+void CanvasXYGridSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, Geom::Point const normal_to_line, Geom::Point const point_on_line) const
{
SnappedLine dummy = SnappedLine(snapped_point, snapped_distance, getSnapperTolerance(), getSnapperAlwaysSnap(), normal_to_line, point_on_line);
sc.grid_lines.push_back(dummy);
@@ -930,7 +1000,7 @@ void CanvasXYGridSnapper::_addSnappedLine(SnappedConstraints &sc, NR::Point cons
*/
bool CanvasXYGridSnapper::ThisSnapperMightSnap() const
{
- return _named_view == NULL ? false : (_snap_enabled && _snap_from != 0);
+ return _snap_enabled && _snap_from != 0;
}