#include "evoral/SMF.hpp"
-#include "ardour/amp.h"
#include "ardour/audio_library.h"
#include "ardour/auditioner.h"
#include "ardour/audioregion.h"
#include "ardour/source_factory.h"
#include "ardour/session.h"
#include "ardour/session_directory.h"
-#include "ardour/profile.h"
#include "ardour_ui.h"
#include "editing.h"
#include "editing.h"
#include "utils.h"
#include "gain_meter.h"
+#include "main_clock.h"
#ifdef FREESOUND
#include "sfdb_freesound_mootcher.h"
return false;
}
- preview_label.set_markup (string_compose ("<b>%1</b>", Glib::path_get_basename (filename)));
+ preview_label.set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text (Glib::path_get_basename (filename))));
std::string n = sf_info.format_name;
if (n.substr (0, 8) == X_("Format: ")) {
n = n.substr (8);
notebook.set_size_request (500, -1);
+ notebook.signal_switch_page().connect (
+ sigc::hide_return (sigc::hide (sigc::hide (sigc::mem_fun (*this, &SoundFileBrowser::reset_options))))
+ );
set_session (s);
void
SoundFileBrowser::update_preview ()
{
- if (preview.setup_labels (chooser.get_filename())) {
+ if (preview.setup_labels (chooser.get_preview_filename())) {
if (preview.autoplay()) {
Glib::signal_idle().connect (sigc::mem_fun (preview, &SoundFileBox::audition_oneshot));
}
XMLNode *root = doc.root();
if (!root) {
- cerr << "no root XML node!" << endl;
+ error << "no root XML node!" << endmsg;
break;
}
if ( strcmp(root->name().c_str(), "response") != 0) {
- cerr << "root node name == " << root->name() << ", != \"response\"!" << endl;
+ error << string_compose ("root node name == %1 != \"response\"", root->name()) << endmsg;
break;
}
XMLNode *sounds_root = root->child("sounds");
if (!sounds_root) {
- cerr << "no child node \"sounds\" found!" << endl;
+ error << "no child node \"sounds\" found!" << endmsg;
break;
}
for (niter = sounds.begin(); niter != sounds.end(); ++niter) {
node = *niter;
if( strcmp( node->name().c_str(), "resource") != 0 ){
- cerr << "node->name()=" << node->name() << ",!= \"resource\"!" << endl;
+ error << string_compose ("node->name()=%1 != \"resource\"", node->name()) << endmsg;
freesound_search_cancel = true;
break;
}
channel_combo.set_sensitive (false);
action_combo.set_sensitive (false);
where_combo.set_sensitive (false);
+ copy_files_btn.set_active (true);
copy_files_btn.set_sensitive (false);
return false;
/* if we get through this function successfully, this may be
reset at the end, once we know if we can use hard links
- to do embedding
+ to do embedding (or if we are importing a MIDI file).
*/
if (Config->get_only_copy_imported_files()) {
bool selection_can_be_embedded_with_links = check_link_status (_session, paths);
ImportMode mode;
+ /* See if we are thinking about importing any MIDI files */
+ vector<string>::iterator i = paths.begin ();
+ while (i != paths.end() && SMFSource::safe_midi_file_extension (*i) == false) {
+ ++i;
+ }
+ bool const have_a_midi_file = (i != paths.end ());
+
if (check_info (paths, same_size, src_needed, selection_includes_multichannel)) {
Glib::signal_idle().connect (sigc::mem_fun (*this, &SoundFileOmega::bad_file_message));
return false;
string existing_choice;
vector<string> action_strings;
+ resetting_ourselves = true;
+
if (chooser.get_filter() == &audio_filter) {
/* AUDIO */
}
}
}
-
+
} else {
- /* MIDI */
+ /* MIDI ONLY */
if (selected_midi_track_cnt > 0) {
action_strings.push_back (importmode2string (ImportToTrack));
action_strings.push_back (importmode2string (ImportAsRegion));
action_strings.push_back (importmode2string (ImportAsTapeTrack));
- resetting_ourselves = true;
-
existing_choice = action_combo.get_active_text();
set_popdown_strings (action_combo, action_strings);
src_combo.set_sensitive (false);
}
+ /* We must copy MIDI files or those from Freesound */
+ bool const must_copy = have_a_midi_file || notebook.get_current_page() == 2;
+
if (Config->get_only_copy_imported_files()) {
- if (selection_can_be_embedded_with_links) {
+ if (selection_can_be_embedded_with_links && !must_copy) {
copy_files_btn.set_sensitive (true);
} else {
+ if (must_copy) {
+ copy_files_btn.set_active (true);
+ }
copy_files_btn.set_sensitive (false);
}
} else {
- copy_files_btn.set_sensitive (true);
+ if (must_copy) {
+ copy_files_btn.set_active (true);
+ }
+ copy_files_btn.set_sensitive (!must_copy);
}
return true;
bool
SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths)
{
- sys::path path = s->session_directory().sound_path() / "linktest";
- string tmpdir = path.to_string();
+ std::string tmpdir(Glib::build_filename (s->session_directory().sound_path(), "linktest"));
bool ret = false;
if (mkdir (tmpdir.c_str(), 0744)) {
where_combo.set_active_text (str.front());
Label* l = manage (new Label);
- l->set_text (_("Add files:"));
+ l->set_markup (_("<b>Add files as ...</b>"));
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->set_spacing (6);
- hbox->pack_start (*l, false, false);
- hbox->pack_start (action_combo, false, false);
vbox = manage (new VBox);
- vbox->pack_start (*hbox, false, false);
- options.pack_start (*vbox, false, false);
+ vbox->set_border_width (12);
+ vbox->set_spacing (6);
+ vbox->pack_start (*l, false, false);
+ vbox->pack_start (action_combo, false, false);
+ hbox = manage (new HBox);
+ hbox->pack_start (*vbox, false, false);
+ options.pack_start (*hbox, false, false);
/* dummy entry for action combo so that it doesn't look odd if we
come up with no tracks selected.
action_combo.set_sensitive (false);
l = manage (new Label);
- l->set_text (_("Insert at:"));
+ l->set_markup (_("<b>Insert at</b>"));
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->set_spacing (6);
- hbox->pack_start (*l, false, false);
- hbox->pack_start (where_combo, false, false);
vbox = manage (new VBox);
- vbox->pack_start (*hbox, false, false);
- options.pack_start (*vbox, false, false);
+ vbox->set_border_width (12);
+ vbox->set_spacing (6);
+ vbox->pack_start (*l, false, false);
+ vbox->pack_start (where_combo, false, false);
+ hbox = manage (new HBox);
+ hbox->pack_start (*vbox, false, false);
+ options.pack_start (*hbox, false, false);
l = manage (new Label);
- l->set_text (_("Mapping:"));
+ l->set_markup (_("<b>Mapping</b>"));
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->set_spacing (6);
- hbox->pack_start (*l, false, false);
- hbox->pack_start (channel_combo, false, false);
vbox = manage (new VBox);
- vbox->pack_start (*hbox, false, false);
- options.pack_start (*vbox, false, false);
+ vbox->set_border_width (12);
+ vbox->set_spacing (6);
+ vbox->pack_start (*l, false, false);
+ vbox->pack_start (channel_combo, false, false);
+ hbox = manage (new HBox);
+ hbox->pack_start (*vbox, false, false);
+ options.pack_start (*hbox, false, false);
str.clear ();
str.push_back (_("one track per file"));
channel_combo.set_sensitive (false);
l = manage (new Label);
- l->set_text (_("Conversion quality:"));
+ l->set_markup (_("<b>Conversion quality</b>"));
- hbox = manage (new HBox);
- hbox->set_border_width (12);
- hbox->set_spacing (6);
- hbox->pack_start (*l, false, false);
- hbox->pack_start (src_combo, false, false);
vbox = manage (new VBox);
- vbox->pack_start (*hbox, false, false);
- options.pack_start (*vbox, false, false);
+ vbox->set_border_width (12);
+ vbox->set_spacing (6);
+ vbox->pack_start (*l, false, false);
+ vbox->pack_start (src_combo, false, false);
+ hbox = manage (new HBox);
+ hbox->pack_start (*vbox, false, false);
+ options.pack_start (*hbox, false, false);
str.clear ();
str.push_back (_("Best"));
copy_files_btn.set_active (true);
+ Gtk::Label* copy_label = dynamic_cast<Gtk::Label*>(copy_files_btn.get_child());
+
+ if (copy_label) {
+ copy_label->set_size_request (175, -1);
+ copy_label->set_line_wrap (true);
+ }
+
block_four.pack_start (copy_files_btn, false, false);
options.pack_start (block_four, false, false);
{
selected_audio_track_cnt = selected_audio_tracks;
selected_midi_track_cnt = selected_midi_tracks;
+
+ if (selected_audio_track_cnt == 0 && selected_midi_track_cnt > 0) {
+ chooser.set_filter (midi_filter);
+ } else if (selected_midi_track_cnt == 0 && selected_audio_track_cnt > 0) {
+ chooser.set_filter (audio_filter);
+ } else {
+ chooser.set_filter (audio_and_midi_filter);
+ }
+
reset_options ();
}