From 4d75f1ecca2fcab4cbfec9fb84c5b1f3647dbc17 Mon Sep 17 00:00:00 2001 From: Tomasz Boczkowski Date: Wed, 28 May 2014 23:28:17 +0200 Subject: SPPattern c++-sification: replaced function by methods (bzr r13341.6.21) --- src/sp-item.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index b10aae1c6..b6a6e66ef 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1113,16 +1113,16 @@ void SPItem::adjust_pattern (Geom::Affine const &postmul, bool set) if (style && (style->fill.isPaintserver())) { SPObject *server = style->getFillPaintServer(); if ( SP_IS_PATTERN(server) ) { - SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "fill"); - sp_pattern_transform_multiply(pattern, postmul, set); + SPPattern *pattern = SP_PATTERN(server)->clone_if_necessary(this, "fill"); + pattern->transform_multiply(postmul, set); } } if (style && (style->stroke.isPaintserver())) { SPObject *server = style->getStrokePaintServer(); if ( SP_IS_PATTERN(server) ) { - SPPattern *pattern = sp_pattern_clone_if_necessary(this, SP_PATTERN(server), "stroke"); - sp_pattern_transform_multiply(pattern, postmul, set); + SPPattern *pattern = SP_PATTERN(server)->clone_if_necessary(this, "stroke"); + pattern->transform_multiply(postmul, set); } } } -- cgit v1.2.3 From 3b8c4f31de73bd83057bffb8105498ae62be1984 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sun, 10 May 2015 23:55:55 +0200 Subject: Fix for bug 1194091 Fixed bugs: - https://launchpad.net/bugs/1194091 (bzr r14142) --- src/sp-item.cpp | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'src/sp-item.cpp') diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 8c99e9bcf..5445be947 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -349,17 +349,11 @@ void SPItem::lowerToBottom() { using Inkscape::Util::MutableList; using Inkscape::Util::reverse_list; - MutableList bottom=find_last_if( - reverse_list( - parent->firstChild(), this - ), - MutableList(), - &is_item - ); + SPObject * bottom=parent->firstChild(); + while(dynamic_cast(bottom) && dynamic_cast(bottom->next) && bottom!=this && !is_item(*(bottom->next))) bottom=bottom->next; if (bottom) { - ++bottom; Inkscape::XML::Node *ref = ( bottom ? bottom->getRepr() : NULL ); - getRepr()->parent()->changeOrder(getRepr(), ref); + parent->getRepr()->changeOrder(getRepr(), ref); } } @@ -367,20 +361,20 @@ void SPItem::moveTo(SPItem *target, bool intoafter) { Inkscape::XML::Node *target_ref = ( target ? target->getRepr() : NULL ); Inkscape::XML::Node *our_ref = getRepr(); - gboolean first = FALSE; - - if (target_ref == our_ref) { - // Move to ourself ignore - return; - } if (!target_ref) { // Assume move to the "first" in the top node, find the top node - target_ref = our_ref; - while (target_ref->parent() != target_ref->root()) { - target_ref = target_ref->parent(); + intoafter = false; + SPObject* bottom = this->document->getObjectByRepr(our_ref->root())->firstChild(); + while(!dynamic_cast(bottom->next)){ + bottom=bottom->next; } - first = TRUE; + target_ref = bottom->getRepr(); + } + + if (target_ref == our_ref) { + // Move to ourself ignore + return; } if (intoafter) { @@ -391,16 +385,10 @@ void SPItem::moveTo(SPItem *target, bool intoafter) { // Change in parent, need to remove and add our_ref->parent()->removeChild(our_ref); target_ref->parent()->addChild(our_ref, target_ref); - } else if (!first) { + } else { // Same parent, just move our_ref->parent()->changeOrder(our_ref, target_ref); } - - if (first && parent) { - // If "first" ensure it appears after the defs etc - lowerToBottom(); - return; - } } void SPItem::build(SPDocument *document, Inkscape::XML::Node *repr) { -- cgit v1.2.3