X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsplivarot.cpp;h=feba2cab6b0ee522b2cd5f02f8f4e5699520c082;hb=e51e77b1ae5ed3ffa90c30fc971b35b5484ce148;hp=c57c58a1421285bd6272023a6fb1932235321b11;hpb=06aecef405c4cf6f7551ab622c3040562cb62c78;p=inkscape.git diff --git a/src/splivarot.cpp b/src/splivarot.cpp index c57c58a14..feba2cab6 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -127,8 +127,8 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb } if (g_slist_length(il) > 2) { - if (bop == bool_op_diff || bop == bool_op_symdiff || bop == bool_op_cut || bop == bool_op_slice ) { - desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select exactly 2 paths to perform difference, XOR, division, or path cut.")); + if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { + desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Select exactly 2 paths to perform difference, division, or path cut.")); return; } } @@ -138,8 +138,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb // topmost object (differences, cuts) bool reverseOrderForOp = false; - // mettre les elements de la liste dans l'ordre pour ces operations - if (bop == bool_op_diff || bop == bool_op_symdiff || bop == bool_op_cut || bop == bool_op_slice) { + if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice) { // check in the tree to find which element of the selection list is topmost (for 2-operand commands only) Inkscape::XML::Node *a = SP_OBJECT_REPR(il->data); Inkscape::XML::Node *b = SP_OBJECT_REPR(il->next->data); @@ -431,7 +430,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb // get the source path object SPObject *source; - if ( bop == bool_op_diff || bop == bool_op_symdiff || bop == bool_op_cut || bop == bool_op_slice ) { + if ( bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { if (reverseOrderForOp) { source = SP_OBJECT(il->data); } else { @@ -858,46 +857,52 @@ sp_selected_path_outline(SPDesktop *desktop) Geom::PathVector const & pathv = curve->get_pathvector(); for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - if ( SPObject *marker_obj = shape->marker[SP_MARKER_LOC_START] ) { - Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); - sp_selected_path_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc ); + for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( SPObject *marker_obj = shape->marker[i] ) { + Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } } - SPObject *midmarker_obj = shape->marker[SP_MARKER_LOC_MID]; - if ( midmarker_obj && (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 - */ - Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - sp_selected_path_outline_add_marker(midmarker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc); - - ++curve_it1; - ++curve_it2; + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + SPObject *midmarker_obj = shape->marker[i]; + if ( midmarker_obj && (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 + */ + Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + sp_selected_path_outline_add_marker(midmarker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc); + + ++curve_it1; + ++curve_it2; + } } } - if ( SPObject *marker_obj = 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]; + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if ( SPObject *marker_obj = shape->marker[i] ) { + /* 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]; - Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); - sp_selected_path_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc ); + Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } } } @@ -1584,6 +1589,9 @@ sp_selected_path_simplify_item(SPDesktop *desktop, g_free(clip_path); } + // restore path effect + repr->setAttribute("inkscape:path-effect", patheffect); + // path gchar *str = orig->svg_dump_path(); if (patheffect) @@ -1606,9 +1614,6 @@ sp_selected_path_simplify_item(SPDesktop *desktop, // reapply the transform sp_item_write_transform(newitem, repr, transform); - // restore path effect - repr->setAttribute("inkscape:path-effect", patheffect); - // restore title & description if (title) { newitem->setTitle(title);