Code

Adding the lacking HSL bubbles transparent
[inkscape.git] / src / nodepath.cpp
index b59a2d8655441acb595f84cdacdb996ef8badd18..ad230df75645ee1934933a75418cb3d5798a059f 100644 (file)
@@ -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;
@@ -198,7 +192,10 @@ sp_nodepath_create_helperpaths(Inkscape::NodePath::Path *np) {
             // 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();
             }
         }
     }
@@ -384,7 +381,7 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
 
     // 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);
@@ -1391,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
@@ -3593,7 +3590,7 @@ static void node_grabbed(SPKnot *knot, guint state, gpointer data)
     }
 
     n->is_dragging = true;
-    //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, true);
+    //sp_event_context_snap_window_open(n->subpath->nodepath->desktop->canvas);
     // 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;
 
@@ -3611,7 +3608,7 @@ static void node_ungrabbed(SPKnot */*knot*/, guint /*state*/, gpointer data)
 
    n->dragging_out = NULL;
    n->is_dragging = false;
-   //sp_canvas_set_snap_delay_active(n->subpath->nodepath->desktop->canvas, false);
+   //sp_event_context_snap_window_closed(n->subpath->nodepath->desktop->canvas);
    n->subpath->nodepath->drag_origin_mouse = Geom::Point(NR_HUGE, NR_HUGE);
    sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas);