2008-09-17 08:56:00 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2008 Paul Davis
|
|
|
|
Author: Sakari Bergen
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __export_channel_selector_h__
|
|
|
|
#define __export_channel_selector_h__
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/export_profile_manager.h"
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2013-07-11 15:29:28 -04:00
|
|
|
#ifdef interface
|
|
|
|
#undef interface
|
|
|
|
#endif
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
#include <gtkmm.h>
|
|
|
|
#include <sigc++/signal.h>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Session;
|
|
|
|
class ExportChannelConfiguration;
|
2008-10-11 06:14:51 -04:00
|
|
|
class RegionExportChannelFactory;
|
2008-09-17 08:56:00 -04:00
|
|
|
class ExportHandler;
|
|
|
|
class AudioPort;
|
|
|
|
class IO;
|
2008-10-11 06:14:51 -04:00
|
|
|
class AudioRegion;
|
|
|
|
class AudioTrack;
|
2008-09-17 08:56:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class XMLNode;
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
|
2008-10-11 06:14:51 -04:00
|
|
|
{
|
|
|
|
protected:
|
2008-09-17 08:56:00 -04:00
|
|
|
typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
|
2011-01-06 11:55:19 -05:00
|
|
|
typedef std::list<ChannelConfigPtr> ChannelConfigList;
|
2009-03-08 06:56:40 -04:00
|
|
|
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
ProfileManagerPtr manager;
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
public:
|
2009-03-08 06:56:40 -04:00
|
|
|
ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
|
2009-12-17 13:24:23 -05:00
|
|
|
: SessionHandlePtr (session)
|
|
|
|
, manager (manager)
|
2009-03-08 06:56:40 -04:00
|
|
|
{}
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
virtual ~ExportChannelSelector () {}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
virtual void sync_with_manager () = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
sigc::signal<void> CriticalSelectionChanged;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PortExportChannelSelector : public ExportChannelSelector
|
|
|
|
{
|
2008-09-17 08:56:00 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
public:
|
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
|
2008-10-11 06:14:51 -04:00
|
|
|
~PortExportChannelSelector ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
void sync_with_manager ();
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void fill_route_list ();
|
|
|
|
void update_channel_count ();
|
|
|
|
void update_split_state ();
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
|
2008-09-17 08:56:00 -04:00
|
|
|
|
|
|
|
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
|
|
|
|
|
|
|
|
/*** GUI stuff ***/
|
|
|
|
|
|
|
|
Gtk::VBox channels_vbox;
|
|
|
|
Gtk::HBox channels_hbox;
|
|
|
|
|
|
|
|
Gtk::Label channels_label;
|
|
|
|
Gtk::SpinButton channels_spinbutton;
|
|
|
|
Gtk::CheckButton split_checkbox;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Column record for channel selector view */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
class RouteCols : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
struct Channel;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
RouteCols () : n_channels (0)
|
|
|
|
{ add (selected); add (name); add (io); add (port_list_col); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void add_channels (uint32_t chans);
|
|
|
|
uint32_t n_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Channel count starts from one! */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Channel & get_channel (uint32_t channel);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Static columns */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::TreeModelColumn<bool> selected;
|
2010-09-14 12:51:02 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::TreeModelColumn<ARDOUR::IO *> io;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Combo list column (shared by all channels) */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
|
|
|
|
ComboCol port_list_col;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2013-06-16 13:48:33 -04:00
|
|
|
/* Channel struct, that represents the selected port and its name */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
struct Channel {
|
|
|
|
public:
|
|
|
|
Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-10-28 13:04:09 -04:00
|
|
|
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
|
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
2008-09-17 08:56:00 -04:00
|
|
|
};
|
|
|
|
std::list<Channel> channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* List of available ports
|
|
|
|
* Note: We need only one list of selectable ports per route,
|
|
|
|
* so the list is kept in the column record
|
|
|
|
*/
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Column record for selecting ports for a channel from a route */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
class PortCols : public Gtk::TreeModel::ColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2011-10-28 13:04:09 -04:00
|
|
|
PortCols () { add(selected); add(port); add(label); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-10-28 13:04:09 -04:00
|
|
|
Gtk::TreeModelColumn<bool> selected; // not used ATM
|
|
|
|
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
|
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
2008-09-17 08:56:00 -04:00
|
|
|
};
|
|
|
|
PortCols port_cols;
|
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Channels view */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
class ChannelTreeView : public Gtk::TreeView {
|
|
|
|
public:
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
ChannelTreeView (uint32_t max_channels);
|
|
|
|
void set_config (ChannelConfigPtr c);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Routes have to be added before adding channels */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
void clear_routes () { route_list->clear (); }
|
|
|
|
void add_route (ARDOUR::IO * route);
|
|
|
|
void set_channel_count (uint32_t channels);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
sigc::signal<void> CriticalSelectionChanged;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
private:
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
ChannelConfigPtr config;
|
|
|
|
void update_config ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
/* Signal handlers for selections changes in the view */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
void update_toggle_selection (std::string const & path);
|
|
|
|
void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
RouteCols route_cols;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> route_list;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
uint32_t static_columns;
|
|
|
|
uint32_t n_channels;
|
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
uint32_t max_channels;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
Gtk::ScrolledWindow channel_scroller;
|
|
|
|
Gtk::Alignment channel_alignment;
|
|
|
|
ChannelTreeView channel_view;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
class RegionExportChannelSelector : public ExportChannelSelector
|
|
|
|
{
|
|
|
|
public:
|
2009-03-08 06:56:40 -04:00
|
|
|
RegionExportChannelSelector (ARDOUR::Session * session,
|
|
|
|
ProfileManagerPtr manager,
|
|
|
|
ARDOUR::AudioRegion const & region,
|
|
|
|
ARDOUR::AudioTrack & track);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-03-08 06:56:40 -04:00
|
|
|
virtual void sync_with_manager ();
|
2008-10-11 06:14:51 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void handle_selection ();
|
|
|
|
|
|
|
|
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
|
|
|
|
boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
|
|
|
|
ARDOUR::AudioRegion const & region;
|
|
|
|
ARDOUR::AudioTrack & track;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
uint32_t region_chans;
|
|
|
|
uint32_t track_chans;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
/*** GUI components ***/
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
Gtk::VBox vbox;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-10-11 06:14:51 -04:00
|
|
|
Gtk::RadioButtonGroup type_group;
|
|
|
|
Gtk::RadioButton raw_button;
|
2008-10-11 10:07:50 -04:00
|
|
|
Gtk::RadioButton fades_button;
|
2008-10-11 06:14:51 -04:00
|
|
|
Gtk::RadioButton processed_button;
|
|
|
|
};
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
class TrackExportChannelSelector : public ExportChannelSelector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
virtual void sync_with_manager ();
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
private:
|
|
|
|
|
|
|
|
void fill_list();
|
2013-03-24 15:53:34 -04:00
|
|
|
void add_track (boost::shared_ptr<ARDOUR::Route> route);
|
2011-01-06 11:55:19 -05:00
|
|
|
void update_config();
|
|
|
|
ChannelConfigList configs;
|
2011-01-16 14:41:11 -05:00
|
|
|
|
2013-03-24 15:53:34 -04:00
|
|
|
Gtk::VBox main_layout;
|
|
|
|
|
2011-01-06 11:55:19 -05:00
|
|
|
struct TrackCols : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2013-03-24 15:53:34 -04:00
|
|
|
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
|
2011-01-16 14:41:11 -05:00
|
|
|
Gtk::TreeModelColumn<std::string> label;
|
|
|
|
Gtk::TreeModelColumn<bool> selected;
|
2015-04-04 08:20:15 -04:00
|
|
|
Gtk::TreeModelColumn<uint32_t> order_key;
|
2011-01-06 11:55:19 -05:00
|
|
|
|
2015-04-04 08:20:15 -04:00
|
|
|
TrackCols () { add (route); add(label); add(selected); add(order_key); }
|
2011-01-06 11:55:19 -05:00
|
|
|
};
|
|
|
|
TrackCols track_cols;
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::ListStore> track_list;
|
|
|
|
Gtk::TreeView track_view;
|
|
|
|
|
|
|
|
Gtk::ScrolledWindow track_scroller;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2013-03-24 15:53:34 -04:00
|
|
|
Gtk::HBox options_box;
|
|
|
|
Gtk::RadioButton::Group source_group;
|
|
|
|
Gtk::RadioButton region_contents_button;
|
|
|
|
Gtk::RadioButton track_output_button;
|
2011-01-06 11:55:19 -05:00
|
|
|
};
|
|
|
|
|
2008-09-17 08:56:00 -04:00
|
|
|
#endif /* __export_channel_selector_h__ */
|