/* override state that may have been incorrectly inherited from the other region
*/
- _position = 0;
+ _position = other->_position;
_locked = false;
_whole_file = false;
_hidden = false;
_position_lock_style = other->_position_lock_style;
_first_edit = other->_first_edit;
- _start = 0; // It seems strange _start is not inherited here?
+ _start = other->_start;
+ _beat = other->_beat;
/* sync pos is relative to start of file. our start-in-file is now zero,
so set our sync position to whatever the the difference between
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
+ , _beat (0.0)
, _layer (other->_layer)
{
register_properties ();
/* override state that may have been incorrectly inherited from the other region
*/
- _position = 0;
+ _position = other->_position + offset;
_locked = false;
_whole_file = false;
_hidden = false;
set_master_sources (other->_master_sources);
_start = other->_start + offset;
+ _beat = _session.tempo_map().beat_at_frame (_position);
/* if the other region had a distinct sync point
set, then continue to use it as best we can.
}
- _last_length = _length;
set_length_internal (len);
_whole_file = false;
first_edit ();
void
Region::set_length_internal (framecnt_t len)
{
+ _last_length = _length;
_length = len;
}
/* do this even if the position is the same. this helps out
a GUI that has moved its representation already.
*/
- send_change (Properties::position);
+ PropertyChange p_and_l;
+
+ p_and_l.add (Properties::position);
+ /* Currently length change due to position change is only implemented
+ for MidiRegion (Region has no length in beats).
+ Notify a length change regardless (its more efficient for MidiRegions),
+ and when Region has a _length_beats we will need it here anyway).
+ */
+ if (position_lock_style() == MusicTime) {
+ p_and_l.add (Properties::length);
+ }
+
+ send_change (p_and_l);
}
if (_position != pos) {
_position = pos;
+ if (allow_bbt_recompute) {
+ recompute_position_from_lock_style ();
+ }
/* check that the new _position wouldn't make the current
length impossible - if so, change the length.
XXX is this the right thing to do?
*/
-
if (max_framepos - _length < _position) {
_last_length = _length;
_length = max_framepos - _position;
}
-
- if (allow_bbt_recompute) {
- recompute_position_from_lock_style ();
- }
}
}
what_changed.add (Properties::start);
}
+
/* Set position before length, otherwise for MIDI regions this bad thing happens:
* 1. we call set_length_internal; length in beats is computed using the region's current
* (soon-to-be old) position
return _position + (minlen - _start) - 1;
}
-