summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_canvas.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2005-12-30 00:34:21 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2005-12-30 00:34:21 +0000
commitd43cc4e7b5e95d4f4a8ed4d8fff99b6f846fe074 (patch)
tree4c4f688bb32f42fe91f45cdcbf39efdf04fa2461 /gtk2_ardour/editor_canvas.cc
parent0faaa3ad7bf0cedf68eda1dd43e232363b9f7f04 (diff)
many changes, read the diffs
git-svn-id: svn://localhost/trunk/ardour2@214 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r--gtk2_ardour/editor_canvas.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 933d33eeb5..029ddb4408 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -36,6 +36,7 @@
#include "rgb_macros.h"
#include "utils.h"
#include "time_axis_view.h"
+#include "audio_time_axis.h"
#include "i18n.h"
@@ -399,3 +400,61 @@ Editor::time_canvas_map_handler (GdkEventAny* ev)
return false;
}
+void
+Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context,
+ int x, int y,
+ const SelectionData& data,
+ guint info, guint time)
+{
+ TimeAxisView* tvp;
+ AudioTimeAxisView* tv;
+ double cy;
+ vector<string> paths;
+ string spath;
+ GdkEvent ev;
+ jack_nframes_t frame;
+
+ if (convert_drop_to_paths (paths, context, x, y, data, info, time)) {
+ goto out;
+ }
+
+ /* D-n-D coordinates are window-relative, so convert to "world" coordinates
+ */
+
+ double wx;
+ double wy;
+
+ track_canvas.c2w( x, y, wx, wy);
+
+ ev.type = GDK_BUTTON_RELEASE;
+ ev.button.x = wx;
+ ev.button.y = wy;
+
+ frame = event_frame (&ev, 0, &cy);
+
+ snap_to (frame);
+
+ if ((tvp = trackview_by_y_position (cy)) == 0) {
+
+ /* drop onto canvas background: create a new track */
+
+ insert_paths_as_new_tracks (paths, false);
+
+
+ } else if ((tv = dynamic_cast<AudioTimeAxisView*>(tvp)) != 0) {
+
+ /* check that its an audio track, not a bus */
+
+ if (tv->get_diskstream()) {
+
+ for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
+ insert_sndfile_into (*p, true, tv, frame);
+ }
+ }
+
+ }
+
+ out:
+ context->drag_finish (true, false, time);
+}
+