- (*i)->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
- }
+ (*i)->DropReferences.connect_same_thread (*this, boost::bind (&Region::source_deleted, this, boost::weak_ptr<Source>(*i)));
+ }
+ }
+}
+
+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 || can_trim_start_before_source_start ()) {
+ ct = CanTrim (ct | FrontTrimEarlier);
+ }
+
+ if (!_sources.empty()) {
+ if ((start() + length()) < _sources.front()->length (0)) {
+ ct = CanTrim (ct | EndTrimLater);
+ }
+ }
+
+ return ct;
+}
+
+uint32_t
+Region::max_source_level () const
+{
+ uint32_t lvl = 0;
+
+ for (SourceList::const_iterator i = _sources.begin(); i != _sources.end(); ++i) {
+ lvl = max (lvl, (*i)->level());
+ }
+
+ return lvl;
+}
+
+bool
+Region::is_compound () const
+{
+ return max_source_level() > 0;
+}
+
+void
+Region::post_set (const PropertyChange& pc)
+{
+ if (pc.contains (Properties::position)) {
+ recompute_position_from_lock_style ();