X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fsfdb_ui.cc;h=bd19db31f04ba275cc413be8ae3799289b7da9d4;hb=99aa8c6338e47b41143f799fdcb35d1699548076;hp=c266b808837ce94fb90c90e4f78a4b38732e6f69;hpb=dc815ea8e84d28fc01a68225c2ece4399c4a9c7e;p=ardour.git diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index c266b80883..bd19db31f0 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -17,6 +17,10 @@ */ +#ifdef WAF_BUILD +#include "gtk2ardour-config.h" +#endif + #include #include #include @@ -73,9 +77,9 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace Editing; -using Glib::ustring; +using std::string; -ustring SoundFileBrowser::persistent_folder; +string SoundFileBrowser::persistent_folder; static ImportMode string2importmode (string str) @@ -144,7 +148,10 @@ SoundFileBox::SoundFileBox (bool persistent) samplerate.set_text (_("Sample rate:")); samplerate.set_alignment (1, 0.5); - format_text.set_max_width_chars (8); + preview_label.set_max_width_chars (50); + preview_label.set_ellipsize (Pango::ELLIPSIZE_END); + + format_text.set_max_width_chars (20); format_text.set_ellipsize (Pango::ELLIPSIZE_END); format_text.set_alignment (0, 1); @@ -213,7 +220,7 @@ SoundFileBox::set_session(Session* s) } bool -SoundFileBox::setup_labels (const ustring& filename) +SoundFileBox::setup_labels (const string& filename) { if (!path.empty()) { // save existing tags @@ -261,7 +268,7 @@ SoundFileBox::setup_labels (const ustring& filename) samplerate.set_name ("NewSessionSR2Label"); } - nframes_t const nfr = _session ? _session->nominal_frame_rate() : 25; + framecnt_t const nfr = _session ? _session->nominal_frame_rate() : 25; double src_coef = (double) nfr / sf_info.samplerate; length_clock.set (sf_info.length * src_coef + 0.5, true); @@ -308,6 +315,11 @@ SoundFileBox::audition () return; } + if (SMFSource::safe_midi_file_extension (path)) { + error << _("Auditioning of MIDI files is not yet supported") << endmsg; + return; + } + _session->cancel_audition(); if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { @@ -418,12 +430,11 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S resetting_ourselves = false; gm = 0; - if (ARDOUR::Profile->get_sae()) { - chooser.add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops"); - chooser.add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files"); - } - #ifdef GTKOSX + chooser.add_shortcut_folder_uri("file:///Library/GarageBand/Apple Loops"); + chooser.add_shortcut_folder_uri("file:///Library/Audio/Apple Loops"); + chooser.add_shortcut_folder_uri("file:///Library/Application Support/GarageBand/Instrument Library/Sampler/Sampler Files"); + chooser.add_shortcut_folder_uri("file:///Volumes"); #endif @@ -678,7 +689,7 @@ SoundFileBrowser::found_list_view_selected () if (!reset_options ()) { set_response_sensitive (RESPONSE_OK, false); } else { - ustring file; + string file; TreeView::Selection::ListHandle_Path rows = found_list_view.get_selection()->get_selected_rows (); @@ -701,7 +712,7 @@ SoundFileBrowser::freesound_list_view_selected () if (!reset_options ()) { set_response_sensitive (RESPONSE_OK, false); } else { - ustring file; + string file; TreeView::Selection::ListHandle_Path rows = freesound_list_view.get_selection()->get_selected_rows (); @@ -830,16 +841,16 @@ SoundFileBrowser::freesound_search_thread() } -vector +vector SoundFileBrowser::get_paths () { - vector results; + vector results; int n = notebook.get_current_page (); if (n == 0) { - vector filenames = chooser.get_filenames(); - vector::iterator i; + vector filenames = chooser.get_filenames(); + vector::iterator i; for (i = filenames.begin(); i != filenames.end(); ++i) { struct stat buf; @@ -855,7 +866,7 @@ SoundFileBrowser::get_paths () ListPath rows = found_list_view.get_selection()->get_selected_rows (); for (ListPath::iterator i = rows.begin() ; i != rows.end(); ++i) { TreeIter iter = found_list->get_iter(*i); - ustring str = (*iter)[found_list_columns.pathname]; + string str = (*iter)[found_list_columns.pathname]; results.push_back (str); } @@ -866,7 +877,7 @@ SoundFileBrowser::get_paths () ListPath rows = freesound_list_view.get_selection()->get_selected_rows (); for (ListPath::iterator i = rows.begin() ; i != rows.end(); ++i) { TreeIter iter = freesound_list->get_iter(*i); - ustring str = (*iter)[freesound_list_columns.pathname]; + string str = (*iter)[freesound_list_columns.pathname]; results.push_back (str); } @@ -886,7 +897,7 @@ SoundFileOmega::reset_options_noret () bool SoundFileOmega::reset_options () { - vector paths = get_paths (); + vector paths = get_paths (); if (paths.empty()) { @@ -926,7 +937,7 @@ SoundFileOmega::reset_options () return false; } - ustring existing_choice; + string existing_choice; vector action_strings; if (selected_track_cnt > 0) { @@ -1008,6 +1019,7 @@ SoundFileOmega::reset_options () } if (same_size) { channel_strings.push_back (_("all files in one track")); + channel_strings.push_back (_("merge files")); } } @@ -1026,6 +1038,8 @@ SoundFileOmega::reset_options () } } + resetting_ourselves = true; + existing_choice = channel_combo.get_active_text(); set_popdown_strings (channel_combo, channel_strings); @@ -1047,6 +1061,8 @@ SoundFileOmega::reset_options () channel_combo.set_active_text (channel_strings.front()); } + resetting_ourselves = false; + if (src_needed) { src_combo.set_sensitive (true); } else { @@ -1074,7 +1090,7 @@ bool SoundFileOmega::bad_file_message() { MessageDialog msg (*this, - _("One or more of the selected files\ncannot be used by Ardour"), + string_compose (_("One or more of the selected files\ncannot be used by %1"), PROGRAM_NAME), true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK); @@ -1087,10 +1103,10 @@ SoundFileOmega::bad_file_message() } bool -SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& src_needed, bool& multichannel) +SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& src_needed, bool& multichannel) { SoundFileInfo info; - nframes64_t sz = 0; + framepos_t sz = 0; bool err = false; string errmsg; @@ -1098,7 +1114,7 @@ SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& src_needed = false; multichannel = false; - for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { + for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { if (AudioFileSource::get_soundfile_info (*i, info, errmsg)) { if (info.channels > 1) { @@ -1112,7 +1128,7 @@ SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& } } - if ((nframes_t) info.samplerate != _session->frame_rate()) { + if (info.samplerate != _session->frame_rate()) { src_needed = true; } @@ -1138,7 +1154,7 @@ SoundFileOmega::check_info (const vector& paths, bool& same_size, bool& bool -SoundFileOmega::check_link_status (const Session* s, const vector& paths) +SoundFileOmega::check_link_status (const Session* s, const vector& paths) { sys::path path = s->session_directory().sound_path() / "linktest"; string tmpdir = path.to_string(); @@ -1150,7 +1166,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector& path } } - for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { + for (vector::const_iterator i = paths.begin(); i != paths.end(); ++i) { char tmpc[MAXPATHLEN+1]; @@ -1191,19 +1207,19 @@ SoundFileChooser::on_hide () } } -ustring +string SoundFileChooser::get_filename () { - vector paths; + vector paths; paths = get_paths (); if (paths.empty()) { - return ustring (); + return string (); } if (!Glib::file_test (paths.front(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { - return ustring(); + return string(); } return paths.front(); @@ -1314,6 +1330,7 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi reset_options (); action_combo.signal_changed().connect (sigc::mem_fun (*this, &SoundFileOmega::reset_options_noret)); + channel_combo.signal_changed().connect (sigc::mem_fun (*this, &SoundFileOmega::reset_options_noret)); copy_files_btn.set_active (true); @@ -1325,14 +1342,15 @@ SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Sessi /* setup disposition map */ - disposition_map.insert (pair(_("one track per file"), ImportDistinctFiles)); - disposition_map.insert (pair(_("one track per channel"), ImportDistinctChannels)); - disposition_map.insert (pair(_("merge files"), ImportMergeFiles)); - disposition_map.insert (pair(_("sequence files"), ImportSerializeFiles)); + disposition_map.insert (pair(_("one track per file"), ImportDistinctFiles)); + disposition_map.insert (pair(_("one track per channel"), ImportDistinctChannels)); + disposition_map.insert (pair(_("merge files"), ImportMergeFiles)); + disposition_map.insert (pair(_("sequence files"), ImportSerializeFiles)); - disposition_map.insert (pair(_("one region per file"), ImportDistinctFiles)); - disposition_map.insert (pair(_("one region per channel"), ImportDistinctChannels)); - disposition_map.insert (pair(_("all files in one region"), ImportMergeFiles)); + disposition_map.insert (pair(_("one region per file"), ImportDistinctFiles)); + disposition_map.insert (pair(_("one region per channel"), ImportDistinctChannels)); + disposition_map.insert (pair(_("all files in one region"), ImportMergeFiles)); + disposition_map.insert (pair(_("all files in one track"), ImportMergeFiles)); chooser.signal_selection_changed().connect (sigc::mem_fun (*this, &SoundFileOmega::file_selection_changed)); @@ -1380,7 +1398,7 @@ SoundFileOmega::on_hide () ImportPosition SoundFileOmega::get_position() const { - ustring str = where_combo.get_active_text(); + string str = where_combo.get_active_text(); if (str == _("file timestamp")) { return ImportAtTimestamp; @@ -1396,7 +1414,7 @@ SoundFileOmega::get_position() const SrcQuality SoundFileOmega::get_src_quality() const { - ustring str = where_combo.get_active_text(); + string str = where_combo.get_active_text(); if (str == _("Best")) { return SrcBest; @@ -1419,7 +1437,7 @@ SoundFileOmega::get_channel_disposition () const and the ImportDisposition enum that corresponds to it. */ - ustring str = channel_combo.get_active_text(); + string str = channel_combo.get_active_text(); DispositionMap::const_iterator x = disposition_map.find (str); if (x == disposition_map.end()) {