From 7009ff030070c1ce9da23c00d8153e763f65901a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 6 Aug 2017 22:16:36 +0200 Subject: Update Selection API to include all Stripables --- gtk2_ardour/editor.cc | 12 ++++++------ gtk2_ardour/editor.h | 2 +- gtk2_ardour/luainstance.cc | 2 +- gtk2_ardour/mixer_strip.cc | 8 ++++---- gtk2_ardour/public_editor.h | 3 ++- gtk2_ardour/route_time_axis.cc | 2 +- gtk2_ardour/selection.cc | 20 ++++++++++---------- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index d84d92267d..38fad22ddf 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -5552,15 +5552,15 @@ Editor::foreach_time_axis_view (sigc::slot theslot) } } -/** Find a RouteTimeAxisView by the ID of its route */ -RouteTimeAxisView* -Editor::get_route_view_by_route_id (const PBD::ID& id) const +/** Find a StripableTimeAxisView by the ID of its stripable */ +StripableTimeAxisView* +Editor::get_stripable_time_axis_by_id (const PBD::ID& id) const { - RouteTimeAxisView* v; + StripableTimeAxisView* v; for (TrackViewList::const_iterator i = track_views.begin(); i != track_views.end(); ++i) { - if((v = dynamic_cast(*i)) != 0) { - if(v->route()->id() == id) { + if((v = dynamic_cast(*i)) != 0) { + if(v->stripable()->id() == id) { return v; } } diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index a2e3aacfa2..dfc0ab2cb5 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -192,7 +192,7 @@ public: void foreach_time_axis_view (sigc::slot); void add_to_idle_resize (TimeAxisView*, int32_t); - RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const; + StripableTimeAxisView* get_stripable_time_axis_by_id (const PBD::ID& id) const; void consider_auditioning (boost::shared_ptr); void hide_a_region (boost::shared_ptr); diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index f708e21dec..f8dbbc3e2a 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -813,7 +813,7 @@ LuaInstance::register_classes (lua_State* L) .addFunction ("drags", &PublicEditor::drags) #endif - .addFunction ("get_route_view_by_route_id", &PublicEditor::get_route_view_by_route_id) + .addFunction ("get_stripable_time_axis_by_id", &PublicEditor::get_stripable_time_axis_by_id) .addFunction ("get_track_views", &PublicEditor::get_track_views) .addFunction ("rtav_from_route", &PublicEditor::rtav_from_route) .addFunction ("axis_views_from_routes", &PublicEditor::axis_views_from_routes) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 343ddf99b6..f17468ea65 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1750,11 +1750,11 @@ MixerStrip::build_route_ops_menu () sane thing for users anyway. */ - RouteTimeAxisView* rtav = PublicEditor::instance().get_route_view_by_route_id (_route->id()); - if (rtav) { + StripableTimeAxisView* stav = PublicEditor::instance().get_stripable_time_axis_by_id (_route->id()); + if (stav) { Selection& selection (PublicEditor::instance().get_selection()); - if (!selection.selected (rtav)) { - selection.set (rtav); + if (!selection.selected (stav)) { + selection.set (stav); } if (!_route->is_master()) { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 37bf6b89b5..f7c20ea983 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -84,6 +84,7 @@ class PluginUIWindow; class RegionView; class RouteTimeAxisView; class Selection; +class StripableTimeAxisView; class TempoCurve; class TempoMarker; class TimeAxisView; @@ -354,7 +355,7 @@ public: virtual bool track_selection_change_without_scroll () const = 0; - virtual RouteTimeAxisView* get_route_view_by_route_id (const PBD::ID& id) const = 0; + virtual StripableTimeAxisView* get_stripable_time_axis_by_id (const PBD::ID& id) const = 0; virtual TimeAxisView* time_axis_view_from_stripable (boost::shared_ptr s) const = 0; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index b0651a9dfb..8b5b17739f 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2479,7 +2479,7 @@ RouteTimeAxisView::set_underlay_state() if (prop) { PBD::ID id (prop->value()); - RouteTimeAxisView* v = _editor.get_route_view_by_route_id (id); + StripableTimeAxisView* v = _editor.get_stripable_time_axis_by_id (id); if (v) { add_underlay(v->view(), false); diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 1e89e08879..a75574bb19 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1138,11 +1138,11 @@ Selection::get_state () const XMLNode* node = new XMLNode (X_("Selection")); for (TrackSelection::const_iterator i = tracks.begin(); i != tracks.end(); ++i) { - RouteTimeAxisView* rtv = dynamic_cast (*i); + StripableTimeAxisView* stv = dynamic_cast (*i); AutomationTimeAxisView* atv = dynamic_cast (*i); - if (rtv) { - XMLNode* t = node->add_child (X_("RouteView")); - t->set_property (X_("id"), rtv->route()->id ()); + if (stv) { + XMLNode* t = node->add_child (X_("StripableView")); + t->set_property (X_("id"), stv->stripable()->id ()); } else if (atv) { XMLNode* t = node->add_child (X_("AutomationView")); t->set_property (X_("id"), atv->parent_stripable()->id ()); @@ -1317,11 +1317,11 @@ Selection::set_state (XMLNode const & node, int) assert(false); } - RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (route_id); // XXX may also be VCA + StripableTimeAxisView* stv = editor->get_stripable_time_axis_by_id (route_id); vector cps; - if (rtv) { - boost::shared_ptr atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param)); + if (stv) { + boost::shared_ptr atv = stv->automation_child (EventTypeMap::instance().from_symbol (param)); if (atv) { list > lines = atv->lines(); for (list > ::iterator li = lines.begin(); li != lines.end(); ++li) { @@ -1387,10 +1387,10 @@ Selection::set_state (XMLNode const & node, int) assert (false); } - RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (id); + StripableTimeAxisView* stv = editor->get_stripable_time_axis_by_id (id); - if (rtv) { - boost::shared_ptr atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param)); + if (stv) { + boost::shared_ptr atv = stv->automation_child (EventTypeMap::instance().from_symbol (param)); /* the automation could be for an entity that was never saved in the session file. Don't freak out if we can't find -- cgit v1.2.3