summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-21 13:10:42 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-21 15:35:20 -0400
commitb02a7445bfa11d1c1ea1f6762b7e845b780ab4ea (patch)
treeb146dedc8b854adda7073b89a9bb7ba26315aa0d /libs
parentfca81c9a6a591b6f94223454a981d919c9ad51a5 (diff)
Revert "add Group::clear(), do not clear _canvas member of Item when unparented (only the parent is changed)"
This reverts commit a4df65a56f83823aba27432685977f420458a213.
Diffstat (limited to 'libs')
-rw-r--r--libs/canvas/canvas/group.h1
-rw-r--r--libs/canvas/group.cc33
-rw-r--r--libs/canvas/item.cc4
3 files changed, 3 insertions, 35 deletions
diff --git a/libs/canvas/canvas/group.h b/libs/canvas/canvas/group.h
index 236880a906..8dee5f2672 100644
--- a/libs/canvas/canvas/group.h
+++ b/libs/canvas/canvas/group.h
@@ -40,7 +40,6 @@ public:
void add (Item *);
void remove (Item *);
- void clear (bool with_delete = false);
std::list<Item*> const & items () const {
return _items;
}
diff --git a/libs/canvas/group.cc b/libs/canvas/group.cc
index fe783ad8b5..907282f9cd 100644
--- a/libs/canvas/group.cc
+++ b/libs/canvas/group.cc
@@ -170,8 +170,6 @@ Group::compute_bounding_box () const
void
Group::add (Item* i)
{
- /* XXX should really notify canvas about this */
-
_items.push_back (i);
invalidate_lut ();
_bounding_box_dirty = true;
@@ -182,40 +180,11 @@ Group::add (Item* i)
void
Group::remove (Item* i)
{
-
- if (i->parent() != this) {
- return;
- }
-
- begin_change ();
-
- i->unparent ();
_items.remove (i);
invalidate_lut ();
_bounding_box_dirty = true;
- end_change ();
-}
-
-void
-Group::clear (bool with_delete)
-{
- begin_change ();
-
- for (list<Item*>::iterator i = _items.begin(); i != _items.end(); ++i) {
- if (with_delete) {
- delete *i;
- } else {
- (*i)->unparent ();
- }
- }
-
- _items.clear ();
-
- invalidate_lut ();
- _bounding_box_dirty = true;
-
- end_change ();
+ DEBUG_TRACE (PBD::DEBUG::CanvasItemsDirtied, "canvas item dirty: group remove\n");
}
void
diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc
index 786c2f81cd..f5aa39d20d 100644
--- a/libs/canvas/item.cc
+++ b/libs/canvas/item.cc
@@ -236,14 +236,13 @@ Item::parent_to_item (ArdourCanvas::Rect const & d) const
void
Item::unparent ()
{
+ _canvas = 0;
_parent = 0;
}
void
Item::reparent (Group* new_parent)
{
- assert (_canvas == _parent->canvas ());
-
if (_parent) {
_parent->remove (this);
}
@@ -251,6 +250,7 @@ Item::reparent (Group* new_parent)
assert (new_parent);
_parent = new_parent;
+ _canvas = _parent->canvas ();
_parent->add (this);
}