Use conf.fatal for fatal configuration errors
[ardour.git] / gtk2_ardour / add_route_dialog.cc
index 4aeb80e161aa0417f79683b1fa217658db9de8e4..ee251d1f279bf94f440a23fc5b185c24eabdd11f 100644 (file)
@@ -1,21 +1,27 @@
 /*
-  Copyright (C) 2003 Paul Davis
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
+ * Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2015-2017 Ben Loftis <ben@harrisonconsoles.com>
+ * Copyright (C) 2015 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2018 Len Ovens <len@ovenwerks.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <cstdio>
 #include <cmath>
@@ -89,90 +95,95 @@ AddRouteDialog::AddRouteDialog ()
 
        if (builtin_types.empty()) {
                builtin_types.push_back (
-                       std::pair<string,string>(_("Audio Tracks"),  _(" \
-Use the settings, below, to create 1 or more new Audio tracks.\n \
-\n\n \
-You may select:\n \
-* The number of tracks to add.\n \
-* A Name for the new track(s).\n \
-* Mono, Stereo, or Multichannel operation for the new track(s).\n \
-* A Group which the track will be assigned to.\n \
-* The Pin Connections mode. (see tooltip for details).\n \
-* Normal (non-destructive) or Tape (destructive) recording mode.\n \
-\n \
-The track will be added in the location specified by \"Position\".\n \
-")
-               ));
+                  std::pair<string,string> (_("Audio Tracks"), std::string () +
+                    _("Use these settings to create one or more audio tracks.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of tracks to add") + "\n" +
+                    "* " + _("A name for the track(s)") + "\n" +
+                    "* " + _("Mono, stereo, or multi-channel operation for the track(s)") + "\n" +
+                    "* " + _("A group which the track(s) will be assigned to") + "\n" +
+#ifndef MIXBUS
+                    "* " + _("The pin connections mode (see tooltip for details)") + "\n" +
+                    "* " + _("Normal (non-destructive) or tape (destructive) recording mode") + "\n" +
+#endif
+                    "\n" + _("The track(s) will be added at the location specified by \"Position\"")
+                    ));
+
                builtin_types.push_back (
-                       std::pair<string,string>(_("MIDI Tracks"),  _(" \
-Use the settings, below, to create 1 or more new MIDI tracks.\n \
-\n\n \
-You may select:\n \
-* The number of tracks to add.\n \
-* A Name for the track(s).\n \
-* An Instrument plugin (or select \"None\" to drive an external device)\n \
-* A Group which the track will be assigned to.\n \
-* The Pin Connections mode. (see tooltip for details)\n \
-\n \
-The track will be added in the location specified by \"Position\".\n \
-")
-               ));
+                  std::pair<string,string> (_("MIDI Tracks"), std::string () +
+                    _(" Use these settings to create one or more MIDI tracks.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of tracks to add") + "\n" +
+                    "* " + _("A name for the track(s)") + "\n" +
+                    "* " + _("An instrument plugin (or select \"None\" to drive an external device)") + "\n" +
+                    "* " + _("A group which the track(s) will be assigned to") + "\n" +
+#ifndef MIXBUS
+                    "* " + _("The pin connections mode (see tooltip for details)") + "\n" +
+#endif
+                    "\n" + _("The track(s) will be added at the location specified by \"Position\"")
+                    ));
+
+#ifndef MIXBUS
                builtin_types.push_back (
-                       std::pair<string,string>(_("Audio+MIDI Tracks"),   _(" \
-Use the settings, below, to create 1 or more new Audio+MIDI tracks.\n \
-\n\n \
-You may select:\n \
-* The number of tracks to add.\n \
-* A Name for the track(s).\n \
-* An Instrument plugin (or select \"None\" to drive an external device)\n \
-* A Group which will be assigned to the track(s).\n \
-* Pin Connections mode. (see tooltip for details).\n \
-* Normal (non-destructive) or Tape (destructive) recording mode.\n \
-\n \
-The track will be added in the location specified by \"Position\".\n \
-")
-               ));
+                  std::pair<string,string> (_("Audio+MIDI Tracks"), std::string () +
+                    _("Use these settings to create one or more Audio+MIDI tracks.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of tracks to add") + "\n" +
+                    "* " + _("A name for the track(s)") + "\n" +
+                    "* " + _("An instrument plugin (or select \"None\" to drive an external device)") + "\n" +
+                    "* " + _("A group which the track(s) will be assigned to") + "\n" +
+#ifndef MIXBUS
+                    "* " + _("The pin connections mode (see tooltip for details)") + "\n" +
+                    "* " + _("Normal (non-destructive) or tape (destructive) recording mode") + "\n" +
+#endif
+                    "\n" + _("The track(s) will be added at the location specified by \"Position\"")
+                    ));
+#endif
+
                builtin_types.push_back (
-                       std::pair<string,string>(_("Audio Busses"),  _(" \
-Use the settings, below, to create new Audio Tracks.\n \
-\n\n \
-You may select:\n \
-* The number of buses to add.\n \
-* A Name for the track(s).\n \
-* An Instrument plugin (or select \"None\" to drive an external device)\n \
-* A Group which will be assigned to the track(s).\n \
-* Pin Connections mode. (see tooltip for details).\n \
-* Normal (non-destructive) or Tape (destructive) recording mode.\n \
-\n \
-The track will be added in the location specified by \"Position\".\n \
-")
-               ));
+                  std::pair<string,string> (_("Audio Busses"), std::string () +
+                    _("Use these settings to create one or more audio busses.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of busses to add") + "\n" +
+                    "* " + _("A name for the buss(es)") + "\n" +
+                    "* " + _("A group which the buss(es) will be assigned to") + "\n" +
+#ifndef MIXBUS
+                    "* " + _("The pin connections mode (see tooltip for details)") + "\n" +
+#endif
+                    "\n" + _("The buss(es) will be added at the location specified by \"Position\"")
+                    ));
+
+               builtin_types.push_back (
+                  std::pair<string,string> (_("MIDI Busses"), std::string () +
+                    _("Use these settings to create one or more MIDI busses.") + "\n\n" +
+                    _("MIDI busses can combine the output of multiple tracks. They are sometimes used\nto host a single \"heavy\" instrument plugin which is fed from multiple MIDI tracks.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of busses to add") + "\n" +
+                    "* " + _("A name for the buss(es)") + "\n" +
+                    "* " + _("An instrument plugin (or select \"None\" to drive an external device)") + "\n" +
+                    "* " + _("A group which the buss(es) will be assigned to") + "\n" +
+#ifndef MIXBUS
+                    "* " + _("The pin connections mode (see tooltip for details)") + "\n" +
+#endif
+                    "\n" + _("The buss(es) will be added at the location specified by \"Position\"")
+                    ));
+
                builtin_types.push_back (
-                       std::pair<string,string>(_("MIDI Busses"),  _(" \
-Use the settings, below, to create new MIDI Busses.\n \
-\n \
-MIDI Busses can combine the output of multiple tracks. \n \
-MIDI Buses are sometimes used to host a single \"heavy\" instrument plugin which is fed from multiple MIDI tracks.  \
-\n\n \
-You may select:\n \
-* The number of buses to add.\n \
-* A Name for the track(s).\n \
-* An Instrument plugin (or select \"None\" to drive an external device)\n \
-* A Group which will be assigned to the track(s).\n \
-* Pin Connections mode. (see tooltip for details).\n \
-\n \
-The track will be added in the location specified by \"Position\".\n \
-")
-               ));
+                  std::pair<string,string> (_("VCA Masters"), std::string () +
+                    _("Use these settings to create one or more VCA masters.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of VCAs to add") + "\n" +
+                    "* " + _("A name for the VCA(s). \"%n\" will be replaced by an index number for each VCA")
+                    ));
+
                builtin_types.push_back (
-                       std::pair<string,string>(_("VCA Masters"),   _(" \
-Use the settings, below, to create 1 or more VCA Master(s).\n \
-\n\n \
-You may select:\n \
-* The number of buses to add.\n \
-* A name for the new VCAs.  \"%n\" will be replaced by an index number for each VCA.\n \
-")
-               ));
+                  std::pair<string,string> (_("Foldback Busses"), std::string () +
+                    _("Use these settings to create one or more foldback busses.") + "\n\n" +
+                    _("Foldback busses are used as master outputs for monitor channels and are fed by\nhidden monitor sends.") + "\n\n" +
+                    _("You may select:") + "\n" +
+                    "* " + _("The number of busses to add") + "\n" +
+                    "* " + _("A name for the buss(es)")
+                    ));
        }
 
        insert_at_combo.append_text (_("First"));
@@ -571,6 +582,8 @@ AddRouteDialog::type_wanted()
                return AudioTrack;
        } else if (str == _("VCA Masters")) {
                return VCAMaster;
+       } else if (str == _("Foldback Busses")) {
+               return FoldbackBus;
        } else {
                assert (0);
                return AudioTrack;
@@ -598,6 +611,9 @@ AddRouteDialog::maybe_update_name_template_entry ()
        case MidiBus:
                name_template_entry.set_text (_("Bus"));
                break;
+       case FoldbackBus:
+               name_template_entry.set_text (_("Foldback"));
+               break;
        case VCAMaster:
                name_template_entry.set_text (VCA::default_name_template());
                break;
@@ -654,8 +670,8 @@ AddRouteDialog::track_type_chosen ()
                break;
        case MixedTrack:
                {
-                       MessageDialog msg (_("Audio+MIDI tracks are intended for use <b>ONLY</b> with plugins that use both audio and MIDI input data\n\n"
-                                            "If you do not plan to use such a plugin, then use a normal audio or MIDI track instead."),
+                       MessageDialog msg (_("Audio+MIDI tracks are intended for use <b>ONLY</b> with plugins that use both audio and MIDI input data.\n\n"
+                                            "Use a normal audio or MIDI track if you do not plan to use such a plugin."),
                                           true, MESSAGE_INFO, BUTTONS_OK, true);
                        msg.set_position (WIN_POS_MOUSE);
                        msg.run ();
@@ -742,6 +758,27 @@ AddRouteDialog::track_type_chosen ()
                insert_label.set_sensitive (true);
                insert_at_combo.set_sensitive (true);
 
+               break;
+       case FoldbackBus:
+
+               configuration_label.set_sensitive (true);
+               channel_combo.set_sensitive (true);
+
+               mode_label.set_sensitive (false);
+               mode_combo.set_sensitive (false);
+
+               instrument_label.set_sensitive (false);
+               instrument_combo.set_sensitive (false);
+
+               group_label.set_sensitive (false);
+               route_group_combo.set_sensitive (false);
+
+               strict_io_label.set_sensitive (false);
+               strict_io_combo.set_sensitive (false);
+
+               insert_label.set_sensitive (false);
+               insert_at_combo.set_sensitive (false);
+
                break;
        }
 
@@ -763,6 +800,7 @@ AddRouteDialog::name_template_is_default () const
            n == _("MIDI") ||
            n == _("Audio+MIDI") ||
            n == _("Bus") ||
+           n == _("Foldback") ||
            n == VCA::default_name_template()) {
                return true;
        }
@@ -842,6 +880,12 @@ AddRouteDialog::channels ()
                ret.set (DataType::AUDIO, channel_count ());
                ret.set (DataType::MIDI, 1);
                break;
+
+       case FoldbackBus:
+               ret.set (DataType::AUDIO, channel_count ());
+               ret.set (DataType::MIDI, 0);
+               break;
+
        default:
                break;
        }
@@ -957,6 +1001,11 @@ AddRouteDialog::refill_channel_setups ()
                }
        }
 
+       if (!selected_default && !trk_template_model->children().empty()) {
+               TreeModel::Children rows = trk_template_model->children();
+               trk_template_chooser.get_selection()->select(rows[0]);
+       }
+
        std::vector<ARDOUR::TemplateInfo> route_templates;
        ARDOUR::find_route_templates (route_templates);