mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
Abort a copy-drag in the case where it would result in a copy at the same location
also code cleanup: clear_draggingview_list() avoids duplicated code
This commit is contained in:
parent
87ecc9b4ca
commit
69af0e6964
2 changed files with 28 additions and 26 deletions
|
|
@ -1604,7 +1604,19 @@ RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed_tracks*/, MusicSample last_position, int32_t const ev_state)
|
RegionMoveDrag::clear_draggingview_list ()
|
||||||
|
{
|
||||||
|
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end();) {
|
||||||
|
list<DraggingView>::const_iterator next = i;
|
||||||
|
++next;
|
||||||
|
delete i->view;
|
||||||
|
i = next;
|
||||||
|
}
|
||||||
|
_views.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_tracks, MusicSample last_position, int32_t const ev_state)
|
||||||
{
|
{
|
||||||
RegionSelection new_views;
|
RegionSelection new_views;
|
||||||
PlaylistSet modified_playlists;
|
PlaylistSet modified_playlists;
|
||||||
|
|
@ -1617,12 +1629,15 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
|
||||||
|
|
||||||
if (_brushing) {
|
if (_brushing) {
|
||||||
/* all changes were made during motion event handlers */
|
/* all changes were made during motion event handlers */
|
||||||
|
clear_draggingview_list();
|
||||||
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
|
_editor->commit_reversible_command ();
|
||||||
delete i->view;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_editor->commit_reversible_command ();
|
/*x_contrained on the same track: this will just make a duplicate region in the same place: abort the operation */
|
||||||
|
if (_x_constrained && !changed_tracks) {
|
||||||
|
clear_draggingview_list();
|
||||||
|
_editor->abort_reversible_command ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1630,7 +1645,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
|
||||||
PlaylistMapping playlist_mapping;
|
PlaylistMapping playlist_mapping;
|
||||||
|
|
||||||
/* insert the regions into their new playlists */
|
/* insert the regions into their new playlists */
|
||||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end();) {
|
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); i++) {
|
||||||
|
|
||||||
RouteTimeAxisView* dest_rtv = 0;
|
RouteTimeAxisView* dest_rtv = 0;
|
||||||
|
|
||||||
|
|
@ -1693,17 +1708,11 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
|
||||||
new_views.push_back (new_view);
|
new_views.push_back (new_view);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the copy of the view that was used for dragging. Need to play safe with the iterator
|
|
||||||
since deletion will automagically remove it from _views, thus invalidating i as an iterator.
|
|
||||||
*/
|
|
||||||
|
|
||||||
list<DraggingView>::const_iterator next = i;
|
|
||||||
++next;
|
|
||||||
delete i->view;
|
|
||||||
i = next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* in the past this was done in the main iterator loop; no need */
|
||||||
|
clear_draggingview_list();
|
||||||
|
|
||||||
/* If we've created new regions either by copying or moving
|
/* If we've created new regions either by copying or moving
|
||||||
to a new track, we want to replace the old selection with the new ones
|
to a new track, we want to replace the old selection with the new ones
|
||||||
*/
|
*/
|
||||||
|
|
@ -2052,16 +2061,7 @@ void
|
||||||
RegionMoveDrag::aborted (bool movement_occurred)
|
RegionMoveDrag::aborted (bool movement_occurred)
|
||||||
{
|
{
|
||||||
if (_copy) {
|
if (_copy) {
|
||||||
|
clear_draggingview_list();
|
||||||
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end();) {
|
|
||||||
list<DraggingView>::const_iterator next = i;
|
|
||||||
++next;
|
|
||||||
delete i->view;
|
|
||||||
i = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
_views.clear ();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
RegionMotionDrag::aborted (movement_occurred);
|
RegionMotionDrag::aborted (movement_occurred);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -434,6 +434,8 @@ public:
|
||||||
void finished (GdkEvent *, bool);
|
void finished (GdkEvent *, bool);
|
||||||
void aborted (bool);
|
void aborted (bool);
|
||||||
|
|
||||||
|
void clear_draggingview_list ();
|
||||||
|
|
||||||
bool regions_came_from_canvas () const {
|
bool regions_came_from_canvas () const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue