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
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_selected_midi_region_view (MidiRegionView&);
@ -595,11 +595,11 @@ public:
void edit_meter_section (Temporal::MeterPoint&);
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>, samplepos_t, samplecnt_t, 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 get_markers_to_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t pos, std::vector<ArdourMarker*>& markers);
samplepos_t effective_ripple_mark_start (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepos_t pos);
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>, 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, Temporal::timepos_t at, Temporal::timecnt_t const & distance);
void get_markers_to_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t const & pos, std::vector<ArdourMarker*>& markers);
Temporal::timepos_t effective_ripple_mark_start (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t pos);
void add_region_marker ();
void clear_region_markers ();
@ -2416,6 +2416,7 @@ private:
friend class RegionCutDrag;
friend class RegionDrag;
friend class RegionMoveDrag;
friend class RegionRippleDrag;
friend class TrimDrag;
friend class BBTRulerDrag;
friend class MeterMarkerDrag;

View File

@ -877,8 +877,8 @@ RegionMotionDrag::compute_x_delta (GdkEvent const * event, Temporal::timepos_t &
pending_region_position = _last_position;
}
if (pending_region_position->sample <= _earliest_time_limit) {
pending_region_position->sample = _earliest_time_limit;
if (!_earliest_time_limit.zero() && pending_region_position <= _earliest_time_limit) {
pending_region_position = _earliest_time_limit;
return 0.0;
}
@ -1708,7 +1708,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
PlaylistSet modified_playlists;
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;
/*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;
/* determine boundaries of dragged regions, across all playlists */
samplepos_t extent_min = max_samplepos;
samplepos_t extent_max = 0;
timepos_t extent_min = timepos_t::max(_primary->region()->position().time_domain());
timepos_t extent_max;
/* insert the regions into their (potentially) new (or existing) playlists */
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 */
if (where.sample < extent_min) {
extent_min = where.sample;
if (where < extent_min) {
extent_min = where;
}
if (where.sample + i->view->region()->length() > extent_max) {
extent_max = where.sample + i->view->region()->length();
if (where + i->view->region()->length() > extent_max) {
extent_max = where + i->view->region()->length();
}
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) {
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());
}
@ -1810,7 +1810,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
/* Ripple marks & ranges if appropriate */
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
@ -1838,7 +1838,7 @@ RegionMoveDrag::finished_no_copy (
set<RouteTimeAxisView*> views_to_update;
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;
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);
if (_editor->should_ripple()) {
playlist->ripple (_last_position, _primary->region()->nt_length(), _primary->region());
playlist->ripple (_last_position, _primary->region()->length(), _primary->region());
} else {
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();
ArdourCanvas::Item* rvg = (*i)->get_canvas_group();
Duple rv_canvas_offset = rvg->item_to_canvas (Duple (0,0));
Duple dmg_canvas_offset = _editor->_drag_motion_group->canvas_origin ();
rvg->reparent (_editor->_drag_motion_group);
Duple dmg_canvas_offset = _editor->get_drag_motion_group()->canvas_origin ();
rvg->reparent (_editor->get_drag_motion_group());
// we only need to move in the y direction
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
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,
// and then ripple them back by the length of the regions that were dragged away
// 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");
// 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());
// 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);
// 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 {
// motion on same track

View File

@ -302,7 +302,7 @@ protected:
bool _x_constrained; ///< true if x 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
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:
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
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)
{
pos = effective_ripple_mark_start (target_playlist, pos);
const timepos_t ripple_start = effective_ripple_mark_start (target_playlist, pos);
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;
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);
}
}

View File

@ -2253,7 +2253,7 @@ Editor::add_location_from_selection ()
void
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;
}
@ -4822,7 +4822,7 @@ Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
case Cut:
_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);
if (should_ripple()) {
do_ripple (pl, r->position(), -r->length(), boost::shared_ptr<Region>(), false);
@ -9216,7 +9216,7 @@ Editor::should_ripple () const
}
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;
if (exclude) {
@ -9226,7 +9226,7 @@ Editor::do_ripple (boost::shared_ptr<ARDOUR::Playlist> target_playlist, samplepo
}
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;
UniquePlaylists playlists;
@ -9301,8 +9301,8 @@ Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, samplepos_t at,
ripple_marks (target_playlist, at, distance);
}
samplepos_t
Editor::effective_ripple_mark_start (boost::shared_ptr<Playlist> target_playlist, samplepos_t pos)
timepos_t
Editor::effective_ripple_mark_start (boost::shared_ptr<Playlist> target_playlist, timepos_t pos)
{
/* in the target playlist, find the region before the target
* (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();
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) {
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) {
last_region_end_before_at = region_end;
}
}
if (last_region_end_before_at < pos) {
pos = last_region_end_before_at + 1;
pos = last_region_end_before_at.increment();
}
return pos;
}
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);

View File

@ -2261,7 +2261,7 @@ Editor::select_all_selectables_between (bool within)
}
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) {
(*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_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);
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);

View File

@ -1176,7 +1176,7 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>&
}
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) {
return;

View File

@ -102,7 +102,7 @@ public:
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_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 toggle_layer_display ();
LayerDisplay layer_display () const;

View File

@ -602,7 +602,7 @@ StreamView::get_inverted_selectables (Selection& sel, list<Selectable*>& results
}
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) {
if ((*i)->region()->position() >= pos) {

View File

@ -106,7 +106,7 @@ public:
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_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>) {}

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_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 remove_ghost (RegionView*);