From cac03dbeb6ebdcd406385dd14a746cb8c51dd5f8 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 23 Jun 2010 01:51:55 +0000 Subject: Update locations GUI more efficiently by avoiding a rebuild when a location is removed. Fixes #3263. git-svn-id: svn://localhost/ardour2/branches/3.0@7290 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/location.h | 14 +++++++++++--- libs/ardour/location.cc | 13 ++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index f23d2e382a..7d3b0ac1a9 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -163,15 +163,23 @@ class Locations : public PBD::StatefulDestructible int set_current (Location *, bool want_lock = true); Location *current () const { return current_location; } - Location *first_location_before (nframes64_t, bool include_special_ranges = false); - Location *first_location_after (nframes64_t, bool include_special_ranges = false); + Location* first_location_before (nframes64_t, bool include_special_ranges = false); + Location* first_location_after (nframes64_t, bool include_special_ranges = false); void marks_either_side (nframes64_t const, nframes64_t &, nframes64_t &) const; void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags); + enum Change { + ADDITION, ///< a location was added, but nothing else changed + REMOVAL, ///< a location was removed, but nothing else changed + OTHER ///< something more complicated happened + }; + PBD::Signal1 current_changed; - PBD::Signal0 changed; + /** something changed about the location list; the parameter gives some idea as to what */ + PBD::Signal1 changed; + /** a location has been added to the end of the list */ PBD::Signal1 added; PBD::Signal1 removed; PBD::Signal1 StateChanged; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 7202e1ef03..93b6b5c5fa 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -492,7 +492,7 @@ Locations::clear () current_location = 0; } - changed (); /* EMIT SIGNAL */ + changed (OTHER); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ } @@ -515,7 +515,7 @@ Locations::clear_markers () } } - changed (); /* EMIT SIGNAL */ + changed (OTHER); /* EMIT SIGNAL */ } void @@ -541,7 +541,7 @@ Locations::clear_ranges () current_location = 0; } - changed (); /* EMIT SIGNAL */ + changed (OTHER); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ } @@ -568,7 +568,6 @@ Locations::add (Location *loc, bool make_current) void Locations::remove (Location *loc) - { bool was_removed = false; bool was_current = false; @@ -602,14 +601,14 @@ Locations::remove (Location *loc) current_changed (0); /* EMIT SIGNAL */ } - changed (); /* EMIT_SIGNAL */ + changed (REMOVAL); /* EMIT_SIGNAL */ } } void Locations::location_changed (Location* /*loc*/) { - changed (); /* EMIT SIGNAL */ + changed (OTHER); /* EMIT SIGNAL */ } XMLNode& @@ -701,7 +700,7 @@ Locations::set_state (const XMLNode& node, int version) } } - changed (); /* EMIT SIGNAL */ + changed (OTHER); /* EMIT SIGNAL */ return 0; } -- cgit v1.2.3