fix horiz alignment (corner-radius is added to layout)
[ardour.git] / gtk2_ardour / sfdb_ui.cc
index da39d45db651b9023c90577959edd12c048eab7a..eab34a6a0a0fe16aeb446c5e9e38389588cc24a4 100644 (file)
@@ -248,7 +248,7 @@ SoundFileBox::setup_labels (const string& filename)
                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);
@@ -582,6 +582,9 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
 
 
        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);
 
@@ -1016,6 +1019,7 @@ SoundFileOmega::reset_options ()
                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;
@@ -1028,7 +1032,7 @@ SoundFileOmega::reset_options ()
 
                /* 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()) {
@@ -1044,6 +1048,13 @@ SoundFileOmega::reset_options ()
        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;
@@ -1194,17 +1205,26 @@ SoundFileOmega::reset_options ()
                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;
@@ -1281,8 +1301,7 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
 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)) {
@@ -1381,16 +1400,16 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
        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.
@@ -1403,29 +1422,29 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
        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"));
@@ -1434,16 +1453,16 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
        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"));
@@ -1463,6 +1482,13 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi
 
        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);