diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index dadb38733a..38c3235aa5 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -347,6 +347,7 @@ public: void add_child_bounding_boxes (bool include_hidden = false) const; void render_children (Rect const & area, Cairo::RefPtr context) const; void prepare_for_render_children (Rect const & area) const; + void size_allocate_children (Rect const & r); Duple scroll_offset() const; public: diff --git a/libs/canvas/canvas/root_group.h b/libs/canvas/canvas/root_group.h index 38ab32db61..da9d9d4061 100644 --- a/libs/canvas/canvas/root_group.h +++ b/libs/canvas/canvas/root_group.h @@ -29,7 +29,6 @@ class LIBCANVAS_API Root : public Container { public: void preferred_size (Duple&, Duple&) const; - void size_allocate (Rect const &); private: friend class Canvas; diff --git a/libs/canvas/cbox.cc b/libs/canvas/cbox.cc index 9331a8248b..8f658d43d8 100644 --- a/libs/canvas/cbox.cc +++ b/libs/canvas/cbox.cc @@ -509,8 +509,6 @@ cBox::render (Rect const & area, Cairo::RefPtr context) const if (fill()) { - cerr << whoami() << " setting fill context with 0x" << std::hex << _fill_color << std::dec << " draw " << draw << endl; - setup_fill_context (context); context->rectangle (draw.x0, draw.y0, draw.width(), draw.height()); context->fill_preserve (); diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index 4610d546ae..29e396d0a8 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -24,6 +24,7 @@ #include "pbd/convert.h" #include "canvas/canvas.h" +#include "canvas/constraint_packer.h" #include "canvas/debug.h" #include "canvas/item.h" #include "canvas/scroll_group.h" @@ -607,6 +608,27 @@ Item::size_allocate (Rect const & r) _position = Duple (r.x0, r.y0); _allocation = r; } + + size_allocate_children (r); +} + +void +Item::size_allocate_children (Rect const & r) +{ + bool have_constraint_container = false; + + for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { + + (*i)->size_allocate (r); + + if (dynamic_cast (*i)) { + have_constraint_container = true; + } + } + + if (have_constraint_container) { + _bounding_box_dirty = true; + } } void diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc index 174a2d626a..adcca99252 100644 --- a/libs/canvas/rectangle.cc +++ b/libs/canvas/rectangle.cc @@ -288,13 +288,13 @@ Rectangle::vertical_fraction (double y) const void Rectangle::size_allocate (Rect const & r) { - _allocation = r; + Item::size_allocate (r); if (_layout_sensitive) { - /* set position, and then set the _rect member with values that - use _position as the origin. + /* Item::size_allocate() will have set _position, and then set + the _rect member with values that use _position as the + origin. */ - _position = Duple (r.x0, r.y0); Rect r2 (0, 0, r.x1 - r.x0, r.y1 - r.y0); set (r2); } diff --git a/libs/canvas/root_group.cc b/libs/canvas/root_group.cc index d32fa0ee5e..5cb2cbd596 100644 --- a/libs/canvas/root_group.cc +++ b/libs/canvas/root_group.cc @@ -21,7 +21,6 @@ #include "canvas/root_group.h" #include "canvas/canvas.h" -#include "canvas/constraint_packer.h" using namespace std; using namespace ArdourCanvas; @@ -48,19 +47,3 @@ Root::preferred_size (Duple& min, Duple& natural) const Item::preferred_size (min, natural); } -void -Root::size_allocate (Rect const & r) -{ - bool have_constraint_container = false; - - for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { - if (dynamic_cast (*i)) { - (*i)->size_allocate (r); - have_constraint_container = true; - } - } - - if (have_constraint_container) { - _bounding_box_dirty = true; - } -}