diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 92c1e51288d00141959d7bd05d0868e62ee23ab1..d3f357e7688f51e1d6a025aa04eebe1d7738d0ed 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
#include "style.h"
#include "marker.h"
#include "sp-path.h"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "attributes.h"
#include "live_effects/lpeobject.h"
static void sp_shape_modified (SPObject *object, unsigned int flags);
static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags);
+static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
void sp_shape_print (SPItem * item, SPPrintContext * ctx);
static NRArenaItem *sp_shape_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
static void sp_shape_hide (SPItem *item, unsigned int key);
-static void sp_shape_snappoints (SPItem const *item, SnapPointsIter p);
+static void sp_shape_snappoints (SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs);
static void sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai);
@@ -171,6 +171,10 @@ sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep
if (((SPObjectClass *) (parent_class))->build) {
(*((SPObjectClass *) (parent_class))->build) (object, document, repr);
}
+
+ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
+ sp_shape_set_marker (object, i, object->style->marker[i].value);
+ }
}
/**
for (i=SP_MARKER_LOC_START; i<SP_MARKER_LOC_QTY; i++) {
if (shape->marker[i]) {
- sp_signal_disconnect_by_data (shape->marker[i], object);
for (v = item->display; v != NULL; v = v->next) {
sp_marker_hide ((SPMarker *) shape->marker[i], NR_ARENA_ITEM_GET_KEY (v->arenaitem) + i);
}
+ shape->release_connect[i].disconnect();
+ shape->modified_connect[i].disconnect();
shape->marker[i] = sp_object_hunref (shape->marker[i], object);
}
}
SPItem *item = (SPItem *) object;
SPShape *shape = (SPShape *) object;
- if (((SPObjectClass *) (parent_class))->update) {
- (* ((SPObjectClass *) (parent_class))->update) (object, ctx, flags);
- }
+ if (((SPObjectClass *) (parent_class))->update) {
+ (* ((SPObjectClass *) (parent_class))->update) (object, ctx, flags);
+ }
- /* This stanza checks that an object's marker style agrees with
- * the marker objects it has allocated. sp_shape_set_marker ensures
- * that the appropriate marker objects are present (or absent) to
- * match the style.
- */
- /* TODO: It would be nice if this could be done at an earlier level */
- for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
- sp_shape_set_marker (object, i, object->style->marker[i].value);
+ /* This stanza checks that an object's marker style agrees with
+ * the marker objects it has allocated. sp_shape_set_marker ensures
+ * that the appropriate marker objects are present (or absent) to
+ * match the style.
+ */
+ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
+ sp_shape_set_marker (object, i, object->style->marker[i].value);
}
- if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
- SPStyle *style;
- style = SP_OBJECT_STYLE (object);
- if (style->stroke_width.unit == SP_CSS_UNIT_PERCENT) {
- SPItemCtx *ictx = (SPItemCtx *) ctx;
- double const aw = 1.0 / NR::expansion(ictx->i2vp);
- style->stroke_width.computed = style->stroke_width.value * aw;
- for (SPItemView *v = ((SPItem *) (shape))->display; v != NULL; v = v->next) {
- nr_arena_shape_set_style ((NRArenaShape *) v->arenaitem, style);
- }
- }
- }
-
- if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
- /* This is suboptimal, because changing parent style schedules recalculation */
- /* But on the other hand - how can we know that parent does not tie style and transform */
- boost::optional<NR::Rect> paintbox = SP_ITEM(object)->getBounds(NR::identity());
- for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
- NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
- if (flags & SP_OBJECT_MODIFIED_FLAG) {
- nr_arena_shape_set_path(s, shape->curve, (flags & SP_OBJECT_USER_MODIFIED_FLAG_B));
- }
- if (paintbox) {
- s->setPaintBox(*paintbox);
- }
- }
- }
-
- if (sp_shape_has_markers (shape)) {
+ if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
+ SPStyle *style;
+ style = SP_OBJECT_STYLE (object);
+ if (style->stroke_width.unit == SP_CSS_UNIT_PERCENT) {
+ SPItemCtx *ictx = (SPItemCtx *) ctx;
+ double const aw = 1.0 / NR::expansion(ictx->i2vp);
+ style->stroke_width.computed = style->stroke_width.value * aw;
+ for (SPItemView *v = ((SPItem *) (shape))->display; v != NULL; v = v->next) {
+ nr_arena_shape_set_style ((NRArenaShape *) v->arenaitem, style);
+ }
+ }
+ }
- /* Dimension marker views */
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
+ /* This is suboptimal, because changing parent style schedules recalculation */
+ /* But on the other hand - how can we know that parent does not tie style and transform */
+ Geom::OptRect paintbox = SP_ITEM(object)->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX);
+ for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
+ NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
+ if (flags & SP_OBJECT_MODIFIED_FLAG) {
+ nr_arena_shape_set_path(s, shape->curve, (flags & SP_OBJECT_USER_MODIFIED_FLAG_B));
+ }
+ if (paintbox) {
+ s->setPaintBox(*paintbox);
+ }
+ }
+ }
- if (!v->arenaitem->key) {
- /* Get enough keys for all, start, mid and end marker types,
- ** and set this view's arenaitem key to the first of these keys.
- */
- NR_ARENA_ITEM_SET_KEY (
- v->arenaitem,
- sp_item_display_key_new (SP_MARKER_LOC_QTY)
- );
+ if (sp_shape_has_markers (shape)) {
+ /* Dimension marker views */
+ for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ if (!v->arenaitem->key) {
+ NR_ARENA_ITEM_SET_KEY (v->arenaitem, sp_item_display_key_new (SP_MARKER_LOC_QTY));
+ }
+ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
+ if (shape->marker[i]) {
+ sp_marker_show_dimension ((SPMarker *) shape->marker[i],
+ NR_ARENA_ITEM_GET_KEY (v->arenaitem) + i - SP_MARKER_LOC,
+ sp_shape_number_of_markers (shape, i));
}
-
- for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
- if (shape->marker[i]) {
- sp_marker_show_dimension ((SPMarker *) shape->marker[i],
- NR_ARENA_ITEM_GET_KEY (v->arenaitem) + i - SP_MARKER_LOC,
- sp_shape_number_of_markers (shape, i));
- }
- }
}
+ }
- /* Update marker views */
- for (SPItemView *v = item->display; v != NULL; v = v->next) {
- sp_shape_update_marker_view (shape, v->arenaitem);
- }
- }
+ /* Update marker views */
+ for (SPItemView *v = item->display; v != NULL; v = v->next) {
+ sp_shape_update_marker_view (shape, v->arenaitem);
+ }
+ }
}
/**
* Calculates the bounding box for item, storing it into bbox.
* This also includes the bounding boxes of any markers included in the shape.
*/
-static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags)
+static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags)
{
SPShape const *shape = SP_SHAPE (item);
-
if (shape->curve) {
-
- NRRect cbbox;
-
- Geom::Rect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform);
- cbbox.x0 = geombbox[0][0];
- cbbox.y0 = geombbox[1][0];
- cbbox.x1 = geombbox[0][1];
- cbbox.y1 = geombbox[1][1];
-
- if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) {
-
- SPStyle* style=SP_OBJECT_STYLE (item);
- if (!style->stroke.isNone()) {
- double const scale = expansion(transform);
- if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
- double const width = MAX(0.125, style->stroke_width.computed * scale);
- if ( fabs(cbbox.x1-cbbox.x0) > -0.00001 && fabs(cbbox.y1-cbbox.y0) > -0.00001 ) {
- cbbox.x0-=0.5*width;
- cbbox.x1+=0.5*width;
- cbbox.y0-=0.5*width;
- cbbox.y1+=0.5*width;
+ Geom::OptRect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform);
+ if (geombbox) {
+ NRRect cbbox;
+ cbbox.x0 = (*geombbox)[0][0];
+ cbbox.y0 = (*geombbox)[1][0];
+ cbbox.x1 = (*geombbox)[0][1];
+ cbbox.y1 = (*geombbox)[1][1];
+
+ if ((SPItem::BBoxType) flags != SPItem::GEOMETRIC_BBOX) {
+
+ SPStyle* style=SP_OBJECT_STYLE (item);
+ if (!style->stroke.isNone()) {
+ double const scale = transform.descrim();
+ if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
+ double const width = MAX(0.125, style->stroke_width.computed * scale);
+ if ( fabs(cbbox.x1-cbbox.x0) > -0.00001 && fabs(cbbox.y1-cbbox.y0) > -0.00001 ) {
+ cbbox.x0-=0.5*width;
+ cbbox.x1+=0.5*width;
+ cbbox.y0-=0.5*width;
+ cbbox.y1+=0.5*width;
+ }
}
}
- }
- // Union with bboxes of the markers, if any
- if (sp_shape_has_markers (shape)) {
- /* TODO: make code prettier: lots of variables can be taken out of the loop! */
- Geom::PathVector const & pathv = shape->curve->get_pathvector();
- for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
- if ( shape->marker[SP_MARKER_LOC_START] ) {
- SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
- SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
+ // Union with bboxes of the markers, if any
+ if (sp_shape_has_markers (shape)) {
+ /* TODO: make code prettier: lots of variables can be taken out of the loop! */
+ Geom::PathVector const & pathv = shape->curve->get_pathvector();
+ for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) {
+ if ( shape->marker[SP_MARKER_LOC_START] ) {
+ SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
+ SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
+ Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
- if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
+ }
+
+ // total marker transform
+ tr = marker_item->transform * marker->c2p * tr * transform;
+
+ // get bbox of the marker with that transform
+ NRRect marker_bbox;
+ sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true);
+ // union it with the shape bbox
+ nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
- // total marker transform
- tr = marker_item->transform * marker->c2p * tr * transform;
+ if ( shape->marker[SP_MARKER_LOC_MID] && (path_it->size_default() > 1) ) {
+ Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
+ Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
+ while (curve_it2 != path_it->end_default())
+ {
+ /* Put marker between curve_it1 and curve_it2.
+ * Loop to end_default (so including closing segment), because when a path is closed,
+ * there should be a midpoint marker between last segment and closing straight line segment */
- // get bbox of the marker with that transform
- NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true);
- // union it with the shape bbox
- nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
- }
+ SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
+ SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
+
+ Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
+
+ if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
+ }
+
+ // total marker transform
+ tr = marker_item->transform * marker->c2p * tr * transform;
+
+ // get bbox of the marker with that transform
+ NRRect marker_bbox;
+ sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true);
+ // union it with the shape bbox
+ nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
+
+ ++curve_it1;
+ ++curve_it2;
+ }
+ }
- if ( shape->marker[SP_MARKER_LOC_MID] && (path_it->size_default() > 1) ) {
- Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve
- Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve
- while (curve_it2 != path_it->end_default())
- {
- /* Put marker between curve_it1 and curve_it2.
- * Loop to end_default (so including closing segment), because when a path is closed,
- * there should be a midpoint marker between last segment and closing straight line segment */
+ if ( shape->marker[SP_MARKER_LOC_END] ) {
+ SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
+ SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
- SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
- SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
+ /* Get reference to last curve in the path.
+ * For moveto-only path, this returns the "closing line segment". */
+ unsigned int index = path_it->size_default();
+ if (index > 0) {
+ index--;
+ }
+ Geom::Curve const &lastcurve = (*path_it)[index];
- NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
+ Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
// total marker transform
@@ -566,45 +591,14 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true);
// union it with the shape bbox
nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
-
- ++curve_it1;
- ++curve_it2;
- }
- }
-
- if ( shape->marker[SP_MARKER_LOC_END] ) {
- SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_END]);
- SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_END]));
-
- /* Get reference to last curve in the path.
- * For moveto-only path, this returns the "closing line segment". */
- unsigned int index = path_it->size_default();
- if (index > 0) {
- index--;
- }
- Geom::Curve const &lastcurve = (*path_it)[index];
-
- NR::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
-
- if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
}
-
- // total marker transform
- tr = marker_item->transform * marker->c2p * tr * transform;
-
- // get bbox of the marker with that transform
- NRRect marker_bbox;
- sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true);
- // union it with the shape bbox
- nr_rect_d_union (&cbbox, &cbbox, &marker_bbox);
}
}
}
- }
- // copy our bbox to the variable we're given
- *bbox = cbbox;
+ // copy our bbox to the variable we're given
+ *bbox = cbbox;
+ }
}
}
if (!shape->curve) return;
- gint add_comments = prefs_get_int_attribute_limited ("printing.debug", "add-label-comments", 0, 0, 1);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gint add_comments = prefs->getBool("/printing/debug/add-label-comments");
if (add_comments) {
gchar * comment = g_strdup_printf("begin '%s'",
SP_OBJECT(item)->defaultLabel());
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_START]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_START]));
- NR::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
+ Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front()));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
tr = marker_item->transform * marker->c2p * tr;
SPMarker* marker = SP_MARKER (shape->marker[SP_MARKER_LOC_MID]);
SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (shape->marker[SP_MARKER_LOC_MID]));
- NR::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
+ Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
tr = marker_item->transform * marker->c2p * tr;
}
Geom::Curve const &lastcurve = (*path_it)[index];
- NR::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
+ Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve);
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
- tr = NR::scale(style->stroke_width.computed) * tr;
+ tr = Geom::Scale(style->stroke_width.computed) * tr;
}
tr = marker_item->transform * marker->c2p * tr;
static NRArenaItem *
sp_shape_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/)
{
- SPObject *object = SP_OBJECT(item);
- SPShape *shape = SP_SHAPE(item);
+ SPObject *object = SP_OBJECT(item);
+ SPShape *shape = SP_SHAPE(item);
+
+ NRArenaItem *arenaitem = NRArenaShape::create(arena);
+ NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
+ nr_arena_shape_set_style(s, object->style);
+ nr_arena_shape_set_path(s, shape->curve, false);
+ Geom::OptRect paintbox = item->getBounds(Geom::identity());
+ if (paintbox) {
+ s->setPaintBox(*paintbox);
+ }
- NRArenaItem *arenaitem = NRArenaShape::create(arena);
- NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
- nr_arena_shape_set_style(s, object->style);
- nr_arena_shape_set_path(s, shape->curve, false);
- boost::optional<NR::Rect> paintbox = item->getBounds(NR::identity());
- if (paintbox) {
- s->setPaintBox(*paintbox);
- }
+ /* This stanza checks that an object's marker style agrees with
+ * the marker objects it has allocated. sp_shape_set_marker ensures
+ * that the appropriate marker objects are present (or absent) to
+ * match the style.
+ */
+ for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
+ sp_shape_set_marker (object, i, object->style->marker[i].value);
+ }
- if (sp_shape_has_markers (shape)) {
+ if (sp_shape_has_markers (shape)) {
- /* Dimension the marker views */
- if (!arenaitem->key) {
- NR_ARENA_ITEM_SET_KEY (arenaitem, sp_item_display_key_new (SP_MARKER_LOC_QTY));
- }
+ /* provide key and dimension the marker views */
+ if (!arenaitem->key) {
+ NR_ARENA_ITEM_SET_KEY (arenaitem, sp_item_display_key_new (SP_MARKER_LOC_QTY));
+ }
- for (int i = 0; i < SP_MARKER_LOC_QTY; i++) {
- if (shape->marker[i]) {
- sp_marker_show_dimension ((SPMarker *) shape->marker[i],
- NR_ARENA_ITEM_GET_KEY (arenaitem) + i - SP_MARKER_LOC,
- sp_shape_number_of_markers (shape, i));
- }
+ for (int i = 0; i < SP_MARKER_LOC_QTY; i++) {
+ if (shape->marker[i]) {
+ sp_marker_show_dimension ((SPMarker *) shape->marker[i],
+ NR_ARENA_ITEM_GET_KEY (arenaitem) + i - SP_MARKER_LOC,
+ sp_shape_number_of_markers (shape, i));
}
+ }
+ /* Update marker views */
+ sp_shape_update_marker_view (shape, arenaitem);
+ }
- /* Update marker views */
- sp_shape_update_marker_view (shape, arenaitem);
- }
-
- return arenaitem;
+ return arenaitem;
}
/**
/* nr_arena_item_set_mask (v->arenaitem, NULL); */
}
/* Detach marker */
- sp_signal_disconnect_by_data (shape->marker[i], item);
+ shape->release_connect[i].disconnect();
+ shape->modified_connect[i].disconnect();
shape->marker[i] = sp_object_hunref (shape->marker[i], item);
}
}
@@ -1030,7 +1034,7 @@ sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner)
/**
* Return all nodes in a path that are to be considered for snapping
*/
-static void sp_shape_snappoints(SPItem const *item, SnapPointsIter p)
+static void sp_shape_snappoints(SPItem const *item, SnapPointsIter p, Inkscape::SnapPreferences const *snapprefs)
{
g_assert(item != NULL);
g_assert(SP_IS_SHAPE(item));
Geom::NodeType nodetype = Geom::get_nodetype(*curve_it1, *curve_it2);
- // Only add cusp nodes. TODO: Shouldn't this be a preference instead?
- if (nodetype == Geom::NODE_NONE) {
- *p = from_2geom(curve_it1->finalPoint() * i2d);
- }
- if (nodetype == Geom::NODE_CUSP) {
+ // Depending on the snapping preferences, either add only cusp nodes, or add add both cusp and smooths nodes
+ if (snapprefs->getSnapSmoothNodes() || nodetype == Geom::NODE_NONE || nodetype == Geom::NODE_CUSP) {
*p = from_2geom(curve_it1->finalPoint() * i2d);
}
-
+
++curve_it1;
++curve_it2;
}