X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fio_selector.cc;h=16576a0b8ff358a8bdffe0b04e4a0aa4f622d050;hb=e11b3f90c2d02735a071d526d67cfd0de90cbac3;hp=b0b1a5f9b7674496e87b2e0995a8902fc6bfc8e4;hpb=8c743c2c0c6ce55eecffb16aeeb6b844b586c437;p=ardour.git diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index b0b1a5f9b7..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,11 +30,15 @@ #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, @@ -46,14 +53,12 @@ IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr _io->output_changed.connect (mem_fun(*this, &IOSelector::ports_changed)); } -#ifdef FIXME - /* these got lost in a merge from 2.0 */ - set_button_sensitivity (); - io->name_changed.connect (mem_fun(*this, &IOSelector::name_changed)); -#endif + /* 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) @@ -161,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 (); } @@ -172,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) { @@ -199,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