- _gdk_window.clear ();
-
- Gtk::Widget::on_unrealize ();
-}
-
-
-/**
- * Set up our Pango layout to plot a given string, and compute its dimensions once it has been rotated.
- * @param s String to use.
- * @return width and height of the rotated string, in pixels.
- */
-
-std::pair<int, int>
-RotatedLabelSet::setup_layout (std::string const & s)
-{
- _pango_layout->set_text (s);
-
- /* Here's the unrotated size */
- int w;
- int h;
- _pango_layout->get_pixel_size (w, h);
-
- /* Rotate the width and height as appropriate. I thought Pango might be able to do this for us,
- but I can't find out how... */
- std::pair<int, int> d;
- d.first = int (w * cos (_angle_radians) - h * sin (_angle_radians));
- d.second = int (w * sin (_angle_radians) + h * cos (_angle_radians));
-
- return d;
-}
-
-bool RotatedLabelSet::on_expose_event (GdkEventExpose* event)
-{
- if (!_gdk_window) {
- return true;
- }
-
- int const height = get_allocation().get_height ();
- double const spacing = double (_base_width) / _labels.size();
-
- /* Plot all the labels; really we should clip for efficiency */
- for (uint32_t i = 0; i < _labels.size(); ++i) {
- std::pair<int, int> const d = setup_layout (_labels[i]);
- get_window()->draw_layout (_gc, _base_start + int ((i + 0.25) * spacing), height - d.second, _pango_layout, _fg_colour, _bg_colour);
- }
-
- return true;
-}
-
-void
-RotatedLabelSet::set_n_labels (int n)
-{
- _labels.resize (n);
- queue_resize ();
-}
-
-void
-RotatedLabelSet::set_label (int n, std::string const & l)
-{
- _labels[n] = l;
- queue_resize ();
-}
-
-std::string
-RotatedLabelSet::get_label (int n) const
-{
- return _labels[n];
-}
-
-/**
- * Set the `base dimensions'. These are the dimensions of the area at which the labels start, and
- * have to be set up to match whatever they are labelling.
- *
- * Roughly speaking, we have
- *
- * L L L L
- * E E E E
- * B B B B
- * A A A A
- * L L L L
- * <--s--><--w--->
- */
-
-void
-RotatedLabelSet::set_base_dimensions (int s, int w)
-{
- _base_start = s;
- _base_width = w;
- queue_resize ();
-}
-
-
-/**
- * Construct an IOSelector.
- * @param session Session to operate on.
- * @param io IO to operate on.
- * @param for_input true if the selector is for an input, otherwise false.
- */
-
-IOSelector::IOSelector (ARDOUR::Session& session, boost::shared_ptr<ARDOUR::IO> io, bool for_input)
- : _session (session), _io (io), _for_input (for_input), _width (0), _height (0),
- _ignore_check_button_toggle (false), _add_remove_box_added (false)
-{
- /* Column labels */
- pack_start (_column_labels, true, true);
-
- /* Buttons for adding and removing ports */
- _add_port_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_MENU)));
- _add_port_button.set_label (_("Add port"));
- _add_port_button.signal_clicked().connect (mem_fun (*this, &IOSelector::add_port_button_clicked));
- _add_remove_box.pack_start (_add_port_button);
- _remove_port_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::REMOVE, Gtk::ICON_SIZE_MENU)));
- _remove_port_button.set_label (_("Remove port"));
- _remove_port_button.signal_clicked().connect (mem_fun (*this, &IOSelector::remove_port_button_clicked));
- _add_remove_box.pack_start (_remove_port_button);
- set_button_sensitivity ();
-
- /* Table. We need to put in a HBox, with a dummy label to its right,
- so that the rotated column labels can overhang the right hand side of the table. */
- setup_table_size ();
- setup_row_labels ();
- setup_column_labels ();
- setup_check_button_states ();
- _table_hbox.pack_start (_table, false, false);
- _table_hbox.pack_start (_dummy);
- _table.set_col_spacings (4);
- pack_start (_table_hbox);
-
- show_all ();
-
- update_column_label_dimensions ();
-