diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 9206f1516b..bd78648107 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6114,6 +6114,7 @@ Editor::remove_tracks () const char* trackstr; const char* busstr; vector > routes; + bool special_bus = false; for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) { RouteTimeAxisView* rtv = dynamic_cast (*x); @@ -6125,8 +6126,30 @@ Editor::remove_tracks () } } routes.push_back (rtv->_route); - } + if (rtv->route()->is_master() || rtv->route()->is_monitor()) { + special_bus = true; + } + } + + if (special_bus && !Config->get_allow_special_bus_removal()) { + MessageDialog msg (_("That would be bad news ...."), + false, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK); + msg.set_secondary_text (string_compose (_( +"Removing the master or monitor bus is such a bad idea\n\ +that %1 is not going to allow it.\n\ +\n\ +If you really want to do this sort of thing\n\ +edit your ardour.rc file to set the\n\ +\"allow-special-bus-removal\" option to be \"yes\""), PROGRAM_NAME)); + + msg.present (); + msg.run (); + return; + } + if (ntracks + nbusses == 0) { return; } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index f87614b613..71d38360d5 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1226,6 +1226,25 @@ RouteUI::set_color_from_route () void RouteUI::remove_this_route () { + if ((route()->is_master() || route()->is_monitor()) && + !Config->get_allow_special_bus_removal()) { + MessageDialog msg (_("That would be bad news ...."), + false, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK); + msg.set_secondary_text (string_compose (_( +"Removing the master or monitor bus is such a bad idea\n\ +that %1 is not going to allow it.\n\ +\n\ +If you really want to do this sort of thing\n\ +edit your ardour.rc file to set the\n\ +\"allow-special-bus-removal\" option to be \"yes\""), PROGRAM_NAME)); + + msg.present (); + msg.run (); + return; + } + vector choices; string prompt; @@ -1255,7 +1274,7 @@ RouteUI::remove_this_route () gint RouteUI::idle_remove_this_route (RouteUI *rui) { - rui->_session->remove_route (rui->_route); + rui->_session->remove_route (rui->route()); return false; } diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index bbf37362a5..92397c149f 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -152,6 +152,7 @@ CONFIG_VARIABLE (bool, show_waveforms, "show-waveforms", true) CONFIG_VARIABLE (bool, show_waveforms_while_recording, "show-waveforms-while-recording", true) CONFIG_VARIABLE (WaveformScale, waveform_scale, "waveform-scale", Linear) CONFIG_VARIABLE (WaveformShape, waveform_shape, "waveform-shape", Traditional) +CONFIG_VARIABLE (bool, allow_special_bus_removal, "allow-special-bus-removal", false) /* denormal management */ diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 3655a074d8..48d2f6982c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2051,6 +2051,10 @@ Session::add_internal_sends (boost::shared_ptr dest, Placement p, boost:: void Session::remove_route (shared_ptr route) { + if (((route == _master_out) || (route == _monitor_out)) && !Config->get_allow_special_bus_removal()) { + return; + } + { RCUWriter writer (routes); shared_ptr rs = writer.get_copy ();