diff options
-rw-r--r-- | libs/canvas/canvas/item.h | 2 | ||||
-rw-r--r-- | libs/canvas/item.cc | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index dc29e75677..dacb9d559b 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -99,7 +99,7 @@ public: void ungrab (); void unparent (); - void reparent (Item *); + void reparent (Item *, bool already_added = false); /** @return Parent group, or 0 if this is the root group */ Item* parent () const { diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index e2cdc698bb..706a62b717 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -410,7 +410,7 @@ Item::unparent () } void -Item::reparent (Item* new_parent) +Item::reparent (Item* new_parent, bool already_added) { if (new_parent == _parent) { return; @@ -429,7 +429,9 @@ Item::reparent (Item* new_parent) find_scroll_parent (); - _parent->add (this); + if (!already_added) { + _parent->add (this); + } } void @@ -862,7 +864,7 @@ Item::add (Item* i) /* XXX should really notify canvas about this */ _items.push_back (i); - i->reparent (this); + i->reparent (this, true); invalidate_lut (); _bounding_box_dirty = true; } @@ -873,7 +875,7 @@ Item::add_front (Item* i) /* XXX should really notify canvas about this */ _items.push_front (i); - i->reparent (this); + i->reparent (this, true); invalidate_lut (); _bounding_box_dirty = true; } |