From af5b9f92a52f08d154ad84c60c61823cb45b62db Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 18 Jul 2009 13:10:08 +0000 Subject: Various tweaks to the port matrix. git-svn-id: svn://localhost/ardour2/branches/3.0@5380 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/global_port_matrix.cc | 18 ++++++++++++++++++ gtk2_ardour/global_port_matrix.h | 2 ++ gtk2_ardour/port_group.cc | 4 +--- gtk2_ardour/port_matrix.cc | 17 ++++------------- gtk2_ardour/port_matrix.h | 4 ++-- gtk2_ardour/port_matrix_body.cc | 1 + gtk2_ardour/port_matrix_column_labels.cc | 8 ++++++-- gtk2_ardour/port_matrix_row_labels.cc | 6 +++++- 8 files changed, 39 insertions(+), 21 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/global_port_matrix.cc b/gtk2_ardour/global_port_matrix.cc index b19c383565..64ed8e04d9 100644 --- a/gtk2_ardour/global_port_matrix.cc +++ b/gtk2_ardour/global_port_matrix.cc @@ -128,13 +128,31 @@ GlobalPortMatrixWindow::GlobalPortMatrixWindow (ARDOUR::Session& s, ARDOUR::Data people with very large monitors */ resize (32768, 32768); + + _port_matrix.MaxSizeChanged.connect (mem_fun (*this, &GlobalPortMatrixWindow::max_size_changed)); } void GlobalPortMatrixWindow::on_realize () { Window::on_realize (); + set_max_size (); +} +void +GlobalPortMatrixWindow::max_size_changed () +{ + set_max_size (); + resize (32768, 32768); +} + +void +GlobalPortMatrixWindow::set_max_size () +{ + if ((get_flags() & Gtk::REALIZED) == 0) { + return; + } + pair const m = _port_matrix.max_size (); GdkGeometry g; diff --git a/gtk2_ardour/global_port_matrix.h b/gtk2_ardour/global_port_matrix.h index 1e383a094a..0e5fb02dc5 100644 --- a/gtk2_ardour/global_port_matrix.h +++ b/gtk2_ardour/global_port_matrix.h @@ -64,6 +64,8 @@ public: private: void on_realize (); + void max_size_changed (); + void set_max_size (); GlobalPortMatrix _port_matrix; Gtk::Button _rescan_button; diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index 93211f02e9..544d0e527e 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -421,9 +421,7 @@ PortGroupList::bundles () const _bundles.clear (); for (PortGroupList::List::const_iterator i = begin (); i != end (); ++i) { - if ((*i)->visible()) { - std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (_bundles)); - } + std::copy ((*i)->bundles().begin(), (*i)->bundles().end(), std::back_inserter (_bundles)); } return _bundles; diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index a35ec2f046..8727c1f677 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -50,8 +50,7 @@ PortMatrix::PortMatrix (ARDOUR::Session& session, ARDOUR::DataType type) _column_index (1), _min_height_divisor (1), _show_only_bundles (false), - _inhibit_toggle_show_only_bundles (false), - _realized (false) + _inhibit_toggle_show_only_bundles (false) { _body = new PortMatrixBody (this); @@ -115,7 +114,7 @@ PortMatrix::routes_changed () void PortMatrix::setup () { - if (!_realized) { + if ((get_flags () & Gtk::REALIZED) == 0) { select_arrangement (); } @@ -461,15 +460,7 @@ PortMatrix::max_size () const } void -PortMatrix::on_realize () +PortMatrix::setup_max_size () { - Widget::on_realize (); - _realized = true; -} - -void -PortMatrix::on_unrealize () -{ - Widget::on_unrealize (); - _realized = false; + MaxSizeChanged (); } diff --git a/gtk2_ardour/port_matrix.h b/gtk2_ardour/port_matrix.h index 666a55da04..4d103bf369 100644 --- a/gtk2_ardour/port_matrix.h +++ b/gtk2_ardour/port_matrix.h @@ -110,6 +110,8 @@ public: void setup_all_ports (); std::pair max_size () const; + void setup_max_size (); + sigc::signal MaxSizeChanged; /** @param c Channels; where c[0] is from _ports[0] and c[1] is from _ports[1]. * @param s New state. @@ -160,8 +162,6 @@ private: void hide_group (boost::weak_ptr); void show_group (boost::weak_ptr); void toggle_show_only_bundles (); - void on_realize (); - void on_unrealize (); /// port type that we are working with ARDOUR::DataType _type; diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index a29f2483e3..93345e893e 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -471,6 +471,7 @@ void PortMatrixBody::component_size_changed () { compute_rectangles (); + _matrix->setup_max_size (); _matrix->setup_scrollbars (); } diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc index 148397d0c5..3183d96a9d 100644 --- a/gtk2_ardour/port_matrix_column_labels.cc +++ b/gtk2_ardour/port_matrix_column_labels.cc @@ -150,7 +150,7 @@ PortMatrixColumnLabels::render (cairo_t* cr) /* compute width of this group */ uint32_t w = 0; - if (!(*i)->visible() || (*i)->bundles().empty()) { + if (!(*i)->visible()) { w = grid_spacing (); } else { if (_matrix->show_only_bundles()) { @@ -158,7 +158,11 @@ PortMatrixColumnLabels::render (cairo_t* cr) } else { w = (*i)->total_channels() * grid_spacing(); } - } + } + + if (w == 0) { + continue; + } /* rectangle */ set_source_rgb (cr, get_a_group_colour (g)); diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc index 2cad8dda3e..00806b36a5 100644 --- a/gtk2_ardour/port_matrix_row_labels.cc +++ b/gtk2_ardour/port_matrix_row_labels.cc @@ -121,7 +121,7 @@ PortMatrixRowLabels::render (cairo_t* cr) /* compute height of this group */ double h = 0; - if (!(*i)->visible() || (*i)->bundles().empty()) { + if (!(*i)->visible()) { h = grid_spacing (); } else { if (_matrix->show_only_bundles()) { @@ -130,6 +130,10 @@ PortMatrixRowLabels::render (cairo_t* cr) h = (*i)->total_channels () * grid_spacing(); } } + + if (h == 0) { + continue; + } /* rectangle */ set_source_rgb (cr, get_a_group_colour (g)); -- cgit v1.2.3