From 8f823388d9bd5aa8e297ab05be8c9fb323518945 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Jan 2015 21:04:38 -0500 Subject: [PATCH] Kludgey fix for invisible playhead when scrolled. The problem this is avoiding makes absolutely no sense. Either I'm dumb, or something is more deeply wrong with scroll group bounding boxes, or both, but I don't care anymore. This works. Viva release mode. --- gtk2_ardour/editor_canvas.cc | 2 +- libs/canvas/canvas/scroll_group.h | 5 +++-- libs/canvas/scroll_group.cc | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 611d5ac054..2e2231c09f 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -92,7 +92,7 @@ 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); + cursor_scroll_group = cg = new ArdourCanvas::ScrollGroup (_track_canvas->root(), ArdourCanvas::ScrollGroup::ScrollsHorizontally, false); CANVAS_DEBUG_NAME (cursor_scroll_group, "canvas cursor scroll"); _track_canvas->add_scroller (*cg); diff --git a/libs/canvas/canvas/scroll_group.h b/libs/canvas/canvas/scroll_group.h index fd9b2388d4..86bbf9821b 100644 --- a/libs/canvas/canvas/scroll_group.h +++ b/libs/canvas/canvas/scroll_group.h @@ -35,8 +35,8 @@ class LIBCANVAS_API ScrollGroup : public Container ScrollsHorizontally = 0x2 }; - ScrollGroup (Canvas*, ScrollSensitivity); - ScrollGroup (Item*, ScrollSensitivity); + ScrollGroup (Canvas*, ScrollSensitivity, bool clip=true); + ScrollGroup (Item*, ScrollSensitivity, bool clip=true); void scroll_to (Duple const& d); Duple scroll_offset() const { return _scroll_offset; } @@ -51,6 +51,7 @@ class LIBCANVAS_API ScrollGroup : public Container private: ScrollSensitivity _scroll_sensitivity; Duple _scroll_offset; + bool _clip; }; } diff --git a/libs/canvas/scroll_group.cc b/libs/canvas/scroll_group.cc index 1562643b4a..ad3731116a 100644 --- a/libs/canvas/scroll_group.cc +++ b/libs/canvas/scroll_group.cc @@ -27,15 +27,17 @@ using namespace std; using namespace ArdourCanvas; -ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s) +ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s, bool clip) : Container (c) , _scroll_sensitivity (s) + , _clip(clip) { } -ScrollGroup::ScrollGroup (Item* parent, ScrollSensitivity s) +ScrollGroup::ScrollGroup (Item* parent, ScrollSensitivity s, bool clip) : Container (parent) , _scroll_sensitivity (s) + , _clip(clip) { } @@ -52,6 +54,14 @@ ScrollGroup::render (Rect const & area, Cairo::RefPtr context) c return; } + if (!_clip) { + /* kludge: clip disabled, because for some reason the cursor scroll + group requires scroll offsets here to clip correctly yet everything + else does not. I can't figure this out, so since not clipping a + single arrow isn't the end of the world, just don't clip. */ + Container::render (area, context); + } + Rect self (_position.x + r.get().x0, _position.y + r.get().y0, _position.x + r.get().x1, -- 2.30.2