From 07324bd1e25cf4fa501b1fbab7d1a9fb49ffaf69 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 28 Aug 2021 15:29:44 -0600 Subject: [PATCH] change the way source list adds new regions to match the way the region list does it This avoids duplicates, updates rows etc --- gtk2_ardour/editor_sources.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_sources.cc b/gtk2_ardour/editor_sources.cc index 6ba481bec6..3f665914ce 100644 --- a/gtk2_ardour/editor_sources.cc +++ b/gtk2_ardour/editor_sources.cc @@ -508,8 +508,10 @@ EditorSources::add_source (boost::shared_ptr region) region->DropReferences.connect (remove_region_connections, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_weak_region, this, boost::weak_ptr (region)), gui_context()); - TreeModel::Row row = *(_model->append()); - populate_row (row, region); + PropertyChange pc; + boost::shared_ptr rl (new RegionList); + rl->push_back (region); + regions_changed (rl, pc); } void @@ -519,6 +521,7 @@ EditorSources::regions_changed (boost::shared_ptr rl, PBD::P if (freeze) { freeze_tree_model (); } + for (RegionList::const_iterator r = rl->begin (); r != rl->end(); ++r) { boost::shared_ptr region = *r; @@ -537,7 +540,13 @@ EditorSources::regions_changed (boost::shared_ptr rl, PBD::P break; } } + + if (i == rows.end()) { + TreeModel::Row row = *(_model->append()); + populate_row (row, region); + } } + if (freeze) { thaw_tree_model (); }