2005-10-27 15:46:27 -04:00
|
|
|
/*
|
2006-12-01 01:01:30 -05:00
|
|
|
Copyright (C) 2005-2006 Paul Davis
|
2005-10-27 15:46:27 -04:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-10-12 16:06:20 -04:00
|
|
|
#ifndef __ardour_sfdb_ui_h__
|
|
|
|
#define __ardour_sfdb_ui_h__
|
|
|
|
|
|
|
|
#include <string>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <vector>
|
2007-10-11 18:07:47 -04:00
|
|
|
#include <map>
|
|
|
|
#include <glibmm/ustring.h>
|
2005-10-12 16:06:20 -04:00
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
#include <sigc++/signal.h>
|
|
|
|
|
|
|
|
#include <gtkmm/box.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/button.h>
|
2005-10-12 23:48:57 -04:00
|
|
|
#include <gtkmm/checkbutton.h>
|
2007-01-05 14:53:38 -05:00
|
|
|
#include <gtkmm/comboboxtext.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/dialog.h>
|
2005-12-07 17:57:47 -05:00
|
|
|
#include <gtkmm/entry.h>
|
2005-10-12 17:59:45 -04:00
|
|
|
#include <gtkmm/filechooserwidget.h>
|
2005-12-07 17:57:47 -05:00
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/label.h>
|
2009-05-13 20:13:27 -04:00
|
|
|
#include <gtkmm/textview.h>
|
2005-12-07 17:57:47 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/audiofilesource.h"
|
2005-10-12 16:06:20 -04:00
|
|
|
|
2005-12-02 17:12:56 -05:00
|
|
|
#include "ardour_dialog.h"
|
2006-03-22 12:03:00 -05:00
|
|
|
#include "editing.h"
|
2009-05-13 20:13:27 -04:00
|
|
|
#include "audio_clock.h"
|
2005-12-02 17:12:56 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
};
|
|
|
|
|
|
|
|
class GainMeter;
|
|
|
|
|
2005-12-07 17:57:47 -05:00
|
|
|
class SoundFileBox : public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileBox (bool persistent);
|
2006-12-01 01:01:30 -05:00
|
|
|
virtual ~SoundFileBox () {};
|
|
|
|
|
|
|
|
void set_session (ARDOUR::Session* s);
|
2007-10-11 18:07:47 -04:00
|
|
|
bool setup_labels (const Glib::ustring& filename);
|
|
|
|
|
|
|
|
void audition();
|
|
|
|
bool audition_oneshot();
|
|
|
|
bool autoplay () const;
|
2005-12-07 17:57:47 -05:00
|
|
|
|
|
|
|
protected:
|
2006-01-04 00:53:51 -05:00
|
|
|
ARDOUR::Session* _session;
|
2007-10-11 18:07:47 -04:00
|
|
|
Glib::ustring path;
|
2006-12-01 01:01:30 -05:00
|
|
|
|
|
|
|
ARDOUR::SoundFileInfo sf_info;
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Table table;
|
2006-12-01 01:01:30 -05:00
|
|
|
|
|
|
|
Gtk::Label length;
|
|
|
|
Gtk::Label format;
|
|
|
|
Gtk::Label channels;
|
|
|
|
Gtk::Label samplerate;
|
|
|
|
Gtk::Label timecode;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
Gtk::Label channels_value;
|
|
|
|
Gtk::Label samplerate_value;
|
2006-12-01 01:01:30 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Label format_text;
|
|
|
|
AudioClock length_clock;
|
|
|
|
AudioClock timecode_clock;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Frame border_frame;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::Label preview_label;
|
|
|
|
|
|
|
|
Gtk::TextView tags_entry;
|
2006-12-01 01:01:30 -05:00
|
|
|
|
|
|
|
Gtk::VBox main_box;
|
|
|
|
Gtk::VBox path_box;
|
|
|
|
Gtk::HBox bottom_box;
|
|
|
|
|
|
|
|
Gtk::Button play_btn;
|
|
|
|
Gtk::Button stop_btn;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::CheckButton autoplay_btn;
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::Button apply_btn;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
bool tags_entry_left (GdkEventFocus* event);
|
2007-10-11 18:07:47 -04:00
|
|
|
void tags_changed ();
|
|
|
|
void save_tags (const std::vector<std::string>&);
|
|
|
|
void stop_audition ();
|
2005-12-07 17:57:47 -05:00
|
|
|
};
|
|
|
|
|
2005-12-02 17:12:56 -05:00
|
|
|
class SoundFileBrowser : public ArdourDialog
|
2005-10-12 17:59:45 -04:00
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
private:
|
|
|
|
class FoundTagColumns : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> pathname;
|
|
|
|
|
|
|
|
FoundTagColumns() { add(pathname); }
|
|
|
|
};
|
|
|
|
|
|
|
|
FoundTagColumns found_list_columns;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> found_list;
|
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
FoundTagColumns freesound_list_columns;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> freesound_list;
|
|
|
|
|
2005-10-12 17:59:45 -04:00
|
|
|
public:
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileBrowser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, bool persistent);
|
2007-02-01 14:53:58 -05:00
|
|
|
virtual ~SoundFileBrowser ();
|
2006-12-01 01:01:30 -05:00
|
|
|
|
|
|
|
virtual void set_session (ARDOUR::Session*);
|
2007-10-11 18:07:47 -04:00
|
|
|
std::vector<Glib::ustring> get_paths ();
|
|
|
|
|
|
|
|
void clear_selection ();
|
2006-03-22 12:03:00 -05:00
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
Gtk::FileChooserWidget chooser;
|
2008-04-11 10:06:50 -04:00
|
|
|
|
|
|
|
SoundFileBox preview;
|
|
|
|
|
|
|
|
Gtk::Entry found_entry;
|
|
|
|
Gtk::Button found_search_btn;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::TreeView found_list_view;
|
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
Gtk::Entry freesound_name_entry;
|
|
|
|
Gtk::Entry freesound_pass_entry;
|
|
|
|
Gtk::Entry freesound_entry;
|
|
|
|
Gtk::Button freesound_search_btn;
|
|
|
|
Gtk::TreeView freesound_list_view;
|
|
|
|
|
|
|
|
void freesound_search_thread();
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
protected:
|
|
|
|
bool resetting_ourselves;
|
|
|
|
|
2008-02-18 14:45:52 -05:00
|
|
|
Gtk::FileFilter audio_filter;
|
|
|
|
Gtk::FileFilter midi_filter;
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtk::FileFilter custom_filter;
|
2007-05-15 22:21:41 -04:00
|
|
|
Gtk::FileFilter matchall_filter;
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::HBox hpacker;
|
2007-02-01 14:53:58 -05:00
|
|
|
|
|
|
|
static Glib::ustring persistent_folder;
|
|
|
|
|
2007-01-04 23:24:23 -05:00
|
|
|
Gtk::Notebook notebook;
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
GainMeter* gm;
|
|
|
|
Gtk::VBox meter_packer;
|
|
|
|
void add_gain_meter ();
|
|
|
|
void remove_gain_meter ();
|
|
|
|
void meter ();
|
|
|
|
void start_metering ();
|
|
|
|
void stop_metering ();
|
|
|
|
sigc::connection metering_connection;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
void update_preview ();
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2007-01-04 23:24:23 -05:00
|
|
|
void found_list_view_selected ();
|
2007-10-11 18:07:47 -04:00
|
|
|
void found_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
|
2007-01-04 23:24:23 -05:00
|
|
|
void found_search_clicked ();
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2008-04-11 10:06:50 -04:00
|
|
|
void freesound_list_view_selected ();
|
|
|
|
void freesound_list_view_activated (const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn*);
|
|
|
|
void freesound_search_clicked ();
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void chooser_file_activated ();
|
2007-01-04 23:24:23 -05:00
|
|
|
|
2008-02-18 14:45:52 -05:00
|
|
|
bool on_audio_filter (const Gtk::FileFilter::Info& filter_info);
|
|
|
|
bool on_midi_filter (const Gtk::FileFilter::Info& filter_info);
|
2007-10-11 18:07:47 -04:00
|
|
|
|
|
|
|
virtual bool reset_options() { return true; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void on_show();
|
|
|
|
|
2005-10-12 17:59:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class SoundFileChooser : public SoundFileBrowser
|
2005-10-12 16:06:20 -04:00
|
|
|
{
|
|
|
|
public:
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileChooser (Gtk::Window& parent, std::string title, ARDOUR::Session* _s = 0);
|
2006-12-01 01:01:30 -05:00
|
|
|
virtual ~SoundFileChooser () {};
|
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Glib::ustring get_filename ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void on_hide();
|
2005-10-12 16:06:20 -04:00
|
|
|
};
|
|
|
|
|
2005-10-12 23:48:57 -04:00
|
|
|
class SoundFileOmega : public SoundFileBrowser
|
2005-10-12 17:59:45 -04:00
|
|
|
{
|
2007-10-11 18:07:47 -04:00
|
|
|
|
2005-10-12 17:59:45 -04:00
|
|
|
public:
|
2007-10-11 18:07:47 -04:00
|
|
|
SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks, bool persistent,
|
|
|
|
Editing::ImportMode mode_hint = Editing::ImportAsTrack);
|
2006-12-01 01:01:30 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
void reset (int selected_tracks);
|
2006-12-01 01:01:30 -05:00
|
|
|
|
2007-10-11 18:07:47 -04:00
|
|
|
Gtk::ComboBoxText action_combo;
|
|
|
|
Gtk::ComboBoxText where_combo;
|
|
|
|
Gtk::ComboBoxText channel_combo;
|
|
|
|
Gtk::ComboBoxText src_combo;
|
|
|
|
|
|
|
|
Gtk::CheckButton copy_files_btn;
|
|
|
|
|
2006-12-01 01:01:30 -05:00
|
|
|
void set_mode (Editing::ImportMode);
|
2007-10-11 18:07:47 -04:00
|
|
|
Editing::ImportMode get_mode() const;
|
|
|
|
Editing::ImportPosition get_position() const;
|
|
|
|
Editing::ImportDisposition get_channel_disposition() const;
|
|
|
|
ARDOUR::SrcQuality get_src_quality() const;
|
2005-10-12 17:59:45 -04:00
|
|
|
|
|
|
|
protected:
|
2007-10-11 18:07:47 -04:00
|
|
|
void on_hide();
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint32_t selected_track_cnt;
|
|
|
|
|
|
|
|
typedef std::map<Glib::ustring,Editing::ImportDisposition> DispositionMap;
|
|
|
|
DispositionMap disposition_map;
|
|
|
|
|
|
|
|
Gtk::HBox options;
|
|
|
|
Gtk::VBox block_two;
|
|
|
|
Gtk::VBox block_three;
|
|
|
|
Gtk::VBox block_four;
|
|
|
|
|
|
|
|
bool check_info (const std::vector<Glib::ustring>& paths,
|
|
|
|
bool& same_size, bool& src_needed, bool& multichannel);
|
|
|
|
|
|
|
|
static bool check_link_status (const ARDOUR::Session&, const std::vector<Glib::ustring>& paths);
|
|
|
|
|
|
|
|
void file_selection_changed ();
|
|
|
|
bool reset_options ();
|
|
|
|
void reset_options_noret ();
|
|
|
|
bool bad_file_message ();
|
2005-10-12 23:48:57 -04:00
|
|
|
};
|
2005-10-12 17:59:45 -04:00
|
|
|
|
2005-10-12 16:06:20 -04:00
|
|
|
#endif // __ardour_sfdb_ui_h__
|