timeline type changes for new ripple code and post-conflict-resolution fixups

This commit is contained in:
Paul Davis 2021-07-16 14:12:00 -06:00
parent d772ea3fdf
commit b6f290add2
12 changed files with 47 additions and 47 deletions

View file

@ -275,7 +275,7 @@ public:
bool get_selection_extents (Temporal::timepos_t &start, Temporal::timepos_t &end) const; // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes bool get_selection_extents (Temporal::timepos_t &start, Temporal::timepos_t &end) const; // the time extents of the current selection, whether Range, Region(s), Control Points, or Notes
Selection& get_cut_buffer() const { return *cut_buffer; } Selection& get_cut_buffer() const { return *cut_buffer; }
void get_regionviews_at_or_after (ARDOUR::samplepos_t, RegionSelection&); void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&);
void set_selection (std::list<Selectable*>, Selection::Operation); void set_selection (std::list<Selectable*>, Selection::Operation);
void set_selected_midi_region_view (MidiRegionView&); void set_selected_midi_region_view (MidiRegionView&);
@ -595,11 +595,11 @@ public:
void edit_meter_section (Temporal::MeterPoint&); void edit_meter_section (Temporal::MeterPoint&);
bool should_ripple () const; bool should_ripple () const;
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, samplepos_t, samplecnt_t, ARDOUR::RegionList* exclude, bool add_to_command); void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, ARDOUR::RegionList* exclude, bool add_to_command);
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, samplepos_t, samplecnt_t, boost::shared_ptr<ARDOUR::Region> exclude, bool add_to_command); void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, boost::shared_ptr<ARDOUR::Region> exclude, bool add_to_command);
void ripple_marks (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t at, samplecnt_t distance); void ripple_marks (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t at, Temporal::timecnt_t const & distance);
void get_markers_to_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t pos, std::vector<ArdourMarker*>& markers); void get_markers_to_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t const & pos, std::vector<ArdourMarker*>& markers);
samplepos_t effective_ripple_mark_start (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t pos); Temporal::timepos_t effective_ripple_mark_start (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t pos);
void add_region_marker (); void add_region_marker ();
void clear_region_markers (); void clear_region_markers ();
@ -2416,6 +2416,7 @@ private:
friend class RegionCutDrag; friend class RegionCutDrag;
friend class RegionDrag; friend class RegionDrag;
friend class RegionMoveDrag; friend class RegionMoveDrag;
friend class RegionRippleDrag;
friend class TrimDrag; friend class TrimDrag;
friend class BBTRulerDrag; friend class BBTRulerDrag;
friend class MeterMarkerDrag; friend class MeterMarkerDrag;

View file

