diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-05-10 22:24:53 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-05-10 22:24:53 +0000 |
| commit | 41a39c7fbd71fa3327a5f8a259d25bebcdd90710 (patch) | |
| tree | cf874d8ac8d0332287a831ff161d68df0813b2f2 /src/sp-item.cpp | |
| parent | fix a minor bug calculating max time (diff) | |
| parent | Fix for bug 1194091 (diff) | |
| download | inkscape-41a39c7fbd71fa3327a5f8a259d25bebcdd90710.tar.gz inkscape-41a39c7fbd71fa3327a5f8a259d25bebcdd90710.zip | |
update to trunk
(bzr r13645.1.93)
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
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<SPObject &> bottom=find_last_if( - reverse_list<SPObject::SiblingIterator>( - parent->firstChild(), this - ), - MutableList<SPObject &>(), - &is_item - ); + SPObject * bottom=parent->firstChild(); + while(dynamic_cast<SPObject*>(bottom) && dynamic_cast<SPObject*>(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<SPItem*>(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) { |
