mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-07 06:05:43 +01:00
[Summary] Reworked tracks deletion algorithm to remove multiple tracks at once and do common actions only once for all deleted tracks
This commit is contained in:
parent
1f52283df9
commit
0969e46e4a
3 changed files with 37 additions and 19 deletions
|
|
@ -1452,9 +1452,14 @@ RouteUI::set_color_from_route ()
|
|||
void
|
||||
RouteUI::remove_this_route (bool apply_to_selection)
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<RouteList> routes_to_remove(new RouteList);
|
||||
if (apply_to_selection) {
|
||||
TrackSelection& track_selection = ARDOUR_UI::instance()->the_editor().get_selection().tracks;
|
||||
|
||||
|
||||
for (list<TimeAxisView*>::iterator i = track_selection.begin(); i != track_selection.end(); ++i) {
|
||||
RouteUI* t = dynamic_cast<RouteUI*> (*i);
|
||||
if (t) {
|
||||
|
|
@ -1465,7 +1470,7 @@ RouteUI::remove_this_route (bool apply_to_selection)
|
|||
if( audio_track && audio_track->is_master_track() )
|
||||
continue;
|
||||
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), t));
|
||||
routes_to_remove->push_back(t->route() );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1476,8 +1481,10 @@ RouteUI::remove_this_route (bool apply_to_selection)
|
|||
if( audio_track && audio_track->is_master_track() )
|
||||
return;
|
||||
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_this_route), this));
|
||||
routes_to_remove->push_back(this->route() );
|
||||
}
|
||||
|
||||
Glib::signal_idle().connect (sigc::bind (sigc::ptr_fun (&RouteUI::idle_remove_routes), ARDOUR_UI::instance()->the_session(), routes_to_remove) );
|
||||
}
|
||||
|
||||
gint
|
||||
|
|
@ -1487,6 +1494,13 @@ RouteUI::idle_remove_this_route (RouteUI *rui)
|
|||
return false;
|
||||
}
|
||||
|
||||
gint
|
||||
RouteUI::idle_remove_routes (Session* sess, boost::shared_ptr<RouteList>& rlist)
|
||||
{
|
||||
sess->remove_routes (rlist);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return true if this name should be used for the route, otherwise false */
|
||||
bool
|
||||
RouteUI::verify_new_route_name (const std::string& name)
|
||||
|
|
|
|||
|
|
@ -214,6 +214,7 @@ class RouteUI : public Gtk::EventBox, public WavesUI, public virtual AxisView
|
|||
|
||||
void remove_this_route (bool apply_to_selection = false);
|
||||
static gint idle_remove_this_route (RouteUI *);
|
||||
static gint idle_remove_routes (ARDOUR::Session*, boost::shared_ptr<ARDOUR::RouteList> &);
|
||||
|
||||
void route_rename();
|
||||
|
||||
|
|
|
|||
|
|
@ -3137,22 +3137,6 @@ Session::remove_routes (boost::shared_ptr<RouteList> routes_to_remove)
|
|||
_step_editors--;
|
||||
}
|
||||
}
|
||||
|
||||
/* try to cause everyone to drop their references
|
||||
* and unregister ports from the backend
|
||||
*/
|
||||
for (size_t i = 0; i < (*iter)->input()->ports().num_ports(); ++i) {
|
||||
_engine.unregister_port((*iter)->input()->ports().port(i));
|
||||
PortEngine::PortHandle handle = (*iter)->input()->ports().port(i)->port_handle();
|
||||
_engine.current_backend()->unregister_port(handle);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < (*iter)->output()->ports().num_ports(); ++i) {
|
||||
_engine.unregister_port((*iter)->output()->ports().port(i));
|
||||
PortEngine::PortHandle handle = (*iter)->output()->ports().port(i)->port_handle();
|
||||
_engine.current_backend()->unregister_port(handle);
|
||||
}
|
||||
(*iter)->drop_references ();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -3182,6 +3166,25 @@ Session::remove_routes (boost::shared_ptr<RouteList> routes_to_remove)
|
|||
|
||||
routes.flush ();
|
||||
|
||||
/* try to cause everyone to drop their references
|
||||
* and unregister ports from the backend
|
||||
*/
|
||||
for (RouteList::iterator iter = routes_to_remove->begin(); iter != routes_to_remove->end(); ++iter) {
|
||||
|
||||
for (size_t i = 0; i < (*iter)->input()->ports().num_ports(); ++i) {
|
||||
_engine.unregister_port((*iter)->input()->ports().port(i));
|
||||
PortEngine::PortHandle handle = (*iter)->input()->ports().port(i)->port_handle();
|
||||
_engine.current_backend()->unregister_port(handle);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < (*iter)->output()->ports().num_ports(); ++i) {
|
||||
_engine.unregister_port((*iter)->output()->ports().port(i));
|
||||
PortEngine::PortHandle handle = (*iter)->output()->ports().port(i)->port_handle();
|
||||
_engine.current_backend()->unregister_port(handle);
|
||||
}
|
||||
(*iter)->drop_references ();
|
||||
}
|
||||
|
||||
Route::RemoteControlIDChange(); /* EMIT SIGNAL */
|
||||
|
||||
/* save the new state of the world */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue