+ } else if ((*i)->name() == X_("Region")) {
+
+ if (!(*i)->get_property (X_("id"), id)) {
+ assert(false);
+ }
+
+ RegionSelection rs;
+ editor->get_regionviews_by_id (id, rs);
+
+ if (!rs.empty ()) {
+ selected_regions.insert (selected_regions.end(), rs.begin(), rs.end());
+ } 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")) {
+
+ if (!(*i)->get_property (X_("region-id"), id)) {
+ assert (false);
+ }
+
+ 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) {
+ Evoral::event_id_t id;
+ if ((*ci)->get_property (X_ ("note-id"), id)) {
+ 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") {
+
+ PBD::ID route_id;
+ PBD::ID alist_id;
+ std::string param;
+ uint32_t view_index;
+
+ if (!(*i)->get_property (X_("route-id"), route_id) ||
+ !(*i)->get_property (X_("automation-list-id"), alist_id) ||
+ !(*i)->get_property (X_("parameter"), param) ||
+ !(*i)->get_property (X_("view-index"), view_index)) {
+ assert(false);
+ }
+
+ 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 (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) {
+ if ((*li)->the_list()->id() == alist_id) {
+ ControlPoint* cp = (*li)->nth(view_index);
+ if (cp) {
+ cps.push_back (cp);
+ cp->show();
+ }
+ }
+ }
+ }
+ }
+ if (!cps.empty()) {
+ add (cps);
+ }
+ } else if (prop_type->value () == "region") {
+
+ PBD::ID region_id;
+ uint32_t view_index;
+ if (!(*i)->get_property (X_("region-id"), region_id) ||
+ !(*i)->get_property (X_("view-index"), view_index)) {
+ continue;
+ }
+
+ 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(view_index);
+ if (cp) {
+ cps.push_back (cp);
+ cp->show();
+ }
+ }
+ }
+ if (!cps.empty()) {
+ add (cps);
+ }
+ }
+ }
+
+ } else if ((*i)->name() == X_("AudioRange")) {
+ framepos_t start;
+ framepos_t end;
+
+ if (!(*i)->get_property (X_("start"), start) || !(*i)->get_property (X_("end"), end)) {
+ assert(false);
+ }
+ set_preserving_all_ranges (start, end);
+