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>
39 #include <gtkmm/textview.h>
41 #include "ardour/session.h"
42 #include "ardour/audiofilesource.h"
44 #include "ardour_dialog.h"
46 #include "audio_clock.h"
54 class SoundFileBox : public Gtk::VBox
57 SoundFileBox (bool persistent);
58 virtual ~SoundFileBox () {};
60 void set_session (ARDOUR::Session* s);
61 bool setup_labels (const Glib::ustring& filename);
64 bool audition_oneshot();
65 bool autoplay () const;
68 ARDOUR::Session* _session;
71 ARDOUR::SoundFileInfo sf_info;
78 Gtk::Label samplerate;
81 Gtk::Label channels_value;
82 Gtk::Label samplerate_value;
84 Gtk::Label format_text;
85 AudioClock length_clock;
86 AudioClock timecode_clock;
88 Gtk::Frame border_frame;
89 Gtk::Label preview_label;
91 Gtk::TextView tags_entry;
99 Gtk::CheckButton autoplay_btn;
100 Gtk::Button apply_btn;
102 bool tags_entry_left (GdkEventFocus* event);
103 void tags_changed ();
104 void save_tags (const std::vector<std::string>&);
105 void stop_audition ();
108 class SoundFileBrowser : public ArdourDialog
111 class FoundTagColumns : public Gtk::TreeModel::ColumnRecord
114 Gtk::TreeModelColumn<Glib::ustring> pathname;
116 FoundTagColumns() { add(pathname); }
119 FoundTagColumns found_list_columns;
120 Glib::RefPtr<Gtk::ListStore> found_list;
122 FoundTagColumns freesound_list_columns;
123 Glib::RefPtr<Gtk::ListStore> freesound_list;
126 SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, bool persistent);
127 virtual ~SoundFileBrowser ();
129 virtual void set_session (ARDOUR::Session*);
130 std::vector<Glib::ustring> get_paths ();
132 void clear_selection ();
134 Gtk::FileChooserWidget chooser;
136 SoundFileBox preview;
138 Gtk::Entry found_entry;
139 Gtk::Button found_search_btn;
140 Gtk::TreeView found_list_view;
142 Gtk::Entry freesound_name_entry;
143 Gtk::Entry freesound_pass_entry;
144 Gtk::Entry freesound_entry;
145 Gtk::Button freesound_search_btn;
146 Gtk::TreeView freesound_list_view;
148 void freesound_search_thread();
151 bool resetting_ourselves;
153 Gtk::FileFilter audio_filter;
154 Gtk::FileFilter midi_filter;
155 Gtk::FileFilter custom_filter;
156 Gtk::FileFilter matchall_filter;
159 static Glib::ustring persistent_folder;
161 Gtk::Notebook notebook;
164 Gtk::VBox meter_packer;
165 void add_gain_meter ();
166 void remove_gain_meter ();
168 void start_metering ();
169 void stop_metering ();
170 sigc::connection metering_connection;
172 void update_preview ();
174 void found_list_view_selected ();
175 void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
176 void found_search_clicked ();
178 void freesound_list_view_selected ();
179 void freesound_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
180 void freesound_search_clicked ();
182 void chooser_file_activated ();
184 bool on_audio_filter (const Gtk::FileFilter::Info& filter_info);
185 bool on_midi_filter (const Gtk::FileFilter::Info& filter_info);
187 virtual bool reset_options() { return true; }
194 class SoundFileChooser : public SoundFileBrowser
197 SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
198 virtual ~SoundFileChooser () {};
200 Glib::ustring get_filename ();
206 class SoundFileOmega : public SoundFileBrowser
210 SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks, bool persistent,
211 Editing::ImportMode mode_hint = Editing::ImportAsTrack);
213 void reset (int selected_tracks);
215 Gtk::ComboBoxText action_combo;
216 Gtk::ComboBoxText where_combo;
217 Gtk::ComboBoxText channel_combo;
218 Gtk::ComboBoxText src_combo;
220 Gtk::CheckButton copy_files_btn;
222 void set_mode (Editing::ImportMode);
223 Editing::ImportMode get_mode() const;
224 Editing::ImportPosition get_position() const;
225 Editing::ImportDisposition get_channel_disposition() const;
226 ARDOUR::SrcQuality get_src_quality() const;
232 uint32_t selected_track_cnt;
234 typedef std::map<Glib::ustring,Editing::ImportDisposition> DispositionMap;
235 DispositionMap disposition_map;
239 Gtk::VBox block_three;
240 Gtk::VBox block_four;
242 bool check_info (const std::vector<Glib::ustring>& paths,
243 bool& same_size, bool& src_needed, bool& multichannel);
245 static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
247 void file_selection_changed ();
248 bool reset_options ();
249 void reset_options_noret ();
250 bool bad_file_message ();
253 #endif // __ardour_sfdb_ui_h__