- if (_setup_once) {
-
- /* we've set up before, so we need to clean up before re-setting-up */
- /* XXX: we ought to be able to do this by just getting a list of children
- from each container widget, but I couldn't make that work */
-
- for (std::vector<Gtk::CheckButton*>::iterator i = _column_visibility_buttons.begin(); i != _column_visibility_buttons.end(); ++i) {
- _column_visibility_box.remove (**i);
- delete *i;
- }
-
- _column_visibility_buttons.clear ();
-
- for (std::vector<Gtk::CheckButton*>::iterator i = _row_visibility_buttons.begin(); i != _row_visibility_buttons.end(); ++i) {
- _row_visibility_box.remove (**i);
- delete *i;
- }
-
- _row_visibility_buttons.clear ();
-
- _scroller_table.remove (_vscroll);
- _scroller_table.remove (*_body);
- _scroller_table.remove (_hscroll);
-
- remove (_scroller_table);
- if (_row_visibility_box_added) {
- remove (_row_visibility_box);
- }
-
- if (_column_visibility_box_added) {
- remove (_column_visibility_box);
- }
- }
-
- if (_column_index == 0) {
- _column_visibility_label.set_text (_("Show Outputs"));
- _row_visibility_label.set_text (_("Show Inputs"));
- } else {
- _column_visibility_label.set_text (_("Show Inputs"));
- _row_visibility_label.set_text (_("Show Outputs"));
- }
-
- for (PortGroupList::List::const_iterator i = columns()->begin(); i != columns()->end(); ++i) {
- Gtk::CheckButton* b = new Gtk::CheckButton ((*i)->name);
- b->set_active ((*i)->visible());
- boost::weak_ptr<PortGroup> w (*i);
- b->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &PortMatrix::visibility_toggled), w, b));
- _column_visibility_buttons.push_back (b);
- _column_visibility_box.pack_start (*b, Gtk::PACK_SHRINK);
- }
-
- for (PortGroupList::List::const_iterator i = rows()->begin(); i != rows()->end(); ++i) {
- Gtk::CheckButton* b = new Gtk::CheckButton ((*i)->name);
- b->set_active ((*i)->visible());
- boost::weak_ptr<PortGroup> w (*i);
- b->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &PortMatrix::visibility_toggled), w, b));
- _row_visibility_buttons.push_back (b);
- _row_visibility_box.pack_start (*b, Gtk::PACK_SHRINK);
- }
-
- if (_arrangement == TOP_TO_RIGHT) {
-
- _scroller_table.attach (_hscroll, 0, 1, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
- _scroller_table.attach (*_body, 0, 1, 1, 2);
- _scroller_table.attach (_vscroll, 1, 2, 1, 2, Gtk::SHRINK);
-
- attach (_scroller_table, 0, 1, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND);
-
- if (rows()->size() > 1) {
- attach (_row_visibility_box, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
- _row_visibility_box_added = true;
- } else {
- _row_visibility_box_added = false;
- }
-
- if (columns()->size() > 1) {
- attach (_column_visibility_box, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
- _column_visibility_box_added = true;
- } else {
- _column_visibility_box_added = false;
- }
-
- } else {
- _scroller_table.attach (_vscroll, 0, 1, 0, 1, Gtk::SHRINK);
- _scroller_table.attach (*_body, 1, 2, 0, 1);
- _scroller_table.attach (_hscroll, 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
-
- if (rows()->size() > 1) {
- attach (_row_visibility_box, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
- _row_visibility_box_added = true;
- } else {
- _row_visibility_box_added = false;
- }
-
- attach (_scroller_table, 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND);
-
- if (columns()->size() > 1) {
- attach (_column_visibility_box, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
- _column_visibility_box_added = true;
- } else {
- _column_visibility_box_added = false;
- }
- }
-
- _setup_once = true;
-