- if (sfbrowser->copy_files_btn.get_active()) {
- do_import (paths, chns, mode, quality, where);
- } else {
- do_embed (paths, chns, mode, where);
+
+ if (sfbrowser->copy_files_btn.get_active()) {
+ do_import (paths, chns, mode, quality, where);
+ } else {
+ do_embed (paths, chns, mode, where);
+ }
+
+ if (response == RESPONSE_APPLY) {
+ sfbrowser->clear_selection ();
+ keepRunning = true;
+ }
+
+ } while (keepRunning);
+}
+
+void
+Editor::session_import_dialog ()
+{
+ SessionImportDialog dialog (*session);
+ ensure_float (dialog);
+ dialog.run ();
+}
+
+typedef std::map<PBD::ID,boost::shared_ptr<ARDOUR::Source> > SourceMap;
+
+/**
+ * Updating is still disabled, see note in libs/ardour/import.cc Session::import_audiofiles()
+ *
+ * all_or_nothing:
+ * true = show "Update", "Import" and "Skip"
+ * false = show "Import", and "Cancel"
+ *
+ * Returns:
+ * 0 To update an existing source of the same name
+ * 1 To import/embed the file normally (make sure the new name will be unique)
+ * 2 If the user wants to skip this file
+ **/
+int
+Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
+{
+ string wave_name (Glib::path_get_basename(path));
+
+ SourceMap all_sources = session->get_sources();
+ bool wave_name_exists = false;
+
+ for (SourceMap::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
+ string tmp (Glib::path_get_basename (i->second->path()));
+ if (tmp == wave_name) {
+ wave_name_exists = true;
+ break;
+ }