+ if (!internal_editing()) {
+ return false;
+ }
+
+ return typed_event (item, event, NoteItem);
+}
+
+bool
+Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context, int x, int y, guint time)
+{
+ double wx;
+ double wy;
+ boost::shared_ptr<Region> region;
+ boost::shared_ptr<Region> region_copy;
+ RouteTimeAxisView* rtav;
+ GdkEvent event;
+ double px;
+ double py;
+
+ string target = track_canvas->drag_dest_find_target (context, track_canvas->drag_dest_get_target_list());
+
+ if (target.empty()) {
+ return false;
+ }
+
+ track_canvas->window_to_world (x, y, wx, wy);
+
+ event.type = GDK_MOTION_NOTIFY;
+ event.button.x = wx;
+ event.button.y = wy;
+ /* assume we're dragging with button 1 */
+ event.motion.state = Gdk::BUTTON1_MASK;
+
+ (void) event_frame (&event, &px, &py);
+
+ std::pair<TimeAxisView*, int> const tv = trackview_by_y_position (py);
+ bool can_drop = false;
+
+ if (tv.first != 0) {
+
+ /* over a time axis view of some kind */
+
+ rtav = dynamic_cast<RouteTimeAxisView*> (tv.first);
+
+ if (rtav != 0 && rtav->is_track ()) {
+ /* over a track, not a bus */
+ can_drop = true;
+ }
+
+
+ } else {
+ /* not over a time axis view, so drop is possible */
+ can_drop = true;
+ }
+
+ if (can_drop) {
+ region = _regions->get_dragged_region ();
+
+ if (region) {
+
+ if ((boost::dynamic_pointer_cast<AudioRegion> (region) != 0 &&
+ dynamic_cast<AudioTimeAxisView*> (tv.first) != 0) ||
+ (boost::dynamic_pointer_cast<MidiRegion> (region) != 0 &&
+ dynamic_cast<MidiTimeAxisView*> (tv.first) != 0)) {
+
+ /* audio to audio
+ OR
+ midi to midi
+ */
+
+ context->drag_status (context->get_suggested_action(), time);
+ return true;
+ }
+ } else {
+ /* DND originating from outside ardour
+ *
+ * TODO: check if file is audio/midi, allow drops on same track-type only,
+ * currently: if audio is dropped on a midi-track, it is only added to the region-list
+ */
+ if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
+ context->drag_status(Gdk::ACTION_COPY, time);
+ } else {
+ if ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY) {
+ context->drag_status(Gdk::ACTION_COPY, time);
+ } else {
+ context->drag_status(Gdk::ACTION_LINK, time);
+ }
+ }
+ return true;
+ }
+ }
+
+ /* no drop here */
+ context->drag_status (Gdk::DragAction (0), time);
+ return false;