@ -877,8 +877,8 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, Temporal::timepos_t &
pending_region_position = _last_position; pending_region_position = _last_position;
} }
if (pending_region_position->sample <= _earliest_time_limit) { if (!_earliest_time_limit.zero() && pending_region_position <= _earliest_time_limit) {
pending_region_position->sample = _earliest_time_limit; pending_region_position = _earliest_time_limit;
return 0.0; return 0.0;
} }
@ -1708,7 +1708,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
PlaylistSet modified_playlists; PlaylistSet modified_playlists;
RouteTimeAxisView* new_time_axis_view = 0; RouteTimeAxisView* new_time_axis_view = 0;
timecnt_t const drag_delta = _last_position.distance (_primary->region()->nt_position()); timecnt_t const drag_delta = _last_position.distance (_primary->region()->position());
RegionList ripple_exclude; RegionList ripple_exclude;
/*x_contrained on the same track: this will just make a duplicate region in the same place: abort the operation */ /*x_contrained on the same track: this will just make a duplicate region in the same place: abort the operation */
@ -1722,8 +1722,8 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
PlaylistMapping playlist_mapping; PlaylistMapping playlist_mapping;
/* determine boundaries of dragged regions, across all playlists */ /* determine boundaries of dragged regions, across all playlists */
samplepos_t extent_min = max_samplepos; timepos_t extent_min = timepos_t::max(_primary->region()->position().time_domain());
samplepos_t extent_max = 0; timepos_t extent_max;
/* insert the regions into their (potentially) new (or existing) playlists */ /* insert the regions into their (potentially) new (or existing) playlists */
for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) { for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ++i) {
@ -1744,12 +1744,12 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
/* compute full extent of regions that we're going to insert */ /* compute full extent of regions that we're going to insert */
if (where.sample < extent_min) { if (where < extent_min) {
extent_min = where.sample; extent_min = where;
} }
if (where.sample + i->view->region()->length() > extent_max) { if (where + i->view->region()->length() > extent_max) {
extent_max = where.sample + i->view->region()->length(); extent_max = where + i->view->region()->length();
} }
if (i->time_axis_view < 0 || i->time_axis_view >= (int)_time_axis_views.size()) { if (i->time_axis_view < 0 || i->time_axis_view >= (int)_time_axis_views.size()) {
@ -1802,7 +1802,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
for (PlaylistSet::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) { for (PlaylistSet::iterator p = modified_playlists.begin(); p != modified_playlists.end(); ++p) {
if (_editor->should_ripple()) { if (_editor->should_ripple()) {
(*p)->ripple (extent_min, extent_max - extent_min, &ripple_exclude); (*p)->ripple (extent_min, extent_min.distance (extent_max), &ripple_exclude);
} }
(*p)->rdiff_and_add_command (_editor->session()); (*p)->rdiff_and_add_command (_editor->session());
} }
@ -1810,7 +1810,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
/* Ripple marks & ranges if appropriate */ /* Ripple marks & ranges if appropriate */
if (Config->get_edit_mode() == RippleAll) { if (Config->get_edit_mode() == RippleAll) {
_editor->ripple_marks (_primary->region()->playlist(), extent_min, extent_max - extent_min); _editor->ripple_marks (_primary->region()->playlist(), extent_min, extent_min.distance (extent_max));
} }
/* If we've created new regions either by copying or moving /* If we've created new regions either by copying or moving
@ -1838,7 +1838,7 @@ RegionMoveDrag::finished_no_copy (
set<RouteTimeAxisView*> views_to_update; set<RouteTimeAxisView*> views_to_update;
RouteTimeAxisView* new_time_axis_view = 0; RouteTimeAxisView* new_time_axis_view = 0;
timecnt_t const drag_delta = last_position.distance (_primary->region()->nt_position()); timecnt_t const drag_delta = last_position.distance (_primary->region()->position());
RegionList ripple_exclude; RegionList ripple_exclude;
typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping; typedef map<boost::shared_ptr<Playlist>, RouteTimeAxisView*> PlaylistMapping;
@ -2236,7 +2236,7 @@ RegionInsertDrag::finished (GdkEvent * event, bool)
playlist->add_region (_primary->region (), _last_position, 1.0, false); playlist->add_region (_primary->region (), _last_position, 1.0, false);
if (_editor->should_ripple()) { if (_editor->should_ripple()) {
playlist->ripple (_last_position, _primary->region()->nt_length(), _primary->region()); playlist->ripple (_last_position, _primary->region()->length(), _primary->region());
} else { } else {
playlist->rdiff_and_add_command (_editor->session()); playlist->rdiff_and_add_command (_editor->session());
} }
@ -2286,8 +2286,8 @@ RegionRippleDrag::add_all_after_to_views(TimeAxisView *tav, timepos_t const & wh
(*i)->drag_start(); (*i)->drag_start();
ArdourCanvas::Item* rvg = (*i)->get_canvas_group(); ArdourCanvas::Item* rvg = (*i)->get_canvas_group();
Duple rv_canvas_offset = rvg->item_to_canvas (Duple (0,0)); Duple rv_canvas_offset = rvg->item_to_canvas (Duple (0,0));
Duple dmg_canvas_offset = _editor->_drag_motion_group->canvas_origin (); Duple dmg_canvas_offset = _editor->get_drag_motion_group()->canvas_origin ();
rvg->reparent (_editor->_drag_motion_group); rvg->reparent (_editor->get_drag_motion_group());
// we only need to move in the y direction // we only need to move in the y direction
Duple fudge = rv_canvas_offset - dmg_canvas_offset; Duple fudge = rv_canvas_offset - dmg_canvas_offset;
@ -2309,7 +2309,7 @@ RegionRippleDrag::remove_unselected_from_views(timecnt_t const & amount, bool mo
// we added all the regions after the selection // we added all the regions after the selection
std::list<DraggingView>::iterator to_erase = i++; std::list<DraggingView>::iterator to_erase = i++;
if (!_editor->selection->regions.contains (to_erase->view)) { if (!_editor->get_selection().regions.contains (to_erase->view)) {
// restore the non-selected regions to their original playlist & positions, // restore the non-selected regions to their original playlist & positions,
// and then ripple them back by the length of the regions that were dragged away // and then ripple them back by the length of the regions that were dragged away
// do the same things as RegionMotionDrag::aborted // do the same things as RegionMotionDrag::aborted
@ -2359,7 +2359,7 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView
{ {
DEBUG_TRACE (DEBUG::Drags, "New RegionRippleDrag\n"); DEBUG_TRACE (DEBUG::Drags, "New RegionRippleDrag\n");
// compute length of selection // compute length of selection
RegionSelection selected_regions = _editor->selection->regions; RegionSelection selected_regions = _editor->get_selection().regions;
selection_length = selected_regions.start_time().distance (selected_regions.end_time()); selection_length = selected_regions.start_time().distance (selected_regions.end_time());
// Rippling accross tracks disabled. Rippling on all tracks is the way to go in the future. // Rippling accross tracks disabled. Rippling on all tracks is the way to go in the future.
@ -2468,7 +2468,7 @@ RegionRippleDrag::motion (GdkEvent* event, bool first_move)
tv->playlist()->ripple (where, amount+adjust, exclude); tv->playlist()->ripple (where, amount+adjust, exclude);
// add regions after point where drag entered this track to subsequent ripples // add regions after point where drag entered this track to subsequent ripples
add_all_after_to_views (tv, where, _editor->selection->regions, true); add_all_after_to_views (tv, where, _editor->get_selection().regions, true);
} else { } else {
// motion on same track // motion on same track

View file

@ -302,7 +302,7 @@ protected:
bool _x_constrained; ///< true if x motion is constrained, otherwise false bool _x_constrained; ///< true if x motion is constrained, otherwise false
bool _y_constrained; ///< true if y motion is constrained, otherwise false bool _y_constrained; ///< true if y motion is constrained, otherwise false
bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false bool _was_rolling; ///< true if the session was rolling before the drag started, otherwise false
ARDOUR::samplepos_t _earliest_time_limit; ///< time we cannot drag before (defaults to 0, indicating no such limit) ARDOUR::timepos_t _earliest_time_limit; ///< time we cannot drag before (defaults to 0, indicating no such limit)
private: private:
bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group bool _trackview_only; ///< true if pointer y value should always be relative to the top of the trackview group

View file

@ -471,17 +471,16 @@ Editor::LocationMarkers::~LocationMarkers ()
} }
void void
Editor::get_markers_to_ripple (boost::shared_ptr<Playlist> target_playlist, samplepos_t pos, std::vector<ArdourMarker*>& markers) Editor::get_markers_to_ripple (boost::shared_ptr<Playlist> target_playlist, timepos_t const & pos, std::vector<ArdourMarker*>& markers)
{ {
const timepos_t ripple_start = effective_ripple_mark_start (target_playlist, pos);
pos = effective_ripple_mark_start (target_playlist, pos);
for (LocationMarkerMap::const_iterator i = location_markers.begin(); i != location_markers.end(); ++i) { for (LocationMarkerMap::const_iterator i = location_markers.begin(); i != location_markers.end(); ++i) {
if (i->first->start() >= pos) { if (i->first->start() >= ripple_start) {
cerr << "Add markers for " << i->first->name() << endl; cerr << "Add markers for " << i->first->name() << endl;
markers.push_back (i->second->start); markers.push_back (i->second->start);
} }
if (i->first->end() >= pos && i->second->end) { if (i->first->end() >= ripple_start && i->second->end) {
markers.push_back (i->second->end); markers.push_back (i->second->end);
} }
} }

View file

@ -2253,7 +2253,7 @@ Editor::add_location_from_selection ()
void void
Editor::add_location_mark (timepos_t const & where) Editor::add_location_mark (timepos_t const & where)
{ {
if (_session->locations()->mark_at (where, 1)) { if (_session->locations()->mark_at (where, timecnt_t (1))) {
return; return;
} }
@ -4822,7 +4822,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
case Cut: case Cut:
_xx = RegionFactory::create (r, false); _xx = RegionFactory::create (r, false);
npl->add_region (_xx, r->position() - first_position); npl->add_region (_xx, timepos_t (first_position.distance (r->position())));
pl->remove_region (r); pl->remove_region (r);
if (should_ripple()) { if (should_ripple()) {
do_ripple (pl, r->position(), -r->length(), boost::shared_ptr<Region>(), false); do_ripple (pl, r->position(), -r->length(), boost::shared_ptr<Region>(), false);
@ -9216,7 +9216,7 @@ Editor::should_ripple () const
} }
void void
Editor::do_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t at, samplecnt_t distance, boost::shared_ptr<ARDOUR::Region> exclude, bool add_to_command) Editor::do_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, boost::shared_ptr<ARDOUR::Region> exclude, bool add_to_command)
{ {
RegionList el; RegionList el;
if (exclude) { if (exclude) {
@ -9226,7 +9226,7 @@ Editor::do_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepo
} }
void void
Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, samplepos_t at, samplecnt_t distance, RegionList* exclude, bool add_to_command) Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, timepos_t const & at, timecnt_t const & distance, RegionList* exclude, bool add_to_command)
{ {
typedef std::set<boost::shared_ptr<Playlist> > UniquePlaylists; typedef std::set<boost::shared_ptr<Playlist> > UniquePlaylists;
UniquePlaylists playlists; UniquePlaylists playlists;
@ -9301,8 +9301,8 @@ Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, samplepos_t at,
ripple_marks (target_playlist, at, distance); ripple_marks (target_playlist, at, distance);
} }
samplepos_t timepos_t
Editor::effective_ripple_mark_start (boost::shared_ptr<Playlist> target_playlist, samplepos_t pos) Editor::effective_ripple_mark_start (boost::shared_ptr<Playlist> target_playlist, timepos_t pos)
{ {
/* in the target playlist, find the region before the target /* in the target playlist, find the region before the target
* (implicitly given by @param at. Allow all markers that occur between * (implicitly given by @param at. Allow all markers that occur between
@ -9311,24 +9311,24 @@ Editor::effective_ripple_mark_start (boost::shared_ptr<Playlist> target_playlist
*/ */
boost::shared_ptr<RegionList> rl = target_playlist->region_list(); boost::shared_ptr<RegionList> rl = target_playlist->region_list();
samplepos_t last_region_end_before_at = 0; timepos_t last_region_end_before_at (pos.time_domain());
for (RegionList::const_iterator r = rl->begin(); r != rl->end(); ++r) { for (RegionList::const_iterator r = rl->begin(); r != rl->end(); ++r) {
samplepos_t region_end = (*r)->position() + (*r)->length(); timepos_t region_end = (*r)->end();
if (region_end > last_region_end_before_at && region_end < pos) { if (region_end > last_region_end_before_at && region_end < pos) {
last_region_end_before_at = region_end; last_region_end_before_at = region_end;
} }
} }
if (last_region_end_before_at < pos) { if (last_region_end_before_at < pos) {
pos = last_region_end_before_at + 1; pos = last_region_end_before_at.increment();
} }
return pos; return pos;
} }
void void
Editor::ripple_marks (boost::shared_ptr<Playlist> target_playlist, samplepos_t at, samplecnt_t distance) Editor::ripple_marks (boost::shared_ptr<Playlist> target_playlist, timepos_t at, timecnt_t const & distance)
{ {
at = effective_ripple_mark_start (target_playlist, at); at = effective_ripple_mark_start (target_playlist, at);

View file

@ -2261,7 +2261,7 @@ Editor::select_all_selectables_between (bool within)
} }
void void
Editor::get_regionviews_at_or_after (samplepos_t pos, RegionSelection& regions) Editor::get_regionviews_at_or_after (timepos_t const & pos, RegionSelection& regions)
{ {
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) { for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
(*iter)->get_regionviews_at_or_after (pos, regions); (*iter)->get_regionviews_at_or_after (pos, regions);

View file

@ -507,7 +507,7 @@ MidiStreamView::setup_rec_box ()
*/ */
region->set_start (timepos_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 ()); region->set_position (timepos_t (_trackview.track()->current_capture_start ()));
RegionView* rv = add_region_view_internal (region, false, true); RegionView* rv = add_region_view_internal (region, false, true);
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv); MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);

View file

@ -1176,7 +1176,7 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>&
} }
void void
RouteTimeAxisView::get_regionviews_at_or_after (samplepos_t pos, RegionSelection& regions) RouteTimeAxisView::get_regionviews_at_or_after (timepos_t const & pos, RegionSelection& regions)
{ {
if (!_view) { if (!_view) {
return; return;

View file

@ -102,7 +102,7 @@ public:
void set_selected_regionviews (RegionSelection&); void set_selected_regionviews (RegionSelection&);
void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within = false); void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable*>&); void get_inverted_selectables (Selection&, std::list<Selectable*>&);
void get_regionviews_at_or_after (ARDOUR::samplepos_t, RegionSelection&); void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&);
void set_layer_display (LayerDisplay d); void set_layer_display (LayerDisplay d);
void toggle_layer_display (); void toggle_layer_display ();
LayerDisplay layer_display () const; LayerDisplay layer_display () const;

View file

@ -602,7 +602,7 @@ StreamView::get_inverted_selectables (Selection& sel, list<Selectable*>& results
} }
void void
StreamView::get_regionviews_at_or_after (samplepos_t pos, RegionSelection& regions) StreamView::get_regionviews_at_or_after (timepos_t const & pos, RegionSelection& regions)
{ {
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) { for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
if ((*i)->region()->position() >= pos) { if ((*i)->region()->position() >= pos) {

View file

@ -106,7 +106,7 @@ public:
void set_selected_regionviews (RegionSelection&); void set_selected_regionviews (RegionSelection&);
void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable* >&, bool within = false); void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable* >&, bool within = false);
void get_inverted_selectables (Selection&, std::list<Selectable* >& results); void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
void get_regionviews_at_or_after (ARDOUR::samplepos_t, RegionSelection&); void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&);
virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {} virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}

View file

@ -211,7 +211,7 @@ public:
virtual void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable*>&, bool within = false); virtual void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable*>&, bool within = false);
virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results); virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
virtual void get_regionviews_at_or_after (ARDOUR::samplepos_t, RegionSelection&) {} virtual void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&) {}
void add_ghost (RegionView*); void add_ghost (RegionView*);
void remove_ghost (RegionView*); void remove_ghost (RegionView*);