- for (list<RegionView*>::iterator i = regions.begin(); i != regions.end(); ++i) {
-
- rv = (*i);
-
- if (rv->region()->locked()) {
- continue;
- }
-
-
- if (regionview_x_movement) {
- double ownspeed = 1.0;
- atv = dynamic_cast<AudioTimeAxisView*> (&(rv->get_time_axis_view()));
-
- if (atv && atv->get_diskstream()) {
- ownspeed = atv->get_diskstream()->speed();
- }
-
- /* base the new region position on the current position of the regionview.*/
-
- double ix1, ix2, iy1, iy2;
-
- rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
- rv->get_canvas_group()->i2w (ix1, iy1);
- where = (nframes_t) (unit_to_frame (ix1) * ownspeed);
-
- } else {
-
- where = rv->region()->position();
- }
-
- boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
-
- assert (to_playlist);
-
- /* add the undo */
-
- session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
-
- if (drag_info.copy) {
-
- boost::shared_ptr<Region> newregion;
- boost::shared_ptr<Region> ar;
-
- if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
- newregion = RegionFactory::create (ar);
- } else {
- /* XXX MIDI HERE drobilla */
- continue;
- }
-
- /* add it */
-
- latest_regionview = 0;
- sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
- to_playlist->add_region (newregion, (nframes_t) (where * atv->get_diskstream()->speed()));
- c.disconnect ();
-
- if (latest_regionview) {
- atv->reveal_dependent_views (*latest_regionview);
- selection->add (latest_regionview);
- }
-
- /* if the original region was locked, we don't care for the new one */
-
- newregion->set_locked (false);
-
- } else {
-
- /* just change the model */
-
- rv->region()->set_position (where, (void*) this);
-
- }
-
- /* add the redo */
-
- session->add_command (new MementoCommand<Playlist>(*to_playlist, 0, &to_playlist->get_state()));
-
- if (drag_info.copy) {
- copies.push_back (rv);
- }