- clear ();
-
- /* Work out how many rows we have */
- ARDOUR::DataType const t = _io->default_type();
-
- int rows;
- if (_for_input) {
- rows = _io->n_inputs().get(t);
- } else {
- rows = _io->n_outputs().get(t);
- }
-
- /* Row labels */
- _row_labels_vbox = new Gtk::VBox;
- for (int i = 0; i < rows; ++i) {
- Gtk::Label* label = new Gtk::Label (_for_input ? _io->input(i)->name() : _io->output(i)->name());
- Gtk::EventBox* b = new Gtk::EventBox;
- b->set_events (Gdk::BUTTON_PRESS_MASK);
- b->signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &IOSelector::row_label_button_pressed), i));
- b->add (*Gtk::manage (label));
- _row_labels.push_back (b);
- _row_labels_vbox->pack_start (*b, false, false);
- }
- _left_vbox.pack_start (*_row_labels_vbox, false, false);
- _left_vbox_pad = new Gtk::Label ("");
- _left_vbox.pack_start (*_left_vbox_pad, false, false);
-
- /* Checkbutton tables */
- int n = 0;
- for (PortGroupList::iterator i = _port_group_list.begin(); i != _port_group_list.end(); ++i) {
- PortGroupTable* t = new PortGroupTable (*i, _io, _for_input);
-
- /* XXX: this is a bit of a hack; should probably use a configurable colour here */
- Gdk::Color alt_bg = get_style()->get_bg (Gtk::STATE_NORMAL);
- alt_bg.set_rgb (alt_bg.get_red() + 4096, alt_bg.get_green() + 4096, alt_bg.get_blue () + 4096);
- if ((n % 2) == 0) {
- t->get_widget().modify_bg (Gtk::STATE_NORMAL, alt_bg);
- }
-
- _port_group_tables.push_back (t);
- _port_group_hbox.pack_start (t->get_widget(), false, false);
- ++n;
- }
-
- show_all ();
-}
-
-void
-IOSelector::ports_changed (ARDOUR::IOChange change, void *src)
-{
- ENSURE_GUI_THREAD (bind (mem_fun (*this, &IOSelector::ports_changed), change, src));
-
- redisplay ();
-}
-
-
-void
-IOSelector::redisplay ()
-{
- _port_group_list.refresh ();
- setup ();
-}
-
-
-/** Handle a button press on a row label */
-bool
-IOSelector::row_label_button_pressed (GdkEventButton* e, int r)
-{
- if (e->type != GDK_BUTTON_PRESS || e->button != 3) {
- return false;