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__
27 #include <sigc++/signal.h>
29 #include <gtkmm/box.h>
30 #include <gtkmm/button.h>
31 #include <gtkmm/checkbutton.h>
32 #include <gtkmm/comboboxtext.h>
33 #include <gtkmm/dialog.h>
34 #include <gtkmm/entry.h>
35 #include <gtkmm/filechooserwidget.h>
36 #include <gtkmm/frame.h>
37 #include <gtkmm/label.h>
38 #include <gtkmm/textview.h>
40 #include "ardour/audiofilesource.h"
41 #include "ardour/session_handle.h"
43 #include "ardour_dialog.h"
45 #include "audio_clock.h"
53 class SoundFileBox
: public Gtk::VBox
, public ARDOUR::SessionHandlePtr
56 SoundFileBox (bool persistent
);
57 virtual ~SoundFileBox () {};
59 void set_session (ARDOUR::Session
* s
);
60 bool setup_labels (const std::string
& filename
);
63 bool audition_oneshot();
64 bool autoplay () const;
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
<std::string
> pathname
;
114 FoundTagColumns() { add(pathname
); }
117 FoundTagColumns found_list_columns
;
118 Glib::RefPtr
<Gtk::ListStore
> found_list
;
120 FoundTagColumns freesound_list_columns
;
121 Glib::RefPtr
<Gtk::ListStore
> freesound_list
;
124 SoundFileBrowser (Gtk::Window
& parent
, std::string title
, ARDOUR::Session
* _s
, bool persistent
);
125 virtual ~SoundFileBrowser ();
127 virtual void set_session (ARDOUR::Session
*);
128 std::vector
<std::string
> get_paths ();
130 void clear_selection ();
132 Gtk::FileChooserWidget chooser
;
134 SoundFileBox preview
;
136 Gtk::Entry found_entry
;
137 Gtk::Button found_search_btn
;
138 Gtk::TreeView found_list_view
;
140 Gtk::Entry freesound_name_entry
;
141 Gtk::Entry freesound_pass_entry
;
142 Gtk::Entry freesound_entry
;
143 Gtk::Button freesound_search_btn
;
144 Gtk::TreeView freesound_list_view
;
146 void freesound_search_thread();
149 bool resetting_ourselves
;
151 Gtk::FileFilter audio_filter
;
152 Gtk::FileFilter midi_filter
;
153 Gtk::FileFilter custom_filter
;
154 Gtk::FileFilter matchall_filter
;
157 static std::string persistent_folder
;
159 Gtk::Notebook notebook
;
162 Gtk::VBox meter_packer
;
163 void add_gain_meter ();
164 void remove_gain_meter ();
166 void start_metering ();
167 void stop_metering ();
168 sigc::connection metering_connection
;
170 void update_preview ();
172 void found_list_view_selected ();
173 void found_list_view_activated (const Gtk::TreeModel::Path
& path
, Gtk::TreeViewColumn
*);
174 void found_search_clicked ();
176 void freesound_list_view_selected ();
177 void freesound_list_view_activated (const Gtk::TreeModel::Path
& path
, Gtk::TreeViewColumn
*);
178 void freesound_search_clicked ();
180 void chooser_file_activated ();
182 bool on_audio_filter (const Gtk::FileFilter::Info
& filter_info
);
183 bool on_midi_filter (const Gtk::FileFilter::Info
& filter_info
);
185 virtual bool reset_options() { return true; }
192 class SoundFileChooser
: public SoundFileBrowser
195 SoundFileChooser (Gtk::Window
& parent
, std::string title
, ARDOUR::Session
* _s
= 0);
196 virtual ~SoundFileChooser () {};
198 std::string
get_filename ();
204 class SoundFileOmega
: public SoundFileBrowser
208 SoundFileOmega (Gtk::Window
& parent
, std::string title
, ARDOUR::Session
* _s
, int selected_tracks
, bool persistent
,
209 Editing::ImportMode mode_hint
= Editing::ImportAsTrack
);
211 void reset (int selected_tracks
);
213 Gtk::ComboBoxText action_combo
;
214 Gtk::ComboBoxText where_combo
;
215 Gtk::ComboBoxText channel_combo
;
216 Gtk::ComboBoxText src_combo
;
218 Gtk::CheckButton copy_files_btn
;
220 void set_mode (Editing::ImportMode
);
221 Editing::ImportMode
get_mode() const;
222 Editing::ImportPosition
get_position() const;
223 Editing::ImportDisposition
get_channel_disposition() const;
224 ARDOUR::SrcQuality
get_src_quality() const;
230 uint32_t selected_track_cnt
;
232 typedef std::map
<std::string
,Editing::ImportDisposition
> DispositionMap
;
233 DispositionMap disposition_map
;
237 Gtk::VBox block_three
;
238 Gtk::VBox block_four
;
240 bool check_info (const std::vector
<std::string
>& paths
,
241 bool& same_size
, bool& src_needed
, bool& multichannel
);
243 static bool check_link_status (const ARDOUR::Session
*, const std::vector
<std::string
>& paths
);
245 void file_selection_changed ();
246 bool reset_options ();
247 void reset_options_noret ();
248 bool bad_file_message ();
251 #endif // __ardour_sfdb_ui_h__