diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-16 23:17:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-08-16 23:17:35 +0000 |
commit | 327275f4c9381575021be96f2c67e23b378bd98c (patch) | |
tree | 0df7621510154ea6db6d7f53085d2686a2b602cf /gtk2_ardour/editor_audio_import.cc | |
parent | f433b4e735ab5ff5f7f7d89d38d0c25de3641cfa (diff) |
support DnD in native/gtk-quartz implementation (note: multifile DnD requires a patch to GTK that is not in distribution yet, so for now, this works only with 1 file at a time, or it requires my patch/library).
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2319 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_audio_import.cc')
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 5a70425480..2a81f85d7f 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -130,17 +130,32 @@ Editor::do_import (vector<ustring> paths, bool split, ImportMode mode, AudioTrac interthread_progress_window->hide_all (); } +bool +Editor::idle_do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos, bool prompt) +{ + _do_embed (paths, split, mode, track, pos, prompt); + return false; +} + void Editor::do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos, bool prompt) { +#ifdef GTKOSX + Glib::signal_idle().connect (bind (mem_fun (*this, &Editor::idle_do_embed), paths, split, mode, track, pos, prompt)); +#else + _do_embed (paths, split, mode, track, pos, prompt); +#endif +} + +void +Editor::_do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos, bool prompt) +{ bool multiple_files = paths.size() > 1; bool check_sample_rate = true; vector<ustring>::iterator a; for (a = paths.begin(); a != paths.end(); ) { - cerr << "Considering embed of " << (*a) << endl; - Glib::ustring path = *a; Glib::ustring pair_base; vector<ustring> to_embed; @@ -208,7 +223,7 @@ Editor::do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack } } else { - + if (embed_sndfile (to_embed, split, multiple_files, check_sample_rate, mode, track, pos, prompt) < -1) { break; } @@ -321,15 +336,14 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi } } } - } /* note that we temporarily truncated _id at the colon */ string error_msg; - + if (!AudioFileSource::get_soundfile_info (path, finfo, error_msg)) { - error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), selection, error_msg ) << endmsg; + error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), path, error_msg ) << endmsg; goto out; } @@ -388,7 +402,7 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi } track_canvas.get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); - ARDOUR_UI::instance()->flush_pending (); + // ARDOUR_UI::instance()->flush_pending (); /* make the proper number of channels in the region */ |