13
0

there is no Properties::position any more

Position is a part of a length property (a duple specifying
"duration AT position", and there is no distinct property
for just the position itself.
This commit is contained in:
Paul Davis 2021-09-25 16:44:37 -06:00
parent 64db1367bb
commit cc6c0f1263
3 changed files with 11 additions and 33 deletions

View File

@ -824,7 +824,6 @@ LuaBindings::common (lua_State* L)
// ardour/region.h // ardour/region.h
.addConst ("Start", &ARDOUR::Properties::start) .addConst ("Start", &ARDOUR::Properties::start)
.addConst ("Length", &ARDOUR::Properties::length) .addConst ("Length", &ARDOUR::Properties::length)
.addConst ("Position", &ARDOUR::Properties::position)
.endNamespace () .endNamespace ()
.beginClass <PBD::PropertyChange> ("PropertyChange") .beginClass <PBD::PropertyChange> ("PropertyChange")

View File

@ -125,8 +125,6 @@ Region::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for length = %1\n", Properties::length.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for length = %1\n", Properties::length.property_id));
Properties::beat.property_id = g_quark_from_static_string (X_("beat")); Properties::beat.property_id = g_quark_from_static_string (X_("beat"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for beat = %1\n", Properties::beat.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for beat = %1\n", Properties::beat.property_id));
Properties::position.property_id = g_quark_from_static_string (X_("position"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for position = %1\n", Properties::position.property_id));
Properties::sync_position.property_id = g_quark_from_static_string (X_("sync-position")); Properties::sync_position.property_id = g_quark_from_static_string (X_("sync-position"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sync-position = %1\n", Properties::sync_position.property_id)); DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sync-position = %1\n", Properties::sync_position.property_id));
Properties::layer.property_id = g_quark_from_static_string (X_("layer")); Properties::layer.property_id = g_quark_from_static_string (X_("layer"));
@ -628,7 +626,6 @@ Region::update_after_tempo_map_change (bool send)
what_changed.add (Properties::start); what_changed.add (Properties::start);
what_changed.add (Properties::length); what_changed.add (Properties::length);
what_changed.add (Properties::position);
/* do this even if the position is the same. this helps out /* do this even if the position is the same. this helps out
* a GUI that has moved its representation already. * a GUI that has moved its representation already.
@ -644,34 +641,19 @@ Region::set_position (timepos_t const & pos)
return; return;
} }
set_position_internal (pos);
/* do this even if the position is the same. this helps out /* do this even if the position is the same. this helps out
* a GUI that has moved its representation already. * a GUI that has moved its representation already.
*/ */
PropertyChange p_and_l; send_change (Properties::length);
p_and_l.add (Properties::position);
set_position_internal (pos);
/* if locked to beats or bbt, changing position can potentially change
* the length, because the tempo map may differ at the two different
* positions. Theoretically we could check this, but the cost of
* notifying about a (potential) length change is not that expensive
* given that we already are notifying about position change.
*/
if (position_time_domain() != Temporal::AudioTime) {
p_and_l.add (Properties::length);
}
send_change (p_and_l);
} }
void void
Region::set_position_internal (timepos_t const & pos) Region::set_position_internal (timepos_t const & pos)
{ {
/* We emit a change of Properties::position even if the position hasn't changed /* We emit a change of Properties::length even if the position hasn't changed
* (see Region::set_position), so we must always set this up so that * (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. * e.g. Playlist::notify_region_moved doesn't use an out-of-date last_position.
*/ */
@ -728,7 +710,7 @@ Region::set_initial_position (timepos_t const & pos)
/* do this even if the position is the same. this helps out /* do this even if the position is the same. this helps out
* a GUI that has moved its representation already. * a GUI that has moved its representation already.
*/ */
send_change (Properties::position); send_change (Properties::length);
} }
void void
@ -761,7 +743,7 @@ Region::nudge_position (timecnt_t const & n)
/* assumes non-musical nudge */ /* assumes non-musical nudge */
set_position_internal (new_position); set_position_internal (new_position);
send_change (Properties::position); send_change (Properties::length);
} }
void void
@ -810,7 +792,7 @@ Region::move_start (timecnt_t const & distance)
timepos_t new_start (_start); timepos_t new_start (_start);
timepos_t current_start (_start); timepos_t current_start (_start);
if (distance.positive()) { if (distance.positive()) {
if (current_start > timepos_t::max (current_start.time_domain()).earlier (distance)) { if (current_start > timepos_t::max (current_start.time_domain()).earlier (distance)) {
@ -1008,7 +990,7 @@ Region::trim_to_internal (timepos_t const & pos, timecnt_t const & len)
_last_length.set_position (position()); _last_length.set_position (position());
} }
set_position_internal (pos); set_position_internal (pos);
what_changed.add (Properties::position); what_changed.add (Properties::length);
} }
if (length() != nl) { if (length() != nl) {
@ -1397,9 +1379,7 @@ void
Region::mid_thaw (const PropertyChange& what_changed) Region::mid_thaw (const PropertyChange& what_changed)
{ {
if (what_changed.contains (Properties::length)) { if (what_changed.contains (Properties::length)) {
if (what_changed.contains (Properties::position)) { recompute_at_start ();
recompute_at_start ();
}
recompute_at_end (); recompute_at_end ();
} }
} }
@ -1421,7 +1401,7 @@ Region::send_change (const PropertyChange& what_changed)
try { try {
boost::shared_ptr<Region> rptr = shared_from_this(); boost::shared_ptr<Region> rptr = shared_from_this();
if (_changemap) { if (_changemap) {
(*_changemap)[what_changed].push_back (rptr); (*_changemap)[what_changed].push_back (rptr);
} else { } else {
boost::shared_ptr<RegionList> rl (new RegionList); boost::shared_ptr<RegionList> rl (new RegionList);

View File

@ -114,8 +114,7 @@ StripSilence::run (boost::shared_ptr<Region> r, Progress* progress)
PBD::PropertyList plist; PBD::PropertyList plist;
boost::shared_ptr<AudioRegion> copy; boost::shared_ptr<AudioRegion> copy;
plist.add (Properties::length, timecnt_t (i->second - i->first)); plist.add (Properties::length, timecnt_t (i->second - i->first, timepos_t (r->position_sample() + (i->first - r->start_sample()))));
plist.add (Properties::position, timepos_t (r->position_sample() + (i->first - r->start_sample())));
copy = boost::dynamic_pointer_cast<AudioRegion> ( copy = boost::dynamic_pointer_cast<AudioRegion> (
RegionFactory::create (region, timecnt_t (i->first - r->start_sample(), timepos_t::zero (false)), plist) RegionFactory::create (region, timecnt_t (i->first - r->start_sample(), timepos_t::zero (false)), plist)