X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fio_selector.cc;h=99050cc34ba0a5a75c728d2cf1da11cdd6004b1c;hb=5d2a03578c3f0d0f39562546bd3e4be9be08d2d4;hp=b9e19de7adb867df65427576e7b99bfc6c4ef9f0;hpb=67ae8c8eb921d0e7176e809cdbd23a5d1867ade2;p=ardour.git diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index b9e19de7ad..99050cc34b 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -17,29 +17,26 @@ */ -#include +#include + #include #include -#include "ardour/port_insert.h" -#include "ardour/session.h" -#include "ardour/io.h" #include "ardour/audioengine.h" -#include "ardour/track.h" -#include "ardour/audio_track.h" -#include "ardour/midi_track.h" -#include "ardour/mtdm.h" +#include "ardour/bundle.h" #include "ardour/data_type.h" +#include "ardour/io.h" #include "ardour/port.h" -#include "ardour/bundle.h" +#include "ardour/session.h" #include "io_selector.h" #include "utils.h" #include "gui_thread.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace Gtk; IOSelector::IOSelector (Gtk::Window* p, ARDOUR::Session* session, boost::shared_ptr io) @@ -119,7 +116,7 @@ IOSelector::setup_ports (int dim) if (dim == _other) { - _ports[_other].gather (_session, type(), _find_inputs_for_io_outputs, false); + _ports[_other].gather (_session, type(), _find_inputs_for_io_outputs, false, show_only_bundles ()); } else { @@ -139,16 +136,20 @@ IOSelector::set_state (ARDOUR::BundleChannel c[2], bool s) for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) { - Port* f = _session->engine().get_port_by_name (*i); + boost::shared_ptr f = _session->engine().get_port_by_name (*i); if (!f) { return; } - if (s) { - _io->connect (f, *j, 0); - } else { - _io->disconnect (f, *j, 0); - } + if (s) { + if (!f->connected_to (*j)) { + _io->connect (f, *j, 0); + } + } else { + if (f->connected_to (*j)) { + _io->disconnect (f, *j, 0); + } + } } } } @@ -172,7 +173,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const for (ARDOUR::Bundle::PortList::const_iterator i = our_ports.begin(); i != our_ports.end(); ++i) { for (ARDOUR::Bundle::PortList::const_iterator j = other_ports.begin(); j != other_ports.end(); ++j) { - Port* f = _session->engine().get_port_by_name (*i); + boost::shared_ptr f = _session->engine().get_port_by_name (*i); /* since we are talking about an IO, our ports should all have an associated Port *, so the above call should never fail */ @@ -204,27 +205,25 @@ IOSelector::list_is_global (int dim) const return (dim == _other); } -string +std::string IOSelector::disassociation_verb () const { return _("Disconnect"); } -string +std::string IOSelector::channel_noun () const { return _("port"); } IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr io, bool /*can_cancel*/) - : ArdourDialog (_("I/O selector")) - , _selector (this, session, io) + : ArdourWindow (_("I/O selector")) + , _selector (this, session, io) { set_name ("IOSelectorWindow2"); - get_vbox()->pack_start (_selector); - - set_position (Gtk::WIN_POS_MOUSE); + add (_selector); io_name_changed (this); @@ -237,8 +236,7 @@ bool IOSelectorWindow::wm_delete (GdkEventAny* /*event*/) { _selector.Finished (IOSelector::Accepted); - hide (); - return true; + return false; } @@ -253,7 +251,7 @@ void IOSelectorWindow::on_show () { Gtk::Window::on_show (); - pair const pm_max = _selector.max_size (); + std::pair const pm_max = _selector.max_size (); resize_window_to_proportion_of_monitor (this, pm_max.first, pm_max.second); } @@ -262,7 +260,7 @@ IOSelectorWindow::io_name_changed (void*) { ENSURE_GUI_THREAD (*this, &IOSelectorWindow::io_name_changed, src) - string title; + std::string title; if (!_selector.find_inputs_for_io_outputs()) { title = string_compose(_("%1 input"), _selector.io()->name());