13
0

Some small-ish port matrix rendering improvements.

git-svn-id: svn://localhost/ardour2/branches/3.0@4430 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-01-22 03:38:40 +00:00
parent 95bd7ba716
commit 24cafcf8e6
5 changed files with 21 additions and 16 deletions

View File

@ -217,5 +217,5 @@ PortMatrix::disassociate_all ()
} }
} }
_body.repaint_grid (); _body.rebuild_and_draw_grid ();
} }

View File

@ -232,14 +232,14 @@ PortMatrixBody::setup (
for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _row_bundles.begin(); i != _row_bundles.end(); ++i) { for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _row_bundles.begin(); i != _row_bundles.end(); ++i) {
_bundle_connections.push_back ( _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<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _column_bundles.begin(); i != _column_bundles.end(); ++i) { for (std::vector<boost::shared_ptr<ARDOUR::Bundle> >::iterator i = _column_bundles.begin(); i != _column_bundles.end(); ++i) {
_bundle_connections.push_back ( _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 void
PortMatrixBody::repaint_grid () PortMatrixBody::rebuild_and_draw_grid ()
{ {
_grid.require_render (); _grid.require_rebuild ();
queue_draw (); queue_draw ();
} }
void void
PortMatrixBody::repaint_column_labels () PortMatrixBody::rebuild_and_draw_column_labels ()
{ {
_column_labels.require_render (); _column_labels.require_rebuild ();
queue_draw (); queue_draw ();
} }
void void
PortMatrixBody::repaint_row_labels () PortMatrixBody::rebuild_and_draw_row_labels ()
{ {
_row_labels.require_render (); _row_labels.require_rebuild ();
queue_draw (); queue_draw ();
} }

View File

@ -63,7 +63,7 @@ public:
void set_xoffset (uint32_t); void set_xoffset (uint32_t);
void set_yoffset (uint32_t); void set_yoffset (uint32_t);
void repaint_grid (); void rebuild_and_draw_grid ();
protected: protected:
bool on_expose_event (GdkEventExpose *); bool on_expose_event (GdkEventExpose *);
@ -73,8 +73,8 @@ protected:
private: private:
void compute_rectangles (); void compute_rectangles ();
void repaint_column_labels (); void rebuild_and_draw_column_labels ();
void repaint_row_labels (); void rebuild_and_draw_row_labels ();
PortMatrix* _port_matrix; PortMatrix* _port_matrix;
PortMatrixColumnLabels _column_labels; PortMatrixColumnLabels _column_labels;

View File

@ -167,8 +167,7 @@ PortMatrixColumnLabels::render (cairo_t* cr)
for (uint32_t j = 0; j < (*i)->nchannels(); ++j) { for (uint32_t j = 0; j < (*i)->nchannels(); ++j) {
double const lc = _longest_channel_name + (2 * name_pad()); double const lc = _longest_channel_name + name_pad();
double const lb = _longest_bundle_name + (2 * name_pad());
double const w = column_width(); double const w = column_width();
if (_location == BOTTOM) { if (_location == BOTTOM) {
@ -179,8 +178,8 @@ PortMatrixColumnLabels::render (cairo_t* cr)
cairo_move_to (cr, x_, y_); cairo_move_to (cr, x_, y_);
x_ -= w; x_ -= w;
cairo_line_to (cr, x_, y_); cairo_line_to (cr, x_, y_);
x_ -= lb * cos (angle()); x_ -= lc * cos (angle());
y_ += lb * sin (angle()); y_ += lc * sin (angle());
cairo_line_to (cr, x_, y_); cairo_line_to (cr, x_, y_);
x_ += w * pow (sin (angle()), 2); x_ += w * pow (sin (angle()), 2);
y_ += w * sin (angle()) * cos (angle()); y_ += w * sin (angle()) * cos (angle());

View File

@ -36,10 +36,16 @@ public:
void setup (); void setup ();
GdkPixmap* get_pixmap (GdkDrawable *); GdkPixmap* get_pixmap (GdkDrawable *);
std::pair<uint32_t, uint32_t> dimensions (); std::pair<uint32_t, uint32_t> dimensions ();
void require_render () { void require_render () {
_render_required = true; _render_required = true;
} }
void require_rebuild () {
_dimension_computation_required = true;
_render_required = true;
}
/** @return width of columns in the grid */ /** @return width of columns in the grid */
static uint32_t column_width () { static uint32_t column_width () {
return 32; return 32;