diff --git a/libs/canvas/box.cc b/libs/canvas/box.cc index 8368552f09..8afff1109e 100644 --- a/libs/canvas/box.cc +++ b/libs/canvas/box.cc @@ -20,6 +20,7 @@ #include #include "pbd/unwind.h" +#include "pbd/stacktrace.h" #include "canvas/box.h" #include "canvas/rectangle.h" @@ -39,11 +40,13 @@ Box::Box (Canvas* canvas, Orientation o) bg->name = "bg rect for box"; bg->set_outline (false); bg->set_fill (false); + bg->hide (); } void Box::render (Rect const & area, Cairo::RefPtr context) const { + bg->render (area, context); Item::render_children (area, context); } @@ -148,6 +151,11 @@ Box::reposition_children () for (std::list::iterator i = _items.begin(); i != _items.end(); ++i) { + if ((*i) == bg || !(*i)->visible()) { + /* background rect takes up no space */ + continue; + } + (*i)->set_position (previous_edge); if (homogenous) { @@ -204,12 +212,10 @@ Box::reposition_children () } if (!_bounding_box) { - bg->hide (); return; } Rect r (_bounding_box); - /* XXX need to shrink by margin */ bg->set (r); } diff --git a/libs/canvas/canvas/box.h b/libs/canvas/canvas/box.h index 8e4b829be5..7996afe100 100644 --- a/libs/canvas/canvas/box.h +++ b/libs/canvas/canvas/box.h @@ -76,7 +76,7 @@ public: void parented (); private: - Rectangle *bg; + Rectangle* bg; bool collapse_on_hide; bool homogenous; bool repositioning; diff --git a/libs/canvas/grid.cc b/libs/canvas/grid.cc index 7a03d763ef..1588322b7c 100644 --- a/libs/canvas/grid.cc +++ b/libs/canvas/grid.cc @@ -41,6 +41,7 @@ Grid::Grid (Canvas* canvas) { bg = new Rectangle (this); bg->name = "bg rect for grid"; + bg->hide (); } void @@ -52,6 +53,7 @@ Grid::set_homogenous (bool yn) void Grid::render (Rect const & area, Cairo::RefPtr context) const { + bg->render (area, context); Item::render_children (area, context); } @@ -297,7 +299,6 @@ Grid::reposition_children () } if (!_bounding_box) { - bg->hide (); return; } else { @@ -306,7 +307,6 @@ Grid::reposition_children () /* XXX need to shrink by margin */ bg->set (r); - bg->show (); } }