Update Selection API to include all Stripables

This commit is contained in:
Robin Gareus 2017-08-06 22:16:36 +02:00
parent 1cbbbf6aad
commit 7009ff0300
7 changed files with 25 additions and 24 deletions

View file

@ -5552,15 +5552,15 @@ Editor::foreach_time_axis_view (sigc::slot<void,TimeAxisView&> 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<RouteTimeAxisView*>(*i)) != 0) {
if(v->route()->id() == id) {
if((v = dynamic_cast<StripableTimeAxisView*>(*i)) != 0) {
if(v->stripable()->id() == id) {
return v;
}
}

View file

@ -192,7 +192,7 @@ public:
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
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<ARDOUR::Region>);
void hide_a_region (boost::shared_ptr<ARDOUR::Region>);

View file

@ -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)

View file

@ -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()) {

View file

@ -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<ARDOUR::Stripable> s) const = 0;

View file

@ -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);

View file

@ -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<RouteTimeAxisView*> (*i);
StripableTimeAxisView* stv = dynamic_cast<StripableTimeAxisView*> (*i);
AutomationTimeAxisView* atv = dynamic_cast<AutomationTimeAxisView*> (*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 <ControlPoint *> cps;
if (rtv) {
boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param));
if (stv) {
boost::shared_ptr<AutomationTimeAxisView> atv = stv->automation_child (EventTypeMap::instance().from_symbol (param));
if (atv) {
list<boost::shared_ptr<AutomationLine> > lines = atv->lines();
for (list<boost::shared_ptr<AutomationLine> > ::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<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (param));
if (stv) {
boost::shared_ptr<AutomationTimeAxisView> 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