X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fio_selector.cc;h=16576a0b8ff358a8bdffe0b04e4a0aa4f622d050;hb=e11b3f90c2d02735a071d526d67cfd0de90cbac3;hp=cecea984709ca703d8c50e447840649ee7c9af1c;hpb=8ab17e96312f1a61c014c50687e15430d5ae786b;p=ardour.git diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index cecea98470..16576a0b8f 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -17,8 +17,11 @@ */ +#include #include + #include + #include #include "ardour/session.h" #include "ardour/io.h" @@ -27,26 +30,35 @@ #include "ardour/audio_track.h" #include "ardour/midi_track.h" #include "ardour/data_type.h" + #include "io_selector.h" #include "utils.h" #include "gui_thread.h" #include "i18n.h" +using namespace ARDOUR; +using namespace Gtk; + IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr io, bool offer_inputs) : PortMatrix ( - session, io->default_type(), offer_inputs, + session, io->default_type(), !offer_inputs, PortGroupList::Mask (PortGroupList::BUSS | PortGroupList::SYSTEM | PortGroupList::OTHER) ), _io (io) { /* Listen for ports changing on the IO */ - if (!offer_inputs) { + if (_offer_inputs) { _io->input_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } else { _io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } -} + /* this got lost in a merge from 2.0 */ + + // set_button_sensitivity (); + // io->name_changed.connect (mem_fun(*this, &IOSelector::name_changed)); + +} void IOSelector::ports_changed (ARDOUR::IOChange change, void *src) @@ -88,7 +100,6 @@ IOSelector::get_state (int r, std::string const & p) const } int k = 0; - for (vector::iterator i = connections.begin(); i != connections.end(); ++i) { if ((*i)== p) { @@ -155,8 +166,8 @@ IOSelector::add_row () _io->add_input_port ("", this); } - catch (ARDOUR::AudioEngine::PortRegistrationFailure& err) { - Gtk::MessageDialog msg (0, _("There are no more JACK ports available.")); + catch (AudioEngine::PortRegistrationFailure& err) { + MessageDialog msg (_("There are no more JACK ports available.")); msg.run (); } @@ -166,14 +177,13 @@ IOSelector::add_row () _io->add_output_port ("", this); } - catch (ARDOUR::AudioEngine::PortRegistrationFailure& err) { - Gtk::MessageDialog msg (0, _("There are no more JACK ports available.")); + catch (AudioEngine::PortRegistrationFailure& err) { + MessageDialog msg (_("There are no more JACK ports available.")); msg.run (); } } } - void IOSelector::remove_row (int r) { @@ -193,7 +203,54 @@ IOSelector::row_descriptor () const return _("port"); } +#if 0 +void +IOSelector::set_button_sensitivity () +{ + if (for_input) { + + if (io->input_maximum() < 0 || io->input_maximum() > (int) io->n_inputs()) { + add_port_button.set_sensitive (true); + } else { + add_port_button.set_sensitive (false); + } + + } else { + if (io->output_maximum() < 0 || io->output_maximum() > (int) io->n_outputs()) { + add_port_button.set_sensitive (true); + } else { + add_port_button.set_sensitive (false); + } + + } + + if (for_input) { + if (io->n_inputs() && (io->input_minimum() < 0 || io->input_minimum() < (int) io->n_inputs())) { + remove_port_button.set_sensitive (true); + } else { + remove_port_button.set_sensitive (false); + } + + } else { + if (io->n_outputs() && (io->output_minimum() < 0 || io->output_minimum() < (int) io->n_outputs())) { + remove_port_button.set_sensitive (true); + } else { + remove_port_button.set_sensitive (false); + } + } +} +#endif + +#if 0 +void +IOSelector::name_changed (void* src) +{ + ENSURE_GUI_THREAD(bind (mem_fun(*this, &IOSelector::name_changed), src)); + + display_ports (); +} +#endif IOSelectorWindow::IOSelectorWindow ( ARDOUR::Session& session, boost::shared_ptr io, bool for_input, bool can_cancel