From 24cafcf8e6fe3d4e303125037bd9efc534e61646 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 22 Jan 2009 03:38:40 +0000 Subject: Some small-ish port matrix rendering improvements. git-svn-id: svn://localhost/ardour2/branches/3.0@4430 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/port_matrix.cc | 2 +- gtk2_ardour/port_matrix_body.cc | 16 ++++++++-------- gtk2_ardour/port_matrix_body.h | 6 +++--- gtk2_ardour/port_matrix_column_labels.cc | 7 +++---- gtk2_ardour/port_matrix_component.h | 6 ++++++ 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/gtk2_ardour/port_matrix.cc b/gtk2_ardour/port_matrix.cc index 66d9f41be0..97e3c5b3ce 100644 --- a/gtk2_ardour/port_matrix.cc +++ b/gtk2_ardour/port_matrix.cc @@ -217,5 +217,5 @@ PortMatrix::disassociate_all () } } - _body.repaint_grid (); + _body.rebuild_and_draw_grid (); } diff --git a/gtk2_ardour/port_matrix_body.cc b/gtk2_ardour/port_matrix_body.cc index 3a69c4ccf2..8ce1d8b635 100644 --- a/gtk2_ardour/port_matrix_body.cc +++ b/gtk2_ardour/port_matrix_body.cc @@ -232,14 +232,14 @@ PortMatrixBody::setup ( for (std::vector >::iterator i = _row_bundles.begin(); i != _row_bundles.end(); ++i) { _bundle_connections.push_back ( - (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::repaint_row_labels)) + (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_row_labels)) ); } for (std::vector >::iterator i = _column_bundles.begin(); i != _column_bundles.end(); ++i) { _bundle_connections.push_back ( - (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::repaint_column_labels)) + (*i)->NameChanged.connect (sigc::mem_fun (*this, &PortMatrixBody::rebuild_and_draw_column_labels)) ); } @@ -318,22 +318,22 @@ PortMatrixBody::on_button_press_event (GdkEventButton* ev) } void -PortMatrixBody::repaint_grid () +PortMatrixBody::rebuild_and_draw_grid () { - _grid.require_render (); + _grid.require_rebuild (); queue_draw (); } void -PortMatrixBody::repaint_column_labels () +PortMatrixBody::rebuild_and_draw_column_labels () { - _column_labels.require_render (); + _column_labels.require_rebuild (); queue_draw (); } void -PortMatrixBody::repaint_row_labels () +PortMatrixBody::rebuild_and_draw_row_labels () { - _row_labels.require_render (); + _row_labels.require_rebuild (); queue_draw (); } diff --git a/gtk2_ardour/port_matrix_body.h b/gtk2_ardour/port_matrix_body.h index bb2d592fe8..753f4f7096 100644 --- a/gtk2_ardour/port_matrix_body.h +++ b/gtk2_ardour/port_matrix_body.h @@ -63,7 +63,7 @@ public: void set_xoffset (uint32_t); void set_yoffset (uint32_t); - void repaint_grid (); + void rebuild_and_draw_grid (); protected: bool on_expose_event (GdkEventExpose *); @@ -73,8 +73,8 @@ protected: private: void compute_rectangles (); - void repaint_column_labels (); - void repaint_row_labels (); + void rebuild_and_draw_column_labels (); + void rebuild_and_draw_row_labels (); PortMatrix* _port_matrix; PortMatrixColumnLabels _column_labels; diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc index 90099eb1e5..72954d1627 100644 --- a/gtk2_ardour/port_matrix_column_labels.cc +++ b/gtk2_ardour/port_matrix_column_labels.cc @@ -167,8 +167,7 @@ PortMatrixColumnLabels::render (cairo_t* cr) for (uint32_t j = 0; j < (*i)->nchannels(); ++j) { - double const lc = _longest_channel_name + (2 * name_pad()); - double const lb = _longest_bundle_name + (2 * name_pad()); + double const lc = _longest_channel_name + name_pad(); double const w = column_width(); if (_location == BOTTOM) { @@ -179,8 +178,8 @@ PortMatrixColumnLabels::render (cairo_t* cr) cairo_move_to (cr, x_, y_); x_ -= w; cairo_line_to (cr, x_, y_); - x_ -= lb * cos (angle()); - y_ += lb * sin (angle()); + x_ -= lc * cos (angle()); + y_ += lc * sin (angle()); cairo_line_to (cr, x_, y_); x_ += w * pow (sin (angle()), 2); y_ += w * sin (angle()) * cos (angle()); diff --git a/gtk2_ardour/port_matrix_component.h b/gtk2_ardour/port_matrix_component.h index a041c807e8..cd836f82ee 100644 --- a/gtk2_ardour/port_matrix_component.h +++ b/gtk2_ardour/port_matrix_component.h @@ -36,9 +36,15 @@ public: void setup (); GdkPixmap* get_pixmap (GdkDrawable *); std::pair dimensions (); + void require_render () { _render_required = true; } + + void require_rebuild () { + _dimension_computation_required = true; + _render_required = true; + } /** @return width of columns in the grid */ static uint32_t column_width () { -- cgit v1.2.3