diff options
author | David Robillard <d@drobilla.net> | 2009-02-16 05:13:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-16 05:13:05 +0000 |
commit | 458c588e2c7dfe7c0e62647fb5e0d0c06cdf8f04 (patch) | |
tree | 32ebd393dd6aae397a1e272ec51a6e2d548b704b /gtk2_ardour/streamview.cc | |
parent | fb254fb2fc89f89142a2c991d9b09364ca1dac02 (diff) |
Don't bind playlist_modified with a shared_ptr<Playlist> parameter.
Clean up.
git-svn-id: svn://localhost/ardour2/branches/3.0@4599 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/streamview.cc')
-rw-r--r-- | gtk2_ardour/streamview.cc | 68 |
1 files changed, 45 insertions, 23 deletions
diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 5810d10eaf..83cdc61afc 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -72,14 +72,21 @@ StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* group) canvas_rect->property_outline_what() = (guint32) (0x2|0x8); // outline RHS and bottom - canvas_rect->signal_event().connect (bind (mem_fun (_trackview.editor(), &PublicEditor::canvas_stream_view_event), canvas_rect, &_trackview)); + canvas_rect->signal_event().connect (bind ( + mem_fun (_trackview.editor(), &PublicEditor::canvas_stream_view_event), + canvas_rect, &_trackview)); if (_trackview.is_track()) { - _trackview.track()->DiskstreamChanged.connect (mem_fun (*this, &StreamView::diskstream_changed)); - _trackview.session().TransportStateChange.connect (mem_fun (*this, &StreamView::transport_changed)); - _trackview.session().TransportLooped.connect (mem_fun (*this, &StreamView::transport_looped)); - _trackview.get_diskstream()->RecordEnableChanged.connect (mem_fun (*this, &StreamView::rec_enable_changed)); - _trackview.session().RecordStateChanged.connect (mem_fun (*this, &StreamView::sess_rec_enable_changed)); + _trackview.track()->DiskstreamChanged.connect ( + mem_fun (*this, &StreamView::diskstream_changed)); + _trackview.session().TransportStateChange.connect ( + mem_fun (*this, &StreamView::transport_changed)); + _trackview.session().TransportLooped.connect ( + mem_fun (*this, &StreamView::transport_looped)); + _trackview.get_diskstream()->RecordEnableChanged.connect ( + mem_fun (*this, &StreamView::rec_enable_changed)); + _trackview.session().RecordStateChanged.connect ( + mem_fun (*this, &StreamView::sess_rec_enable_changed)); } ColorsChanged.connect (mem_fun (*this, &StreamView::color_handler)); @@ -207,18 +214,9 @@ StreamView::display_diskstream (boost::shared_ptr<Diskstream> ds) { playlist_change_connection.disconnect(); playlist_changed (ds); - playlist_change_connection = ds->PlaylistChanged.connect (bind (mem_fun (*this, &StreamView::playlist_changed), ds)); -} - -void -StreamView::playlist_modified_weak (boost::weak_ptr<Diskstream> ds) -{ - boost::shared_ptr<Diskstream> sp (ds.lock()); - if (!sp) { - return; - } - - playlist_modified (sp); + playlist_change_connection = ds->PlaylistChanged.connect (bind ( + mem_fun (*this, &StreamView::playlist_changed_weak), + boost::weak_ptr<Diskstream> (ds))); } void @@ -279,6 +277,15 @@ StreamView::layer_regions() } void +StreamView::playlist_modified_weak (boost::weak_ptr<Diskstream> ds) +{ + boost::shared_ptr<Diskstream> sp (ds.lock()); + if (sp) { + playlist_modified (sp); + } +} + +void StreamView::playlist_modified (boost::shared_ptr<Diskstream> ds) { /* we do not allow shared_ptr<T> to be bound to slots */ @@ -294,14 +301,25 @@ StreamView::playlist_modified (boost::shared_ptr<Diskstream> ds) } void +StreamView::playlist_changed_weak (boost::weak_ptr<Diskstream> ds) +{ + boost::shared_ptr<Diskstream> sp (ds.lock()); + if (sp) { + playlist_changed (sp); + } +} + +void StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) { - /* XXX: binding to a shared_ptr, is this ok? */ - ENSURE_GUI_THREAD (bind (mem_fun (*this, &StreamView::playlist_changed), ds)); + ENSURE_GUI_THREAD (bind ( + mem_fun (*this, &StreamView::playlist_changed_weak), + boost::weak_ptr<Diskstream> (ds))); /* disconnect from old playlist */ - for (vector<sigc::connection>::iterator i = playlist_connections.begin(); i != playlist_connections.end(); ++i) { + for (vector<sigc::connection>::iterator i = playlist_connections.begin(); + i != playlist_connections.end(); ++i) { (*i).disconnect(); } @@ -319,7 +337,9 @@ StreamView::playlist_changed (boost::shared_ptr<Diskstream> ds) /* catch changes */ - playlist_connections.push_back (ds->playlist()->Modified.connect (bind (mem_fun (*this, &StreamView::playlist_modified_weak), ds))); + playlist_connections.push_back (ds->playlist()->Modified.connect (bind ( + mem_fun (*this, &StreamView::playlist_modified_weak), + ds))); } void @@ -328,7 +348,9 @@ StreamView::diskstream_changed () boost::shared_ptr<Track> t; if ((t = _trackview.track()) != 0) { - Gtkmm2ext::UI::instance()->call_slot (bind (mem_fun (*this, &StreamView::display_diskstream), t->diskstream())); + Gtkmm2ext::UI::instance()->call_slot (bind ( + mem_fun (*this, &StreamView::display_diskstream), + t->diskstream())); } else { Gtkmm2ext::UI::instance()->call_slot (mem_fun (*this, &StreamView::undisplay_diskstream)); } |