From 2ed1bdd243765216a22f5edacd64f8497256da7c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 25 Sep 2021 16:33:48 -0600 Subject: [PATCH] Remove PropertyTemplate::call() and replace with code that uses ::set() This makes undo/redo work correctly. --- libs/ardour/midi_region.cc | 6 +++++- libs/ardour/region.cc | 15 +++++++++++---- libs/pbd/pbd/properties.h | 6 ------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 88a0b92d63..ae862b5d90 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -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); diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 9becf3d177..754e583acd 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -356,7 +356,7 @@ Region::Region (boost::shared_ptr 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. diff --git a/libs/pbd/pbd/properties.h b/libs/pbd/pbd/properties.h index c42aa026b7..076830da42 100644 --- a/libs/pbd/pbd/properties.h +++ b/libs/pbd/pbd/properties.h @@ -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) {