prevent removal of master/monitor busses without explicit (and hard to set) approval

git-svn-id: svn://localhost/ardour2/branches/3.0@7265 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-06-16 16:59:20 +00:00
parent a668964d5c
commit 2e644fe91f
4 changed files with 49 additions and 2 deletions

View File

@ -6114,6 +6114,7 @@ Editor::remove_tracks ()
const char* trackstr;
const char* busstr;
vector<boost::shared_ptr<Route> > routes;
bool special_bus = false;
for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) {
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*> (*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;
}

View File

@ -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<string> 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;
}

View File

@ -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 */

View File

@ -2051,6 +2051,10 @@ Session::add_internal_sends (boost::shared_ptr<Route> dest, Placement p, boost::
void
Session::remove_route (shared_ptr<Route> route)
{
if (((route == _master_out) || (route == _monitor_out)) && !Config->get_allow_special_bus_removal()) {
return;
}
{
RCUWriter<RouteList> writer (routes);
shared_ptr<RouteList> rs = writer.get_copy ();