From 28d3dd69de2d99fabcc556f4c41aafdf3c1cb1cc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 1 Mar 2011 16:23:31 +0000 Subject: Update session range on trimming regions. git-svn-id: svn://localhost/ardour2/branches/3.0@9004 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/playlist.cc | 55 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'libs/ardour/playlist.cc') diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 8b839e3269..cb764e7f40 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -539,6 +539,51 @@ Playlist::notify_region_moved (boost::shared_ptr r) } +void +Playlist::notify_region_start_trimmed (boost::shared_ptr r) +{ + if (r->position() >= r->last_position()) { + /* trimmed shorter */ + return; + } + + Evoral::Range const extra (r->position(), r->last_position()); + + if (holding_state ()) { + + pending_region_extensions.push_back (extra); + + } else { + + list > r; + r.push_back (extra); + RegionsExtended (r); + + } +} + +void +Playlist::notify_region_end_trimmed (boost::shared_ptr r) +{ + if (r->length() < r->last_length()) { + /* trimmed shorter */ + } + + Evoral::Range const extra (r->position() + r->last_length(), r->position() + r->length()); + + if (holding_state ()) { + + pending_region_extensions.push_back (extra); + + } else { + + list > r; + r.push_back (extra); + RegionsExtended (r); + } +} + + void Playlist::notify_region_added (boost::shared_ptr r) { @@ -663,6 +708,10 @@ Playlist::flush_notifications (bool from_undo) if (!pending_range_moves.empty ()) { RangesMoved (pending_range_moves, from_undo); } + + if (!pending_region_extensions.empty ()) { + RegionsExtended (pending_region_extensions); + } clear_pending (); @@ -676,6 +725,7 @@ Playlist::clear_pending () pending_removes.clear (); pending_bounds.clear (); pending_range_moves.clear (); + pending_region_extensions.clear (); pending_contents_change = false; pending_length = false; } @@ -1628,9 +1678,12 @@ Playlist::region_changed (const PropertyChange& what_changed, boost::shared_ptr< if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) { notify_region_moved (region); + } else if (!what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) { + notify_region_end_trimmed (region); + } else if (what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) { + notify_region_start_trimmed (region); } - /* don't notify about layer changes, since we are the only object that can initiate them, and we notify in ::relayer() */ -- cgit v1.2.3