Fix things so that selecting a region always selects equivalent regions in the same edit group, even if the appropriate tracks aren't selected at the time.

git-svn-id: svn://localhost/ardour2/trunk@2523 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2007-10-06 16:24:08 +00:00
parent 4848acedee
commit 61872c5663
5 changed files with 70 additions and 29 deletions

View file

@ -3615,27 +3615,45 @@ Editor::restore_editing_space ()
); );
} }
/**
* Make new playlists for a given track and also any others that belong
* to the same active edit group.
* @param v Track.
*/
void void
Editor::new_playlists () Editor::new_playlists (TimeAxisView* v)
{ {
begin_reversible_command (_("new playlists")); begin_reversible_command (_("new playlists"));
mapover_tracks (mem_fun (*this, &Editor::mapped_use_new_playlist)); mapover_tracks (mem_fun (*this, &Editor::mapped_use_new_playlist), v);
commit_reversible_command (); commit_reversible_command ();
} }
/**
* Use a copy of the current playlist for a given track and also any others that belong
* to the same active edit group.
* @param v Track.
*/
void void
Editor::copy_playlists () Editor::copy_playlists (TimeAxisView* v)
{ {
begin_reversible_command (_("copy playlists")); begin_reversible_command (_("copy playlists"));
mapover_tracks (mem_fun (*this, &Editor::mapped_use_copy_playlist)); mapover_tracks (mem_fun (*this, &Editor::mapped_use_copy_playlist), v);
commit_reversible_command (); commit_reversible_command ();
} }
/**
* Clear the current playlist for a given track and also any others that belong
* to the same active edit group.
* @param v Track.
*/
void void
Editor::clear_playlists () Editor::clear_playlists (TimeAxisView* v)
{ {
begin_reversible_command (_("clear playlists")); begin_reversible_command (_("clear playlists"));
mapover_tracks (mem_fun (*this, &Editor::mapped_clear_playlist)); mapover_tracks (mem_fun (*this, &Editor::mapped_clear_playlist), v);
commit_reversible_command (); commit_reversible_command ();
} }

View file

@ -264,9 +264,9 @@ class Editor : public PublicEditor
nframes_t leftmost_frame; nframes_t leftmost_frame;
void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>); void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>);
void new_playlists (); void new_playlists (TimeAxisView* v);
void copy_playlists (); void copy_playlists (TimeAxisView* v);
void clear_playlists (); void clear_playlists (TimeAxisView* v);
TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0); TrackViewList* get_valid_views (TimeAxisView*, ARDOUR::RouteGroup* grp = 0);
@ -438,7 +438,7 @@ class Editor : public PublicEditor
void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks); void get_relevant_tracks (std::set<RouteTimeAxisView*>& relevant_tracks);
void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&); void get_equivalent_regions (RegionView* rv, std::vector<RegionView*>&);
void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl); void mapover_tracks (sigc::slot<void,RouteTimeAxisView&,uint32_t> sl, TimeAxisView*);
/* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */ /* functions to be passed to mapover_tracks(), possibly with sigc::bind()-supplied arguments */

View file

