diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index f7b0066bd5..29021f517f 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1397,7 +1397,7 @@ AutomationLine::session_position (AutomationList::const_iterator p) const } void -AutomationLine::set_offset (timecnt_t const & off) +AutomationLine::set_offset (timepos_t const & off) { if (_offset == off) { return; diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index cf69861077..ced055aee9 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -157,8 +157,8 @@ public: return _maximum_time; } - void set_offset (Temporal::timecnt_t const &); - Temporal::timecnt_t offset () { return _offset; } + void set_offset (Temporal::timepos_t const &); + Temporal::timepos_t offset () { return _offset; } void set_width (Temporal::timecnt_t const &); samplepos_t session_sample_position (ARDOUR::AutomationList::const_iterator) const; @@ -224,7 +224,7 @@ private: /** offset from the start of the automation list to the start of the line, so that * a +ve offset means that the 0 on the line is at _offset in the list */ - Temporal::timecnt_t _offset; + Temporal::timepos_t _offset; bool is_stepped() const; void update_visibility (); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 0ccb69d726..3b8b99d494 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -6344,16 +6344,25 @@ NoteDrag::total_dx (GdkEvent * event) const /* primary note time in quarter notes */ timepos_t const n_qn = _region->region()->source_beats_to_absolute_time (_primary->note()->time()); - /* new session relative time of the primary note (will be in beats) */ + /* new session relative time of the primary note (will be in beats) + + * start from the note position, add the distance the drag has covered, + * and then the required (if any) snap distance + */ timepos_t snap = n_qn + dx + snap_delta (event->button.state); /* possibly snap and return corresponding delta (will be in beats) */ _editor->snap_to_with_modifier (snap, event); - timecnt_t ret = timecnt_t (snap.earlier (n_qn).earlier (snap_delta (event->button.state))); + /* we are trying to return the delta on the x-axis (almost certain in + * beats), So now, having snapped etc., subtract the original note + * position and the snap delta, and we'll know the current dx. + */ + + timecnt_t ret (snap.earlier (n_qn).earlier (snap_delta (event->button.state)), n_qn); /* prevent the earliest note being dragged earlier than the region's start position */ - if (ret + _earliest < _region->region()->start()) { + if (_earliest + ret < _region->region()->start()) { ret -= (ret + _earliest) - _region->region()->start(); } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 473b2b366c..c2188bdf97 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -7286,7 +7286,7 @@ Editor::split_region_at_points (boost::shared_ptr r, AnalysisFeatureList /* file start = original start + how far we from the initial position ? */ - timecnt_t file_start = r->start() + pos; + timepos_t file_start = r->start() + pos; /* length = next position - current position */ @@ -8765,7 +8765,7 @@ Editor::launch_playlist_selector () vector Editor::filter_to_unique_midi_region_views (RegionSelection const & ms) const { - typedef std::pair,timecnt_t> MapEntry; + typedef std::pair,timepos_t> MapEntry; std::set single_region_set; vector views; diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index 9940312de5..a0159c7828 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -505,8 +505,8 @@ MidiStreamView::setup_rec_box () /* MIDI regions should likely not be positioned using audio time, but this is * just a rec-region, so we don't really care */ - region->set_start (timecnt_t (_trackview.track()->current_capture_start() - - _trackview.track()->get_capture_start_sample (0))); + + region->set_start (timepos_t (_trackview.track()->current_capture_start() - _trackview.track()->get_capture_start_sample (0))); region->set_position (_trackview.track()->current_capture_start ()); RegionView* rv = add_region_view_internal (region, false, true);