Remove PropertyTemplate::call() and replace with code that uses ::set()

This makes undo/redo work correctly.
This commit is contained in:
Paul Davis 2021-09-25 16:33:48 -06:00
parent 66595ae60e
commit 2ed1bdd243
3 changed files with 16 additions and 11 deletions

View File

@ -490,7 +490,11 @@ MidiRegion::model_shifted (timecnt_t distance)
if (!_ignore_shift) {
PropertyChange what_changed;
_start.call().operator+= (distance);
/* _start is a Property, so we cannot call timepos_t methods on
it directly. ::val() only provides a const, so use
operator+() rather than operator+=()
*/
_start = _start.val() + distance;
what_changed.add (Properties::start);
what_changed.add (Properties::contents);
send_change (what_changed);

View File

@ -356,7 +356,7 @@ Region::Region (boost::shared_ptr<const Region> other, timecnt_t const & offset)
use_sources (other->_sources);
set_master_sources (other->_master_sources);
_length.call().set_position (other->position() + offset);
_length = timecnt_t (_length.val().distance(), other->position() + offset);
_start = other->_start.val() + offset;
/* if the other region had a distinct sync point
@ -564,7 +564,7 @@ Region::special_set_position (timepos_t const & pos)
* a way to store its "natural" or "captured" position.
*/
_length.call().set_position (pos);
_length = timecnt_t (_length.val().distance(), pos);
}
void
@ -572,7 +572,14 @@ Region::set_position_time_domain (Temporal::TimeDomain td)
{
if (_length.val().time_domain() != td) {
_length.call().set_time_domain (td);
/* _length is a property so we cannot directly call
* ::set_time_domain() on it. Create a temporary timecnt_t,
* change it's time domain, and then assign to _length
*/
timecnt_t t (_length.val());
t.set_time_domain (td);
_length = t;
send_change (Properties::time_domain);
}
@ -699,7 +706,7 @@ Region::set_initial_position (timepos_t const & pos)
if (position() != pos) {
_length.call().set_position (pos);
_length = timecnt_t (_length.val().distance(), pos);
/* check that the new _position wouldn't make the current
* length impossible - if so, change the length.

View File

@ -111,12 +111,6 @@ public:
return _current;
}
/* allows calling non-const methods on _current */
T & call () {
return _current;
}
/* MANAGEMENT OF Stateful State */
bool set_value (XMLNode const & node) {