summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/movable.h15
-rw-r--r--libs/ardour/ardour/region.h6
-rw-r--r--libs/ardour/ardour/trimmable.h36
-rw-r--r--libs/ardour/region.cc28
4 files changed, 85 insertions, 0 deletions
diff --git a/libs/ardour/ardour/movable.h b/libs/ardour/ardour/movable.h
new file mode 100644
index 0000000000..26b6125888
--- /dev/null
+++ b/libs/ardour/ardour/movable.h
@@ -0,0 +1,15 @@
+#ifndef __libardour_movable_h__
+#define __libardour_movable_h__
+
+namespace ARDOUR {
+
+class Movable {
+ public:
+ Movable() {}
+
+ bool locked () const { return false; }
+};
+
+}
+
+#endif /* __libardour_movable_h__ */
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 0ae325d124..ef86dce4b2 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -31,8 +31,10 @@
#include "ardour/ardour.h"
#include "ardour/data_type.h"
#include "ardour/automatable.h"
+#include "ardour/movable.h"
#include "ardour/readable.h"
#include "ardour/session_object.h"
+#include "ardour/trimmable.h"
class XMLNode;
@@ -81,6 +83,8 @@ class Region
: public SessionObject
, public boost::enable_shared_from_this<Region>
, public Readable
+ , public Trimmable
+ , public Movable
{
public:
typedef std::vector<boost::shared_ptr<Source> > SourceList;
@@ -147,6 +151,8 @@ class Region
bool sync_marked() const { return _sync_marked; }
bool external() const { return _external; }
bool import() const { return _import; }
+
+ Trimmable::CanTrim can_trim() const;
PositionLockStyle position_lock_style() const { return _position_lock_style; }
void set_position_lock_style (PositionLockStyle ps);
diff --git a/libs/ardour/ardour/trimmable.h b/libs/ardour/ardour/trimmable.h
new file mode 100644
index 0000000000..e053a2deed
--- /dev/null
+++ b/libs/ardour/ardour/trimmable.h
@@ -0,0 +1,36 @@
+#ifndef __libardour_trimmable_h__
+#define __libardour_trimmable_h__
+
+namespace ARDOUR {
+
+class Trimmable {
+ public:
+ Trimmable() {}
+ virtual ~Trimmable() {}
+
+ enum CanTrim {
+ FrontTrimEarlier,
+ FrontTrimLater,
+ EndTrimEarlier,
+ EndTrimLater,
+ TopTrimUp,
+ TopTrimDown,
+ BottomTrimUp,
+ BottomTrimDown
+ } ;
+
+ virtual CanTrim can_trim() const {
+ return CanTrim (FrontTrimEarlier |
+ FrontTrimLater |
+ EndTrimEarlier |
+ EndTrimLater |
+ TopTrimUp |
+ TopTrimDown |
+ BottomTrimUp |
+ BottomTrimDown);
+ }
+};
+
+}
+
+#endif /* __libardour_trimmable_h__ */
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 7e78475eb3..6d4be37b6d 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1587,3 +1587,31 @@ Region::use_sources (SourceList const & s)
}
}
}
+
+Trimmable::CanTrim
+Region::can_trim () const
+{
+ CanTrim ct = CanTrim (0);
+
+ if (locked()) {
+ return ct;
+ }
+
+ /* if not locked, we can always move the front later, and the end earlier
+ */
+
+ ct = CanTrim (ct | FrontTrimLater | EndTrimEarlier);
+
+ if (start() != 0) {
+ ct = CanTrim (ct | FrontTrimEarlier);
+ }
+
+ if (!_sources.empty()) {
+ if (last_frame() < _sources.front()->length (0)) {
+ ct = CanTrim (ct | EndTrimLater);
+ }
+ }
+
+ return ct;
+}
+