Fix thinkos in cubasish theme
[ardour.git] / gtk2_ardour / plugin_setup_dialog.cc
index 3398f8bb8318cc4563587100cc0f7fb671d02515..a49efe5637dc0a5eea55347f61c46b6277914bac 100644 (file)
@@ -1,29 +1,31 @@
 /*
- * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
- * Copyright (C) 2011 Paul Davis
+ * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
  *
- * 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 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.
+ * 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 <gtkmm/frame.h>
 #include <gtkmm/label.h>
+#include <gtkmm/stock.h>
+#include <gtkmm/table.h>
 
 #include "plugin_setup_dialog.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace Gtk;
 
 PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost::shared_ptr<ARDOUR::PluginInsert> pi, ARDOUR::Route::PluginSetupOptions flags)
@@ -31,6 +33,7 @@ PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost:
        , _route (r)
        , _pi (pi)
        , _keep_mapping (_("Copy I/O Map"), ArdourButton::led_default_elements)
+       , _fan_out (_("Fan out"), ArdourButton::led_default_elements)
 {
        assert (flags != Route::None);
 
@@ -71,7 +74,7 @@ PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost:
                f->add (*box);
                tbl->attach (*f, 0, 1, row, row + 1, EXPAND|FILL, SHRINK, 0, 8);
 
-               _keep_mapping.signal_clicked.connect (sigc::mem_fun (*this, &PluginSetupDialog::apply_mapping)); 
+               _keep_mapping.signal_clicked.connect (sigc::mem_fun (*this, &PluginSetupDialog::apply_mapping));
                add_button ("Replace", 2);
        } else {
 
@@ -86,13 +89,17 @@ PluginSetupDialog::PluginSetupDialog (boost::shared_ptr<ARDOUR::Route> r, boost:
                Box* box = manage (new HBox ());
                box->set_border_width (2);
                box->pack_start (_out_presets, true, true);
+               box->pack_start (_fan_out, false, false);
                Frame* f = manage (new Frame ());
                f->set_label (_("Output Configuration"));
                f->add (*box);
                tbl->attach (*f, 1, 2, row, row + 1, EXPAND|FILL, SHRINK, 0, 8);
+               _fan_out.signal_clicked.connect (sigc::mem_fun (*this, &PluginSetupDialog::toggle_fan_out));
+               _fan_out.set_active (true);
        } else {
                _pi->set_preset_out (_pi->natural_output_streams ());
                update_sensitivity (_pi->natural_output_streams ().n_audio ());
+               _fan_out.set_active (false);
        }
 
        _keep_mapping.set_active (false);
@@ -140,6 +147,8 @@ PluginSetupDialog::setup_output_presets ()
 
        if (have_matching_io) {
                select_output_preset (_cur_outputs.n_audio ());
+       } else if (ppc.size() == 1 && _pi->strict_io ()) {
+               select_output_preset (*ppc.begin ());
        } else {
                select_output_preset (0);
        }
@@ -162,6 +171,7 @@ PluginSetupDialog::update_sensitivity (uint32_t n_audio)
        } else {
                _keep_mapping.set_sensitive (false);
        }
+       _fan_out.set_sensitive (n_audio > 2);
 }
 
 bool
@@ -190,6 +200,12 @@ PluginSetupDialog::apply_mapping ()
        }
 }
 
+void
+PluginSetupDialog::toggle_fan_out ()
+{
+       _fan_out.set_active (!_fan_out.get_active ());
+}
+
 std::string
 PluginSetupDialog::preset_label (uint32_t n_audio) const
 {