-void
-IOSelectorWindow::cancel ()
-{
- _selector.Finished(IOSelector::Cancelled);
- hide ();
-}
-
-void
-IOSelectorWindow::accept ()
-{
- _selector.Finished(IOSelector::Accepted);
- hide ();
-}
-
-
-gint
-IOSelectorWindow::on_map (GdkEventAny *ev)
-{
- _selector.redisplay ();
- return Window::on_map (ev);
-}
-
-/*************************
- The IO Selector "widget"
- *************************/
-
-IOSelector::IOSelector (Session& sess, IO& ior, bool input)
- : session (sess),
- io (ior),
- for_input (input),
- port_frame (for_input? _("Inputs") : _("Outputs")),
- add_port_button (for_input? _("Add Input") : _("Add Output")),
- remove_port_button (for_input? _("Remove Input") : _("Remove Output")),
- clear_connections_button (_("Disconnect All"))
-{
- selected_port = 0;
-
- notebook.set_name ("IOSelectorNotebook");
- notebook.set_size_request (-1, 125);
-
- clear_connections_button.set_name ("IOSelectorButton");
- add_port_button.set_name ("IOSelectorButton");
- remove_port_button.set_name ("IOSelectorButton");
-
- selector_frame.set_name ("IOSelectorFrame");
- port_frame.set_name ("IOSelectorFrame");
-
- selector_frame.set_label (_("Available connections"));
-
- selector_button_box.set_spacing (5);
- selector_button_box.set_border_width (5);
-
- selector_box.set_spacing (5);
- selector_box.set_border_width (5);
- selector_box.pack_start (notebook);
- selector_box.pack_start (selector_button_box, false, false);
-
- selector_frame.add (selector_box);
-
- port_box.set_spacing (5);
- port_box.set_border_width (5);
-
- port_display_scroller.set_name ("IOSelectorNotebook");
- port_display_scroller.set_border_width (0);
- port_display_scroller.set_size_request (-1, 170);
- port_display_scroller.add_with_viewport (port_box);
- port_display_scroller.set_policy (Gtk::POLICY_NEVER,
- Gtk::POLICY_AUTOMATIC);
-
- port_button_box.set_spacing (5);
- port_button_box.set_border_width (5);
-
- port_button_box.pack_start (add_port_button, false, false);
-
- 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);
- }
-
- }