Relent a bit and make adding a route to a group which already contains that group...
[ardour.git] / gtk2_ardour / streamview.cc
index 39f98582c77976954bc7527a76a041680fdc0b57..b93606fbe8b8c072ffbff5324d4d6a5ba68514b3 100644 (file)
@@ -79,12 +79,12 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group)
                        canvas_rect, &_trackview));
 
        if (_trackview.is_track()) {
-               _trackview.track()->DiskstreamChanged.connect (*this, boost::bind (&StreamView::diskstream_changed, this));
-               _trackview.get_diskstream()->RecordEnableChanged.connect (*this, boost::bind (&StreamView::rec_enable_changed, this));
+               _trackview.track()->DiskstreamChanged.connect (*this, boost::bind (&StreamView::diskstream_changed, this), gui_context());
+               _trackview.get_diskstream()->RecordEnableChanged.connect (*this, boost::bind (&StreamView::rec_enable_changed, this), gui_context());
 
-               _trackview.session()->TransportStateChange.connect (*this, boost::bind (&StreamView::transport_changed, this));
-               _trackview.session()->TransportLooped.connect (*this, boost::bind (&StreamView::transport_looped, this));
-               _trackview.session()->RecordStateChanged.connect (*this, boost::bind (&StreamView::sess_rec_enable_changed, this));
+               _trackview.session()->TransportStateChange.connect (*this, boost::bind (&StreamView::transport_changed, this), gui_context());
+               _trackview.session()->TransportLooped.connect (*this, boost::bind (&StreamView::transport_looped, this), gui_context());
+               _trackview.session()->RecordStateChanged.connect (*this, boost::bind (&StreamView::sess_rec_enable_changed, this), gui_context());
        }
 
        ColorsChanged.connect (sigc::mem_fun (*this, &StreamView::color_handler));
@@ -231,7 +231,7 @@ StreamView::display_diskstream (boost::shared_ptr<Diskstream> ds)
 {
        playlist_change_connection.disconnect();
        playlist_changed (ds);
-       ds->PlaylistChanged.connect (playlist_change_connection, boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)));
+       ds->PlaylistChanged.connect (playlist_change_connection, boost::bind (&StreamView::playlist_changed_weak, this, boost::weak_ptr<Diskstream> (ds)), gui_context());
 }
 
 void
@@ -353,9 +353,9 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
 
        /* catch changes */
 
-       ds->playlist()->Modified.connect (playlist_connections, boost::bind (&StreamView::playlist_modified_weak, this, ds));
-       ds->playlist()->RegionAdded.connect (playlist_connections, boost::bind (&StreamView::add_region_view_weak, this, _1));
-       ds->playlist()->RegionRemoved.connect (playlist_connections, boost::bind (&StreamView::remove_region_view, this, _1));
+       ds->playlist()->Modified.connect (playlist_connections, boost::bind (&StreamView::playlist_modified_weak, this, ds), gui_context());
+       ds->playlist()->RegionAdded.connect (playlist_connections, ui_bind (&StreamView::add_region_view_weak, this, _1), gui_context());
+       ds->playlist()->RegionRemoved.connect (playlist_connections, ui_bind (&StreamView::remove_region_view, this, _1), gui_context());
 }
 
 void
@@ -404,19 +404,19 @@ StreamView::region_layered (RegionView* rv)
 void
 StreamView::rec_enable_changed ()
 {
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&StreamView::setup_rec_box, this));
+       setup_rec_box ();
 }
 
 void
 StreamView::sess_rec_enable_changed ()
 {
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&StreamView::setup_rec_box, this));
+       setup_rec_box ();
 }
 
 void
 StreamView::transport_changed()
 {
-       Gtkmm2ext::UI::instance()->call_slot (boost::bind (&StreamView::setup_rec_box, this));
+       setup_rec_box ();
 }
 
 void
@@ -470,6 +470,19 @@ StreamView::find_view (boost::shared_ptr<const Region> region)
        return 0;
 }
 
+uint32_t
+StreamView::num_selected_regionviews () const
+{
+       uint32_t cnt = 0;
+
+       for (list<RegionView*>::const_iterator i = region_views.begin(); i != region_views.end(); ++i) {
+               if ((*i)->get_selected()) {
+                       ++cnt;
+               }
+       }
+       return cnt;
+}
+
 void
 StreamView::foreach_regionview (sigc::slot<void,RegionView*> slot)
 {
@@ -478,6 +491,16 @@ StreamView::foreach_regionview (sigc::slot<void,RegionView*> slot)
        }
 }
 
+void
+StreamView::foreach_selected_regionview (sigc::slot<void,RegionView*> slot)
+{
+       for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+               if ((*i)->get_selected()) {
+                       slot (*i);
+               }
+       }
+}
+
 void
 StreamView::set_selected_regionviews (RegionSelection& regions)
 {