New region-property placeholders should not be Properties (mostly reverts 045cf7)

Properties are created for announcing changes, but values are not actually stored as undo-able properties.
This commit is contained in:
Ben Loftis 2021-12-06 18:13:06 -06:00
parent 3186a85b0c
commit 50430f134d
2 changed files with 38 additions and 38 deletions

View File

@ -74,6 +74,8 @@ namespace Properties {
LIBARDOUR_API extern PBD::PropertyDescriptor<uint64_t> layering_index;
LIBARDOUR_API extern PBD::PropertyDescriptor<std::string> tags;
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> contents; // type doesn't matter here
/* these properties are used as a convenience for announcing changes to state, but aren't stored as properties */
LIBARDOUR_API extern PBD::PropertyDescriptor<Temporal::TimeDomain> time_domain;
LIBARDOUR_API extern PBD::PropertyDescriptor<float> bpm;
LIBARDOUR_API extern PBD::PropertyDescriptor<uint8_t> metrum_numerator; //pulses per bar (typically 4)
@ -136,7 +138,7 @@ public:
uint8_t metrum_divisor () const { return _metrum_divisor; }
bool sync_to_bbt () const { return _sync_to_bbt; }
bool loop_enabled () const { return _loop_enabled; }
timepos_t loop_start () const { return _loop_start.val(); }
timepos_t loop_start () const { return _loop_start; }
timepos_t source_position () const;
timepos_t source_relative_position (Temporal::timepos_t const &) const;
@ -293,6 +295,13 @@ public:
void set_video_locked (bool yn);
void set_position_locked (bool yn);
void set_bpm (float bpm);
void set_metrum_numerator (uint8_t num);
void set_metrum_divisor (uint8_t div);
void set_sync_to_bbt (bool sync);
void set_loop_enabled (bool en);
void set_loop_start (timepos_t);
Temporal::timepos_t region_beats_to_absolute_time(Temporal::Beats beats) const;
/** Convert a timestamp in beats into timepos_t (both relative to region position) */
Temporal::timepos_t region_beats_to_region_time (Temporal::Beats beats) const {
@ -535,13 +544,13 @@ private:
PBD::Property<std::string> _tags;
PBD::Property<bool> _contents; // type is irrelevant
/* these properties are (currently) only used when the region is in a trigger slot */
PBD::Property<float> _bpm;
PBD::Property<uint8_t> _metrum_numerator; //pulses per bar (typically 4)
PBD::Property<uint8_t> _metrum_divisor; //divisor note type (typically 4 = quarter-note)
PBD::Property<bool> _sync_to_bbt;
PBD::Property<bool> _loop_enabled;
PBD::Property<timepos_t> _loop_start;
/* these values are (currently) only used when the region is in a trigger slot */
float _bpm;
uint8_t _metrum_numerator; //pulses per bar (typically 4)
uint8_t _metrum_divisor; //divisor note type (typically 4 = quarter-note)
bool _sync_to_bbt;
bool _loop_enabled;
timepos_t _loop_start;
timecnt_t _last_length;
mutable RegionEditState _first_edit;

View File

@ -82,6 +82,8 @@ namespace ARDOUR {
PBD::PropertyDescriptor<uint64_t> layering_index;
PBD::PropertyDescriptor<std::string> tags;
PBD::PropertyDescriptor<bool> contents;
/* these properties are used as a convenience for announcing changes to state, but aren't stored as properties */
PBD::PropertyDescriptor<Temporal::TimeDomain> time_domain;
PBD::PropertyDescriptor<float> bpm;
PBD::PropertyDescriptor<uint8_t> metrum_numerator;
@ -149,18 +151,6 @@ Region::make_property_quarks ()
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for tags = %1\n", Properties::tags.property_id));
Properties::contents.property_id = g_quark_from_static_string (X_("contents"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for contents = %1\n", Properties::contents.property_id));
Properties::bpm.property_id = g_quark_from_static_string (X_("bpm"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for bpm = %1\n", Properties::bpm.property_id));
Properties::metrum_numerator.property_id = g_quark_from_static_string (X_("metrum_numerator"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for metrum_numerator = %1\n", Properties::metrum_numerator.property_id));
Properties::metrum_divisor.property_id = g_quark_from_static_string (X_("metrum_divisor"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for metrum_divisor = %1\n", Properties::metrum_divisor.property_id));
Properties::sync_to_bbt.property_id = g_quark_from_static_string (X_("sync_to_bbt"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for sync_to_bbt = %1\n", Properties::sync_to_bbt.property_id));
Properties::loop_enabled.property_id = g_quark_from_static_string (X_("loop_enabled"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for loop_enabled = %1\n", Properties::loop_enabled.property_id));
Properties::loop_start.property_id = g_quark_from_static_string (X_("loop_start"));
DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for loop_start = %1\n", Properties::loop_start.property_id));
}
void
@ -192,12 +182,6 @@ Region::register_properties ()
add_property (_layering_index);
add_property (_tags);
add_property (_contents);
add_property (_bpm);
add_property (_metrum_numerator);
add_property (_metrum_divisor);
add_property (_sync_to_bbt);
add_property (_loop_enabled);
add_property (_loop_start);
}
#define REGION_DEFAULT_STATE(s,l) \
@ -229,12 +213,12 @@ Region::register_properties ()
, _layering_index (Properties::layering_index, 0) \
, _tags (Properties::tags, "") \
, _contents (Properties::contents, false) \
, _bpm (Properties::bpm, 110) \
, _metrum_numerator (Properties::metrum_numerator, 4) \
, _metrum_divisor (Properties::metrum_divisor, 4) \
, _sync_to_bbt (Properties::sync_to_bbt, false) \
, _loop_enabled (Properties::loop_enabled, false) \
, _loop_start (Properties::loop_start, (s))
, _bpm (110) \
, _metrum_numerator (4) \
, _metrum_divisor (4) \
, _sync_to_bbt (false) \
, _loop_enabled (false) \
, _loop_start (0)
#define REGION_COPY_STATE(other) \
_sync_marked (Properties::sync_marked, other->_sync_marked) \
@ -267,12 +251,12 @@ Region::register_properties ()
, _layering_index (Properties::layering_index, other->_layering_index) \
, _tags (Properties::tags, other->_tags) \
, _contents (Properties::contents, other->_contents) \
, _bpm (Properties::bpm, other->_bpm) \
, _metrum_numerator (Properties::metrum_numerator, other->_metrum_numerator) \
, _metrum_divisor (Properties::metrum_divisor, other->_metrum_divisor) \
, _sync_to_bbt (Properties::sync_to_bbt, other->_sync_to_bbt) \
, _loop_enabled (Properties::loop_enabled, other->_loop_enabled) \
, _loop_start (Properties::loop_start, other->_loop_start)
, _bpm (other->_bpm) \
, _metrum_numerator (other->_metrum_numerator) \
, _metrum_divisor (other->_metrum_divisor) \
, _sync_to_bbt (other->_sync_to_bbt) \
, _loop_enabled (other->_loop_enabled) \
, _loop_start (other->_loop_start)
/* derived-from-derived constructor (no sources in constructor) */
Region::Region (Session& s, timepos_t const & start, timecnt_t const & length, const string& name, DataType type)
@ -619,6 +603,13 @@ Region::set_position_time_domain (Temporal::TimeDomain td)
}
}
void Region::set_bpm (float bpm) { _bpm = bpm; send_change (Properties::bpm);}
void Region::set_metrum_numerator (uint8_t num) { _metrum_numerator = num; send_change (Properties::metrum_numerator);}
void Region::set_metrum_divisor (uint8_t div) { _metrum_divisor = div; send_change (Properties::metrum_divisor);}
void Region::set_sync_to_bbt (bool sync) { _sync_to_bbt = sync; send_change (Properties::sync_to_bbt);}
void Region::set_loop_enabled (bool en) { _loop_enabled = en; send_change (Properties::loop_enabled);}
void Region::set_loop_start (timepos_t ls) { _loop_start = ls; send_change (Properties::loop_start);}
void
Region::recompute_position_from_time_domain ()
{