Speed up Location changes #9568
Section Markers only need to be updated when an actual section-marker is modified OR flags change. This also removes duplicate signal subscriptions and caches sorted Location list when iterating over section markers.
This commit is contained in:
parent
0c5bbfa62d
commit
7b1997ffda
@ -694,6 +694,7 @@ Editor::Editor ()
|
||||
Location::start_changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context());
|
||||
Location::end_changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context());
|
||||
Location::changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context());
|
||||
Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ());
|
||||
|
||||
#if SELECTION_PROPERTIES_BOX_TODO
|
||||
add_notebook_page (_("Selection"), *_properties_box);
|
||||
@ -1435,10 +1436,6 @@ Editor::set_session (Session *t)
|
||||
_session->auto_loop_location_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::loop_location_changed, this, _1), gui_context ());
|
||||
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
|
||||
|
||||
Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ());
|
||||
Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ());
|
||||
Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ());
|
||||
|
||||
_playhead_cursor->track_canvas_item().reparent ((ArdourCanvas::Item*) get_cursor_scroll_group());
|
||||
_playhead_cursor->show ();
|
||||
|
||||
|
@ -282,6 +282,9 @@ Editor::location_changed (Location *location)
|
||||
if (lam->end) {
|
||||
check_marker_label (lam->end);
|
||||
}
|
||||
if (location->is_section ()) {
|
||||
update_section_rects ();
|
||||
}
|
||||
}
|
||||
|
||||
/** Look at a marker and check whether its label, and those of the previous and next markers,
|
||||
@ -659,13 +662,14 @@ Editor::update_section_rects ()
|
||||
|
||||
timepos_t start;
|
||||
timepos_t end;
|
||||
std::vector<Locations::LocationPair> locs;
|
||||
|
||||
Locations* loc = _session->locations ();
|
||||
Location* l = NULL;
|
||||
bool bright = false;
|
||||
|
||||
do {
|
||||
l = loc->next_section (l, start, end);
|
||||
l = loc->next_section_iter (l, start, end, locs);
|
||||
if (l) {
|
||||
double const left = sample_to_pixel (start.samples ());
|
||||
double const right = sample_to_pixel (end.samples ());
|
||||
|
@ -96,14 +96,14 @@ EditorSections::set_session (Session* s)
|
||||
SessionHandlePtr::set_session (s);
|
||||
|
||||
if (_session) {
|
||||
_session->locations ()->added.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
_session->locations ()->removed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
_session->locations ()->added.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
|
||||
_session->locations ()->removed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
|
||||
_session->locations ()->changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
|
||||
Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
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::name_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ());
|
||||
Location::name_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ());
|
||||
}
|
||||
|
||||
redisplay ();
|
||||
@ -118,6 +118,14 @@ EditorSections::select (ARDOUR::Location* l)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSections::location_changed (ARDOUR::Location* l)
|
||||
{
|
||||
if (l->is_section ()) {
|
||||
redisplay ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EditorSections::redisplay ()
|
||||
{
|
||||
@ -134,12 +142,13 @@ EditorSections::redisplay ()
|
||||
|
||||
timepos_t start;
|
||||
timepos_t end;
|
||||
std::vector<Locations::LocationPair> locs;
|
||||
|
||||
Locations* loc = _session->locations ();
|
||||
Location* l = NULL;
|
||||
|
||||
do {
|
||||
l = loc->next_section (l, start, end);
|
||||
l = loc->next_section_iter (l, start, end, locs);
|
||||
if (l) {
|
||||
TreeModel::Row newrow = *(_model->append ());
|
||||
newrow[_columns.name] = l->name ();
|
||||
@ -214,9 +223,11 @@ EditorSections::update_time_selection ()
|
||||
|
||||
Locations* loc = _session->locations ();
|
||||
Location* l = NULL;
|
||||
|
||||
std::vector<Locations::LocationPair> locs;
|
||||
do {
|
||||
timepos_t start, end;
|
||||
l = loc->next_section (l, start, end);
|
||||
l = loc->next_section_iter (l, start, end, locs);
|
||||
if (l) {
|
||||
if (start == selection.time.start_time () && end == selection.time.end_time ()) {
|
||||
LocationRowMap::iterator map_it = _location_row_map.find (l);
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
|
||||
private:
|
||||
void redisplay ();
|
||||
void location_changed (ARDOUR::Location*);
|
||||
bool delete_selected_section ();
|
||||
bool rename_selected_section ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user