13
0

get rid of Region _last_position member, since the _last_length member has its own position

This commit is contained in:
Paul Davis 2021-02-25 08:57:40 -07:00
parent c0343a5a1a
commit 3bf6e013ee
2 changed files with 4 additions and 13 deletions

View File

@ -141,7 +141,7 @@ public:
/* these two are valid ONLY during a StateChanged signal handler */
timepos_t last_position () const { return _last_position; }
timepos_t last_position () const { return _last_length.position(); }
timecnt_t last_length () const { return _last_length; }
samplecnt_t ancestral_start_sample () const { return _ancestral_start.val().samples(); }
@ -174,7 +174,7 @@ public:
samplepos_t latest_possible_sample () const;
Temporal::TimeRange last_range () const {
return Temporal::TimeRange (_last_position, _last_position + _last_length);
return Temporal::TimeRange (last_position(), last_position() + _last_length);
}
Temporal::TimeRange range_samples () const {
@ -522,7 +522,6 @@ private:
PBD::Property<bool> _contents; // type is irrelevant
timecnt_t _last_length;
timepos_t _last_position;
mutable RegionEditState _first_edit;
layer_t _layer;

View File

@ -246,7 +246,6 @@ Region::Region (Session& s, timecnt_t const & start, timecnt_t const & length, c
, _type(type)
, REGION_DEFAULT_STATE(start,length)
, _last_length (length)
, _last_position (_type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))
, _first_edit (EditChangesNothing)
, _layer (0)
, _changemap (0)
@ -263,7 +262,6 @@ Region::Region (const SourceList& srcs)
, REGION_DEFAULT_STATE(_type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0),
_type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0))
, _last_length (_type == DataType::MIDI ? timecnt_t (Temporal::Beats()) : timecnt_t::from_superclock (0))
, _last_position (_type == DataType::MIDI ? timepos_t (Temporal::Beats()) : timepos_t::from_superclock (0))
, _first_edit (EditChangesNothing)
, _layer (0)
, _changemap (0)
@ -284,7 +282,6 @@ Region::Region (boost::shared_ptr<const Region> other)
, _type (other->data_type())
, REGION_COPY_STATE (other)
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
, _layer (other->_layer)
, _changemap (other->_changemap)
@ -343,7 +340,6 @@ Region::Region (boost::shared_ptr<const Region> other, timecnt_t const & offset)
, _type (other->data_type())
, REGION_COPY_STATE (other)
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
, _layer (other->_layer)
, _changemap (other->_changemap)
@ -389,7 +385,6 @@ Region::Region (boost::shared_ptr<const Region> other, const SourceList& srcs)
, _type (srcs.front()->type())
, REGION_COPY_STATE (other)
, _last_length (other->_last_length)
, _last_position (other->_last_position)
, _first_edit (EditChangesID)
, _layer (other->_layer)
, _changemap (other->_changemap)
@ -672,8 +667,7 @@ Region::set_position_internal (timepos_t const & pos)
* (see Region::set_position), so we must always set this up so that
* e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position.
*/
_last_position = position();
_last_length.set_position (_last_position);
_last_length.set_position (position());
if (position() != pos) {
#warning NUTEMPO is this correct? why would set position set the position of the start (duration)?
@ -721,7 +715,6 @@ Region::set_initial_position (timepos_t const & pos)
recompute_position_from_time_domain ();
/* ensure that this move doesn't cause a range move */
_last_position = position();
_last_length.set_position (position());
}
@ -1005,7 +998,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
if (position() != pos) {
if (!property_changes_suspended()) {
_last_position = position();
_last_length.set_position (position());
}
set_position_internal (pos);
what_changed.add (Properties::position);
@ -1391,7 +1384,6 @@ Region::suspend_property_changes ()
{
Stateful::suspend_property_changes ();
_last_length = _length;
_last_position = position();
}
void