allow Drag-n-Drop onto the empty canvas (again); always import MIDI files since we consider them writable and so embedding isn't a safe option
This commit is contained in:
parent
9fce80d2bc
commit
197e75ab80
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "ardour/profile.h"
|
||||
#include "ardour/rc_configuration.h"
|
||||
#include "ardour/smf_source.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "editor.h"
|
||||
|
@ -423,6 +424,23 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
|
|||
{
|
||||
RouteTimeAxisView* tv;
|
||||
|
||||
/* MIDI files must always be imported, because we consider them
|
||||
* writable. So split paths into two vectors, and follow the import
|
||||
* path on the MIDI part.
|
||||
*/
|
||||
|
||||
vector<string> midi_paths;
|
||||
vector<string> audio_paths;
|
||||
|
||||
for (vector<string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
|
||||
if (SMFSource::safe_midi_file_extension (*i)) {
|
||||
midi_paths.push_back (*i);
|
||||
} else {
|
||||
audio_paths.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::pair<TimeAxisView*, int> const tvp = trackview_by_y_position (ypos);
|
||||
if (tvp.first == 0) {
|
||||
|
||||
|
@ -430,10 +448,12 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
|
|||
|
||||
frame = 0;
|
||||
|
||||
do_import (midi_paths, Editing::ImportDistinctFiles, ImportAsTrack, SrcBest, frame);
|
||||
|
||||
if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
|
||||
do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame);
|
||||
do_import (audio_paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame);
|
||||
} else {
|
||||
do_embed (paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
|
||||
do_embed (audio_paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
|
||||
}
|
||||
|
||||
} else if ((tv = dynamic_cast<RouteTimeAxisView*> (tvp.first)) != 0) {
|
||||
|
@ -444,10 +464,12 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
|
|||
/* select the track, then embed/import */
|
||||
selection->set (tv);
|
||||
|
||||
do_import (midi_paths, Editing::ImportSerializeFiles, ImportToTrack, SrcBest, frame);
|
||||
|
||||
if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
|
||||
do_import (paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
|
||||
do_import (audio_paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
|
||||
} else {
|
||||
do_embed (paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
|
||||
do_embed (audio_paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1031,13 +1031,26 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
(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) {
|
||||
|
@ -1064,13 +1077,13 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
|
|||
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)
|
||||
if ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY) {
|
||||
context->drag_status(Gdk::ACTION_COPY, time);
|
||||
else
|
||||
} else {
|
||||
context->drag_status(Gdk::ACTION_LINK, time);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user