2 Copyright (C) 1999-2002 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_library_ui_h__
21 #define __ardour_library_ui_h__
27 #include <sys/types.h>
29 #include <sigc++/signal.h>
31 #include <gtkmm2ext/selector.h>
33 #include <ardour/region.h>
35 #include "ardour_dialog.h"
40 struct RowTaggedString {
41 RowTaggedString (int r, string s)
48 class SoundFileBox : public Gtk::VBox
52 @variable uri is the path name of string.
53 @variable metadata whether to show the user-added fields from sfdb.
55 SoundFileBox (string uri, bool metadata);
58 sigc::signal<void, string, bool> file_chosen;
70 Gtk::Entry path_entry;
74 Gtk::Label samplerate;
76 Gtkmm2ext::Selector fields;
77 string selected_field;
79 Gtk::Frame border_frame;
87 Gtk::Button add_field_btn;
88 Gtk::Button remove_field_btn;
90 static void _fields_refiller (Gtk::CList &list, void* arg);
91 void fields_refiller (Gtk::CList &clist);
92 int setup_labels (string uri);
95 void play_btn_clicked ();
96 void stop_btn_clicked ();
97 void add_field_clicked ();
98 void remove_field_clicked ();
100 void field_selected (Gtkmm2ext::Selector *selector,
101 Gtkmm2ext::SelectionResult *re);
102 void field_chosen (Gtkmm2ext::Selector *selector,
103 Gtkmm2ext::SelectionResult *re);
104 void audition_status_changed (bool state);
107 class SearchSounds : public ArdourDialog
113 sigc::signal<void, string, bool> file_chosen;
116 Gtk::Button find_btn;
118 Gtk::RadioButton and_rbtn;
119 Gtk::RadioButton or_rbtn;
121 Gtkmm2ext::Selector fields;
122 string selected_field;
126 Gtk::HBox bottom_box;
128 static void _fields_refiller (Gtk::CList &list, void* arg);
129 void fields_refiller (Gtk::CList &clist);
130 void setup_fields ();
132 void field_selected (Gtkmm2ext::Selector *selector,
133 Gtkmm2ext::SelectionResult *re);
135 void find_btn_clicked ();
137 void file_found (string uri, bool multi);
140 class SearchResults : public ArdourDialog
143 SearchResults (map<string,string> field_values, bool and_search);
146 sigc::signal<void, string, bool> file_chosen;
149 map<string,string> search_info;
155 Gtk::HBox import_box;
157 Gtk::Button import_btn;
158 Gtk::CheckButton multichan_check;
160 SoundFileBox* info_box;
162 Gtkmm2ext::Selector results;
163 static void _results_refiller (Gtk::CList &list, void* arg);
164 void results_refiller (Gtk::CList &clist);
166 void import_clicked ();
168 void result_chosen (Gtkmm2ext::Selector *selector,
169 Gtkmm2ext::SelectionResult *re);
172 class LibraryTree : public Gtk::VBox
178 sigc::signal<void, string, bool> file_chosen;
179 sigc::signal<void> group_selected;
180 sigc::signal<void, string> member_selected;
181 sigc::signal<void> member_deselected;
182 sigc::signal<void> deselected;
184 list<string> selection;
185 void clear_selection ();
188 map<string, Gtk::TreeItem*> uri_mapping;
189 map<string, string> uri_parent; // this ugly, but necessary
191 string current_member;
192 string current_group;
195 Gtk::VBox framed_box;
196 Gtk::HBox btn_box_top;
197 Gtk::HBox btn_box_bottom;
199 Gtk::ScrolledWindow scroll;
203 Gtk::Button remove_btn;
204 Gtk::Button find_btn;
205 Gtk::Button folder_btn;
207 Gtk::FileSelection files_select;
209 void file_ok_clicked ();
210 void file_cancel_clicked ();
212 void add_btn_clicked ();
213 void folder_btn_clicked ();
214 void remove_btn_clicked ();
215 void find_btn_clicked ();
217 void file_found (string uri, bool multi);
219 void cb_group_select (Gtk::TreeItem* item, string uri);
220 void cb_member_select (Gtk::TreeItem* item, string uri);
221 void cb_member_deselect (Gtk::TreeItem* item, string uri);
224 void subpopulate (Gtk::Tree*, string group);
226 void added_group (string, string);
227 void removed_group (string);
228 void added_member (string, string);
229 void removed_member (string);
231 void cancel_import_clicked ();
234 class SoundFileBrowser : public Gtk::VBox {
237 ~SoundFileBrowser ();
239 sigc::signal<void> group_selected;
240 sigc::signal<void, string> member_selected;
241 sigc::signal<void> member_deselected;
242 sigc::signal<void> deselected;
244 list<RowTaggedString> selection;
245 void clear_selection ();
248 string current_member;
249 string current_group;
250 Gtk::FileSelection fs_selector;
251 Gtk::CList* file_list;
253 void dir_list_selected(gint row, gint col, GdkEvent* ev);
254 void file_list_selected(gint row, gint col, GdkEvent* ev);
255 void file_list_deselected(gint row, gint col, GdkEvent* ev);
257 string safety_check_file(string file);
260 class SoundFileSelector : public ArdourDialog {
263 @variable action the name given to the action button
264 @variable import is action button sensitive
265 @variable multi does splitting the region by channel make sense here
266 @variable persist should this LibraryTree be hidden or deleted when closed
268 SoundFileSelector ();
269 ~SoundFileSelector ();
271 void run (string action, bool split_makes_sense, bool hide_after_action = false);
272 void get_result (vector<string>& paths, bool& split);
273 void hide_import_stuff();
275 sigc::signal<void,vector<string>,bool> Action;
279 bool hide_after_action;
282 void import_btn_clicked ();
283 void sfdb_group_selected();
284 void browser_group_selected();
285 void member_selected(string member, bool sfdb);
286 void member_deselected(bool sfdb);
287 void sfdb_deselected();
288 void page_switched(Gtk::Notebook_Helpers::Page* page, guint page_num);
292 Gtk::Notebook notebook;
293 Gtk::Label sfdb_label;
296 SoundFileBrowser sf_browser;
297 LibraryTree sfdb_tree;
299 Gtk::HBox import_box;
300 Gtk::Button import_btn;
301 Gtk::CheckButton split_channels;
302 Gtk::CheckButton resample_check;
304 SoundFileBox* info_box;
307 #endif // __ardour_library_ui_h__