Implement 2532: option to show tracks with regions under the playhead.
git-svn-id: svn://localhost/ardour2/branches/3.0@6207 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b88e7fdcca
commit
515d19c745
@ -219,7 +219,7 @@ EditorRoutes::build_menu ()
|
||||
items.push_back (MenuElem (_("Hide All Audio Tracks"), mem_fun (*this, &EditorRoutes::hide_all_audiotracks)));
|
||||
items.push_back (MenuElem (_("Show All Audio Busses"), mem_fun (*this, &EditorRoutes::show_all_audiobus)));
|
||||
items.push_back (MenuElem (_("Hide All Audio Busses"), mem_fun (*this, &EditorRoutes::hide_all_audiobus)));
|
||||
|
||||
items.push_back (MenuElem (_("Show Tracks With Regions Under Playhead"), mem_fun (*this, &EditorRoutes::show_tracks_with_regions_at_playhead)));
|
||||
}
|
||||
|
||||
void
|
||||
@ -968,3 +968,29 @@ EditorRoutes::solo_changed_so_update_mute ()
|
||||
|
||||
update_mute_display (this);
|
||||
}
|
||||
|
||||
void
|
||||
EditorRoutes::show_tracks_with_regions_at_playhead ()
|
||||
{
|
||||
boost::shared_ptr<RouteList> const r = _session->get_routes_with_regions_at (_session->transport_frame ());
|
||||
|
||||
set<TimeAxisView*> show;
|
||||
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
|
||||
cout << "show " << (*i)->name() << "\n";
|
||||
TimeAxisView* tav = _editor->axis_view_from_route (i->get ());
|
||||
if (tav) {
|
||||
show.insert (tav);
|
||||
}
|
||||
}
|
||||
|
||||
suspend_redisplay ();
|
||||
|
||||
TreeModel::Children rows = _model->children ();
|
||||
for (TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) {
|
||||
TimeAxisView* tv = (*i)[_columns.tv];
|
||||
(*i)[_columns.visible] = (show.find (tv) != show.end());
|
||||
}
|
||||
|
||||
resume_redisplay ();
|
||||
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ private:
|
||||
void hide_all_audiotracks ();
|
||||
void show_all_audiobus ();
|
||||
void hide_all_audiobus ();
|
||||
void show_tracks_with_regions_at_playhead ();
|
||||
|
||||
void display_drag_data_received (
|
||||
Glib::RefPtr<Gdk::DragContext> const &, gint, gint, Gtk::SelectionData const &, guint, guint
|
||||
|
@ -120,6 +120,8 @@ class Playlist : public SessionObject,
|
||||
boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir);
|
||||
nframes64_t find_next_region_boundary (nframes64_t frame, int dir);
|
||||
bool region_is_shuffle_constrained (boost::shared_ptr<Region>);
|
||||
bool has_region_at (nframes64_t const) const;
|
||||
|
||||
|
||||
nframes64_t find_next_transient (nframes64_t position, int dir);
|
||||
|
||||
|
@ -322,6 +322,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
|
||||
|
||||
boost::shared_ptr<RouteList> get_routes_with_internal_returns() const;
|
||||
|
||||
boost::shared_ptr<RouteList> get_routes_with_regions_at (nframes64_t const) const;
|
||||
|
||||
uint32_t nroutes() const { return routes.reader()->size(); }
|
||||
uint32_t ntracks () const;
|
||||
uint32_t nbusses () const;
|
||||
|
@ -2521,3 +2521,17 @@ Playlist::set_explicit_relayering (bool e)
|
||||
|
||||
_explicit_relayering = e;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Playlist::has_region_at (nframes64_t const p) const
|
||||
{
|
||||
RegionLock (const_cast<Playlist *> (this));
|
||||
|
||||
RegionList::const_iterator i = regions.begin ();
|
||||
while (i != regions.end() && !(*i)->covers (p)) {
|
||||
++i;
|
||||
}
|
||||
|
||||
return (i != regions.end());
|
||||
}
|
||||
|
@ -4513,3 +4513,35 @@ Session::get_available_sync_options () const
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
boost::shared_ptr<RouteList>
|
||||
Session::get_routes_with_regions_at (nframes64_t const p) const
|
||||
{
|
||||
shared_ptr<RouteList> r = routes.reader ();
|
||||
shared_ptr<RouteList> rl (new RouteList);
|
||||
|
||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (!tr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Diskstream> ds = tr->diskstream ();
|
||||
if (!ds) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Playlist> pl = ds->playlist ();
|
||||
if (!pl) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pl->has_region_at (p)) {
|
||||
rl->push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
return rl;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user