diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 1899f7978646954de604f1ee60d0e518fa312c48..f9a615583fa438c8689eaec09dfeabe9a88dc656 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -161,11 +161,11 @@ static void sp_nodepath_set_curve (Inkscape::NodePath::Path *np, SPCurve *curve)
Inkscape::NodePath::Node * Inkscape::NodePath::Path::active_node = NULL;
static SPCanvasItem *
-sp_nodepath_make_helper_item(Inkscape::NodePath::Path *np, /*SPDesktop *desktop, */const SPCurve *curve, bool show = false) {
+sp_nodepath_make_helper_item(Inkscape::NodePath::Path *np, /*SPDesktop *desktop, */const SPCurve *curve, bool show = false, guint32 color = 0xff0000ff) {
SPCurve *helper_curve = curve->copy();
helper_curve->transform(np->i2d);
SPCanvasItem *helper_path = sp_canvas_bpath_new(sp_desktop_controls(np->desktop), helper_curve);
- sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
+ sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(helper_path), color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(helper_path), 0, SP_WIND_RULE_NONZERO);
sp_canvas_item_move_to_z(helper_path, 0);
if (show) {
@@ -175,12 +175,6 @@ sp_nodepath_make_helper_item(Inkscape::NodePath::Path *np, /*SPDesktop *desktop,
return helper_path;
}
-static SPCanvasItem *
-canvasitem_from_pathvec(Inkscape::NodePath::Path *np, Geom::PathVector const &pathv, bool show) {
- SPCurve *helper_curve = new SPCurve(pathv);
- return sp_nodepath_make_helper_item(np, helper_curve, show);
-}
-
static void
sp_nodepath_create_helperpaths(Inkscape::NodePath::Path *np) {
//std::map<Inkscape::LivePathEffect::Effect *, std::vector<SPCanvasItem *> > helper_path_vec;
// create new canvas items from the effect's helper paths
std::vector<Geom::PathVector> hpaths = lpe->getHelperPaths(lpeitem);
for (std::vector<Geom::PathVector>::iterator j = hpaths.begin(); j != hpaths.end(); ++j) {
- np->helper_path_vec[lpe].push_back(canvasitem_from_pathvec(np, *j, true));
+ SPCurve *helper_curve = new SPCurve(*j);
+ SPCanvasItem * canvasitem = sp_nodepath_make_helper_item(np, helper_curve, true, 0x509050dd);
+ np->helper_path_vec[lpe].push_back(canvasitem);
+ helper_curve->unref();
}
}
}
/**
* \brief Creates new nodepath from item
*
+ * If repr_key_in is not NULL, object *has* to be a LivePathEffectObject !
+ *
* \todo create proper constructor for nodepath::path, this method returns null a constructor cannot so this cannot be simply converted to constructor.
*/
Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object, bool show_handles, const char * repr_key_in, SPItem *item)
{
+ if (repr_key_in) {
+ g_assert(IS_LIVEPATHEFFECT(object));
+ }
+
Inkscape::XML::Node *repr = object->repr;
/** \todo
np->d2i = np->i2d.inverse();
np->repr = repr;
- if (repr_key_in) { // apparently the object is an LPEObject (this is a dirty check, hopefully nobody tries feeding non-lpeobjects into this method with non-null repr_key_in)
+ if (repr_key_in) { // apparently the object is an LPEObject
np->repr_key = g_strdup(repr_key_in);
np->repr_nodetypes_key = g_strconcat(np->repr_key, "-nodetypes", NULL);
Inkscape::LivePathEffect::Effect * lpe = LIVEPATHEFFECT(object)->get_lpe();
// Draw helper curve
if (np->show_helperpath) {
- np->helper_path = sp_nodepath_make_helper_item(np, /*desktop, */np->curve, true);
+ np->helper_path = sp_nodepath_make_helper_item(np, /*desktop, */np->curve, true, np->helperpath_rgba);
}
sp_nodepath_create_helperpaths(np);
@@ -1385,7 +1388,7 @@ static void sp_nodepath_selected_nodes_move(Inkscape::NodePath::Path *nodepath,
}
// Iterate through all selected nodes
- m.setup(nodepath->desktop, false, SP_PATH(nodepath->item), &unselected_nodes);
+ m.setup(nodepath->desktop, false, nodepath->item, &unselected_nodes);
for (GList *l = nodepath->selected; l != NULL; l = l->next) {
Inkscape::NodePath::Node *n = (Inkscape::NodePath::Node *) l->data;
if (!closest_only || n == closest_node) { //try to snap either all selected nodes or only the closest one
}
n->is_dragging = true;
- //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, true);
// Reconstruct and store the location of the mouse pointer at the time when we started dragging (needed for snapping)
n->subpath->nodepath->drag_origin_mouse = knot->grabbed_rel_pos + knot->drag_origin;
n->dragging_out = NULL;
n->is_dragging = false;
- //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, false);
n->subpath->nodepath->drag_origin_mouse = Geom::Point(NR_HUGE, NR_HUGE);
sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);
} else if ( SP_IS_SHAPE(item) && SP_SHAPE(item)->curve ) {
curve = sp_shape_get_curve (SP_SHAPE(item));
} else if ( SP_IS_TEXT(item) ) {
- curve = SP_TEXT(item)->getNormalizedBpath();
+ // do not display helperpath for text - we cannot do anything with it in Node tool anyway
+ // curve = SP_TEXT(item)->getNormalizedBpath();
+ return NULL;
} else {
g_warning ("-----> sp_nodepath_generate_helperpath(SPDesktop *desktop, SPItem *item): TODO: generate the helper path for this item type!\n");
return NULL;