- i = tmp;
- }
-
-
- for (uint32_t n = 0; n < limit; ++n) {
-
- TreeView* tview;
- //ScrolledWindow *scroller;
- string really_short_name;
-
- if (for_input) {
- port = io.input (n);
- } else {
- port = io.output (n);
- }
-
- /* we know there is '/' because we put it there */
-
- really_short_name = port->short_name();
- really_short_name = really_short_name.substr (really_short_name.find ('/') + 1);
-
- tview = manage (new TreeView());
- RefPtr<ListStore> port_model = ListStore::create (port_display_columns);
-
- if (!firsttview) {
- firsttview = tview;
- }
-
- tview->set_model (port_model);
- tview->append_column (really_short_name, port_display_columns.displayed_name);
- tview->get_selection()->set_mode (SELECTION_SINGLE);
- tview->set_data ("port", port);
- tview->set_headers_visible (true);
- tview->set_name ("IOSelectorPortList");
-
- port_box.pack_start (*tview);
- port_displays.insert (port_displays.end(), tview);
-
- /* now fill the clist with the current connections */
-
-
- const char **connections = port->get_connections ();
-
- if (connections) {
- for (uint32_t c = 0; connections[c]; ++c) {
- TreeModel::Row row = *(port_model->append());
- row[port_display_columns.displayed_name] = connections[c];
- row[port_display_columns.full_name] = connections[c];
- }
- }
-
- if (for_input) {
-
- if (io.input_maximum() == 1) {
- selected_port = port;
- selected_port_tview = tview;
- } else {
- if (port == selected_port) {
- selected_port_tview = tview;
- }
- }
-
- } else {
-
- if (io.output_maximum() == 1) {
- selected_port = port;
- selected_port_tview = tview;
- } else {
- if (port == selected_port) {
- selected_port_tview = tview;
- }
- }
- }
-
- TreeViewColumn* col = tview->get_column (0);
-
- col->set_clickable (true);
-
- /* handle button events on the column header and within the treeview itself */
- col->signal_clicked().connect (bind (mem_fun(*this, &IOSelector::select_treeview), tview));
- tview->signal_button_release_event().connect (bind (mem_fun(*this, &IOSelector::connection_button_release), tview));
- }
-
- port_box.show_all ();
-
- if (selected_port_tview) {
- // GTK2FIX
- // selected_port_tview->click_column(0);
- selected_port_tview->set_name ("IOSelectorPortListSelected");
- for (slist<TreeView *>::iterator i = port_displays.begin(); i != port_displays.end(); ++i) {
- if (*i != selected_port_tview) {
- (*i)->set_name ("IOSelectorPortList");
- (*i)->queue_draw ();
- }
- }
- } else {
- selected_port = 0;
- selector_box.hide_all ();
- }
- }
-
- if (selected_port_tview) {
- select_treeview (selected_port_tview);
- } else if (firsttview) {
- // select first
- select_treeview (firsttview);
- }
-}
-
-bool
-IOSelector::port_selection_changed (GdkEventButton *ev, TreeView* treeview)
-{
- TreeModel::iterator i = treeview->get_selection()->get_selected();
- int status;
-
- if (!i) {
- return 0;
- }
-
- if (selected_port == 0) {
- return 0;
- }
-
- ustring other_port_name = (*i)[port_display_columns.full_name];
-
- if (for_input) {
- if ((status = io.connect_input (selected_port, other_port_name, this)) == 0) {
- Port *p = session.engine().get_port_by_name (other_port_name);
- p->enable_metering();
- }