+ } else if ((*i)->name() == X_("Region")) {
+ XMLProperty const * prop_id = (*i)->property (X_("id"));
+ assert (prop_id);
+ PBD::ID id (prop_id->value ());
+
+ RegionSelection rs;
+ editor->get_regionviews_by_id (id, rs);
+
+ if (!rs.empty ()) {
+ add (rs);
+ } else {
+ /*
+ regionviews haven't been constructed - stash the region IDs
+ so we can identify them in Editor::region_view_added ()
+ */
+ regions.pending.push_back (id);
+ }
+
+ } else if ((*i)->name() == X_("MIDINotes")) {
+ XMLProperty const * prop_region_id = (*i)->property (X_("region-id"));
+
+ assert (prop_region_id);
+
+ PBD::ID const id (prop_region_id->value ());
+ RegionSelection rs;
+
+ editor->get_regionviews_by_id (id, rs); // there could be more than one
+
+ std::list<Evoral::event_id_t> notes;
+ XMLNodeList children = (*i)->children ();
+
+ for (XMLNodeList::const_iterator ci = children.begin(); ci != children.end(); ++ci) {
+ XMLProperty const * prop_id = (*ci)->property (X_("note-id"));
+ if (prop_id) {
+ Evoral::event_id_t id = atoi(prop_id->value());
+ notes.push_back (id);
+ }
+ }
+
+ for (RegionSelection::iterator rsi = rs.begin(); rsi != rs.end(); ++rsi) {
+ MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (*rsi);
+ if (mrv) {
+ mrv->select_notes(notes);
+ }
+ }
+
+ if (rs.empty()) {
+ /* regionviews containing these notes don't yet exist on the canvas.*/
+ pending_midi_note_selection.push_back (make_pair (id, notes));
+ }
+
+ } else if ((*i)->name() == X_("ControlPoint")) {
+ XMLProperty const * prop_type = (*i)->property (X_("type"));
+
+ assert(prop_type);
+
+ if (prop_type->value () == "track") {
+
+ XMLProperty const * prop_route_id = (*i)->property (X_("route-id"));
+ XMLProperty const * prop_alist_id = (*i)->property (X_("automation-list-id"));
+ XMLProperty const * prop_parameter = (*i)->property (X_("parameter"));
+ XMLProperty const * prop_view_index = (*i)->property (X_("view-index"));
+
+ assert (prop_route_id);
+ assert (prop_alist_id);
+ assert (prop_parameter);
+ assert (prop_view_index);
+
+ PBD::ID route_id (prop_route_id->value ());
+ RouteTimeAxisView* rtv = editor->get_route_view_by_route_id (route_id);
+ vector <ControlPoint *> cps;
+
+ if (rtv) {
+ boost::shared_ptr<AutomationTimeAxisView> atv = rtv->automation_child (EventTypeMap::instance().from_symbol (prop_parameter->value ()));
+ if (atv) {
+ list<boost::shared_ptr<AutomationLine> > lines = atv->lines();
+ for (list<boost::shared_ptr<AutomationLine> > ::iterator li = lines.begin(); li != lines.end(); ++li) {
+ if ((*li)->the_list()->id() == prop_alist_id->value()) {
+ ControlPoint* cp = (*li)->nth(atol(prop_view_index->value().c_str()));
+ if (cp) {
+ cps.push_back (cp);
+ cp->show();
+ }
+ }
+ }
+ }
+ }
+ if (!cps.empty()) {
+ add (cps);
+ }
+ } else if (prop_type->value () == "region") {
+ XMLProperty const * prop_region_id = (*i)->property (X_("region-id"));
+ XMLProperty const * prop_view_index = (*i)->property (X_("view-index"));
+
+ if (!prop_region_id || !prop_view_index) {
+ continue;
+ }
+
+ PBD::ID region_id (prop_region_id->value ());
+ RegionSelection rs;
+ editor->get_regionviews_by_id (region_id, rs);
+
+ if (!rs.empty ()) {
+ vector <ControlPoint *> cps;
+ for (RegionSelection::iterator rsi = rs.begin(); rsi != rs.end(); ++rsi) {
+ AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*rsi);
+ if (arv) {
+ boost::shared_ptr<AudioRegionGainLine> gl = arv->get_gain_line ();
+ ControlPoint* cp = gl->nth(atol(prop_view_index->value().c_str()));
+ if (cp) {
+ cps.push_back (cp);
+ cp->show();
+ }
+ }
+ }
+ if (!cps.empty()) {
+ add (cps);
+ }
+ }
+ }
+
+ } else if ((*i)->name() == X_("AudioRange")) {
+ XMLProperty const * prop_start = (*i)->property (X_("start"));
+ XMLProperty const * prop_end = (*i)->property (X_("end"));
+
+ assert (prop_start);
+ assert (prop_end);
+
+ framepos_t s (atol (prop_start->value ().c_str()));
+ framepos_t e (atol (prop_end->value ().c_str()));
+
+ set_preserving_all_ranges (s, e);
+