2 Copyright (C) 2005-2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_sfdb_ui_h__
21 #define __ardour_sfdb_ui_h__
26 #include <glibmm/ustring.h>
28 #include <sigc++/signal.h>
30 #include <gtkmm/box.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/checkbutton.h>
33 #include <gtkmm/comboboxtext.h>
34 #include <gtkmm/dialog.h>
35 #include <gtkmm/entry.h>
36 #include <gtkmm/filechooserwidget.h>
37 #include <gtkmm/frame.h>
38 #include <gtkmm/label.h>
40 #include <ardour/session.h>
41 #include <ardour/audiofilesource.h>
43 #include "ardour_dialog.h"
52 class SoundFileBox : public Gtk::VBox
56 virtual ~SoundFileBox () {};
58 void set_session (ARDOUR::Session* s);
59 bool setup_labels (const Glib::ustring& filename);
62 bool audition_oneshot();
63 bool autoplay () const;
66 ARDOUR::Session* _session;
69 ARDOUR::SoundFileInfo sf_info;
76 Gtk::Label samplerate;
79 Gtk::Label channels_value;
80 Gtk::Label samplerate_value;
82 Gtk::Label format_text;
83 AudioClock length_clock;
84 AudioClock timecode_clock;
86 Gtk::Frame border_frame;
87 Gtk::Label preview_label;
89 Gtk::TextView tags_entry;
97 Gtk::CheckButton autoplay_btn;
98 Gtk::Button apply_btn;
100 bool tags_entry_left (GdkEventFocus* event);
101 void tags_changed ();
102 void save_tags (const std::vector<std::string>&);
103 void stop_audition ();
106 class SoundFileBrowser : public ArdourDialog
109 class FoundTagColumns : public Gtk::TreeModel::ColumnRecord
112 Gtk::TreeModelColumn<Glib::ustring> pathname;
114 FoundTagColumns() { add(pathname); }
117 FoundTagColumns found_list_columns;
118 Glib::RefPtr<Gtk::ListStore> found_list;
121 SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s);
122 virtual ~SoundFileBrowser ();
124 virtual void set_session (ARDOUR::Session*);
125 std::vector<Glib::ustring> get_paths ();
127 void clear_selection ();
129 Gtk::FileChooserWidget chooser;
130 Gtk::TreeView found_list_view;
133 bool resetting_ourselves;
135 Gtk::FileFilter custom_filter;
136 Gtk::FileFilter matchall_filter;
137 SoundFileBox preview;
140 static Glib::ustring persistent_folder;
142 Gtk::Entry found_entry;
143 Gtk::Button found_search_btn;
144 Gtk::Notebook notebook;
147 Gtk::VBox meter_packer;
148 void add_gain_meter ();
149 void remove_gain_meter ();
151 void start_metering ();
152 void stop_metering ();
153 sigc::connection metering_connection;
155 void update_preview ();
156 void found_list_view_selected ();
157 void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
158 void found_search_clicked ();
160 void chooser_file_activated ();
162 bool on_custom (const Gtk::FileFilter::Info& filter_info);
164 virtual bool reset_options() { return true; }
171 class SoundFileChooser : public SoundFileBrowser
174 SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
175 virtual ~SoundFileChooser () {};
177 Glib::ustring get_filename ();
183 class SoundFileOmega : public SoundFileBrowser
187 SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks,
188 Editing::ImportMode mode_hint = Editing::ImportAsTrack);
190 void reset (int selected_tracks);
192 Gtk::ComboBoxText action_combo;
193 Gtk::ComboBoxText where_combo;
194 Gtk::ComboBoxText channel_combo;
195 Gtk::ComboBoxText src_combo;
197 Gtk::CheckButton copy_files_btn;
199 void set_mode (Editing::ImportMode);
200 Editing::ImportMode get_mode() const;
201 Editing::ImportPosition get_position() const;
202 Editing::ImportDisposition get_channel_disposition() const;
203 ARDOUR::SrcQuality get_src_quality() const;
209 uint32_t selected_track_cnt;
211 typedef std::map<Glib::ustring,Editing::ImportDisposition> DispositionMap;
212 DispositionMap disposition_map;
216 Gtk::VBox block_three;
217 Gtk::VBox block_four;
219 bool check_info (const std::vector<Glib::ustring>& paths,
220 bool& same_size, bool& src_needed, bool& multichannel);
222 static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
224 void file_selection_changed ();
225 bool reset_options ();
226 void reset_options_noret ();
227 bool bad_file_message ();
230 #endif // __ardour_sfdb_ui_h__