@ -285,17 +285,45 @@ Editor::get_relevant_tracks (set<RouteTimeAxisView*>& relevant_tracks)
} }
} }
/**
* Call a slot for a given `basis' track and also for any track that is in the same
* active edit group.
* @param sl Slot to call.
* @param basis Basis track.
*/
void void
Editor::mapover_tracks (slot<void,RouteTimeAxisView&,uint32_t> sl) Editor::mapover_tracks (slot<void, RouteTimeAxisView&, uint32_t> sl, TimeAxisView* basis)
{ {
set<RouteTimeAxisView*> relevant_tracks; RouteTimeAxisView* route_basis = dynamic_cast<RouteTimeAxisView*> (basis);
if (route_basis == 0) {
return;
}
get_relevant_tracks (relevant_tracks); /* work out the tracks that we will call the slot for; use
a set here as it will disallow possible duplicates of the
basis track */
set<RouteTimeAxisView*> tracks;
uint32_t sz = relevant_tracks.size(); /* always call for the basis */
tracks.insert (route_basis);
for (set<RouteTimeAxisView*>::iterator rti = relevant_tracks.begin(); rti != relevant_tracks.end(); ++rti) { RouteGroup* group = route_basis->route()->edit_group();
sl (**rti, sz); if (group && group->is_active()) {
/* the basis is a member of an active edit group; find other members */
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
RouteTimeAxisView* v = dynamic_cast<RouteTimeAxisView*> (*i);
if (v && v->route()->edit_group() == group) {
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);
} }
} }
@ -331,7 +359,7 @@ Editor::mapped_get_equivalent_regions (RouteTimeAxisView& tv, uint32_t ignored,
void void
Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions) Editor::get_equivalent_regions (RegionView* basis, vector<RegionView*>& equivalent_regions)
{ {
mapover_tracks (bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions)); mapover_tracks (bind (mem_fun (*this, &Editor::mapped_get_equivalent_regions), basis, &equivalent_regions), &basis->get_trackview());
/* add clicked regionview since we skipped all other regions in the same track as the one it was in */ /* add clicked regionview since we skipped all other regions in the same track as the one it was in */
@ -410,12 +438,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op,
case Selection::Set: case Selection::Set:
if (!clicked_regionview->get_selected()) { if (!clicked_regionview->get_selected()) {
if (selection->selected (clicked_routeview)) { get_equivalent_regions (clicked_regionview, all_equivalent_regions);
get_equivalent_regions (clicked_regionview, all_equivalent_regions);
} else {
all_equivalent_regions.push_back (clicked_regionview);
}
selection->set (all_equivalent_regions); selection->set (all_equivalent_regions);
commit = true; commit = true;
} else { } else {

View file

@ -216,9 +216,9 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual PlaylistSelector& playlist_selector () const = 0; virtual PlaylistSelector& playlist_selector () const = 0;
virtual void route_name_changed (TimeAxisView *) = 0; virtual void route_name_changed (TimeAxisView *) = 0;
virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0; virtual void clear_playlist (boost::shared_ptr<ARDOUR::Playlist>) = 0;
virtual void new_playlists () = 0; virtual void new_playlists (TimeAxisView*) = 0;
virtual void copy_playlists () = 0; virtual void copy_playlists (TimeAxisView*) = 0;
virtual void clear_playlists () = 0; virtual void clear_playlists (TimeAxisView*) = 0;
virtual void select_all_tracks () = 0; virtual void select_all_tracks () = 0;
virtual bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0; virtual bool set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0;
virtual void set_selected_mixer_strip (TimeAxisView&) = 0; virtual void set_selected_mixer_strip (TimeAxisView&) = 0;

View file

@ -1414,10 +1414,10 @@ RouteTimeAxisView::build_playlist_menu (Gtk::Menu * menu)
playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist))); playlist_items.push_back (MenuElem (_("Rename"), mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
playlist_items.push_back (SeparatorElem()); playlist_items.push_back (SeparatorElem());
playlist_items.push_back (MenuElem (_("New"), mem_fun(editor, &PublicEditor::new_playlists))); playlist_items.push_back (MenuElem (_("New"), bind(mem_fun(editor, &PublicEditor::new_playlists), this)));
playlist_items.push_back (MenuElem (_("New Copy"), mem_fun(editor, &PublicEditor::copy_playlists))); playlist_items.push_back (MenuElem (_("New Copy"), bind(mem_fun(editor, &PublicEditor::copy_playlists), this)));
playlist_items.push_back (SeparatorElem()); playlist_items.push_back (SeparatorElem());
playlist_items.push_back (MenuElem (_("Clear Current"), mem_fun(editor, &PublicEditor::clear_playlists))); playlist_items.push_back (MenuElem (_("Clear Current"), bind(mem_fun(editor, &PublicEditor::clear_playlists), this)));
playlist_items.push_back (SeparatorElem()); playlist_items.push_back (SeparatorElem());
playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector))); playlist_items.push_back (MenuElem(_("Select from all ..."), mem_fun(*this, &RouteTimeAxisView::show_playlist_selector)));