diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 47021c552b..f3f6bfeee7 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -737,6 +737,12 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* The group used for region motion. Sits on top of _trackview_group */ ArdourCanvas::Group* _region_motion_group; + /* a rect that sits at the bottom of all tracks to act as a drag-no-drop/clickable + * target area. + */ + ArdourCanvas::Rectangle* _canvas_bottom_rect; + bool canvas_bottom_rect_event (GdkEvent* event); + enum RulerType { ruler_metric_timecode = 0, ruler_metric_bbt = 1, diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 98feae94c8..3b9c5dea37 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -212,6 +212,13 @@ Editor::initialize_canvas () logo_item->lower_to_bottom (); } + + _canvas_bottom_rect = new ArdourCanvas::Rectangle (_track_canvas->root(), ArdourCanvas::Rect (0.0, 0.0, max_canvas_coordinate, 20)); + /* this thing is transparent */ + _canvas_bottom_rect->set_fill (false); + _canvas_bottom_rect->set_outline (false); + _canvas_bottom_rect->Event.connect (sigc::mem_fun (*this, &Editor::canvas_bottom_rect_event)); + /* these signals will initially be delivered to the canvas itself, but if they end up remaining unhandled, they are passed to Editor-level handlers. */ @@ -316,12 +323,24 @@ Editor::reset_controls_layout_width () void Editor::reset_controls_layout_height (int32_t h) { + /* ensure that the rect that represents the "bottom" of the canvas + * (the drag-n-drop zone) is, in fact, at the bottom. + */ + + _canvas_bottom_rect->set_position (ArdourCanvas::Duple (0, h)); + + /* track controls layout must span the full height of "h" (all tracks) + * plus the bottom rect. + */ + + h += _canvas_bottom_rect->height (); + /* set the height of the scrollable area (i.e. the sum of all contained widgets) + * for the controls layout. The size request is set elsewhere. */ controls_layout.property_height() = h; - /* size request is set elsewhere, see ::track_canvas_allocate() */ } bool diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index c74c6b6e19..864624a690 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -1009,6 +1009,13 @@ Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item) return typed_event (item, event, NoteItem); } +bool +Editor::canvas_bottom_rect_event (GdkEvent* event) +{ + cerr << "CBR event, type " << event << endl; + return true; +} + bool Editor::track_canvas_drag_motion (Glib::RefPtr const& context, int x, int y, guint time) { @@ -1191,3 +1198,4 @@ Editor::key_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType return handled; } +