From 5bdc9a9a2368abfc03a52a676502f215ef609a3a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 19 Sep 2014 22:50:34 -0400 Subject: [PATCH] duplicate all ARDOUR::Location signals so that we have one static signal that identifies the subject location and one member signal that does not --- libs/ardour/ardour/location.h | 23 ++++++++++++++---- libs/ardour/location.cc | 45 +++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index bf8e663417..b3a4e3ff24 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -101,17 +101,32 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest boost::shared_ptr scene_change() const { return _scene_change; } void set_scene_change (boost::shared_ptr); + /* these are static signals for objects that want to listen to all + locations at once. + */ + static PBD::Signal1 name_changed; static PBD::Signal1 end_changed; static PBD::Signal1 start_changed; - - PBD::Signal1 LockChanged; - PBD::Signal2 FlagsChanged; - PBD::Signal1 PositionLockStyleChanged; + static PBD::Signal1 flags_changed; + static PBD::Signal1 lock_changed; + static PBD::Signal1 position_lock_style_changed; /* this is sent only when both start and end change at the same time */ static PBD::Signal1 changed; + /* these are member signals for objects that care only about + changes to this object + */ + + PBD::Signal0 NameChanged; + PBD::Signal0 EndChanged; + PBD::Signal0 StartChanged; + PBD::Signal0 Changed; + PBD::Signal0 FlagsChanged; + PBD::Signal0 LockChanged; + PBD::Signal0 PositionLockStyleChanged; + /* CD Track / CD-Text info */ std::map cd_info; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 84fe93e7f8..94afad679d 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -47,6 +47,9 @@ PBD::Signal0 Location::scene_changed; PBD::Signal1 Location::name_changed; PBD::Signal1 Location::end_changed; PBD::Signal1 Location::start_changed; +PBD::Signal1 Location::flags_changed; +PBD::Signal1 Location::lock_changed; +PBD::Signal1 Location::position_lock_style_changed; PBD::Signal1 Location::changed; Location::Location (Session& s) @@ -189,7 +192,9 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute) } start_changed (this); /* EMIT SIGNAL */ + StartChanged (); /* EMIT SIGNAL */ end_changed (this); /* EMIT SIGNAL */ + EndChanged (); /* EMIT SIGNAL */ } /* moving the start (position) of a marker with a scene change @@ -215,6 +220,7 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute) recompute_bbt_from_frames (); } start_changed (this); /* EMIT SIGNAL */ + StartChanged (); /* EMIT SIGNAL */ if (is_session_range ()) { Session::StartTimeChanged (old); /* EMIT SIGNAL */ @@ -257,7 +263,9 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute) recompute_bbt_from_frames (); } start_changed (this); /* EMIT SIGNAL */ + StartChanged (); /* EMIT SIGNAL */ end_changed (this); /* EMIT SIGNAL */ + EndChanged (); /* EMIT SIGNAL */ } assert (_start >= 0); @@ -275,6 +283,7 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute) recompute_bbt_from_frames (); } end_changed(this); /* EMIT SIGNAL */ + EndChanged(); /* EMIT SIGNAL */ if (is_session_range()) { Session::EndTimeChanged (old); /* EMIT SIGNAL */ @@ -322,6 +331,7 @@ Location::move_to (framepos_t pos) recompute_bbt_from_frames (); changed (this); /* EMIT SIGNAL */ + Changed (); /* EMIT SIGNAL */ } assert (_start >= 0); @@ -331,15 +341,16 @@ Location::move_to (framepos_t pos) } void -Location::set_hidden (bool yn, void *src) +Location::set_hidden (bool yn, void*) { if (set_flag_internal (yn, IsHidden)) { - FlagsChanged (this, src); /* EMIT SIGNAL */ + flags_changed (this); /* EMIT SIGNAL */ + FlagsChanged (); } } void -Location::set_cd (bool yn, void *src) +Location::set_cd (bool yn, void*) { // XXX this really needs to be session start // but its not available here - leave to GUI @@ -350,39 +361,43 @@ Location::set_cd (bool yn, void *src) } if (set_flag_internal (yn, IsCDMarker)) { - FlagsChanged (this, src); /* EMIT SIGNAL */ + flags_changed (this); /* EMIT SIGNAL */ + FlagsChanged (); } } void -Location::set_is_range_marker (bool yn, void *src) +Location::set_is_range_marker (bool yn, void*) { if (set_flag_internal (yn, IsRangeMarker)) { - FlagsChanged (this, src); /* EMIT SIGNAL */ + flags_changed (this); + FlagsChanged (); /* EMIT SIGNAL */ } } void -Location::set_auto_punch (bool yn, void *src) +Location::set_auto_punch (bool yn, void*) { if (is_mark() || _start == _end) { return; } if (set_flag_internal (yn, IsAutoPunch)) { - FlagsChanged (this, src); /* EMIT SIGNAL */ + flags_changed (this); /* EMIT SIGNAL */ + FlagsChanged (); /* EMIT SIGNAL */ } } void -Location::set_auto_loop (bool yn, void *src) +Location::set_auto_loop (bool yn, void*) { if (is_mark() || _start == _end) { return; } if (set_flag_internal (yn, IsAutoLoop)) { - FlagsChanged (this, src); /* EMIT SIGNAL */ + flags_changed (this); /* EMIT SIGNAL */ + FlagsChanged (); /* EMIT SIGNAL */ } } @@ -554,6 +569,7 @@ Location::set_state (const XMLNode& node, int version) recompute_bbt_from_frames (); changed (this); /* EMIT SIGNAL */ + Changed (); /* EMIT SIGNAL */ assert (_start >= 0); assert (_end >= 0); @@ -572,7 +588,8 @@ Location::set_position_lock_style (PositionLockStyle ps) recompute_bbt_from_frames (); - PositionLockStyleChanged (this); /* EMIT SIGNAL */ + position_lock_style_changed (this); /* EMIT SIGNAL */ + PositionLockStyleChanged (); /* EMIT SIGNAL */ } void @@ -601,14 +618,16 @@ void Location::lock () { _locked = true; - LockChanged (this); + lock_changed (this); + LockChanged (); } void Location::unlock () { _locked = false; - LockChanged (this); + lock_changed (this); + LockChanged (); } void