Compare commits

...

3 Commits

Author SHA1 Message Date
04131077b3 NOOP: remove newline 2022-10-26 22:26:29 -06:00
15b92334dc remove dangerous and unused RegionView::source_relative_distance() method 2022-10-26 22:25:51 -06:00
a6b63b1cca automation region paste: snap at paste, not at cut
This fixes various issues with this operation, mostly because it was really the
wrong concept to begin with.
2022-10-26 22:23:14 -06:00
4 changed files with 10 additions and 23 deletions

View File

@ -253,13 +253,19 @@ AutomationRegionView::paste (timepos_t const & pos
/* add multi-paste offset if applicable */
p += view->editor ().get_paste_offset (pos, paste_count > 0 ? 1 : 0, len);
/* convert sample-position to model's unit and position */
timepos_t model_pos = timepos_t (source_relative_distance (timecnt_t (p, timepos_t()), slist->time_domain()));
timepos_t model_pos = pos;
/* potentially snap */
view->editor().snap_to (model_pos, Temporal::RoundNearest);
/* convert timeline position to model's (source-relative) position */
model_pos = timepos_t (_region->source_position().distance (model_pos));
XMLNode& before = my_list->get_state();
my_list->paste (*slist, model_pos);
view->session()->add_command(
new MementoCommand<ARDOUR::AutomationList>(_line->memento_command_binder(), &before, &my_list->get_state()));
view->session()->add_command(new MementoCommand<ARDOUR::AutomationList>(_line->memento_command_binder(), &before, &my_list->get_state()));
return true;
}

View File

@ -4584,18 +4584,6 @@ Editor::cut_copy_points (Editing::CutCopyOp op, timepos_t const & earliest_time)
earliest = std::min (earliest, (*ctrl_evt)->when);
}
/* Snap start time backwards, so copy/paste is snap aligned. */
if (earliest != timepos_t::max (earliest.time_domain())) {
if (earliest.time_domain() == Temporal::BeatTime) {
/* always just round down to beat */
earliest = timepos_t (earliest.beats().round_down_to_beat());
} else {
/* do actual snap */
snap_to (earliest, Temporal::RoundDownMaybe);
}
}
for (Lists::iterator i = lists.begin(); i != lists.end(); ++i) {
/* Correct this copy list so that it is relative to the earliest
start time, so relative ordering between points is preserved

View File

@ -1187,12 +1187,6 @@ RegionView::region_relative_distance (timecnt_t const & duration, Temporal::Time
return Temporal::TempoMap::use()->convert_duration (duration, _region->position(), domain);
}
timecnt_t
RegionView::source_relative_distance (timecnt_t const & duration, Temporal::TimeDomain domain)
{
return Temporal::TempoMap::use()->convert_duration (duration, _region->source_position(), domain);
}
void
RegionView::update_visibility ()
{

View File

@ -196,7 +196,6 @@ protected:
void maybe_raise_cue_markers ();
Temporal::timecnt_t region_relative_distance (Temporal::timecnt_t const &, Temporal::TimeDomain desired_time_domain);
Temporal::timecnt_t source_relative_distance (Temporal::timecnt_t const &, Temporal::TimeDomain desired_time_domain);
boost::shared_ptr<ARDOUR::Region> _region;