diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index dc34545ab9..b5f922badd 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -423,8 +423,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD return _drags; } - void maybe_autoscroll (bool, bool, bool); - bool autoscroll_active() const; + void maybe_autoscroll (bool, bool, bool); + void start_autoscroll_for_headers (); + bool autoscroll_active() const; Gdk::Cursor* get_canvas_cursor () const { return current_canvas_cursor; } void set_canvas_cursor (Gdk::Cursor*, bool save=false); @@ -1800,7 +1801,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::Rect autoscroll_boundary; bool autoscroll_canvas (); - void start_canvas_autoscroll (bool allow_horiz, bool allow_vert, const ArdourCanvas::Rect& boundary); + void start_canvas_autoscroll (bool allow_horiz, bool allow_vert, const ArdourCanvas::Rect& boundary); void stop_canvas_autoscroll (); /* trimming */ diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 2c51e3e680..2958f1f3eb 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -575,6 +575,19 @@ Editor::maybe_autoscroll (bool allow_horiz, bool allow_vert, bool from_headers) } } +void +Editor::start_autoscroll_for_headers () +{ + if (autoscroll_active () ) { + return; + } + + Gtk::Allocation alloc = controls_layout.get_allocation (); + ArdourCanvas::Rect scrolling_boundary = ArdourCanvas::Rect (alloc.get_x(), alloc.get_y(), alloc.get_x() + alloc.get_width(), alloc.get_y() + alloc.get_height()); + + start_canvas_autoscroll (false/*horizontal disabled*/, true/*vertical enabled*/, scrolling_boundary); +} + bool Editor::autoscroll_active () const { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 4527481a17..785eb2f1ab 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -373,12 +373,12 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual ArdourCanvas::ScrollGroup* get_vscroll_group () const = 0; virtual ArdourCanvas::ScrollGroup* get_hvscroll_group () const = 0; - virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0; + virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0; virtual TimeAxisView* axis_view_from_route (boost::shared_ptr) const = 0; - virtual void set_current_trimmable (boost::shared_ptr) = 0; - virtual void set_current_movable (boost::shared_ptr) = 0; + virtual void set_current_trimmable (boost::shared_ptr) = 0; + virtual void set_current_movable (boost::shared_ptr) = 0; virtual void center_screen (framepos_t) = 0; @@ -389,9 +389,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual Gtkmm2ext::TearOff* tools_tearoff () const = 0; virtual DragManager* drags () const = 0; - virtual void maybe_autoscroll (bool, bool, bool from_headers) = 0; + virtual void maybe_autoscroll (bool, bool, bool from_headers) = 0; + virtual void start_autoscroll_for_headers () = 0; virtual void stop_canvas_autoscroll () = 0; - virtual bool autoscroll_active() const = 0; + virtual bool autoscroll_active() const = 0; virtual MouseCursors const * cursors () const = 0; virtual VerboseCursor * verbose_cursor () const = 0; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 6e67b6636d..f44b8b946f 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1134,7 +1134,7 @@ RouteTimeAxisView::handle_route_drag_motion(const Glib::RefPtr lower_drop_indicator.show(); upper_drop_indicator.hide(); } - + return true; } } @@ -1161,12 +1161,17 @@ RouteTimeAxisView::handle_route_drag_begin (const Glib::RefPtr _editor.get_selection().add(this); } + // enable autoscroll + _editor.start_autoscroll_for_headers (); + //GZ TO-DO: Draw DnD icon for track header } void RouteTimeAxisView::handle_route_drag_end(const Glib::RefPtr& context) { + // disable autoscroll + _editor.stop_canvas_autoscroll (); } void