summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
commit35d94a8e1c01cd60e4fcf4c15f46fee38c765fca (patch)
treed8366acd729a6a9d4bdc1001f050a43f30d8b7ad /src/sp-item.cpp
parentUndo changes to CMakeLists.txt in 2geom directory after syncs (diff)
parentminor tweaks to libUEMF and related code (diff)
downloadinkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.tar.gz
inkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.zip
Merge from trunk
(bzr r14059.2.15)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp48
1 files changed, 18 insertions, 30 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 8c99e9bcf..410fd9b37 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) {
@@ -1234,8 +1222,8 @@ void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PatternTransf
SPObject *server = style->getFillPaintServer();
SPPattern *serverPatt = dynamic_cast<SPPattern *>(server);
if ( serverPatt ) {
- SPPattern *pattern = sp_pattern_clone_if_necessary(this, serverPatt, "fill");
- sp_pattern_transform_multiply(pattern, postmul, set);
+ SPPattern *pattern = serverPatt->clone_if_necessary(this, "fill");
+ pattern->transform_multiply(postmul, set);
}
}
@@ -1244,8 +1232,8 @@ void SPItem::adjust_pattern(Geom::Affine const &postmul, bool set, PatternTransf
SPObject *server = style->getStrokePaintServer();
SPPattern *serverPatt = dynamic_cast<SPPattern *>(server);
if ( serverPatt ) {
- SPPattern *pattern = sp_pattern_clone_if_necessary(this, serverPatt, "stroke");
- sp_pattern_transform_multiply(pattern, postmul, set);
+ SPPattern *pattern = serverPatt->clone_if_necessary(this, "stroke");
+ pattern->transform_multiply(postmul, set);
}
}
}