summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-09-04 22:23:26 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-09-04 22:23:26 +0000
commit82fb1d9182b3162dcff5a79867918d55e94c0f80 (patch)
tree23a3db1e19b5357b229d929d5e85d6534b9455ea
parent2b3716526bdf34a051cf960dca826fcc428fb76a (diff)
split SoundFileBrowser back into SoundFileOmega; make SoundFileChooser work again; fix bug in assigning click sounds
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2417 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.h6
-rw-r--r--gtk2_ardour/editor_audio_import.cc2
-rw-r--r--gtk2_ardour/option_editor.cc20
-rw-r--r--gtk2_ardour/sfdb_ui.cc262
-rw-r--r--gtk2_ardour/sfdb_ui.h76
-rw-r--r--libs/ardour/session_click.cc2
6 files changed, 193 insertions, 175 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 9a8d59fd35..fcaed5b513 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -102,7 +102,7 @@ class MixerStrip;
class StreamView;
class AudioStreamView;
class ControlPoint;
-class SoundFileBrowser;
+class SoundFileOmega;
#ifdef FFT_ANALYSIS
class AnalysisWindow;
#endif
@@ -966,8 +966,8 @@ class Editor : public PublicEditor
void external_audio_dialog ();
bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
- SoundFileBrowser* sfbrowser;
-
+ SoundFileOmega* sfbrowser;
+
void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index f2873f3f0b..72fbc4fdcb 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -80,7 +80,7 @@ Editor::external_audio_dialog ()
}
if (sfbrowser == 0) {
- sfbrowser = new SoundFileBrowser (*this, _("Add existing audio"), session, selection->tracks.size());
+ sfbrowser = new SoundFileOmega (*this, _("Add existing audio"), session, selection->tracks.size());
} else {
sfbrowser->reset (selection->tracks.size());
}
diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc
index 9a6bc4c4ae..d43c15bbae 100644
--- a/gtk2_ardour/option_editor.cc
+++ b/gtk2_ardour/option_editor.cc
@@ -772,13 +772,16 @@ OptionEditor::raid_path_changed ()
void
OptionEditor::click_browse_clicked ()
{
- // SoundFileChooser sfdb (_("Choose Click"), session);
+ SoundFileChooser sfdb (*this, _("Choose Click"), session);
- //int result = sfdb.run ();
+ sfdb.show_all ();
+ sfdb.present ();
+
+ int result = sfdb.run ();
- // if (result == Gtk::RESPONSE_OK) {
- // click_chosen(sfdb.get_filename());
-// }
+ if (result == Gtk::RESPONSE_OK) {
+ click_chosen(sfdb.get_filename());
+ }
}
void
@@ -791,15 +794,16 @@ OptionEditor::click_chosen (const string & path)
void
OptionEditor::click_emphasis_browse_clicked ()
{
-#if 0
- SoundFileChooser sfdb (_("Choose Click Emphasis"), session);
+ SoundFileChooser sfdb (*this, _("Choose Click Emphasis"), session);
+
+ sfdb.show_all ();
+ sfdb.present ();
int result = sfdb.run ();
if (result == Gtk::RESPONSE_OK) {
click_emphasis_chosen (sfdb.get_filename());
}
-#endif
}
void
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 2350136067..70e108ea8c 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -329,22 +329,17 @@ SoundFileBox::audition_status_changed (bool active)
}
}
-SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::Session* s, int selected_tracks)
+SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::Session* s)
: ArdourDialog (parent, title, false, false),
found_list (ListStore::create(found_list_columns)),
chooser (FILE_CHOOSER_ACTION_OPEN),
found_list_view (found_list),
- import (rgroup2, _("Copy to Ardour-native files")),
- embed (rgroup2, _("Use file without copying")),
- found_search_btn (_("Search")),
- selected_track_cnt (selected_tracks)
+ found_search_btn (_("Search"))
{
VBox* vbox;
HBox* hbox;
HBox* hpacker;
- set_size_request (-1, 450);
-
set_session (s);
resetting_ourselves = false;
@@ -353,69 +348,7 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
hpacker->pack_start (notebook, true, true);
hpacker->pack_start (preview, false, false);
- block_two.set_border_width (12);
- block_three.set_border_width (12);
- block_four.set_border_width (12);
-
- options.set_spacing (12);
-
- vector<string> where_strings;
-
- where_strings.push_back (_("use file timestamp"));
- where_strings.push_back (_("at edit cursor"));
- where_strings.push_back (_("at playhead"));
- where_strings.push_back (_("at session start"));
- set_popdown_strings (where_combo, where_strings);
- where_combo.set_active_text (where_strings.front());
-
- Label* l = manage (new Label);
- l->set_text (_("Add files:"));
-
- 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);
-
- l = manage (new Label);
- l->set_text (_("Insert:"));
-
- 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);
-
-
- l = manage (new Label);
- l->set_text (_("Mapping:"));
-
- 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);
-
- reset_options ();
-
- action_combo.signal_changed().connect (mem_fun (*this, &SoundFileBrowser::reset_options_noret));
-
- block_four.pack_start (import, false, false);
- block_four.pack_start (embed, false, false);
-
- options.pack_start (block_four, false, false);
-
get_vbox()->pack_start (*hpacker, true, true);
- get_vbox()->pack_start (options, false, false);
hbox = manage(new HBox);
hbox->pack_start (found_entry);
@@ -444,7 +377,6 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
chooser.add_filter (matchall_filter);
chooser.set_select_multiple (true);
chooser.signal_update_preview().connect(mem_fun(*this, &SoundFileBrowser::update_preview));
- chooser.signal_selection_changed().connect (mem_fun (*this, &SoundFileBrowser::file_selection_changed));
chooser.signal_file_activated().connect (mem_fun (*this, &SoundFileBrowser::chooser_file_activated));
if (!persistent_folder.empty()) {
@@ -459,16 +391,6 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
add_button (Stock::CANCEL, RESPONSE_CANCEL);
add_button (Stock::OK, RESPONSE_OK);
- /* setup disposition map */
-
- disposition_map.insert (pair<ustring,ImportDisposition>(_("one track per file"), ImportDistinctFiles));
- disposition_map.insert (pair<ustring,ImportDisposition>(_("one track per channel"), ImportDistinctChannels));
- disposition_map.insert (pair<ustring,ImportDisposition>(_("merge files"), ImportMergeFiles));
- disposition_map.insert (pair<ustring,ImportDisposition>(_("sequence files"), ImportSerializeFiles));
-
- disposition_map.insert (pair<ustring,ImportDisposition>(_("one region per file"), ImportDistinctFiles));
- disposition_map.insert (pair<ustring,ImportDisposition>(_("one region per channel"), ImportDistinctChannels));
- disposition_map.insert (pair<ustring,ImportDisposition>(_("all files in one region"), ImportMergeFiles));
}
SoundFileBrowser::~SoundFileBrowser ()
@@ -477,31 +399,6 @@ SoundFileBrowser::~SoundFileBrowser ()
}
void
-SoundFileBrowser::reset (int selected_tracks)
-{
- selected_track_cnt = selected_tracks;
- reset_options ();
-}
-
-void
-SoundFileBrowser::file_selection_changed ()
-{
- if (resetting_ourselves) {
- return;
- }
-
- if (!reset_options ()) {
- set_response_sensitive (RESPONSE_OK, false);
- } else {
- if (chooser.get_filenames().size() > 0) {
- set_response_sensitive (RESPONSE_OK, true);
- } else {
- set_response_sensitive (RESPONSE_OK, false);
- }
- }
-}
-
-void
SoundFileBrowser::chooser_file_activated ()
{
preview.audition ();
@@ -614,7 +511,7 @@ SoundFileBrowser::get_paths ()
}
void
-SoundFileBrowser::reset_options_noret ()
+SoundFileOmega::reset_options_noret ()
{
if (!resetting_ourselves) {
(void) reset_options ();
@@ -622,7 +519,7 @@ SoundFileBrowser::reset_options_noret ()
}
bool
-SoundFileBrowser::reset_options ()
+SoundFileOmega::reset_options ()
{
vector<ustring> paths = get_paths ();
@@ -653,7 +550,7 @@ SoundFileBrowser::reset_options ()
ImportMode mode;
if (err) {
- Glib::signal_idle().connect (mem_fun (*this, &SoundFileBrowser::bad_file_message));
+ Glib::signal_idle().connect (mem_fun (*this, &SoundFileOmega::bad_file_message));
return false;
}
@@ -792,7 +689,7 @@ SoundFileBrowser::reset_options ()
bool
-SoundFileBrowser::bad_file_message()
+SoundFileOmega::bad_file_message()
{
MessageDialog msg (*this,
_("One or more of the selected files\ncannot be used by Ardour"),
@@ -806,7 +703,7 @@ SoundFileBrowser::bad_file_message()
}
bool
-SoundFileBrowser::check_multichannel_status (const vector<ustring>& paths, bool& same_size, bool& err)
+SoundFileOmega::check_multichannel_status (const vector<ustring>& paths, bool& same_size, bool& err)
{
SNDFILE* sf;
SF_INFO info;
@@ -843,7 +740,7 @@ SoundFileBrowser::check_multichannel_status (const vector<ustring>& paths, bool&
}
bool
-SoundFileBrowser::check_link_status (const Session& s, const vector<ustring>& paths)
+SoundFileOmega::check_link_status (const Session& s, const vector<ustring>& paths)
{
string tmpdir = s.sound_dir();
bool ret = false;
@@ -879,27 +776,19 @@ SoundFileBrowser::check_link_status (const Session& s, const vector<ustring>& pa
}
SoundFileChooser::SoundFileChooser (Gtk::Window& parent, string title, ARDOUR::Session* s)
- : SoundFileBrowser (parent, title, s, 0)
+ : SoundFileBrowser (parent, title, s)
{
- set_default_size (700, 300);
-
- // get_vbox()->pack_start (browser, false, false);
-
- // add_button (Stock::OPEN, RESPONSE_OK);
- // add_button (Stock::CANCEL, RESPONSE_CANCEL);
-
- // chooser.set_select_multiple (false);
- // browser.found_list_view.get_selection()->set_mode (SELECTION_SINGLE);
-
- show_all ();
+ set_size_request (700, 300);
+ chooser.set_select_multiple (false);
+ found_list_view.get_selection()->set_mode (SELECTION_SINGLE);
}
ustring
SoundFileChooser::get_filename ()
{
vector<ustring> paths;
-#if 0
- paths = browser.get_paths ();
+
+ paths = get_paths ();
if (paths.empty()) {
return ustring ();
@@ -908,12 +797,101 @@ SoundFileChooser::get_filename ()
if (!Glib::file_test (paths.front(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) {
return ustring();
}
-#endif
+
return paths.front();
}
+SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Session* s, int selected_tracks)
+ : SoundFileBrowser (parent, title, s),
+ import (rgroup2, _("Copy to Ardour-native files")),
+ embed (rgroup2, _("Use file without copying")),
+ selected_track_cnt (selected_tracks)
+{
+ VBox* vbox;
+ HBox* hbox;
+ HBox* hpacker;
+
+ set_size_request (-1, 450);
+
+ block_two.set_border_width (12);
+ block_three.set_border_width (12);
+ block_four.set_border_width (12);
+
+ options.set_spacing (12);
+
+ vector<string> where_strings;
+
+ where_strings.push_back (_("use file timestamp"));
+ where_strings.push_back (_("at edit cursor"));
+ where_strings.push_back (_("at playhead"));
+ where_strings.push_back (_("at session start"));
+ set_popdown_strings (where_combo, where_strings);
+ where_combo.set_active_text (where_strings.front());
+
+ Label* l = manage (new Label);
+ l->set_text (_("Add files:"));
+
+ 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);
+
+ l = manage (new Label);
+ l->set_text (_("Insert:"));
+
+ 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);
+
+
+ l = manage (new Label);
+ l->set_text (_("Mapping:"));
+
+ 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);
+
+ reset_options ();
+
+ action_combo.signal_changed().connect (mem_fun (*this, &SoundFileOmega::reset_options_noret));
+
+ block_four.pack_start (import, false, false);
+ block_four.pack_start (embed, false, false);
+
+ options.pack_start (block_four, false, false);
+
+ get_vbox()->pack_start (options, false, false);
+
+ /* setup disposition map */
+
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("one track per file"), ImportDistinctFiles));
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("one track per channel"), ImportDistinctChannels));
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("merge files"), ImportMergeFiles));
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("sequence files"), ImportSerializeFiles));
+
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("one region per file"), ImportDistinctFiles));
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("one region per channel"), ImportDistinctChannels));
+ disposition_map.insert (pair<ustring,ImportDisposition>(_("all files in one region"), ImportMergeFiles));
+
+ chooser.signal_selection_changed().connect (mem_fun (*this, &SoundFileOmega::file_selection_changed));
+}
+
ImportMode
-SoundFileBrowser::get_mode () const
+SoundFileOmega::get_mode () const
{
ustring str = action_combo.get_active_text();
@@ -929,7 +907,7 @@ SoundFileBrowser::get_mode () const
}
ImportPosition
-SoundFileBrowser::get_position() const
+SoundFileOmega::get_position() const
{
ustring str = where_combo.get_active_text();
@@ -945,7 +923,7 @@ SoundFileBrowser::get_position() const
}
ImportDisposition
-SoundFileBrowser::get_channel_disposition () const
+SoundFileOmega::get_channel_disposition () const
{
/* we use a map here because the channel combo can contain different strings
depending on the state of the other combos. the map contains all possible strings
@@ -962,3 +940,29 @@ SoundFileBrowser::get_channel_disposition () const
return x->second;
}
+
+void
+SoundFileOmega::reset (int selected_tracks)
+{
+ selected_track_cnt = selected_tracks;
+ reset_options ();
+}
+
+void
+SoundFileOmega::file_selection_changed ()
+{
+ if (resetting_ourselves) {
+ return;
+ }
+
+ if (!reset_options ()) {
+ set_response_sensitive (RESPONSE_OK, false);
+ } else {
+ if (chooser.get_filenames().size() > 0) {
+ set_response_sensitive (RESPONSE_OK, true);
+ } else {
+ set_response_sensitive (RESPONSE_OK, false);
+ }
+ }
+}
+
diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h
index 2ad7ebf9b6..cd0e8c6dfa 100644
--- a/gtk2_ardour/sfdb_ui.h
+++ b/gtk2_ardour/sfdb_ui.h
@@ -116,33 +116,19 @@ class SoundFileBrowser : public ArdourDialog
FoundTagColumns found_list_columns;
Glib::RefPtr<Gtk::ListStore> found_list;
- Gtk::RadioButtonGroup rgroup1;
- Gtk::RadioButtonGroup rgroup2;
-
public:
- SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks);
+ SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s);
virtual ~SoundFileBrowser ();
virtual void set_session (ARDOUR::Session*);
std::vector<Glib::ustring> get_paths ();
- void reset (int selected_tracks);
-
Gtk::FileChooserWidget chooser;
Gtk::TreeView found_list_view;
- Gtk::ComboBoxText action_combo;
- Gtk::ComboBoxText where_combo;
- Gtk::ComboBoxText channel_combo;
-
- Gtk::RadioButton import;
- Gtk::RadioButton embed;
-
- Editing::ImportMode get_mode() const;
- Editing::ImportPosition get_position() const;
- Editing::ImportDisposition get_channel_disposition() const;
-
protected:
+ bool resetting_ourselves;
+
Gtk::FileFilter custom_filter;
Gtk::FileFilter matchall_filter;
SoundFileBox preview;
@@ -161,15 +147,50 @@ class SoundFileBrowser : public ArdourDialog
void chooser_file_activated ();
bool on_custom (const Gtk::FileFilter::Info& filter_info);
- void file_selection_changed ();
- int selected_track_cnt;
+ virtual bool reset_options() { return true; }
+};
+
+class SoundFileChooser : public SoundFileBrowser
+{
+ public:
+ SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
+ virtual ~SoundFileChooser () {};
+
+ Glib::ustring get_filename ();
+
+ private:
+ // SoundFileBrowser browser;
+};
+
+class SoundFileOmega : public SoundFileBrowser
+{
+ private:
+ Gtk::RadioButtonGroup rgroup1;
+ Gtk::RadioButtonGroup rgroup2;
+
+ public:
+ SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks);
+
+ void reset (int selected_tracks);
+
+ Gtk::ComboBoxText action_combo;
+ Gtk::ComboBoxText where_combo;
+ Gtk::ComboBoxText channel_combo;
+
+ Gtk::RadioButton import;
+ Gtk::RadioButton embed;
+
+ Editing::ImportMode get_mode() const;
+ Editing::ImportPosition get_position() const;
+ Editing::ImportDisposition get_channel_disposition() const;
+
+ private:
+ uint32_t selected_track_cnt;
typedef std::map<Glib::ustring,Editing::ImportDisposition> DispositionMap;
DispositionMap disposition_map;
- bool resetting_ourselves;
-
Gtk::HBox options;
Gtk::VBox block_two;
Gtk::VBox block_three;
@@ -178,21 +199,10 @@ class SoundFileBrowser : public ArdourDialog
static bool check_multichannel_status (const std::vector<Glib::ustring>& paths, bool& same_size, bool& err);
static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
+ void file_selection_changed ();
bool reset_options ();
void reset_options_noret ();
bool bad_file_message ();
};
-class SoundFileChooser : public SoundFileBrowser
-{
- public:
- SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
- virtual ~SoundFileChooser () {};
-
- Glib::ustring get_filename ();
-
- private:
- // SoundFileBrowser browser;
-};
-
#endif // __ardour_sfdb_ui_h__
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index f2064ab731..f48054c532 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -145,7 +145,7 @@ Session::setup_click_sounds (int which)
click_data = 0;
}
- string path = Config->get_click_emphasis_sound();
+ string path = Config->get_click_sound();
if (path.empty()) {