13
0

convert use of operator* for tim::line types with ::scale(ratio_t) (GUI edition)

This commit is contained in:
Paul Davis 2022-05-27 12:47:37 -06:00
parent cfe2ca9bf2
commit 399a5b3f25
8 changed files with 16 additions and 11 deletions

View File

@ -4250,7 +4250,7 @@ Editor::get_paste_offset (Temporal::timepos_t const & pos, unsigned paste_count,
}
/* calculate basic unsnapped multi-paste offset */
Temporal::timecnt_t offset = duration * paste_count;
Temporal::timecnt_t offset = duration.scale (paste_count);
/* snap offset so pos + offset is aligned to the grid */
Temporal::timepos_t snap_pos (pos + offset);

View File

@ -932,7 +932,7 @@ Editor::add_sources (vector<string> paths,
cerr << "for " << (*x)->name() << " source length appears to be " << len << endl;
if (len.is_zero()) {
if ((*x)->type() == DataType::AUDIO) {
len = timepos_t (_session->sample_rate ()) / 2;
len = timepos_t (_session->sample_rate () / 2);
} else {
len = timepos_t (Beats (1, 0));
}

View File

@ -876,7 +876,12 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, Temporal::timepos_t &
if (sync_dir >= 0 || (sync_dir < 0 && pending_region_position >= sync_offset)) {
timecnt_t const sd = snap_delta (event->button.state);
timepos_t sync_snap (pending_region_position + (sync_offset * sync_dir) + sd);
timepos_t sync_snap;
if (sync_dir > 0) {
sync_snap = pending_region_position + sync_offset + sd;
} else {
sync_snap = pending_region_position.earlier (sync_offset) + sd;
}
_editor->snap_to_with_modifier (sync_snap, event);
if (sync_offset.is_zero () && sd.is_zero ()) {
pending_region_position = sync_snap;
@ -3053,7 +3058,7 @@ TrimDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
setup_snap_delta (region_start);
/* These will get overridden for a point trim.*/
if (pf < (region_start + region_length/2)) {
if (pf < (region_start + region_length.scale (ratio_t (1, 2)))) {
/* closer to front */
_operation = StartTrim;
if (Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::trim_anchored_modifier ())) {
@ -6529,7 +6534,7 @@ AutomationRangeDrag::motion (GdkEvent*, bool first_move)
/* add guard points */
for (list<TimelineRange>::const_iterator i = _ranges.begin(); i != _ranges.end(); ++i) {
timepos_t const half = (i->start() + i->end()) / 2;
timepos_t const half = (i->start() + i->end()).scale (ratio_t (1, 2));
for (list<Line>::iterator j = _lines.begin(); j != _lines.end(); ++j) {
if (j->range.first > i->start() || j->range.second < i->start()) {

View File

@ -1542,7 +1542,7 @@ Editor::marker_menu_zoom_to_range ()
return;
}
timepos_t const extra = timepos_t (l->length() * Temporal::ratio_t (5, 100));
timepos_t const extra = timepos_t (l->length().scale (Temporal::ratio_t (5, 100)));
timepos_t a = l->start ();
if (a >= extra) {
a.shift_earlier (extra);

View File

@ -2643,7 +2643,7 @@ Editor::insert_source_list_selection (float times)
playlist->add_region ((RegionFactory::create (region, true)), get_preferred_edit_position(), times, _session->config.get_layered_record_mode()); //ToDo: insert_mode ?
if (should_ripple()) {
do_ripple (playlist, get_preferred_edit_position(), region->length() * times, boost::shared_ptr<Region>(), true);
do_ripple (playlist, get_preferred_edit_position(), region->length().scale (times), boost::shared_ptr<Region>(), true);
} else {
playlist->rdiff_and_add_command (_session);
}
@ -5241,7 +5241,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times)
}
for (set<boost::shared_ptr<Playlist> >::iterator p = playlists.begin(); p != playlists.end(); ++p) {
do_ripple ((*p), start_sample, span * times, &exclude, false);
do_ripple ((*p), start_sample, span.scale (times), &exclude, false);
}
}

View File

@ -169,7 +169,7 @@ Editor::time_fx (RegionList& regions, Temporal::ratio_t ratio, bool pitching)
}
const timecnt_t oldlen = regions.front()->length();
const timecnt_t newlen = regions.front()->length() * ratio;
const timecnt_t newlen = regions.front()->length().scale (ratio);
const timepos_t pos = regions.front()->position ();
current_timefx = new TimeFXDialog (*this, pitching, oldlen, newlen, pos);

View File

@ -1363,7 +1363,7 @@ RouteTimeAxisView::paste (timepos_t const & pos, const Selection& selection, Pas
if (_editor.should_ripple()) {
std::pair<timepos_t, timepos_t> extent = (*p)->get_extent_with_endspace();
timecnt_t amount = extent.first.distance (extent.second);
pl->ripple (ppos, amount * ctx.times, boost::shared_ptr<Region>());
pl->ripple (ppos, amount.scale (ctx.times), boost::shared_ptr<Region>());
}
pl->paste (*p, ppos, ctx.times);

View File

@ -301,7 +301,7 @@ TimeFXDialog::duration_adjustment_changed ()
PBD::Unwinder<bool> uw (ignore_clock_change, true);
duration_clock->set_duration (original_length * Temporal::ratio_t (1.0, (duration_adjustment.get_value() / 100.0)));
duration_clock->set_duration (original_length.scale (Temporal::ratio_t (1.0, (duration_adjustment.get_value() / 100.0))));
}
void