summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.h5
-rw-r--r--gtk2_ardour/editor_canvas.cc5
-rw-r--r--gtk2_ardour/editor_cursors.cc2
-rw-r--r--gtk2_ardour/public_editor.h1
-rw-r--r--libs/canvas/canvas.cc17
-rw-r--r--libs/canvas/canvas/scroll_group.h2
6 files changed, 26 insertions, 6 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;
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc
index 3ac91deda8..a3d8e6ae67 100644
--- a/libs/canvas/canvas.cc
+++ b/libs/canvas/canvas.cc
@@ -236,7 +236,7 @@ Canvas::window_to_canvas (Duple const & d) const
*/
std::list<Item*> const& root_children (_root.items());
- ScrollGroup* sg = 0;
+ ScrollGroup* best_group = 0;
/* if the coordinates are negative, clamp to zero and find the item
* that covers that "edge" position.
@@ -252,13 +252,20 @@ Canvas::window_to_canvas (Duple const & d) const
}
for (std::list<Item*>::const_reverse_iterator i = root_children.rbegin(); i != root_children.rend(); ++i) {
- if (((sg = dynamic_cast<ScrollGroup*>(*i)) != 0) && sg->covers_window (in_window)) {
- break;
+ ScrollGroup* sg = dynamic_cast<ScrollGroup*>(*i);
+ /* If scroll groups overlap, choose the one with the highest sensitivity,
+ that is, choose an HV scroll group over an H or V only group. */
+ if (sg && (!best_group || sg->sensitivity() > best_group->sensitivity())) {
+ best_group = sg;
+ if (sg->sensitivity() == (ScrollGroup::ScrollsVertically | ScrollGroup::ScrollsHorizontally)) {
+ /* Can't do any better than this. */
+ break;
+ }
}
}
- if (sg) {
- return d.translate (sg->scroll_offset());
+ if (best_group) {
+ return d.translate (best_group->scroll_offset());
}
return d;
diff --git a/libs/canvas/canvas/scroll_group.h b/libs/canvas/canvas/scroll_group.h
index 463abc0bbc..fd9b2388d4 100644
--- a/libs/canvas/canvas/scroll_group.h
+++ b/libs/canvas/canvas/scroll_group.h
@@ -46,6 +46,8 @@ class LIBCANVAS_API ScrollGroup : public Container
void render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
+ ScrollSensitivity sensitivity() const { return _scroll_sensitivity; }
+
private:
ScrollSensitivity _scroll_sensitivity;
Duple _scroll_offset;