Remove unnecessary refresh_location_display_s method. Speed up marker loading somewhat by only setting up marker labels once after load. Fix check on visible status of the location UI so that it is built when opened rather than on load. The location UI is still extremely slow to build with a couple of thousand markers. This fixes #3958.

git-svn-id: svn://localhost/ardour2/branches/3.0@9414 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-04-23 02:00:23 +00:00
parent b719876095
commit 4f9b75c8a2
5 changed files with 27 additions and 22 deletions

View File

@ -1138,7 +1138,7 @@ Editor::set_session (Session *t)
_session->locations()->added.connect (_session_connections, invalidator (*this), ui_bind (&Editor::add_new_location, this, _1), gui_context());
_session->locations()->removed.connect (_session_connections, invalidator (*this), ui_bind (&Editor::location_gone, this, _1), gui_context());
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::refresh_location_display, this), gui_context());
_session->locations()->StateChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::refresh_location_display_s, this, _1), gui_context());
_session->locations()->StateChanged.connect (_session_connections, invalidator (*this), ui_bind (&Editor::refresh_location_display, this), gui_context());
_session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context());
if (Profile->get_sae()) {

View File

@ -541,9 +541,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void location_changed (ARDOUR::Location *);
void location_flags_changed (ARDOUR::Location *, void *);
void refresh_location_display ();
void refresh_location_display_s (const PBD::PropertyChange&);
void refresh_location_display_internal (ARDOUR::Locations::LocationList&);
void add_new_location (ARDOUR::Location *);
ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *);
void location_gone (ARDOUR::Location *);
void remove_marker (ArdourCanvas::Item&, GdkEvent*);
gint really_remove_marker (ARDOUR::Location* loc);

View File

@ -61,8 +61,21 @@ Editor::clear_marker_display ()
void
Editor::add_new_location (Location *location)
{
ENSURE_GUI_THREAD (*this, &Editor::add_new_location, location)
ENSURE_GUI_THREAD (*this, &Editor::add_new_location, location);
ArdourCanvas::Group* group = add_new_location_internal (location);
/* Do a full update of the markers in this group */
update_marker_labels (group);
}
/** Add a new location, without a time-consuming update of all marker labels;
* the caller must call update_marker_labels () after calling this.
* @return canvas group that the location's marker was added to.
*/
ArdourCanvas::Group*
Editor::add_new_location_internal (Location* location)
{
LocationMarkers *lam = new LocationMarkers;
uint32_t color;
@ -163,15 +176,14 @@ Editor::add_new_location (Location *location)
lam->set_show_lines (_show_marker_lines);
/* Add these markers to the appropriate sorted marker lists, which will render
them unsorted until the update_marker_labels() below sorts them out.
them unsorted until a call to update_marker_labels() sorts them out.
*/
_sorted_marker_lists[group].push_back (lam->start);
if (lam->end) {
_sorted_marker_lists[group].push_back (lam->end);
}
/* Do a full update of the markers in this group */
update_marker_labels (group);
return group;
}
void
@ -483,7 +495,7 @@ Editor::refresh_location_display_internal (Locations::LocationList& locations)
continue;
}
add_new_location (*i);
add_new_location_internal (*i);
}
/* remove dead ones */
@ -521,16 +533,8 @@ Editor::refresh_location_display ()
if (_session) {
_session->locations()->apply (*this, &Editor::refresh_location_display_internal);
}
}
void
Editor::refresh_location_display_s (const PropertyChange&)
{
ENSURE_GUI_THREAD (*this, &Editor::refresh_location_display_s, ignored)
if (_session) {
_session->locations()->apply (*this, &Editor::refresh_location_display_internal);
}
update_marker_labels ();
}
void

View File

@ -972,7 +972,7 @@ LocationUI::map_locations (Locations::LocationList& locations)
if (location->is_mark()) {
LocationEditRow* erow = manage (new LocationEditRow (_session, location, mark_n));
erow->set_clock_group (*_clock_group);
erow->set_clock_group (*_clock_group);
erow->remove_requested.connect (sigc::mem_fun(*this, &LocationUI::location_remove_requested));
erow->redraw_ranges.connect (sigc::mem_fun(*this, &LocationUI::location_redraw_ranges));
@ -1052,7 +1052,9 @@ LocationUI::refresh_location_list ()
using namespace Box_Helpers;
// this is just too expensive to do when window is not shown
if (!is_visible()) return;
if (!is_mapped()) {
return;
}
BoxList & loc_children = location_rows.children();
BoxList & range_children = range_rows.children();
@ -1063,7 +1065,6 @@ LocationUI::refresh_location_list ()
if (_session) {
_session->locations()->apply (*this, &LocationUI::map_locations);
}
}
void
@ -1133,10 +1134,10 @@ LocationUIWindow::~LocationUIWindow()
}
void
LocationUIWindow::on_show()
LocationUIWindow::on_map ()
{
ArdourDialog::on_map ();
_ui.refresh_location_list();
ArdourDialog::on_show();
}
bool

View File

@ -206,7 +206,7 @@ class LocationUIWindow : public ArdourDialog
LocationUIWindow ();
~LocationUIWindow ();
void on_show();
void on_map ();
void set_session (ARDOUR::Session *);
LocationUI& ui() { return _ui; }