-
-
-bool
-RegionMotionDrag::x_move_allowed () const
-{
- if (Config->get_edit_mode() == Lock) {
- /* in locked edit mode, reverse the usual meaning of _x_constrained */
- return _x_constrained;
- }
-
- return !_x_constrained;
-}
-
-void
-RegionMotionDrag::copy_regions (GdkEvent* event)
-{
- /* duplicate the regionview(s) and region(s) */
-
- list<DraggingView> new_regionviews;
-
- for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
-
- RegionView* rv = i->view;
- AudioRegionView* arv = dynamic_cast<AudioRegionView*>(rv);
- MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(rv);
-
- const boost::shared_ptr<const Region> original = rv->region();
- boost::shared_ptr<Region> region_copy = RegionFactory::create (original);
- region_copy->set_position (original->position(), this);
-
- RegionView* nrv;
- if (arv) {
- boost::shared_ptr<AudioRegion> audioregion_copy
- = boost::dynamic_pointer_cast<AudioRegion>(region_copy);
-
- nrv = new AudioRegionView (*arv, audioregion_copy);
- } else if (mrv) {
- boost::shared_ptr<MidiRegion> midiregion_copy
- = boost::dynamic_pointer_cast<MidiRegion>(region_copy);
- nrv = new MidiRegionView (*mrv, midiregion_copy);
- } else {
- continue;
- }
-
- nrv->get_canvas_group()->show ();
- new_regionviews.push_back (DraggingView (nrv));
-
- /* swap _primary to the copy */
-
- if (rv == _primary) {
- _primary = nrv;
- }
-
- /* ..and deselect the one we copied */
-
- rv->set_selected (false);
- }
-
- if (new_regionviews.empty()) {
- return;
- }
-
- /* reflect the fact that we are dragging the copies */
-
- _views = new_regionviews;
-
- swap_grab (new_regionviews.front().view->get_canvas_group (), 0, event ? event->motion.time : 0);
-
- /*
- sync the canvas to what we think is its current state
- without it, the canvas seems to
- "forget" to update properly after the upcoming reparent()
- ..only if the mouse is in rapid motion at the time of the grab.
- something to do with regionview creation taking so long?
- */
- _editor->update_canvas_now();
-}
-
-bool
-RegionMotionDrag::check_possible (RouteTimeAxisView** tv, layer_t* layer)
-{
- /* Which trackview is this ? */
-
- pair<TimeAxisView*, int> const tvp = _editor->trackview_by_y_position (_drags->current_pointer_y ());
- (*tv) = dynamic_cast<RouteTimeAxisView*> (tvp.first);
- (*layer) = tvp.second;
-
- if (*tv && (*tv)->layer_display() == Overlaid) {
- *layer = 0;
- }
-
- /* The region motion is only processed if the pointer is over
- an audio track.
- */
-
- if (!(*tv) || !(*tv)->is_track()) {
- /* To make sure we hide the verbose canvas cursor when the mouse is
- not held over and audiotrack.
- */
- _editor->hide_verbose_canvas_cursor ();
- return false;
- }
-
- return true;
-}