+ 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;
+ }
+ }
+
+ int function = 1;
+
+ if (wave_name_exists) {
+ string message;
+ if (all_or_nothing) {
+ // updating is still disabled
+ //message = string_compose(_("The session already contains a source file named %1. Do you want to update that file (and thus all regions using the file) or import this file as a new file?"),wave_name);
+ message = string_compose(_("The session already contains a source file named %1. This file will be imported as a new file, please confirm."),wave_name);
+ } else {
+ message = string_compose(_("A source file %1 already exists. This operation will not update that source but import the file %2 as a new source, please confirm."), wave_name, wave_name);
+
+ }
+ MessageDialog dialog(message, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);
+
+ if (all_or_nothing) {
+ // disabled
+ //dialog.add_button("Update", 0);
+ dialog.add_button("Import", 1);
+ dialog.add_button("Skip", 2);
+ } else {
+ dialog.add_button("Import", 1);
+ dialog.add_button("Cancel", 2);
+ }
+
+ //dialog.add_button("Skip all", 4); // All or rest?
+
+ dialog.show();
+
+ function = dialog.run ();
+
+ dialog.hide();
+ }
+
+ return function;
+}
+
+boost::shared_ptr<AudioTrack>
+Editor::get_nth_selected_audio_track (int nth) const
+{
+ AudioTimeAxisView* atv;
+ TrackSelection::iterator x;