summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-04-16 04:16:56 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-04-16 04:16:56 -0400
commit5668eea2a3b31352698232127c5876a0cd9f2925 (patch)
treee36331d71e3051a0cfd075d7e39dba6e39fc9a48 /gtk2_ardour
parent8b93576c180a62539baad83d2846b6da192eea6a (diff)
add a transparent rect that is always located at the bottom of the track canvas
This gives us an event/drag-n-drop/click target for things "at the bottom"
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.h6
-rw-r--r--gtk2_ardour/editor_canvas.cc21
-rw-r--r--gtk2_ardour/editor_canvas_events.cc8
3 files changed, 34 insertions, 1 deletions
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
@@ -1010,6 +1010,13 @@ Editor::canvas_note_event (GdkEvent *event, ArdourCanvas::Item* item)
}
bool
+Editor::canvas_bottom_rect_event (GdkEvent* event)
+{
+ cerr << "CBR event, type " << event << endl;
+ return true;
+}
+
+bool
Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int x, int y, guint time)
{
boost::shared_ptr<Region> region;
@@ -1191,3 +1198,4 @@ Editor::key_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType
return handled;
}
+