toggling smart mode is just an option.
[ardour.git] / gtk2_ardour / export_channel_selector.cc
index 6b90f7a36c12cabd65f74bdc98e47462fccc2b1c..20155471af11c5d87edab625d15c65066a238045 100644 (file)
@@ -110,8 +110,10 @@ PortExportChannelSelector::fill_route_list ()
 
        /* Add master bus and then everything else */
 
-       ARDOUR::IO* master = _session->master_out()->output().get();
-       channel_view.add_route (master);
+       if (_session->master_out()) {
+               ARDOUR::IO* master = _session->master_out()->output().get();
+               channel_view.add_route (master);
+       }
 
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
                if ((*it)->is_master () || (*it)->is_monitor ()) {
@@ -456,15 +458,15 @@ RegionExportChannelSelector::RegionExportChannelSelector (ARDOUR::Session * _ses
 
        raw_button.set_label (string_compose (_("Region contents without fades nor region gain (channels: %1)"), region_chans));
        raw_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
-       vbox.pack_start (raw_button);
+       vbox.pack_start (raw_button, false, false);
 
        fades_button.set_label (string_compose (_("Region contents with fades and region gain (channels: %1)"), region_chans));
        fades_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
-       vbox.pack_start (fades_button);
+       vbox.pack_start (fades_button, false, false);
 
        processed_button.set_label (string_compose (_("Track output (channels: %1)"), track_chans));
        processed_button.signal_toggled ().connect (sigc::mem_fun (*this, &RegionExportChannelSelector::handle_selection));
-       vbox.pack_start (processed_button);
+       vbox.pack_start (processed_button, false, false);
 
        sync_with_manager();
        vbox.show_all_children ();
@@ -527,13 +529,25 @@ RegionExportChannelSelector::handle_selection ()
        CriticalSelectionChanged ();
 }
 
+/* Track export channel selector */
+
 TrackExportChannelSelector::TrackExportChannelSelector (ARDOUR::Session * session, ProfileManagerPtr manager)
   : ExportChannelSelector(session, manager)
+  , region_contents_button(source_group, _("Export region contents"))
+  , track_output_button(source_group, _("Export track output"))
 {
+       pack_start(main_layout);
+
+       // Options
+       options_box.pack_start(region_contents_button);
+       options_box.pack_start(track_output_button);
+       main_layout.pack_start(options_box, false, false);
+
+       // Track scroller
        track_scroller.add (track_view);
        track_scroller.set_size_request (-1, 130);
        track_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
-       pack_start(track_scroller);
+       main_layout.pack_start(track_scroller);
 
        // Track list
        track_list = Gtk::ListStore::create (track_cols);
@@ -613,22 +627,23 @@ TrackExportChannelSelector::update_config()
 
                boost::shared_ptr<Route> route = row[track_cols.route];
 
-               /* Output of track code. TODO make this an option also
-               uint32_t outs = route->n_ports().n_audio();
-               for (uint32_t i = 0; i < outs; ++i) {
-                       AudioPort * port = route->audio (i);
-                       if (port) {
-                               ExportChannelPtr channel (new PortExportChannel ());
-                               PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
-                               pec->add_port(port);
-                               state->config->register_channel(channel);
+               if (track_output_button.get_active()) {
+                       uint32_t outs = route->n_outputs().n_audio();
+                       for (uint32_t i = 0; i < outs; ++i) {
+                               boost::shared_ptr<AudioPort> port = route->output()->audio (i);
+                               if (port) {
+                                       ExportChannelPtr channel (new PortExportChannel ());
+                                       PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
+                                       pec->add_port(port);
+                                       state->config->register_channel(channel);
+                               }
                        }
+               } else {
+                       std::list<ExportChannelPtr> list;
+                       RouteExportChannel::create_from_route (list, route);
+                       state->config->register_channels (list);
                }
-               */
 
-               std::list<ExportChannelPtr> list;
-               RouteExportChannel::create_from_route (list, route);
-               state->config->register_channels (list);
                state->config->set_name (route->name());
        }