From a7f2b2ba3f13ceb60376802f4a31e104153839e8 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 17 Feb 2015 03:00:37 +0100 Subject: At first, I was thinking "I just have to go to the selection file, and change that GSList* with a std::list, then resolve the few problems" So, i tried that. And I will continue tomorrow, and the days after, on and on. (bzr r13922.1.1) --- src/splivarot.cpp | 102 +++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 55 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 8bb3e9897..aec7051e0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -60,6 +60,11 @@ using Inkscape::DocumentUndo; bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who); +//SHOULD DISAPPEAR +bool sp_repr_compare_position_obj(SPObject* &a,SPObject* &b){ + return sp_repr_compare_position(dynamic_cast(a),dynamic_cast(b)); +} + void sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool_op bop, const unsigned int verb=SP_VERB_NONE, const Glib::ustring description=""); void sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset); void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updating); @@ -326,21 +331,21 @@ void sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool_op bop, const unsigned int verb, const Glib::ustring description) { SPDocument *doc = selection->layers()->getDocument(); - GSList *il = (GSList *) selection->itemList(); + SelContainer il= selection->itemList(); // allow union on a single object for the purpose of removing self overlapse (svn log, revision 13334) - if ( (g_slist_length(il) < 2) && (bop != bool_op_union)) { + if ( (il.size() < 2) && (bop != bool_op_union)) { boolop_display_error_message(desktop, _("Select at least 2 paths to perform a boolean operation.")); return; } - else if ( g_slist_length(il) < 1 ) { + else if ( il.size() < 1 ) { boolop_display_error_message(desktop, _("Select at least 1 path to perform a boolean union.")); return; } - g_assert(il != NULL); + g_assert(!il.empty()); - if (g_slist_length(il) > 2) { + if (il.size() > 2) { if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { boolop_display_error_message(desktop, _("Select exactly 2 paths to perform difference, division, or path cut.")); return; @@ -354,8 +359,8 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool 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(il->data)->getRepr(); - Inkscape::XML::Node *b = SP_OBJECT(il->next->data)->getRepr(); + Inkscape::XML::Node *a = SP_OBJECT(il.front())->getRepr(); + Inkscape::XML::Node *b = SP_OBJECT(il.back())->getRepr(); if (a == NULL || b == NULL) { boolop_display_error_message(desktop, _("Unable to determine the z-order of the objects selected for difference, XOR, division, or path cut.")); @@ -394,38 +399,36 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool } } - il = g_slist_copy(il); - g_assert(il != NULL); + g_assert(!il.empty()); // first check if all the input objects have shapes // otherwise bail out - for (GSList *l = il; l != NULL; l = l->next) + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++) { - SPItem *item = SP_ITEM(l->data); + SPItem *item = SP_ITEM(*l); if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item) && !SP_IS_FLOWTEXT(item)) { boolop_display_error_message(desktop, _("One of the objects is not a path, cannot perform boolean operation.")); - g_slist_free(il); return; } } // extract the livarot Paths from the source objects // also get the winding rule specified in the style - int nbOriginaux = g_slist_length(il); + int nbOriginaux = il.size(); std::vector originaux(nbOriginaux); std::vector origWind(nbOriginaux); int curOrig; { curOrig = 0; - for (GSList *l = il; l != NULL; l = l->next) + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++) { // apply live path effects prior to performing boolean operation - if (SP_IS_LPE_ITEM(l->data)) { - SP_LPE_ITEM(l->data)->removeAllPathEffects(true); + if (SP_IS_LPE_ITEM(*l)) { + SP_LPE_ITEM(*l)->removeAllPathEffects(true); } - SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast(il->data)->getRepr(), "style"); + SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast(il.front())->getRepr(), "style"); gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); if (val && strcmp(val, "nonzero") == 0) { origWind[curOrig]= fill_nonZero; @@ -435,11 +438,10 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool origWind[curOrig]= fill_nonZero; } - originaux[curOrig] = Path_for_item((SPItem *) l->data, true, true); + originaux[curOrig] = Path_for_item((SPItem *) (*l), true, true); if (originaux[curOrig] == NULL || originaux[curOrig]->descr_cmd.size() <= 1) { for (int i = curOrig; i >= 0; i--) delete originaux[i]; - g_slist_free(il); return; } curOrig++; @@ -472,7 +474,8 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool theShapeA->ConvertToShape(theShape, origWind[0]); curOrig = 1; - for (GSList *l = il->next; l != NULL; l = l->next) { + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + if(*l==il.front())continue; originaux[curOrig]->ConvertWithBackData(0.1); originaux[curOrig]->Fill(theShape, curOrig); @@ -668,15 +671,13 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool if (res->descr_cmd.size() <= 1) { // only one command, presumably a moveto: it isn't a path - for (GSList *l = il; l != NULL; l = l->next) - { - SP_OBJECT(l->data)->deleteObject(); + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + SP_OBJECT(*l)->deleteObject(); } DocumentUndo::done(doc, SP_VERB_NONE, description); selection->clear(); delete res; - g_slist_free(il); return; } @@ -684,19 +685,17 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool SPObject *source; if ( bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { if (reverseOrderForOp) { - source = SP_OBJECT(il->data); + source = SP_OBJECT(il.front()); } else { - source = SP_OBJECT(il->next->data); + source = SP_OBJECT(il.back()); } } else { // find out the bottom object - GSList *sorted = g_slist_copy((GSList *) selection->reprList()); - - sorted = g_slist_sort(sorted, (GCompareFunc) sp_repr_compare_position); + SelContainer sorted(selection->reprList()); - source = doc->getObjectByRepr((Inkscape::XML::Node *)sorted->data); + sorted.sort(sp_repr_compare_position_obj); - g_slist_free(sorted); + source = doc->getObjectByRepr((Inkscape::XML::Node *)sorted.front()); } // adjust style properties that depend on a possible transform in the source object in order @@ -721,17 +720,16 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool gchar *desc = source->desc(); // remove source paths selection->clear(); - for (GSList *l = il; l != NULL; l = l->next) { + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ // if this is the bottommost object, - if (!strcmp(reinterpret_cast(l->data)->getRepr()->attribute("id"), id)) { + if (!strcmp(reinterpret_cast(*l)->getRepr()->attribute("id"), id)) { // delete it so that its clones don't get alerted; this object will be restored shortly, with the same id - SP_OBJECT(l->data)->deleteObject(false); + SP_OBJECT(*l)->deleteObject(false); } else { // delete the object for real, so that its clones can take appropriate action - SP_OBJECT(l->data)->deleteObject(); + SP_OBJECT(*l)->deleteObject(); } } - g_slist_free(il); // premultiply by the inverse of parent's repr SPItem *parent_item = SP_ITEM(doc->getObjectByRepr(parent)); @@ -1159,12 +1157,9 @@ sp_selected_path_outline(SPDesktop *desktop) } bool did = false; - - for (GSList *items = g_slist_copy((GSList *) selection->itemList()); - items != NULL; - items = items->next) { - - SPItem *item = SP_ITEM(items->data); + SelContainer il(selection->itemList()); + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + SPItem *item = SP_ITEM(*l); if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) continue; @@ -1774,12 +1769,9 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } bool did = false; - - for (GSList *items = g_slist_copy((GSList *) selection->itemList()); - items != NULL; - items = items->next) { - - SPItem *item = SP_ITEM(items->data); + SelContainer il(selection->itemList()); + for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + SPItem *item = SP_ITEM(*l); SPCurve *curve = NULL; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) @@ -1975,7 +1967,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) static bool sp_selected_path_simplify_items(SPDesktop *desktop, - Inkscape::Selection *selection, GSList *items, + Inkscape::Selection *selection, SelContainer &items, float threshold, bool justCoalesce, float angleLimit, bool breakableAngles, bool modifySelection); @@ -1994,7 +1986,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, //If this is a group, do the children instead if (SP_IS_GROUP(item)) { - GSList *items = sp_item_group_item_list(SP_GROUP(item)); + SelContainer items = sp_item_group_item_list(SP_GROUP(item)); return sp_selected_path_simplify_items(desktop, selection, items, threshold, justCoalesce, @@ -2119,7 +2111,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, bool sp_selected_path_simplify_items(SPDesktop *desktop, - Inkscape::Selection *selection, GSList *items, + Inkscape::Selection *selection, SelContainer &items, float threshold, bool justCoalesce, float angleLimit, bool breakableAngles, bool modifySelection) @@ -2145,13 +2137,13 @@ sp_selected_path_simplify_items(SPDesktop *desktop, gdouble simplifySize = selectionSize; int pathsSimplified = 0; - int totalPathCount = g_slist_length(items); + int totalPathCount = items.size(); // set "busy" cursor desktop->setWaitingCursor(); - for (; items != NULL; items = items->next) { - SPItem *item = (SPItem *) items->data; + for (SelContainer::const_iterator l = items.begin(); l != items.end(); l++){ + SPItem *item = SP_ITEM(*l); if (!(SP_IS_GROUP(item) || SP_IS_SHAPE(item) || SP_IS_TEXT(item))) continue; @@ -2199,7 +2191,7 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju return; } - GSList *items = g_slist_copy((GSList *) selection->itemList()); + SelContainer items(selection->itemList()); bool didSomething = sp_selected_path_simplify_items(desktop, selection, items, threshold, -- cgit v1.2.3 From 9e21d00fb1053897420f80d05a9815c5b2bbf312 Mon Sep 17 00:00:00 2001 From: mc <> Date: Wed, 18 Feb 2015 11:25:23 +0100 Subject: I can't really understand why, but i can now launch inkscape without it segfaulting. That's an improvement. Next thing: code cleaning, replacing containers with vectors (bzr r13922.1.4) --- src/splivarot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index aec7051e0..107dfc629 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -691,11 +691,11 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool } } else { // find out the bottom object - SelContainer sorted(selection->reprList()); + std::vector sorted(selection->reprList()); - sorted.sort(sp_repr_compare_position_obj); + sort(sorted.begin(),sorted.end(),sp_repr_compare_position); - source = doc->getObjectByRepr((Inkscape::XML::Node *)sorted.front()); + source = doc->getObjectByRepr(sorted.front()); } // adjust style properties that depend on a possible transform in the source object in order -- cgit v1.2.3 From 5fd00cab14d48beaf2279a2b8f3ad5b02b76c87b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 19 Feb 2015 04:25:21 +0100 Subject: Put a few std::vector (bzr r13922.1.5) --- src/splivarot.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 107dfc629..6e47dfff3 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -331,7 +331,7 @@ void sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool_op bop, const unsigned int verb, const Glib::ustring description) { SPDocument *doc = selection->layers()->getDocument(); - SelContainer il= selection->itemList(); + std::vector il= selection->itemList(); // allow union on a single object for the purpose of removing self overlapse (svn log, revision 13334) if ( (il.size() < 2) && (bop != bool_op_union)) { @@ -403,7 +403,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // first check if all the input objects have shapes // otherwise bail out - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++) + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++) { SPItem *item = SP_ITEM(*l); if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item) && !SP_IS_FLOWTEXT(item)) @@ -421,7 +421,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool int curOrig; { curOrig = 0; - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++) + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++) { // apply live path effects prior to performing boolean operation if (SP_IS_LPE_ITEM(*l)) { @@ -474,7 +474,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool theShapeA->ConvertToShape(theShape, origWind[0]); curOrig = 1; - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ if(*l==il.front())continue; originaux[curOrig]->ConvertWithBackData(0.1); @@ -671,7 +671,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool if (res->descr_cmd.size() <= 1) { // only one command, presumably a moveto: it isn't a path - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ SP_OBJECT(*l)->deleteObject(); } DocumentUndo::done(doc, SP_VERB_NONE, description); @@ -720,7 +720,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool gchar *desc = source->desc(); // remove source paths selection->clear(); - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ // if this is the bottommost object, if (!strcmp(reinterpret_cast(*l)->getRepr()->attribute("id"), id)) { // delete it so that its clones don't get alerted; this object will be restored shortly, with the same id @@ -1157,8 +1157,8 @@ sp_selected_path_outline(SPDesktop *desktop) } bool did = false; - SelContainer il(selection->itemList()); - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + std::vector il(selection->itemList()); + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ SPItem *item = SP_ITEM(*l); if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) @@ -1769,8 +1769,8 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) } bool did = false; - SelContainer il(selection->itemList()); - for (SelContainer::const_iterator l = il.begin(); l != il.end(); l++){ + std::vector il(selection->itemList()); + for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ SPItem *item = SP_ITEM(*l); SPCurve *curve = NULL; @@ -1967,7 +1967,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) static bool sp_selected_path_simplify_items(SPDesktop *desktop, - Inkscape::Selection *selection, SelContainer &items, + Inkscape::Selection *selection, std::vector &items, float threshold, bool justCoalesce, float angleLimit, bool breakableAngles, bool modifySelection); @@ -1986,7 +1986,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, //If this is a group, do the children instead if (SP_IS_GROUP(item)) { - SelContainer items = sp_item_group_item_list(SP_GROUP(item)); + std::vector items = sp_item_group_item_list(SP_GROUP(item)); return sp_selected_path_simplify_items(desktop, selection, items, threshold, justCoalesce, @@ -2111,7 +2111,7 @@ sp_selected_path_simplify_item(SPDesktop *desktop, bool sp_selected_path_simplify_items(SPDesktop *desktop, - Inkscape::Selection *selection, SelContainer &items, + Inkscape::Selection *selection, std::vector &items, float threshold, bool justCoalesce, float angleLimit, bool breakableAngles, bool modifySelection) @@ -2142,7 +2142,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, // set "busy" cursor desktop->setWaitingCursor(); - for (SelContainer::const_iterator l = items.begin(); l != items.end(); l++){ + for (std::vector::const_iterator l = items.begin(); l != items.end(); l++){ SPItem *item = SP_ITEM(*l); if (!(SP_IS_GROUP(item) || SP_IS_SHAPE(item) || SP_IS_TEXT(item))) @@ -2191,7 +2191,7 @@ sp_selected_path_simplify_selection(SPDesktop *desktop, float threshold, bool ju return; } - SelContainer items(selection->itemList()); + std::vector items(selection->itemList()); bool didSomething = sp_selected_path_simplify_items(desktop, selection, items, threshold, -- cgit v1.2.3 From 9a7fa4d1899d30ec745107823f307b2a0bf3172f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 03:10:36 +0100 Subject: corrected the casts (hopefully) (bzr r13922.1.10) --- src/splivarot.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 6e47dfff3..bc09802f0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -60,11 +60,6 @@ using Inkscape::DocumentUndo; bool Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who); -//SHOULD DISAPPEAR -bool sp_repr_compare_position_obj(SPObject* &a,SPObject* &b){ - return sp_repr_compare_position(dynamic_cast(a),dynamic_cast(b)); -} - void sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool_op bop, const unsigned int verb=SP_VERB_NONE, const Glib::ustring description=""); void sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset); void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updating); @@ -405,7 +400,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // otherwise bail out for (std::vector::const_iterator l = il.begin(); l != il.end(); l++) { - SPItem *item = SP_ITEM(*l); + SPItem *item = *l; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item) && !SP_IS_FLOWTEXT(item)) { boolop_display_error_message(desktop, _("One of the objects is not a path, cannot perform boolean operation.")); @@ -428,7 +423,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool SP_LPE_ITEM(*l)->removeAllPathEffects(true); } - SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast(il.front())->getRepr(), "style"); + SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast(il[0])->getRepr(), "style"); gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); if (val && strcmp(val, "nonzero") == 0) { origWind[curOrig]= fill_nonZero; @@ -438,7 +433,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool origWind[curOrig]= fill_nonZero; } - originaux[curOrig] = Path_for_item((SPItem *) (*l), true, true); + originaux[curOrig] = Path_for_item(*l, true, true); if (originaux[curOrig] == NULL || originaux[curOrig]->descr_cmd.size() <= 1) { for (int i = curOrig; i >= 0; i--) delete originaux[i]; @@ -475,7 +470,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool curOrig = 1; for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ - if(*l==il.front())continue; + if(*l==il[0])continue; originaux[curOrig]->ConvertWithBackData(0.1); originaux[curOrig]->Fill(theShape, curOrig); @@ -685,7 +680,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool SPObject *source; if ( bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { if (reverseOrderForOp) { - source = SP_OBJECT(il.front()); + source = SP_OBJECT(il[0]); } else { source = SP_OBJECT(il.back()); } @@ -1159,7 +1154,7 @@ sp_selected_path_outline(SPDesktop *desktop) bool did = false; std::vector il(selection->itemList()); for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ - SPItem *item = SP_ITEM(*l); + SPItem *item = *l; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) continue; @@ -1771,7 +1766,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) bool did = false; std::vector il(selection->itemList()); for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ - SPItem *item = SP_ITEM(*l); + SPItem *item = *l; SPCurve *curve = NULL; if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) @@ -2143,7 +2138,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, desktop->setWaitingCursor(); for (std::vector::const_iterator l = items.begin(); l != items.end(); l++){ - SPItem *item = SP_ITEM(*l); + SPItem *item = *l; if (!(SP_IS_GROUP(item) || SP_IS_SHAPE(item) || SP_IS_TEXT(item))) continue; -- cgit v1.2.3 From 9bdc157f705ca61516e599cb416580283d21ec35 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 27 Feb 2015 04:21:48 +0100 Subject: more cast cleanup (bzr r13922.1.11) --- src/splivarot.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index bc09802f0..c668199c0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -667,7 +667,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool { // only one command, presumably a moveto: it isn't a path for (std::vector::const_iterator l = il.begin(); l != il.end(); l++){ - SP_OBJECT(*l)->deleteObject(); + (*l)->deleteObject(); } DocumentUndo::done(doc, SP_VERB_NONE, description); selection->clear(); @@ -680,9 +680,9 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool SPObject *source; if ( bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice ) { if (reverseOrderForOp) { - source = SP_OBJECT(il[0]); + source = il[0]; } else { - source = SP_OBJECT(il.back()); + source = il.back(); } } else { // find out the bottom object @@ -719,10 +719,10 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // if this is the bottommost object, if (!strcmp(reinterpret_cast(*l)->getRepr()->attribute("id"), id)) { // delete it so that its clones don't get alerted; this object will be restored shortly, with the same id - SP_OBJECT(*l)->deleteObject(false); + (*l)->deleteObject(false); } else { // delete the object for real, so that its clones can take appropriate action - SP_OBJECT(*l)->deleteObject(); + (*l)->deleteObject(); } } -- cgit v1.2.3 From 643c75ddbbbea2f018050faa1e7e38c71482418a Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 28 Apr 2015 01:20:57 +0200 Subject: removed a few useless SP_OBJECT() casts (bzr r13922.1.17) --- src/splivarot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index a04dedda9..f61a30462 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -354,8 +354,8 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool 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(il.front())->getRepr(); - Inkscape::XML::Node *b = SP_OBJECT(il.back())->getRepr(); + Inkscape::XML::Node *a = il.front()->getRepr(); + Inkscape::XML::Node *b = il.back()->getRepr(); if (a == NULL || b == NULL) { boolop_display_error_message(desktop, _("Unable to determine the z-order of the objects selected for difference, XOR, division, or path cut.")); -- cgit v1.2.3 From 6307c00b5774db5e914415127b302cca5e21345b Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 1 May 2015 02:26:56 +0200 Subject: Fixed crash bug due to some overlooked function changed in the recent merge. Also fixed the layer ordering in the widget, which was messed up by the same bug in a way i haven't quite sorted out (so the fact that this patch fixed it is quite a mystery, but i won't complain) (bzr r14079) --- src/splivarot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index f61a30462..bec300936 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -688,7 +688,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // find out the bottom object std::vector sorted(selection->reprList()); - sort(sorted.begin(),sorted.end(),sp_repr_compare_position); + sort(sorted.begin(),sorted.end(),sp_repr_compare_position_bool); source = doc->getObjectByRepr(sorted.front()); } -- cgit v1.2.3