Use sigc::slots rather than templates + function ptrs for a foreach_region and foreach_crossfade.
git-svn-id: svn://localhost/ardour2/branches/3.0@5118 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
27915ccdc0
commit
a75e811edb
|
@ -29,7 +29,6 @@
|
|||
#include "ardour/audiofilesource.h"
|
||||
#include "ardour/audio_diskstream.h"
|
||||
#include "ardour/audio_track.h"
|
||||
#include "ardour/playlist_templates.h"
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/profile.h"
|
||||
|
@ -401,13 +400,16 @@ AudioStreamView::redisplay_diskstream ()
|
|||
|
||||
if (_trackview.is_audio_track()) {
|
||||
_trackview.get_diskstream()->playlist()->foreach_region(
|
||||
static_cast<StreamView*>(this),
|
||||
&StreamView::add_region_view);
|
||||
sigc::mem_fun (*this, &StreamView::add_region_view)
|
||||
);
|
||||
|
||||
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(
|
||||
_trackview.get_diskstream()->playlist());
|
||||
if (apl)
|
||||
apl->foreach_crossfade (this, &AudioStreamView::add_crossfade);
|
||||
_trackview.get_diskstream()->playlist()
|
||||
);
|
||||
|
||||
if (apl) {
|
||||
apl->foreach_crossfade (sigc::mem_fun (*this, &AudioStreamView::add_crossfade));
|
||||
}
|
||||
}
|
||||
|
||||
// Remove invalid crossfade views
|
||||
|
|
|
@ -167,7 +167,8 @@ AutomationStreamView::redisplay_diskstream ()
|
|||
// Add and display region views, and flag them as valid
|
||||
if (_trackview.is_track()) {
|
||||
_trackview.get_diskstream()->playlist()->foreach_region (
|
||||
static_cast<StreamView*>(this), &StreamView::add_region_view);
|
||||
sigc::mem_fun (*this, &StreamView::add_region_view)
|
||||
);
|
||||
}
|
||||
|
||||
// Stack regions by layer, and remove invalid regions
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "ardour/auditioner.h"
|
||||
#include "ardour/audioplaylist.h"
|
||||
#include "ardour/audiosource.h"
|
||||
#include "ardour/playlist_templates.h"
|
||||
#include "ardour/region_factory.h"
|
||||
#include "ardour/profile.h"
|
||||
|
||||
|
@ -1234,7 +1233,7 @@ CrossfadeEditor::audition (Audition which)
|
|||
}
|
||||
|
||||
/* there is only one ... */
|
||||
pl.foreach_crossfade (this, &CrossfadeEditor::setup);
|
||||
pl.foreach_crossfade (sigc::mem_fun (*this, &CrossfadeEditor::setup));
|
||||
|
||||
session.audition_playlist ();
|
||||
}
|
||||
|
|
|
@ -243,8 +243,8 @@ MidiStreamView::redisplay_diskstream ()
|
|||
_data_note_min = 127;
|
||||
_data_note_max = 0;
|
||||
_trackview.get_diskstream()->playlist()->foreach_region(
|
||||
static_cast<StreamView*>(this),
|
||||
&StreamView::update_contents_metrics);
|
||||
sigc::mem_fun (*this, &StreamView::update_contents_metrics)
|
||||
);
|
||||
|
||||
// No notes, use default range
|
||||
if (!_range_dirty) {
|
||||
|
@ -266,8 +266,8 @@ MidiStreamView::redisplay_diskstream ()
|
|||
|
||||
// Add and display region views, and flag them as valid
|
||||
_trackview.get_diskstream()->playlist()->foreach_region(
|
||||
static_cast<StreamView*>(this),
|
||||
&StreamView::add_region_view);
|
||||
sigc::mem_fun (*this, &StreamView::add_region_view)
|
||||
);
|
||||
|
||||
// Stack regions by layer, and remove invalid regions
|
||||
layer_regions();
|
||||
|
|
|
@ -54,7 +54,7 @@ class AudioPlaylist : public ARDOUR::Playlist
|
|||
|
||||
sigc::signal<void,boost::shared_ptr<Crossfade> > NewCrossfade;
|
||||
|
||||
template<class T> void foreach_crossfade (T *t, void (T::*func)(boost::shared_ptr<Crossfade>));
|
||||
void foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> >);
|
||||
void crossfades_at (nframes_t frame, Crossfades&);
|
||||
|
||||
bool destroy_region (boost::shared_ptr<Region>);
|
||||
|
|
|
@ -120,8 +120,8 @@ class Playlist : public SessionObject,
|
|||
|
||||
nframes64_t find_next_transient (nframes64_t position, int dir);
|
||||
|
||||
template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg);
|
||||
template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>));
|
||||
void foreach_region (sigc::slot<void, boost::shared_ptr<Region>, void *>, void *);
|
||||
void foreach_region (sigc::slot<void, boost::shared_ptr<Region> >);
|
||||
|
||||
XMLNode& get_state ();
|
||||
int set_state (const XMLNode&);
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2003 Paul Davis
|
||||
|
||||
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 __ardour_playlist_templates_h__
|
||||
#define __ardour_playlist_templates_h__
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
template<class T> void AudioPlaylist::foreach_crossfade (T *t, void (T::*func)(boost::shared_ptr<Crossfade>)) {
|
||||
RegionLock rlock (this, false);
|
||||
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); i++) {
|
||||
(t->*func) (*i);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Playlist::foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg) {
|
||||
RegionLock rlock (this, false);
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); i++) {
|
||||
(t->*func) ((*i), arg);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> void Playlist::foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>)) {
|
||||
RegionLock rlock (this, false);
|
||||
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); i++) {
|
||||
(t->*func) (*i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* __ardour_playlist_templates_h__ */
|
|
@ -786,3 +786,11 @@ AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioPlaylist::foreach_crossfade (sigc::slot<void, boost::shared_ptr<Crossfade> > s)
|
||||
{
|
||||
RegionLock rl (this, false);
|
||||
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
|
||||
s (*i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2395,3 +2395,23 @@ Playlist::update_after_tempo_map_change ()
|
|||
|
||||
thaw ();
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::foreach_region (sigc::slot<void, boost::shared_ptr<Region>, void *> s, void* arg)
|
||||
{
|
||||
RegionLock rl (this, false);
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
s (*i, arg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::foreach_region (sigc::slot<void, boost::shared_ptr<Region> > s)
|
||||
{
|
||||
RegionLock rl (this, false);
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
s (*i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user