summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-04-15 20:42:05 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-04-15 20:42:05 +0000
commitdc815ea8e84d28fc01a68225c2ece4399c4a9c7e (patch)
tree27954a7b74ea3df1ca87d0ece20ad15a6f46f6be /libs/ardour/region.cc
parentd2beb38ea9fb39dbfb8667784bd248b32d171cbf (diff)
forward-port from 2.X commits 5827-6000 including
git-svn-id: svn://localhost/ardour2/branches/3.0@6914 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc60
1 files changed, 45 insertions, 15 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 8625b17a8a..2589f94f81 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -764,12 +764,30 @@ Region::trim_start (framepos_t new_position, void */*src*/)
void
Region::trim_front (framepos_t new_position, void *src)
{
+ modify_front (new_position, false, src);
+}
+
+void
+Region::cut_front (nframes_t new_position, void *src)
+{
+ modify_front (new_position, true, src);
+}
+
+void
+Region::cut_end (nframes_t new_endpoint, void *src)
+{
+ modify_end (new_endpoint, true, src);
+}
+
+void
+Region::modify_front (nframes_t new_position, bool reset_fade, void *src)
+{
if (locked()) {
return;
}
- framepos_t end = last_frame();
- framepos_t source_zero;
+ nframes_t end = last_frame();
+ nframes_t source_zero;
if (_position > _start) {
source_zero = _position - _start;
@@ -778,46 +796,58 @@ Region::trim_front (framepos_t new_position, void *src)
}
if (new_position < end) { /* can't trim it zero or negative length */
-
- framecnt_t newlen;
+
+ nframes_t newlen;
/* can't trim it back passed where source position zero is located */
-
+
new_position = max (new_position, source_zero);
-
-
+
if (new_position > _position) {
newlen = _length - (new_position - _position);
} else {
newlen = _length + (_position - new_position);
}
-
+
trim_to_internal (new_position, newlen, src);
- if (!property_changes_suspended()) {
+ if (reset_fade) {
+ _right_of_split = true;
+ }
+
+ if (!property_changes_suspended()) {
recompute_at_start ();
}
}
}
-/** @param new_endpoint New region end point, such that, for example,
- * a region at 0 of length 10 has an endpoint of 9.
- */
-
void
-Region::trim_end (framepos_t new_endpoint, void */*src*/)
+Region::modify_end (nframes_t new_endpoint, bool reset_fade, void *src)
{
if (locked()) {
return;
}
if (new_endpoint > _position) {
- trim_to_internal (_position, new_endpoint - _position + 1, this);
+ trim_to_internal (_position, new_endpoint - _position +1, this);
+ if (reset_fade) {
+ _left_of_split = true;
+ }
if (!property_changes_suspended()) {
recompute_at_end ();
}
}
}
+/** @param new_endpoint New region end point, such that, for example,
+ * a region at 0 of length 10 has an endpoint of 9.
+ */
+
+void
+Region::trim_end (framepos_t new_endpoint, void* src)
+{
+ modify_end (new_endpoint, false, src);
+}
+
void
Region::trim_to (framepos_t position, framecnt_t length, void *src)
{