Canvas: alter RootGroup to work with layout
This commit is contained in:
parent
baea368223
commit
ad39faeb3e
@ -27,12 +27,15 @@ namespace ArdourCanvas {
|
|||||||
|
|
||||||
class LIBCANVAS_API Root : public Container
|
class LIBCANVAS_API Root : public Container
|
||||||
{
|
{
|
||||||
private:
|
public:
|
||||||
|
void preferred_size (Duple&, Duple&) const;
|
||||||
|
void size_allocate (Rect const &);
|
||||||
|
|
||||||
|
private:
|
||||||
friend class Canvas;
|
friend class Canvas;
|
||||||
|
|
||||||
Root (Canvas *);
|
Root (Canvas *);
|
||||||
|
|
||||||
void compute_bounding_box () const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,11 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pbd/stacktrace.h"
|
||||||
|
|
||||||
#include "canvas/root_group.h"
|
#include "canvas/root_group.h"
|
||||||
#include "canvas/canvas.h"
|
#include "canvas/canvas.h"
|
||||||
|
#include "canvas/constraint_packer.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
@ -32,12 +35,34 @@ Root::Root (Canvas* canvas)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Root::compute_bounding_box () const
|
Root::preferred_size (Duple& min, Duple& natural) const
|
||||||
{
|
{
|
||||||
Container::compute_bounding_box ();
|
if (_items.size() == 1) {
|
||||||
|
cerr << "Call prefsize on " << _items.front()->whoami() << endl;
|
||||||
|
_items.front()->preferred_size (min, natural);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_bounding_box) {
|
cerr << "use regular prefsize for root\n";
|
||||||
Rect r (_bounding_box);
|
|
||||||
_canvas->request_size (Duple (r.width (), r.height ()));
|
Item::preferred_size (min, natural);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Root::size_allocate (Rect const & r)
|
||||||
|
{
|
||||||
|
bool have_constraint_container = false;
|
||||||
|
|
||||||
|
cerr << "ROOT alloc " << r << endl;
|
||||||
|
|
||||||
|
for (list<Item*>::const_iterator i = _items.begin(); i != _items.end(); ++i) {
|
||||||
|
if (dynamic_cast<ConstraintPacker*> (*i)) {
|
||||||
|
(*i)->size_allocate (r);
|
||||||
|
have_constraint_container = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (have_constraint_container) {
|
||||||
|
_bounding_box_dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user