MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(rv);
const boost::shared_ptr<const Region> original = rv->region();
- boost::shared_ptr<Region> region_copy = RegionFactory::create (original, true
- , current_music_divisor (original->position(), event->button.state));
+ boost::shared_ptr<Region> region_copy;
+
+ if (rv == _primary) {
+ region_copy = RegionFactory::create (original, true
+ , current_music_divisor (original->position(), event->button.state));
+ } else {
+ region_copy = RegionFactory::create (original, true, 0);
+ }
+
/* need to set this so that the drop zone code can work. This doesn't
actually put the region into the playlist, but just sets a weak pointer
to it.
if (was_double_click() && !_views.empty()) {
DraggingView dv = _views.front();
- dv.view->show_region_editor ();
-
+ _editor->edit_region (dv.view);
}
return;
/* Add a new track of the correct type, and return the RouteTimeAxisView that is created to display the
new track.
*/
-
+ TimeAxisView* tav = 0;
try {
if (boost::dynamic_pointer_cast<AudioRegion> (region)) {
list<boost::shared_ptr<AudioTrack> > audio_tracks;
output_chan = _editor->session()->master_out()->n_inputs().n_audio();
}
audio_tracks = _editor->session()->new_audio_track (region->n_channels(), output_chan, 0, 1, region->name(), PresentationInfo::max_order);
- TimeAxisView* tav =_editor->axis_view_from_stripable (audio_tracks.front());
- if (tav) {
- tav->set_height (original->current_height());
- }
- return dynamic_cast<RouteTimeAxisView*>(tav);
+ tav =_editor->axis_view_from_stripable (audio_tracks.front());
} else {
ChanCount one_midi_port (DataType::MIDI, 1);
list<boost::shared_ptr<MidiTrack> > midi_tracks;
midi_tracks = _editor->session()->new_midi_track (one_midi_port, one_midi_port, boost::shared_ptr<ARDOUR::PluginInfo>(),
(ARDOUR::Plugin::PresetRecord*) 0,
(ARDOUR::RouteGroup*) 0, 1, region->name(), PresentationInfo::max_order);
- TimeAxisView* tav = _editor->axis_view_from_stripable (midi_tracks.front());
- if (tav) {
- tav->set_height (original->current_height());
- }
- return dynamic_cast<RouteTimeAxisView*> (tav);
+ tav = _editor->axis_view_from_stripable (midi_tracks.front());
+ }
+
+ if (tav) {
+ tav->set_height (original->current_height());
}
} catch (...) {
error << _("Could not create new track after region placed in the drop zone") << endmsg;
- return 0;
}
+
+ return dynamic_cast<RouteTimeAxisView*> (tav);
}
void
PlaylistSet modified_playlists;
RouteTimeAxisView* new_time_axis_view = 0;
+ int32_t divisor = current_music_divisor (_primary->region()->position() - drag_delta, ev_state);
+ TempoMap& tmap (_editor->session()->tempo_map());
+ double qn_delta = _primary->region()->quarter_note() - tmap.exact_qn_at_frame (_primary->region()->position() - drag_delta, divisor);
+
if (_brushing) {
/* all changes were made during motion event handlers */
if ((pm = playlist_mapping.find (i->view->region()->playlist())) == playlist_mapping.end()) {
/* first region from this original playlist: create a new track */
new_time_axis_view = create_destination_time_axis (i->view->region(), i->initial_time_axis_view);
+ if(!new_time_axis_view) {
+ Drag::abort();
+ return;
+ }
playlist_mapping.insert (make_pair (i->view->region()->playlist(), new_time_axis_view));
dest_rtv = new_time_axis_view;
} else {
}
if (dest_rtv != 0) {
- RegionView* new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where,
- modified_playlists, current_music_divisor (where, ev_state));
+ RegionView* new_view;
+ if (i->view == _primary) {
+ new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where,
+ modified_playlists, current_music_divisor (where, ev_state));
+ } else {
+ if (i->view->region()->position_lock_style() == AudioTime) {
+ new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where,
+ modified_playlists, 0);
+ } else {
+ where = tmap.frame_at_quarter_note (i->view->region()->quarter_note() - qn_delta);
+ new_view = insert_region_into_playlist (i->view->region(), dest_rtv, i->layer, where,
+ modified_playlists, 0);
+ }
+ }
if (new_view != 0) {
new_views.push_back (new_view);
typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
PlaylistMapping playlist_mapping;
+ int32_t divisor = current_music_divisor (_primary->region()->position() - drag_delta, ev_state);
+ TempoMap& tmap (_editor->session()->tempo_map());
+ double qn_delta = _primary->region()->quarter_note() - tmap.exact_qn_at_frame (_primary->region()->position() - drag_delta, divisor);
+
std::set<boost::shared_ptr<const Region> > uniq;
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ) {
if ((pm = playlist_mapping.find (i->view->region()->playlist())) == playlist_mapping.end()) {
/* first region from this original playlist: create a new track */
new_time_axis_view = create_destination_time_axis (i->view->region(), i->initial_time_axis_view);
+ if(!new_time_axis_view) { // New track creation failed
+ Drag::abort();
+ return;
+ }
playlist_mapping.insert (make_pair (i->view->region()->playlist(), new_time_axis_view));
dest_rtv = new_time_axis_view;
} else {
if (changed_tracks) {
/* insert into new playlist */
+ RegionView* new_view;
+ if (rv == _primary) {
+ new_view = insert_region_into_playlist (
+ RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where,
+ modified_playlists, current_music_divisor (where, ev_state)
+ );
+ } else {
+ if (rv->region()->position_lock_style() == AudioTime) {
- RegionView* new_view = insert_region_into_playlist (
- RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where,
- modified_playlists, current_music_divisor (where, ev_state)
- );
+ new_view = insert_region_into_playlist (
+ RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where,
+ modified_playlists, 0
+ );
+ } else {
+ where = tmap.frame_at_quarter_note (rv->region()->quarter_note() - qn_delta);
+ new_view = insert_region_into_playlist (
+ RegionFactory::create (rv->region (), true), dest_rtv, dest_layer, where,
+ modified_playlists, 0
+ );
+ }
+ }
if (new_view == 0) {
++i;
if (r.second) {
playlist->freeze ();
}
+ if (rv == _primary) {
+ rv->region()->set_position (where, current_music_divisor (where, ev_state));
+ } else {
+ if (rv->region()->position_lock_style() == AudioTime) {
+ rv->region()->set_position (where, 0);
+ } else {
+ rv->region()->set_position (tmap.frame_at_quarter_note (rv->region()->quarter_note() - qn_delta), 0);
- rv->region()->set_position (where, current_music_divisor (where, ev_state));
+ }
+ }
_editor->session()->add_command (new StatefulDiffCommand (rv->region()));
}
if (was_double_click() && !_views.empty()) {
DraggingView dv = _views.front();
- dv.view->show_region_editor ();
-
+ _editor->edit_region (dv.view);
}
return;
--bbt.bars;
}
const double beat = map.beat_at_bbt (bbt);
+ const framepos_t frame = map.frame_at_beat (beat);
_real_section = map.add_meter (Meter (_marker->meter().divisions_per_bar(), _marker->meter().note_divisor())
- , beat, bbt, _real_section->position_lock_style());
+ , beat, bbt, frame, _real_section->position_lock_style());
if (!_real_section) {
aborted (true);
return;
_marker = reinterpret_cast<TempoMarker*> (_item->get_data ("marker"));
_real_section = &_marker->tempo();
- _movable = _real_section->movable();
+ _movable = !_real_section->initial();
_grab_bpm = _real_section->note_types_per_minute();
assert (_marker);
}
/* just a click, no pointer movement.
*/
+ if (was_double_click()) {
+ if (UIConfiguration::instance().get_use_double_click_to_zoom_to_selection()) {
+ _editor->temporal_zoom_selection (Both);
+ return;
+ }
+ }
+
if (_operation == SelectionExtend) {
if (_time_selection_at_start) {
framepos_t pos = adjusted_current_frame (event, false);