refine video-tools installer:
[ardour.git] / gtk2_ardour / export_channel_selector.cc
index 27e6ffaa502d194ab98e18ed436347d35a38f94f..6f32ae783e3b75e244246d7f6ece1b8cd68fc7e5 100644 (file)
@@ -527,13 +527,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);
+
+       // 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);
@@ -570,34 +582,31 @@ TrackExportChannelSelector::fill_list()
        RouteList routes = *_session->get_routes();
 
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
-               Route * route = it->get();
-               if(!dynamic_cast<Track *>(route)) {
+               if (!boost::dynamic_pointer_cast<Track>(*it)) {
                        // not a track, must be a bus
                        if ((*it)->is_master () || (*it)->is_monitor ()) {
                                continue;
                        }
                        // not monitor or master bus
-                                       
-                       add_track(route);
+                       add_track (*it);
                }
        }
        for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
-               Route * route = it->get();
-               if(dynamic_cast<AudioTrack *>(route)) {
-                       add_track(route);
+               if (boost::dynamic_pointer_cast<AudioTrack>(*it)) {
+                       add_track (*it);
                }
        }
 }
 
 void
-TrackExportChannelSelector::add_track(Route * route)
+TrackExportChannelSelector::add_track (boost::shared_ptr<Route> route)
 {
        Gtk::TreeModel::iterator iter = track_list->append();
        Gtk::TreeModel::Row row = *iter;
 
        row[track_cols.selected] = true;
        row[track_cols.label] = route->name();
-       row[track_cols.track] = route;
+       row[track_cols.route] = route;
 }
 
 void
@@ -614,25 +623,26 @@ TrackExportChannelSelector::update_config()
 
                ExportProfileManager::ChannelConfigStatePtr state = manager->add_channel_config();
 
-               Route * track = row[track_cols.track];
-
-               /* Output of track code. TODO make this an option also
-               uint32_t outs = track->n_ports().n_audio();
-               for (uint32_t i = 0; i < outs; ++i) {
-                       AudioPort * port = track->audio (i);
-                       if(port) {
-                               ExportChannelPtr channel (new PortExportChannel ());
-                               PortExportChannel * pec = static_cast<PortExportChannel *> (channel.get());
-                               pec->add_port(port);
-                               state->config->register_channel(channel);
+               boost::shared_ptr<Route> route = row[track_cols.route];
+
+               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, *track);
-               state->config->register_channels (list);
-               state->config->set_name(track->name());
+               state->config->set_name (route->name());
        }
 
        CriticalSelectionChanged ();