2 Copyright (C) 2005 Paul Davis
3 Written by Taybin Rutkin
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gtkmm/box.h>
23 #include <gtkmm/stock.h>
25 #include <ardour/audio_library.h>
31 SoundFileBox::SoundFileBox (ARDOUR::Session* session)
34 fields(Gtk::ListStore::create(label_columns)),
40 add_field_btn(_("Add Field...")),
41 remove_field_btn(_("Remove Field"))
43 set_name (X_("SoundFileBox"));
44 border_frame.set_label (_("Soundfile Info"));
45 border_frame.add (main_box);
47 pack_start (border_frame);
50 path_box.set_spacing (4);
51 path_box.pack_start (path, false, false);
52 path_box.pack_start (path_entry, true, true);
54 main_box.set_border_width (4);
56 main_box.pack_start(label, false, false);
57 main_box.pack_start(path_box, false, false);
58 main_box.pack_start(length, false, false);
59 main_box.pack_start(format, false, false);
60 main_box.pack_start(channels, false, false);
61 main_box.pack_start(samplerate, false, false);
62 main_box.pack_start(field_view, true, true);
63 main_box.pack_start(top_box, false, false);
64 main_box.pack_start(bottom_box, false, false);
66 field_view.set_size_request(200, 150);
67 top_box.set_homogeneous(true);
68 top_box.pack_start(add_field_btn);
69 top_box.pack_start(remove_field_btn);
71 remove_field_btn.set_sensitive(false);
73 bottom_box.set_homogeneous(true);
74 bottom_box.pack_start(play_btn);
75 bottom_box.pack_start(stop_btn);
77 play_btn.signal_clicked().connect (mem_fun (*this, &SoundFileBox::play_btn_clicked));
78 stop_btn.signal_clicked().connect (mem_fun (*this, &SoundFileBox::stop_btn_clicked));
81 play_btn.set_sensitive(false);
83 session->AuditionActive.connect(mem_fun (*this, &SoundFileBox::audition_status_changed));
86 add_field_btn.signal_clicked().connect
87 (mem_fun (*this, &SoundFileBox::add_field_clicked));
88 remove_field_btn.signal_clicked().connect
89 (mem_fun (*this, &SoundFileBox::remove_field_clicked));
91 field_view.get_selection()->signal_changed().connect (mem_fun (*this, &SoundFileBox::field_selected));
92 ARDOUR::Library->fields_changed.connect (mem_fun (*this, &SoundFileBox::setup_fields));
99 SoundFileBox::setup_labels (string filename)
103 SoundFileBox::setup_fields ()
107 SoundFileBox::play_btn_clicked ()
111 SoundFileBox::stop_btn_clicked ()
115 SoundFileBox::add_field_clicked ()
119 SoundFileBox::remove_field_clicked ()
123 SoundFileBox::audition_status_changed (bool state)
127 SoundFileBox::field_selected ()
131 SoundFileBox::update (std::string filename)
134 SoundFileBrowser::SoundFileBrowser (std::string title)
137 chooser(Gtk::FILE_CHOOSER_ACTION_OPEN),
140 get_vbox()->pack_start(chooser);
141 chooser.set_preview_widget(preview);
143 chooser.signal_update_preview().connect(mem_fun(*this, &SoundFileBrowser::update_preview));
149 SoundFileBrowser::update_preview ()
151 chooser.set_preview_widget_active(preview.update(chooser.get_filename()));
154 SoundFileChooser::SoundFileChooser (std::string title)
156 SoundFileBrowser(title)
158 add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
159 add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
164 SoundFileOmega::SoundFileOmega (std::string title)
166 SoundFileBrowser(title),
167 embed_btn (_("Embed")),
168 import_btn (_("Import")),
169 split_check (_("Split Channels"))
171 get_action_area()->pack_start(embed_btn);
172 get_action_area()->pack_start(import_btn);
173 add_button (Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
175 chooser.set_extra_widget(split_check);
177 embed_btn.signal_clicked().connect (mem_fun (*this, &SoundFileOmega::embed_clicked));
178 import_btn.signal_clicked().connect (mem_fun (*this, &SoundFileOmega::import_clicked));
184 SoundFileOmega::embed_clicked ()
186 Embedded (chooser.get_filenames(), split_check.get_active());
190 SoundFileOmega::import_clicked ()
192 Imported (chooser.get_filenames(), split_check.get_active());