Another speedup when multiple locations change

This is mainly relevant for redo, and ripple
when all multiple locations are changed and static signals
are emitted by each Location.
This commit is contained in:
Robin Gareus 2023-12-08 23:03:38 +01:00
parent 857d8096a9
commit 62f20d126f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 20 additions and 2 deletions

View File

@ -102,7 +102,7 @@ EditorSections::set_session (Session* s)
Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::queue_redisplay, this), gui_context ());
Location::name_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
}
@ -122,10 +122,25 @@ void
EditorSections::location_changed (ARDOUR::Location* l)
{
if (l->is_section ()) {
redisplay ();
queue_redisplay ();
}
}
void
EditorSections::queue_redisplay ()
{
if (!_redisplay_connection.connected ()) {
_redisplay_connection = Glib::signal_idle().connect (sigc::mem_fun (*this, &EditorSections::idle_redisplay), Glib::PRIORITY_HIGH_IDLE+10);
}
}
bool
EditorSections::idle_redisplay ()
{
redisplay ();
return false;
}
void
EditorSections::redisplay ()
{

View File

@ -45,6 +45,8 @@ public:
private:
void redisplay ();
void queue_redisplay ();
bool idle_redisplay ();
void location_changed (ARDOUR::Location*);
bool delete_selected_section ();
bool rename_selected_section ();
@ -117,6 +119,7 @@ private:
bool _no_redisplay;
sigc::connection _scroll_timeout;
sigc::connection _selection_change;
sigc::connection _redisplay_connection;
};
#endif