mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 12:46:32 +01:00
fix duplicating multiple selected regions - fixes #6202
This commit is contained in:
parent
7b4aa97145
commit
6a248b61f0
3 changed files with 12 additions and 2 deletions
|
|
@ -4792,6 +4792,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
|
||||||
|
|
||||||
framepos_t const start_frame = regions.start ();
|
framepos_t const start_frame = regions.start ();
|
||||||
framepos_t const end_frame = regions.end_frame ();
|
framepos_t const end_frame = regions.end_frame ();
|
||||||
|
framecnt_t const gap = end_frame - start_frame;
|
||||||
|
|
||||||
begin_reversible_command (Operations::duplicate_region);
|
begin_reversible_command (Operations::duplicate_region);
|
||||||
|
|
||||||
|
|
@ -4806,9 +4807,10 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
|
||||||
latest_regionviews.clear ();
|
latest_regionviews.clear ();
|
||||||
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
|
sigc::connection c = rtv->view()->RegionViewAdded.connect (sigc::mem_fun(*this, &Editor::collect_new_region_view));
|
||||||
|
|
||||||
|
framepos_t const position = end_frame + (r->first_frame() - start_frame);
|
||||||
playlist = (*i)->region()->playlist();
|
playlist = (*i)->region()->playlist();
|
||||||
playlist->clear_changes ();
|
playlist->clear_changes ();
|
||||||
playlist->duplicate (r, end_frame + (r->first_frame() - start_frame), times);
|
playlist->duplicate (r, position, gap, times);
|
||||||
_session->add_command(new StatefulDiffCommand (playlist));
|
_session->add_command(new StatefulDiffCommand (playlist));
|
||||||
|
|
||||||
c.disconnect ();
|
c.disconnect ();
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ public:
|
||||||
void shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue);
|
void shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue);
|
||||||
void partition (framepos_t start, framepos_t end, bool cut = false);
|
void partition (framepos_t start, framepos_t end, bool cut = false);
|
||||||
void duplicate (boost::shared_ptr<Region>, framepos_t position, float times);
|
void duplicate (boost::shared_ptr<Region>, framepos_t position, float times);
|
||||||
|
void duplicate (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, float times);
|
||||||
void nudge_after (framepos_t start, framecnt_t distance, bool forwards);
|
void nudge_after (framepos_t start, framecnt_t distance, bool forwards);
|
||||||
boost::shared_ptr<Region> combine (const RegionList&);
|
boost::shared_ptr<Region> combine (const RegionList&);
|
||||||
void uncombine (boost::shared_ptr<Region>);
|
void uncombine (boost::shared_ptr<Region>);
|
||||||
|
|
|
||||||
|
|
@ -1244,6 +1244,13 @@ Playlist::flush_notifications (bool from_undo)
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, float times)
|
Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, float times)
|
||||||
|
{
|
||||||
|
duplicate(region, position, region->length(), times);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @param gap from the beginning of the region to the next beginning */
|
||||||
|
void
|
||||||
|
Playlist::duplicate (boost::shared_ptr<Region> region, framepos_t position, framecnt_t gap, float times)
|
||||||
{
|
{
|
||||||
times = fabs (times);
|
times = fabs (times);
|
||||||
|
|
||||||
|
|
@ -1255,7 +1262,7 @@ Playlist::flush_notifications (bool from_undo)
|
||||||
boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
|
boost::shared_ptr<Region> copy = RegionFactory::create (region, true);
|
||||||
add_region_internal (copy, pos);
|
add_region_internal (copy, pos);
|
||||||
set_layer (copy, DBL_MAX);
|
set_layer (copy, DBL_MAX);
|
||||||
pos += region->length();
|
pos += gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (floor (times) != times) {
|
if (floor (times) != times) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue