From 2f08c2af203444acbea58eb5f521013780626ee5 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 16 Aug 2015 21:11:47 +0200 Subject: fix for ungrouping dynamic offset displacement bug Fixed bugs: - https://launchpad.net/bugs/844909 (bzr r14305) --- src/sp-item-group.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 72cd5d7fa..5d96899b1 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -465,7 +465,7 @@ sp_item_group_ungroup (SPGroup *group, std::vector &children, bool do_d Inkscape::XML::Node *nrepr = child->getRepr()->duplicate(prepr->document()); // Merging transform - Geom::Affine ctrans; + Geom::Affine ctrans = citem->transform * g; // 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)); @@ -476,13 +476,9 @@ sp_item_group_ungroup (SPGroup *group, std::vector &children, bool do_d source = sp_offset_get_source(dynamic_cast(source)); } if (source != NULL && // If true then we must be dealing with a linked offset ... - group->isAncestorOf(source) == false) { // ... of which the source is not in the same group - ctrans = citem->transform * g; // then we should apply the transformation of the group to the offset - } else { - ctrans = citem->transform; + group->isAncestorOf(source) ) { // ... of which the source is in the same group + ctrans = citem->transform; // then we should apply the transformation of the group to the offset } - } else { - ctrans = citem->transform * g; } // FIXME: constructing a transform that would fully preserve the appearance of a -- cgit v1.2.3 From c54db8d887cae2bd6dd326a10f976c726f905e7d Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 7 Dec 2015 21:19:14 +0100 Subject: static code analysis (bzr r14509) --- src/sp-item-group.cpp | 20 ++++++++++---------- 1 file changed, 10 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 5d96899b1..8cd0bf8d3 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -162,7 +162,7 @@ void SPGroup::update(SPCtx *ctx, unsigned int flags) { } childflags &= SP_OBJECT_MODIFIED_CASCADE; std::vector l=this->childList(true, SPObject::ActionUpdate); - for(std::vector ::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector ::const_iterator i=l.begin();i!=l.end();++i){ SPObject *child = *i; if (childflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { @@ -206,7 +206,7 @@ void SPGroup::modified(guint flags) { flags &= SP_OBJECT_MODIFIED_CASCADE; std::vector l=this->childList(true); - for(std::vector::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector::const_iterator i=l.begin();i!=l.end();++i){ SPObject *child = *i; if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { @@ -280,7 +280,7 @@ Geom::OptRect SPGroup::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox // TODO CPPIFY: replace this const_cast later std::vector l = const_cast(this)->childList(false, SPObject::ActionBBox); - for(std::vector::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector::const_iterator i=l.begin();i!=l.end();++i){ SPObject *o = *i; SPItem *item = dynamic_cast(o); if (item && !item->isHidden()) { @@ -294,7 +294,7 @@ Geom::OptRect SPGroup::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox void SPGroup::print(SPPrintContext *ctx) { std::vector l=this->childList(false); - for(std::vector::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector::const_iterator i=l.begin();i!=l.end();++i){ SPObject *o = *i; SPItem *item = dynamic_cast(o); if (item) { @@ -348,7 +348,7 @@ Inkscape::DrawingItem *SPGroup::show (Inkscape::Drawing &drawing, unsigned int k void SPGroup::hide (unsigned int key) { std::vector l=this->childList(false, SPObject::ActionShow); - for(std::vector::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector::const_iterator i=l.begin();i!=l.end();++i){ SPObject *o = *i; SPItem *item = dynamic_cast(o); @@ -373,7 +373,7 @@ void SPGroup::snappoints(std::vector &p, Inkscape: void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) { - for(std::list::const_iterator refd=parent->hrefList.begin();refd!=parent->hrefList.end();refd++){ + for(std::list::const_iterator refd=parent->hrefList.begin();refd!=parent->hrefList.end();++refd){ SPItem *citem = dynamic_cast(*refd); if (citem && !citem->cloned) { SPUse *useitem = dynamic_cast(citem); @@ -781,7 +781,7 @@ gint SPGroup::getItemCount() const { void SPGroup::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) { Inkscape::DrawingItem *ac = NULL; std::vector l=this->childList(false, SPObject::ActionShow); - for(std::vector::const_iterator i=l.begin();i!=l.end();i++){ + for(std::vector::const_iterator i=l.begin();i!=l.end();++i){ SPObject *o = *i; SPItem * child = dynamic_cast(o); if (child) { @@ -800,7 +800,7 @@ void SPGroup::update_patheffect(bool write) { std::vector const item_list = sp_item_group_item_list(this); - for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *subitem = *iter; SPLPEItem *lpeItem = dynamic_cast(subitem); @@ -810,7 +810,7 @@ void SPGroup::update_patheffect(bool write) { } if (hasPathEffect() && pathEffectsEnabled()) { - for (PathEffectList::iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); it++) + for (PathEffectList::iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); ++it) { LivePathEffectObject *lpeobj = (*it)->lpeobject; @@ -828,7 +828,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) { std::vector const item_list = sp_item_group_item_list(group); - for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();iter++) { + for ( std::vector::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *subitem = *iter; SPGroup *subGroup = dynamic_cast(subitem); -- cgit v1.2.3 From d0e818f6aab594de812e51550a8b81838f3f783d Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 7 Dec 2015 21:38:35 +0100 Subject: static code analysis (bzr r14511) --- src/sp-item-group.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 8cd0bf8d3..83d67cf5a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -58,8 +58,11 @@ using Inkscape::DocumentUndo; static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write); -SPGroup::SPGroup() : SPLPEItem() { - this->_layer_mode = SPGroup::GROUP; +SPGroup::SPGroup() : SPLPEItem(), + _expanded(false), + _insertBottom(false), + _layer_mode(SPGroup::GROUP) +{ } SPGroup::~SPGroup() { @@ -90,10 +93,9 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) if ( item ) { /* TODO: this should be moved into SPItem somehow */ SPItemView *v; - Inkscape::DrawingItem *ac; for (v = this->display; v != NULL; v = v->next) { - ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); + Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); if (ac) { v->arenaitem->appendChild(ac); @@ -105,12 +107,10 @@ void SPGroup::child_added(Inkscape::XML::Node* child, Inkscape::XML::Node* ref) if ( item ) { /* TODO: this should be moved into SPItem somehow */ SPItemView *v; - Inkscape::DrawingItem *ac; - unsigned position = item->pos_in_parent(); for (v = this->display; v != NULL; v = v->next) { - ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); + Inkscape::DrawingItem *ac = item->invoke_show (v->arenaitem->drawing(), v->key, v->flags); if (ac) { v->arenaitem->prependChild(ac); -- cgit v1.2.3