summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-16 16:59:20 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-16 16:59:20 +0000
commit2e644fe91fd30743527010dd799bf11db1af7313 (patch)
tree15dffcccc06df9786972d49a39b256f62be7e7bf
parenta668964d5c07c8edf6fc0036fd927eb74f4b1546 (diff)
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
-rw-r--r--gtk2_ardour/editor_ops.cc25
-rw-r--r--gtk2_ardour/route_ui.cc21
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h1
-rw-r--r--libs/ardour/session.cc4
4 files changed, 49 insertions, 2 deletions
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<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;
}
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<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;
}
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<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 ();