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"
50 class SoundFileBox : public Gtk::VBox
54 virtual ~SoundFileBox () {};
56 void set_session (ARDOUR::Session* s);
57 bool setup_labels (const Glib::ustring& filename);
62 ARDOUR::Session* _session;
65 ARDOUR::SoundFileInfo sf_info;
74 Gtk::Label samplerate;
77 Gtk::Label channels_value;
78 Gtk::Label samplerate_value;
80 Gtk::TextView format_text;
81 AudioClock length_clock;
82 AudioClock timecode_clock;
84 Gtk::Frame border_frame;
85 Gtk::Label preview_label;
87 Gtk::TextView tags_entry;
95 Gtk::Button apply_btn;
97 bool tags_entry_left (GdkEventFocus* event);
98 void stop_btn_clicked ();
101 void audition_status_changed (bool state);
102 sigc::connection audition_connection;
105 class SoundFileBrowser : public ArdourDialog
108 class FoundTagColumns : public Gtk::TreeModel::ColumnRecord
111 Gtk::TreeModelColumn<Glib::ustring> pathname;
113 FoundTagColumns() { add(pathname); }
116 FoundTagColumns found_list_columns;
117 Glib::RefPtr<Gtk::ListStore> found_list;
119 Gtk::RadioButtonGroup rgroup1;
120 Gtk::RadioButtonGroup rgroup2;
123 SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks);
124 virtual ~SoundFileBrowser ();
126 virtual void set_session (ARDOUR::Session*);
127 std::vector<Glib::ustring> get_paths ();
129 void reset (int selected_tracks);
131 Gtk::FileChooserWidget chooser;
132 Gtk::TreeView found_list_view;
134 Gtk::ComboBoxText action_combo;
135 Gtk::ComboBoxText where_combo;
136 Gtk::ComboBoxText channel_combo;
138 Gtk::RadioButton import;
139 Gtk::RadioButton embed;
141 Editing::ImportMode get_mode() const;
142 Editing::ImportPosition get_position() const;
143 Editing::ImportDisposition get_channel_disposition() const;
146 Gtk::FileFilter custom_filter;
147 Gtk::FileFilter matchall_filter;
148 SoundFileBox preview;
150 static Glib::ustring persistent_folder;
152 Gtk::Entry found_entry;
153 Gtk::Button found_search_btn;
154 Gtk::Notebook notebook;
156 void update_preview ();
157 void found_list_view_selected ();
158 void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
159 void found_search_clicked ();
161 void chooser_file_activated ();
163 bool on_custom (const Gtk::FileFilter::Info& filter_info);
164 void file_selection_changed ();
166 int selected_track_cnt;
168 typedef std::map<Glib::ustring,Editing::ImportDisposition> DispositionMap;
169 DispositionMap disposition_map;
171 bool resetting_ourselves;
175 Gtk::VBox block_three;
176 Gtk::VBox block_four;
178 static bool check_multichannel_status (const std::vector<Glib::ustring>& paths, bool& same_size, bool& err);
179 static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
181 bool reset_options ();
182 void reset_options_noret ();
183 bool bad_file_message ();
186 class SoundFileChooser : public SoundFileBrowser
189 SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
190 virtual ~SoundFileChooser () {};
192 Glib::ustring get_filename ();
195 // SoundFileBrowser browser;
198 #endif // __ardour_sfdb_ui_h__