duplicate all ARDOUR::Location signals so that we have one static signal that identifies the subject location and one member signal that does not

This commit is contained in:
Paul Davis 2014-09-19 22:50:34 -04:00
parent ceff2e3a62
commit 5bdc9a9a23
2 changed files with 51 additions and 17 deletions

View file

@ -101,17 +101,32 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest
boost::shared_ptr<SceneChange> scene_change() const { return _scene_change; } boost::shared_ptr<SceneChange> scene_change() const { return _scene_change; }
void set_scene_change (boost::shared_ptr<SceneChange>); void set_scene_change (boost::shared_ptr<SceneChange>);
/* these are static signals for objects that want to listen to all
locations at once.
*/
static PBD::Signal1<void,Location*> name_changed; static PBD::Signal1<void,Location*> name_changed;
static PBD::Signal1<void,Location*> end_changed; static PBD::Signal1<void,Location*> end_changed;
static PBD::Signal1<void,Location*> start_changed; static PBD::Signal1<void,Location*> start_changed;
static PBD::Signal1<void,Location*> flags_changed;
PBD::Signal1<void,Location*> LockChanged; static PBD::Signal1<void,Location*> lock_changed;
PBD::Signal2<void,Location*,void*> FlagsChanged; static PBD::Signal1<void,Location*> position_lock_style_changed;
PBD::Signal1<void,Location*> PositionLockStyleChanged;
/* this is sent only when both start and end change at the same time */ /* this is sent only when both start and end change at the same time */
static PBD::Signal1<void,Location*> changed; static PBD::Signal1<void,Location*> changed;
/* these are member signals for objects that care only about
changes to this object
*/
PBD::Signal0<void> NameChanged;
PBD::Signal0<void> EndChanged;
PBD::Signal0<void> StartChanged;
PBD::Signal0<void> Changed;
PBD::Signal0<void> FlagsChanged;
PBD::Signal0<void> LockChanged;
PBD::Signal0<void> PositionLockStyleChanged;
/* CD Track / CD-Text info */ /* CD Track / CD-Text info */
std::map<std::string, std::string> cd_info; std::map<std::string, std::string> cd_info;

View file

