summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-07-07 22:12:21 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-22 15:31:21 -0500
commit9010262bed21611f2db652d16f63e4af4380259d (patch)
treeb112724d2b26eb3b66b5e1c5571dbf6c5509cc24 /gtk2_ardour/editor_canvas.cc
parent85eee3b09dd53f6f5d1803f2b585270ab535e16f (diff)
first compilable version of tabbable design.
I would have loved to split this apart, but there are just so many interrelated changes, it makes little sense and would be a huge effort that would break future git bisect use because so many intermediate commits would not compile
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r--gtk2_ardour/editor_canvas.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 233a3fbb35..b3668ba194 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -500,7 +500,13 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
void
Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
{
- if (!UIConfiguration::instance().get_autoscroll_editor () || autoscroll_active ()) {
+ Gtk::Window* toplevel = dynamic_cast<Gtk::Window*>(contents().get_toplevel());
+
+ if (!toplevel) {
+ return;
+ }
+
+ if (!UIConfiguration::instance()->get_autoscroll_editor () || autoscroll_active ()) {
return;
}
@@ -557,7 +563,7 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers)
int x, y;
Gdk::ModifierType mask;
- get_window()->get_pointer (x, y, mask);
+ toplevel->get_window()->get_pointer (x, y, mask);
if ((allow_horiz && ((x < scrolling_boundary.x0 && leftmost_frame > 0) || x >= scrolling_boundary.x1)) ||
(allow_vert && ((y < scrolling_boundary.y0 && vertical_adjustment.get_value() > 0)|| y >= scrolling_boundary.y1))) {
@@ -578,8 +584,13 @@ Editor::autoscroll_canvas ()
Gdk::ModifierType mask;
frameoffset_t dx = 0;
bool no_stop = false;
+ Gtk::Window* toplevel = dynamic_cast<Gtk::Window*>(contents().get_toplevel());
- get_window()->get_pointer (x, y, mask);
+ if (!toplevel) {
+ return false;
+ }
+
+ toplevel->get_window()->get_pointer (x, y, mask);
VisualChange vc;
bool vertical_motion = false;
@@ -682,7 +693,7 @@ Editor::autoscroll_canvas ()
int cx;
int cy;
- translate_coordinates (*_track_canvas, x, y, cx, cy);
+ toplevel->translate_coordinates (*_track_canvas, x, y, cx, cy);
/* clamp x and y to remain within the autoscroll boundary,
* which is defined in window coordinates
@@ -733,8 +744,8 @@ Editor::autoscroll_canvas ()
x = min (max ((ArdourCanvas::Coord) x, autoscroll_boundary.x0), autoscroll_boundary.x1);
}
y = min (max ((ArdourCanvas::Coord) y, autoscroll_boundary.y0), autoscroll_boundary.y1);
-
- translate_coordinates (*_track_canvas_viewport, x, y, cx, cy);
+
+ toplevel->translate_coordinates (*_track_canvas_viewport, x, y, cx, cy);
ArdourCanvas::Duple d = _track_canvas->window_to_canvas (ArdourCanvas::Duple (cx, cy));
ev.x = d.x;