13
0

Merge branch 'master' of git.ardour.org:ardour/ardour

This commit is contained in:
Paul Davis 2013-03-22 20:28:42 -04:00
commit 0348f9543e
4 changed files with 29 additions and 10 deletions

View File

@ -1257,8 +1257,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void bring_in_external_audio (Editing::ImportMode mode, framepos_t& pos);
bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos);
void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos);
bool idle_drop_paths (std::vector<std::string> paths, framepos_t frame, double ypos, bool copy);
void drop_paths_part_two (const std::vector<std::string>& paths, framepos_t frame, double ypos, bool copy);
int import_sndfiles (std::vector<std::string> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, framepos_t& pos,
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::Track>&, bool);

View File

@ -412,14 +412,14 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
}
bool
Editor::idle_drop_paths (vector<string> paths, framepos_t frame, double ypos)
Editor::idle_drop_paths (vector<string> paths, framepos_t frame, double ypos, bool copy)
{
drop_paths_part_two (paths, frame, ypos);
drop_paths_part_two (paths, frame, ypos, copy);
return false;
}
void
Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, double ypos)
Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, double ypos, bool copy)
{
RouteTimeAxisView* tv;
@ -430,7 +430,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
frame = 0;
if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsTrack, SrcBest, frame);
} else {
do_embed (paths, Editing::ImportDistinctFiles, ImportAsTrack, frame);
@ -444,7 +444,7 @@ Editor::drop_paths_part_two (const vector<string>& paths, framepos_t frame, doub
/* select the track, then embed/import */
selection->set (tv);
if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
do_import (paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
} else {
do_embed (paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
@ -481,14 +481,15 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
snap_to (frame);
bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
#ifdef GTKOSX
/* We are not allowed to call recursive main event loops from within
the main event loop with GTK/Quartz. Since import/embed wants
to push up a progress dialog, defer all this till we go idle.
*/
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, frame, cy));
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, frame, cy, copy));
#else
drop_paths_part_two (paths, frame, cy);
drop_paths_part_two (paths, frame, cy, copy);
#endif
}

View File

@ -26,6 +26,7 @@
#include "ardour/midi_region.h"
#include "ardour/region_factory.h"
#include "ardour/profile.h"
#include "editor.h"
#include "keyboard.h"
@ -1054,6 +1055,21 @@ Editor::track_canvas_drag_motion (Glib::RefPtr<Gdk::DragContext> const& context,
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;
}
}
}

View File

@ -1233,7 +1233,9 @@ EditorRegions::drag_data_received (const RefPtr<Gdk::DragContext>& context,
if (_editor->convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
framepos_t pos = 0;
if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY);
if (Profile->get_sae() || Config->get_only_copy_imported_files() || copy) {
_editor->do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos);
} else {
_editor->do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);