summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-08-27 21:46:50 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-08-27 21:46:50 +0000
commitd31dcc9c78e9b3e85baf3d4b8dbc303405192a1d (patch)
treed23f754c396d31197cdb20f55de47ea025d96fdb /gtk2_ardour/sfdb_ui.cc
parent2fc853ab331b45a7ffdce633b6c02baca541bea8 (diff)
make sure we do not leave pending session state around as we shutdown
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2353 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/sfdb_ui.cc')
-rw-r--r--gtk2_ardour/sfdb_ui.cc162
1 files changed, 84 insertions, 78 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 79fcddc6d1..46072c72d9 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -292,12 +292,22 @@ SoundFileBox::audition_status_changed (bool active)
}
}
-SoundFileBrowser::SoundFileBrowser (string title, ARDOUR::Session* s)
+SoundFileBrowser::SoundFileBrowser (string title, ARDOUR::Session* s, int selected_tracks)
: ArdourDialog (title, false),
found_list (ListStore::create(found_list_columns)),
chooser (FILE_CHOOSER_ACTION_OPEN),
found_list_view (found_list),
- found_search_btn (_("Search"))
+ found_search_btn (_("Search")),
+ split_files (_("Split non-mono files")),
+ merge_stereo (_("Use files as single stereo track")),
+ as_tracks (rgroup1, _("Use files as new tracks")),
+ to_tracks (rgroup1, _("Add files to selected tracks")),
+ as_regions (rgroup1, _("Add files to region list")),
+ as_tape_tracks (rgroup1, _("Add files as new tape tracks")),
+ import (rgroup2, _("Copy to Ardour-native files")),
+ embed (rgroup2, _("Use file without copying")),
+ mode (ImportAsTrack),
+ selected_track_cnt (selected_tracks)
{
VBox* vbox;
@@ -311,8 +321,12 @@ SoundFileBrowser::SoundFileBrowser (string title, ARDOUR::Session* s)
hbox->set_spacing (6);
hbox->pack_start (notebook, true, true);
hbox->pack_start (*vbox, false, false);
+
+ build_options ();
+ rebuild_options ();
get_vbox()->pack_start (*hbox, true, true);
+ get_vbox()->pack_start (options, false, false);
hbox = manage(new HBox);
hbox->pack_start (found_entry);
@@ -469,77 +483,14 @@ SoundFileBrowser::get_paths ()
}
}
-SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
- : ArdourDialog (title, false),
- browser (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);
-
- browser.chooser.set_select_multiple (false);
- browser.found_list_view.get_selection()->set_mode (SELECTION_SINGLE);
-
- show_all ();
-}
-
-Glib::ustring
-SoundFileChooser::get_filename ()
+void
+SoundFileBrowser::rebuild_options ()
{
- vector<Glib::ustring> paths;
-
- paths = browser.get_paths ();
+ vector<Glib::ustring> paths = get_paths ();
- if (paths.empty()) {
- return Glib::ustring ();
- }
-
- if (!Glib::file_test (paths.front(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) {
- return Glib::ustring();
- }
-
- return paths.front();
-}
-
-
-SoundFileOptionsDialog::SoundFileOptionsDialog (Window& parent, const Session& s, const vector<Glib::ustring>& p, int selected_tracks)
- : ArdourDialog (parent, _("External Audio Options"), false),
- mode (ImportAsTrack),
- paths (p),
- split_files (_("Split non-mono files")),
- merge_stereo (_("Use files as single stereo track")),
- as_tracks (rgroup1, _("Use files as new tracks")),
- to_tracks (rgroup1, _("Add files to selected tracks")),
- as_regions (rgroup1, _("Add files to region list")),
- as_tape_tracks (rgroup1, _("Add files as new tape tracks")),
- import (rgroup2, _("Copy to Ardour-native files")),
- embed (rgroup2, _("Use file without copying")),
- session (s),
- selected_track_cnt (selected_tracks)
-{
selection_includes_multichannel = check_multichannel_status (paths);
selection_can_be_embedded_with_links = check_link_status (s, paths);
- block_two.set_border_width (12);
- block_three.set_border_width (12);
- block_four.set_border_width (12);
-
- block_two.pack_start (as_tracks, false, false);
- block_two.pack_start (to_tracks, false, false);
- block_two.pack_start (as_regions, false, false);
- block_two.pack_start (as_tape_tracks, false, false);
-
- as_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
- to_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
- as_regions.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
- as_tape_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
-
- block_three.pack_start (merge_stereo, false, false);
- block_three.pack_start (split_files, false, false);
-
if (Profile->get_sae()) {
if (selection_can_be_embedded_with_links) {
block_four.pack_start (import, false, false);
@@ -555,11 +506,6 @@ SoundFileOptionsDialog::SoundFileOptionsDialog (Window& parent, const Session& s
block_four.pack_start (import, false, false);
block_four.pack_start (embed, false, false);
}
-
- get_vbox()->set_spacing (12);
- get_vbox()->pack_start (block_two, false, false);
- get_vbox()->pack_start (block_three, false, false);
- get_vbox()->pack_start (block_four, false, false);
if (selected_track_cnt == 0) {
to_tracks.set_sensitive (false);
@@ -568,13 +514,36 @@ SoundFileOptionsDialog::SoundFileOptionsDialog (Window& parent, const Session& s
}
mode_changed ();
+}
+
+void
+SoundFileBrowser::build_options (VBox& options)
+{
+ block_two.set_border_width (12);
+ block_three.set_border_width (12);
+ block_four.set_border_width (12);
- add_button (Stock::OK, RESPONSE_OK);
- add_button (Stock::CANCEL, RESPONSE_CANCEL);
+ block_two.pack_start (as_tracks, false, false);
+ block_two.pack_start (to_tracks, false, false);
+ block_two.pack_start (as_regions, false, false);
+ block_two.pack_start (as_tape_tracks, false, false);
+
+ as_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
+ to_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
+ as_regions.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
+ as_tape_tracks.signal_toggled().connect (mem_fun (*this, &SoundFileOptionsDialog::mode_changed));
+
+ block_three.pack_start (merge_stereo, false, false);
+ block_three.pack_start (split_files, false, false);
+
+ options.set_spacing (12);
+ options.pack_start (block_two, false, false);
+ options.pack_start (block_three, false, false);
+ options.pack_start (block_four, false, false);
}
void
-SoundFileOptionsDialog::mode_changed ()
+SoundFileOptionsBrowser::mode_changed ()
{
if (as_tracks.get_active()) {
mode = ImportAsTrack;
@@ -601,7 +570,7 @@ SoundFileOptionsDialog::mode_changed ()
bool
-SoundFileOptionsDialog::check_multichannel_status (const vector<Glib::ustring>& paths)
+SoundFileOptionsBrowser::check_multichannel_status (const vector<Glib::ustring>& paths)
{
SNDFILE* sf;
SF_INFO info;
@@ -622,7 +591,7 @@ SoundFileOptionsDialog::check_multichannel_status (const vector<Glib::ustring>&
}
bool
-SoundFileOptionsDialog::check_link_status (const Session& s, const vector<Glib::ustring>& paths)
+SoundFileOptionsBrowser::check_link_status (const Session& s, const vector<Glib::ustring>& paths)
{
string tmpdir = s.sound_dir();
bool ret = false;
@@ -657,4 +626,41 @@ SoundFileOptionsDialog::check_link_status (const Session& s, const vector<Glib::
return ret;
}
+SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
+ : ArdourDialog (title, false),
+ browser (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);
+
+ browser.chooser.set_select_multiple (false);
+ browser.found_list_view.get_selection()->set_mode (SELECTION_SINGLE);
+
+ show_all ();
+}
+
+Glib::ustring
+SoundFileChooser::get_filename ()
+{
+ vector<Glib::ustring> paths;
+
+ paths = browser.get_paths ();
+
+ if (paths.empty()) {
+ return Glib::ustring ();
+ }
+
+ if (!Glib::file_test (paths.front(), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) {
+ return Glib::ustring();
+ }
+
+ return paths.front();
+}
+
+
+