@ -47,6 +47,9 @@ PBD::Signal0<void> Location::scene_changed;
PBD::Signal1<void,Location*> Location::name_changed; PBD::Signal1<void,Location*> Location::name_changed;
PBD::Signal1<void,Location*> Location::end_changed; PBD::Signal1<void,Location*> Location::end_changed;
PBD::Signal1<void,Location*> Location::start_changed; PBD::Signal1<void,Location*> Location::start_changed;
PBD::Signal1<void,Location*> Location::flags_changed;
PBD::Signal1<void,Location*> Location::lock_changed;
PBD::Signal1<void,Location*> Location::position_lock_style_changed;
PBD::Signal1<void,Location*> Location::changed; PBD::Signal1<void,Location*> Location::changed;
Location::Location (Session& s) 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 */ start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
end_changed (this); /* EMIT SIGNAL */ end_changed (this); /* EMIT SIGNAL */
EndChanged (); /* EMIT SIGNAL */
} }
/* moving the start (position) of a marker with a scene change /* 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 (); recompute_bbt_from_frames ();
} }
start_changed (this); /* EMIT SIGNAL */ start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
if (is_session_range ()) { if (is_session_range ()) {
Session::StartTimeChanged (old); /* EMIT SIGNAL */ 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 (); recompute_bbt_from_frames ();
} }
start_changed (this); /* EMIT SIGNAL */ start_changed (this); /* EMIT SIGNAL */
StartChanged (); /* EMIT SIGNAL */
end_changed (this); /* EMIT SIGNAL */ end_changed (this); /* EMIT SIGNAL */
EndChanged (); /* EMIT SIGNAL */
} }
assert (_start >= 0); assert (_start >= 0);
@ -275,6 +283,7 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
recompute_bbt_from_frames (); recompute_bbt_from_frames ();
} }
end_changed(this); /* EMIT SIGNAL */ end_changed(this); /* EMIT SIGNAL */
EndChanged(); /* EMIT SIGNAL */
if (is_session_range()) { if (is_session_range()) {
Session::EndTimeChanged (old); /* EMIT SIGNAL */ Session::EndTimeChanged (old); /* EMIT SIGNAL */
@ -322,6 +331,7 @@ Location::move_to (framepos_t pos)
recompute_bbt_from_frames (); recompute_bbt_from_frames ();
changed (this); /* EMIT SIGNAL */ changed (this); /* EMIT SIGNAL */
Changed (); /* EMIT SIGNAL */
} }
assert (_start >= 0); assert (_start >= 0);
@ -331,15 +341,16 @@ Location::move_to (framepos_t pos)
} }
void void
Location::set_hidden (bool yn, void *src) Location::set_hidden (bool yn, void*)
{ {
if (set_flag_internal (yn, IsHidden)) { if (set_flag_internal (yn, IsHidden)) {
FlagsChanged (this, src); /* EMIT SIGNAL */ flags_changed (this); /* EMIT SIGNAL */
FlagsChanged ();
} }
} }
void void
Location::set_cd (bool yn, void *src) Location::set_cd (bool yn, void*)
{ {
// XXX this really needs to be session start // XXX this really needs to be session start
// but its not available here - leave to GUI // 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)) { if (set_flag_internal (yn, IsCDMarker)) {
FlagsChanged (this, src); /* EMIT SIGNAL */ flags_changed (this); /* EMIT SIGNAL */
FlagsChanged ();
} }
} }
void void
Location::set_is_range_marker (bool yn, void *src) Location::set_is_range_marker (bool yn, void*)
{ {
if (set_flag_internal (yn, IsRangeMarker)) { if (set_flag_internal (yn, IsRangeMarker)) {
FlagsChanged (this, src); /* EMIT SIGNAL */ flags_changed (this);
FlagsChanged (); /* EMIT SIGNAL */
} }
} }
void void
Location::set_auto_punch (bool yn, void *src) Location::set_auto_punch (bool yn, void*)
{ {
if (is_mark() || _start == _end) { if (is_mark() || _start == _end) {
return; return;
} }
if (set_flag_internal (yn, IsAutoPunch)) { if (set_flag_internal (yn, IsAutoPunch)) {
FlagsChanged (this, src); /* EMIT SIGNAL */ flags_changed (this); /* EMIT SIGNAL */
FlagsChanged (); /* EMIT SIGNAL */
} }
} }
void void
Location::set_auto_loop (bool yn, void *src) Location::set_auto_loop (bool yn, void*)
{ {
if (is_mark() || _start == _end) { if (is_mark() || _start == _end) {
return; return;
} }
if (set_flag_internal (yn, IsAutoLoop)) { 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 (); recompute_bbt_from_frames ();
changed (this); /* EMIT SIGNAL */ changed (this); /* EMIT SIGNAL */
Changed (); /* EMIT SIGNAL */
assert (_start >= 0); assert (_start >= 0);
assert (_end >= 0); assert (_end >= 0);
@ -572,7 +588,8 @@ Location::set_position_lock_style (PositionLockStyle ps)
recompute_bbt_from_frames (); recompute_bbt_from_frames ();
PositionLockStyleChanged (this); /* EMIT SIGNAL */ position_lock_style_changed (this); /* EMIT SIGNAL */
PositionLockStyleChanged (); /* EMIT SIGNAL */
} }
void void
@ -601,14 +618,16 @@ void
Location::lock () Location::lock ()
{ {
_locked = true; _locked = true;
LockChanged (this); lock_changed (this);
LockChanged ();
} }
void void
Location::unlock () Location::unlock ()
{ {
_locked = false; _locked = false;
LockChanged (this); lock_changed (this);
LockChanged ();
} }
void void