1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
|
/*
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>
#include "ardour/export_profile_manager.h"
#ifdef interface
#undef interface
#endif
#include <sigc++/signal.h>
#include <boost/shared_ptr.hpp>
#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
#include <gtkmm/cellrenderercombo.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/label.h>
#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treeview.h>
namespace ARDOUR {
class Session;
class ExportChannelConfiguration;
class RegionExportChannelFactory;
class ExportHandler;
class AudioPort;
class IO;
class AudioRegion;
class AudioTrack;
}
class XMLNode;
class ExportChannelSelector : public Gtk::HBox, public ARDOUR::SessionHandlePtr
{
protected:
typedef boost::shared_ptr<ARDOUR::ExportChannelConfiguration> ChannelConfigPtr;
typedef std::list<ChannelConfigPtr> ChannelConfigList;
typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ProfileManagerPtr;
ProfileManagerPtr manager;
public:
ExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
: SessionHandlePtr (session)
, manager (manager)
{}
virtual ~ExportChannelSelector () {}
virtual void sync_with_manager () = 0;
sigc::signal<void> CriticalSelectionChanged;
};
class PortExportChannelSelector : public ExportChannelSelector
{
public:
PortExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
~PortExportChannelSelector ();
void sync_with_manager ();
private:
void fill_route_list ();
void update_channel_count ();
void update_split_state ();
typedef std::list<ARDOUR::ExportChannelPtr> CahnnelList;
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;
/* Column record for channel selector view */
class RouteCols : public Gtk::TreeModelColumnRecord
{
public:
struct Channel;
RouteCols () : n_channels (0)
{ add (selected); add (name); add (io); add (port_list_col); }
void add_channels (uint32_t chans);
uint32_t n_channels;
/* Channel count starts from one! */
Channel & get_channel (uint32_t channel);
/* Static columns */
Gtk::TreeModelColumn<bool> selected;
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<ARDOUR::IO *> io;
/* Combo list column (shared by all channels) */
typedef Gtk::TreeModelColumn<Glib::RefPtr<Gtk::ListStore> > ComboCol;
ComboCol port_list_col;
/* Channel struct, that represents the selected port and its name */
struct Channel {
public:
Channel (RouteCols & cols) { cols.add (port); cols.add (label); }
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
Gtk::TreeModelColumn<std::string> label;
};
std::list<Channel> channels;
/* List of available ports
* Note: We need only one list of selectable ports per route,
* so the list is kept in the column record
*/
/* Column record for selecting ports for a channel from a route */
class PortCols : public Gtk::TreeModel::ColumnRecord
{
public:
PortCols () { add(selected); add(port); add(label); }
Gtk::TreeModelColumn<bool> selected; // not used ATM
Gtk::TreeModelColumn<boost::weak_ptr<ARDOUR::AudioPort> > port;
Gtk::TreeModelColumn<std::string> label;
};
PortCols port_cols;
};
/* Channels view */
class ChannelTreeView : public Gtk::TreeView
{
public:
ChannelTreeView (uint32_t max_channels);
void set_config (ChannelConfigPtr c);
/* Routes have to be added before adding channels */
void clear_routes () { route_list->clear (); }
void add_route (ARDOUR::IO * route);
void set_channel_count (uint32_t channels);
sigc::signal<void> CriticalSelectionChanged;
private:
ChannelConfigPtr config;
void update_config ();
/* Signal handlers for selections changes in the view */
void update_toggle_selection (std::string const & path);
void update_selection_text (std::string const & path, std::string const & new_text, uint32_t channel);
RouteCols route_cols;
Glib::RefPtr<Gtk::ListStore> route_list;
uint32_t static_columns;
uint32_t n_channels;
};
uint32_t max_channels;
Gtk::ScrolledWindow channel_scroller;
Gtk::Alignment channel_alignment;
ChannelTreeView channel_view;
};
class RegionExportChannelSelector : public ExportChannelSelector
{
public:
RegionExportChannelSelector (ARDOUR::Session * session,
ProfileManagerPtr manager,
ARDOUR::AudioRegion const & region,
ARDOUR::AudioTrack & track);
virtual void sync_with_manager ();
private:
void handle_selection ();
ARDOUR::ExportProfileManager::ChannelConfigStatePtr state;
boost::shared_ptr<ARDOUR::RegionExportChannelFactory> factory;
ARDOUR::AudioRegion const & region;
ARDOUR::AudioTrack & track;
uint32_t region_chans;
uint32_t track_chans;
/*** GUI components ***/
Gtk::VBox vbox;
Gtk::RadioButtonGroup type_group;
Gtk::RadioButton raw_button;
Gtk::RadioButton fades_button;
Gtk::RadioButton processed_button;
};
class TrackExportChannelSelector : public ExportChannelSelector
{
public:
TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
virtual void sync_with_manager ();
bool track_output () const { return track_output_button.get_active(); }
private:
void fill_list();
void add_track (boost::shared_ptr<ARDOUR::Route> route);
void update_config();
ChannelConfigList configs;
Gtk::VBox main_layout;
struct TrackCols : public Gtk::TreeModelColumnRecord
{
public:
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
Gtk::TreeModelColumn<std::string> label;
Gtk::TreeModelColumn<bool> selected;
Gtk::TreeModelColumn<uint32_t> order_key;
TrackCols () { add (route); add(label); add(selected); add(order_key); }
};
TrackCols track_cols;
Glib::RefPtr<Gtk::ListStore> track_list;
Gtk::TreeView track_view;
Gtk::ScrolledWindow track_scroller;
Gtk::HBox options_box;
Gtk::CheckButton track_output_button;
Gtk::Button select_tracks_button;
Gtk::Button select_busses_button;
Gtk::Button select_none_button;
void select_tracks ();
void select_busses ();
void select_none ();
void track_outputs_selected ();
};
#endif /* __export_channel_selector_h__ */
|