#include "ardour/session.h"
#include "ardour/route.h"
#include "ardour/audioengine.h"
+#include "gtkmm2ext/utils.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
#include "port_matrix_component.h"
#include "ardour_dialog.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
#include "gui_thread.h"
#include "utils.h"
_session->engine().PortRegisteredOrUnregistered.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports, this), gui_context());
/* watch for route order keys changing, which changes the order of things in our global ports list(s) */
- Route::SyncOrderKeys.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());
+ PresentationInfo::Change.connect (_session_connections, invalidator (*this), boost::bind (&PortMatrix::setup_global_ports_proxy, this), gui_context());
/* Part 3: other stuff */
if (io) {
int const r = io->add_port ("", this, t);
if (r == -1) {
- Gtk::MessageDialog msg (_("It is not possible to add a port here, as the first processor in the track or buss cannot "
- "support the new configuration."
- ));
+ Gtk::MessageDialog msg (_("It is not possible to add a port here."));
msg.set_title (_("Cannot add port"));
msg.run ();
}
void
PortMatrix::remove_channel (ARDOUR::BundleChannel b)
{
+ std::string errmsg;
boost::shared_ptr<IO> io = io_from_bundle (b.bundle);
+ boost::shared_ptr<Port> p = io->nth (b.channel);
- if (io) {
- boost::shared_ptr<Port> p = io->nth (b.channel);
- if (p) {
- int const r = io->remove_port (p, this);
- if (r == -1) {
- ArdourDialog d (_("Port removal not allowed"));
- Label l (_("This port cannot be removed.\nEither the first plugin in the track or buss cannot accept\nthe new number of inputs or the last plugin has more outputs."));
- d.get_vbox()->pack_start (l);
- d.add_button (Stock::OK, RESPONSE_ACCEPT);
- d.set_modal (true);
- d.show_all ();
- d.run ();
- }
+ if (!io || !p) {
+ return;
+ }
+
+ if (io->n_ports ().n_total () == 1) {
+ errmsg = _("The last port cannot be removed");
+ } else {
+ if (-1 == io->remove_port (p, this)) {
+ errmsg = _("This port cannot be removed.");
}
}
+
+ if (!errmsg.empty ()) {
+ ArdourDialog d (_("Port removal not allowed"));
+ Label l (errmsg);
+ d.get_vbox()->pack_start (l);
+ d.add_button (Stock::OK, RESPONSE_ACCEPT);
+ d.set_modal (true);
+ d.show_all ();
+ d.run ();
+ }
}
void
label->set_text ((*j)->name);
} else if (c.length() && c[0] != '<' && has_connection) {
/* this label is not marked up with <b> but should be */
- label->set_markup (string_compose ("<b>%1</b>", Glib::Markup::escape_text ((*j)->name).c_str()));
+ label->set_markup (string_compose ("<b>%1</b>", Gtkmm2ext::markup_escape_text ((*j)->name)));
}
++p;