summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_selection.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-10 19:20:15 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-10 19:20:15 +0000
commitd23a6de077181caa24af52229bb040c87ed34ebd (patch)
tree664ec7adbdf87826aced9b8d02d6b2603bf5d61d /gtk2_ardour/editor_selection.cc
parent6e211e27e2027da328b6fe117f10e1962c007afb (diff)
fix for most (all? we can dream ...) issues involved in #4399 (editing multiply-applies operations to playlists used more than once), and as a side-issue, fix playlist selection which broke when we hid Diskstreams inside Tracks by using orig_track_id() rather than orig_diskstream_id()
git-svn-id: svn://localhost/ardour2/branches/3.0@10968 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_selection.cc')
-rw-r--r--gtk2_ardour/editor_selection.cc61
1 files changed, 59 insertions, 2 deletions
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index 57db35ccf3..142204f9b4 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -401,6 +401,63 @@ Editor::mapover_tracks (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeA
}
}
+/** Call a slot for a given `basis' track and also for any track that is in the same
+ * active route group with a particular set of properties.
+ *
+ * @param sl Slot to call.
+ * @param basis Basis track.
+ * @param prop Properties that active edit groups must share to be included in the map.
+ */
+
+void
+Editor::mapover_tracks_with_unique_playlists (sigc::slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis, PBD::PropertyID prop) const
+{
+ RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
+ set<boost::shared_ptr<Playlist> > playlists;
+
+ if (route_basis == 0) {
+ return;
+ }
+
+ set<RouteTimeAxisView*> tracks;
+ tracks.insert (route_basis);
+
+ RouteGroup* group = route_basis->route()->route_group(); // could be null, not a problem
+
+ if (group && group->enabled_property(prop) && group->enabled_property (Properties::active.property_id) ) {
+
+ /* the basis is a member of an active route group, with the appropriate
+ properties; find other members */
+
+ for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ RouteTimeAxisView* v = dynamic_cast<RouteTimeAxisView*> (*i);
+
+ if (v && v->route()->route_group() == group) {
+
+ boost::shared_ptr<Track> t = v->track();
+ if (t) {
+ if (playlists.insert (t->playlist()).second) {
+ /* haven't seen this playlist yet */
+ tracks.insert (v);
+ }
+ } else {
+ /* not actually a "Track", but a timeaxis view that
+ we should mapover anyway.
+ */
+ tracks.insert (v);
+ }
+ }
+ }
+ }
+
+ /* call the slots */
+ uint32_t const sz = tracks.size ();
+
+ for (set<RouteTimeAxisView*>::iterator i = tracks.begin(); i != tracks.end(); ++i) {
+ sl (**i, sz);
+ }
+}
+
void
Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionView * basis, vector<RegionView*>* all_equivs) const
{
@@ -433,7 +490,7 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t, RegionVi
void
Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions, PBD::PropertyID property) const
{
- mapover_tracks (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_time_axis_view(), property);
+ mapover_tracks_with_unique_playlists (sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_time_axis_view(), property);
/* add clicked regionview since we skipped all other regions in the same track as the one it was in */
@@ -449,7 +506,7 @@ Editor::get_equivalent_regions (RegionSelection & basis, PBD::PropertyID prop) c
vector<RegionView*> eq;
- mapover_tracks (
+ mapover_tracks_with_unique_playlists (
sigc::bind (sigc::mem_fun (*this, &Editor::mapped_get_equivalent_regions), *i, &eq),
&(*i)->get_time_axis_view(), prop);