diff options
author | David Robillard <d@drobilla.net> | 2015-01-16 19:09:47 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-01-16 19:13:56 -0500 |
commit | b759fd5879f3997e216714c36c6b4145112cf5b9 (patch) | |
tree | 4d3429534650120a3aada042dd6427aca8e5b092 /gtk2_ardour | |
parent | d194ec9135e9f2e5566c925febec4354b0e4e072 (diff) |
Put playhead on top of everything.
Achieve this by adding a new hscroll group just for cursors.
That requires a slightly smarter window_to_canvas() to deal with overlapping
sensitive scroll groups. New rule is that scroll groups can overlap, but the
most sensitive one found from the top down will be chosen to translate
coordinates. This basically means don't overlap scroll groups with different
sensitivities.
In the presence of scroll groups, having a canvas-wide window_to_canvas()
and/or canvas_to_window() fundamentally makes no sense. At some point in the
glorious future we should kill those and use only item-relative coordinate
translation.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/editor_cursors.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 |
4 files changed, 12 insertions, 1 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 5eb0df4621..5cf98fa0d9 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -504,6 +504,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::Container* get_noscroll_group () const { return no_scroll_group; } ArdourCanvas::ScrollGroup* get_hscroll_group () const { return h_scroll_group; } ArdourCanvas::ScrollGroup* get_hvscroll_group () const { return hv_scroll_group; } + ArdourCanvas::ScrollGroup* get_cursor_scroll_group () const { return cursor_scroll_group; } ArdourCanvas::GtkCanvasViewport* get_track_canvas () const; @@ -820,6 +821,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD */ ArdourCanvas::ScrollGroup* h_scroll_group; + /* Scroll group for cursors, scrolled horizontally, above everything else + */ + ArdourCanvas::ScrollGroup* cursor_scroll_group; + /* The group containing all trackviews. */ ArdourCanvas::Container* no_scroll_group; diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 5a791ff060..611d5ac054 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -80,6 +80,7 @@ Editor::initialize_canvas () ArdourCanvas::ScrollGroup* hsg; ArdourCanvas::ScrollGroup* hg; + ArdourCanvas::ScrollGroup* cg; h_scroll_group = hg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally); CANVAS_DEBUG_NAME (h_scroll_group, "canvas h scroll"); @@ -91,6 +92,10 @@ Editor::initialize_canvas () CANVAS_DEBUG_NAME (hv_scroll_group, "canvas hv scroll"); _track_canvas->add_scroller (*hsg); + cursor_scroll_group = cg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally); + CANVAS_DEBUG_NAME (cursor_scroll_group, "canvas cursor scroll"); + _track_canvas->add_scroller (*cg); + _verbose_cursor = new VerboseCursor (this); /* on the bottom, an image */ diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index abce8f6252..ee8253fed8 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -33,7 +33,7 @@ using namespace Gtk; EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanvas::Item*)) : _editor (ed) - , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_hscroll_group())) + , _track_canvas_item (new ArdourCanvas::Arrow (_editor.get_cursor_scroll_group())) { CANVAS_DEBUG_NAME (_track_canvas_item, "track canvas editor cursor"); diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 33b4782f08..ff7cae35f2 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -370,6 +370,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual ArdourCanvas::Container* get_trackview_group () const = 0; virtual ArdourCanvas::ScrollGroup* get_hscroll_group () const = 0; virtual ArdourCanvas::ScrollGroup* get_hvscroll_group () const = 0; + virtual ArdourCanvas::ScrollGroup* get_cursor_scroll_group () const = 0; virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0; |