different approach to independent scrolling, involving ArdourCanvas::ScrollGroup

The idea now is that a scroll group item can be added to the canvas which will causes its children to scroll in either or both
directions (horizontal or vertical). There are few complications: the position() of the ScrollGroup is ambiguous depending
on whether you want it with scroll taken into account or not, so Item::canvas_position() was added, which defaults to
the same value as Item::position() but is overridden by ScrollGroup to return the position independent of scrolling. This
method is used when translating between item/canvas/window coordinate systems.

Note that the basic idea is that we MOVE the scroll group when a scroll happens. This mirrors what happens in the GnomeCanvas,
where Nick Mainsbridge came up with a great idea that allowed unification of the time bar and track canvases.
This commit is contained in:
Paul Davis 2014-05-20 23:08:15 -04:00
parent 6e91e9fd5f
commit cb9453b475
14 changed files with 200 additions and 122 deletions

View file

@ -117,7 +117,9 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
<< (*i)->whatami()
<< ' '
<< (*i)->name
<< " item = "
<< " item "
<< item_bbox.get()
<< " window = "
<< item
<< " intersect = "
<< draw
@ -136,8 +138,8 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
#ifdef CANVAS_DEBUG
if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
cerr << string_compose ("%1skip render of %2 %3, no intersection\n", _canvas->render_indent(), (*i)->whatami(),
(*i)->name);
cerr << string_compose ("%1skip render of %2 %3, no intersection between %4 and %5\n", _canvas->render_indent(), (*i)->whatami(),
(*i)->name, item, area);
}
#endif
@ -152,7 +154,7 @@ Group::scroll_to (Duple const& d)
{
Item::scroll_to (d);
for (list<Item*>::iterator i = _items.begin(); i != _items.end(); ) {
for (list<Item*>::iterator i = _items.begin(); i != _items.end(); ++i) {
(*i)->scroll_to (d);
}
}