From 45b5e7ad68a9166a61f96b3ffc469818a2bf4fcd Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Thu, 15 Jan 2015 14:03:17 -0500 Subject: during copy and paste, scale stock symbols from units of 'px' to 'document-units'. (Bug 1365451) Fixed bugs: - https://launchpad.net/bugs/1365451 (bzr r13853) --- src/sp-item-group.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index acf8b2012..b1ba37de2 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -727,8 +727,8 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo group->scaleChildItemsRec(sc, p, false); } } else { - Geom::OptRect bbox = item->desktopVisualBounds(); - if (bbox) { +// Geom::OptRect bbox = item->desktopVisualBounds(); +// if (bbox) { // test not needed, this was causing a failure to scale and in the clipboard, see LP Bug 1365451 // Scale item Geom::Translate const s(p); Geom::Affine final = s.inverse() * sc * s; @@ -789,7 +789,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo item->scaleCenter(sc); // All coordinates have been scaled, so also the center must be scaled item->updateRepr(); } - } +// } } } } -- cgit v1.2.3 From 55361947a1fbfc1c64fbb424ce845cd081d936ec Mon Sep 17 00:00:00 2001 From: mc <> Date: Mon, 16 Feb 2015 12:54:33 +0100 Subject: Clones. Fix for bug #1245339 (When changing a clone's parent's layer, the clones shift position) and bug #653574 (Ungrouping moves clones inside nested groups). Fixed bugs: - https://launchpad.net/bugs/653574 - https://launchpad.net/bugs/1245339 (bzr r13924) --- src/sp-item-group.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index b1ba37de2..35840e01a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -399,6 +399,26 @@ void SPGroup::snappoints(std::vector &p, Inkscape: } } +void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g) +{ + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { + SPItem *citem = dynamic_cast(child); + if (citem) { + SPUse *useitem = dynamic_cast(citem); + if (useitem && useitem->get_original() == parent) { + Geom::Affine ctrans; + ctrans = g.inverse() * citem->transform; + gchar *affinestr = sp_svg_transform_write(ctrans); + citem->setAttribute("transform", affinestr); + g_free(affinestr); + } + SPGroup *groupitem = dynamic_cast(citem); + if (groupitem) { + sp_item_group_ungroup_handle_clones(groupitem,parent,g); + } + } + } +} void sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) @@ -435,8 +455,14 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { + Geom::Affine const g(group->transform); + + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) + if (SPItem *citem = dynamic_cast(child)) + sp_item_group_ungroup_handle_clones(root,citem,g); + + for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { SPItem *citem = dynamic_cast(child); if (citem) { /* Merging of style */ @@ -472,13 +498,6 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) // Merging transform Geom::Affine ctrans; - Geom::Affine const g(group->transform); - SPUse *useitem = dynamic_cast(citem); - if (useitem && useitem->get_original() && - useitem->get_original()->parent == dynamic_cast(group)) { - // make sure a clone's effective transform is the same as was under group - ctrans = g.inverse() * citem->transform * g; - } else { // We should not apply the group's transformation to both a linked offset AND to its source if (dynamic_cast(citem)) { // Do we have an offset at hand (whether it's dynamic or linked)? SPItem *source = sp_offset_get_source(dynamic_cast(citem)); @@ -497,7 +516,6 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) } else { ctrans = citem->transform * g; } - } // FIXME: constructing a transform that would fully preserve the appearance of a // textpath if it is ungrouped with its path seems to be impossible in general -- cgit v1.2.3 From 709d05b70d2e284fd1594be23aaca6ae55e2abf2 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Thu, 19 Feb 2015 11:47:03 -0500 Subject: scale groups when changing document units. (Bug 1369197) Fixed bugs: - https://launchpad.net/bugs/1369197 (bzr r13926) --- src/sp-item-group.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 35840e01a..3c2053cb2 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -727,21 +727,16 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo subItem = dynamic_cast(item->clip_ref->getObject()->firstChild()); } if (subItem != NULL) { - Geom::Affine tdoc2dt = Geom::Scale(1, -1) * Geom::Translate(p); // re-create doc2dt() - Geom::Affine ti2doc = item->i2doc_affine(); - subItem->set_i2d_affine(ti2doc * sc * ti2doc.inverse() * tdoc2dt); - subItem->doWriteTransform(subItem->getRepr(), subItem->transform, NULL, true); + subItem->doWriteTransform(subItem->getRepr(), subItem->transform*sc, NULL, true); } subItem = NULL; if (item->mask_ref->getObject()) { subItem = dynamic_cast(item->mask_ref->getObject()->firstChild()); } if (subItem != NULL) { - Geom::Affine tdoc2dt = Geom::Scale(1, -1) * Geom::Translate(p); // re-create doc2dt() - Geom::Affine ti2doc = item->i2doc_affine(); - subItem->set_i2d_affine(ti2doc * sc * ti2doc.inverse() * tdoc2dt); - subItem->doWriteTransform(item->getRepr(), item->transform, NULL, true); + subItem->doWriteTransform(subItem->getRepr(), subItem->transform*sc, NULL, true); } + item->doWriteTransform(item->getRepr(), sc.inverse()*item->transform*sc, NULL, true); group->scaleChildItemsRec(sc, p, false); } } else { @@ -795,8 +790,7 @@ void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bo Geom::Affine move = final.inverse() * item->transform * final; item->doWriteTransform(item->getRepr(), move, &move, true); } else { - item->set_i2d_affine(item->i2dt_affine() * final); - item->doWriteTransform(item->getRepr(), item->transform, NULL, true); + item->doWriteTransform(item->getRepr(), item->transform*sc, NULL, true); } if (conn_type != NULL) { -- cgit v1.2.3 From 47d7675c0ec6a65e27e9ff69a8bfd34b621effab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 21 Feb 2015 17:23:30 +0100 Subject: Fix for the performance loss in ungrouping observed by Tavmjong in rev 13933 Added std::list hrefList member to SPObject class. (bzr r13935) --- src/sp-item-group.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 3c2053cb2..0f76051bc 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -399,10 +399,10 @@ void SPGroup::snappoints(std::vector &p, Inkscape: } } -void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g) +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) { - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { - SPItem *citem = dynamic_cast(child); + for(std::list::const_iterator refd=parent->hrefList.begin();refd!=parent->hrefList.end();refd++){ + SPItem *citem = dynamic_cast(*refd); if (citem) { SPUse *useitem = dynamic_cast(citem); if (useitem && useitem->get_original() == parent) { @@ -412,10 +412,6 @@ void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Af citem->setAttribute("transform", affinestr); g_free(affinestr); } - SPGroup *groupitem = dynamic_cast(citem); - if (groupitem) { - sp_item_group_ungroup_handle_clones(groupitem,parent,g); - } } } } @@ -459,7 +455,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) if (SPItem *citem = dynamic_cast(child)) - sp_item_group_ungroup_handle_clones(root,citem,g); + sp_item_group_ungroup_handle_clones(citem,g); for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { -- cgit v1.2.3 From df7828a7a8ba0b7e6c2dd892ca5f0a62ef718bf0 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Tue, 24 Feb 2015 19:22:08 -0500 Subject: create SPObject factory (bzr r13939.1.1) --- src/sp-item-group.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 0f76051bc..0c65bbaed 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -58,16 +58,6 @@ using Inkscape::DocumentUndo; static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write); -#include "sp-factory.h" - -namespace { - SPObject* createGroup() { - return new SPGroup(); - } - - bool groupRegistered = SPFactory::instance().registerObject("svg:g", createGroup); -} - SPGroup::SPGroup() : SPLPEItem() { this->_layer_mode = SPGroup::GROUP; } -- cgit v1.2.3 From c9a989288ac802c9f7ca65f387827a3c2e991741 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 12 Mar 2015 09:19:08 +0100 Subject: Point parameter refactor, Fixes a bug in Lattice2 whith lines. (bzr r13995) --- src/sp-item-group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 0c65bbaed..55857dacf 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -843,7 +843,7 @@ void SPGroup::update_patheffect(bool write) { LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj && lpeobj->get_lpe()) { - lpeobj->get_lpe()->doBeforeEffect(this); + lpeobj->get_lpe()->doBeforeEffect_impl(this); } } -- cgit v1.2.3