diff options
author | Carl Hetherington <carl@carlh.net> | 2009-02-03 01:55:25 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-02-03 01:55:25 +0000 |
commit | d06d697e41e2089ec4cce35ea17b4995797deab7 (patch) | |
tree | 2fa34519aa16b13acaa28a6b7aec02de99be7703 /gtk2_ardour/port_matrix_row_labels.cc | |
parent | 6a9dc6b8d0ccc4b4849c3720ea5fb0606e52ce4b (diff) |
Click and hold button 1 over a channel name in the port matrix highlights
connected channels.
git-svn-id: svn://localhost/ardour2/branches/3.0@4484 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_matrix_row_labels.cc')
-rw-r--r-- | gtk2_ardour/port_matrix_row_labels.cc | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc index 0e48b5b6b2..d8162d715e 100644 --- a/gtk2_ardour/port_matrix_row_labels.cc +++ b/gtk2_ardour/port_matrix_row_labels.cc @@ -26,7 +26,7 @@ #include "i18n.h" PortMatrixRowLabels::PortMatrixRowLabels (PortMatrix* m, PortMatrixBody* b) - : PortMatrixComponent (m, b) + : PortMatrixLabels (m, b) { } @@ -179,7 +179,7 @@ PortMatrixRowLabels::render (cairo_t* cr) y = 0; for (ARDOUR::BundleList::const_iterator i = r.begin(); i != r.end(); ++i) { for (uint32_t j = 0; j < (*i)->nchannels(); ++j) { - render_port_name (cr, get_a_bundle_colour (i - r.begin()), 0, y, ARDOUR::BundleChannel (*i, j)); + render_channel_name (cr, get_a_bundle_colour (i - r.begin()), 0, y, ARDOUR::BundleChannel (*i, j)); y += row_height(); } } @@ -188,10 +188,19 @@ PortMatrixRowLabels::render (cairo_t* cr) void PortMatrixRowLabels::button_press (double x, double y, int b, uint32_t t) { - if (b != 3) { - return; + switch (b) { + case 1: + _body->highlight_associated_channels (_matrix->row_index(), y / row_height ()); + break; + case 3: + maybe_popup_context_menu (x, y, t); + break; } +} +void +PortMatrixRowLabels::maybe_popup_context_menu (double x, double y, uint32_t t) +{ if (!_matrix->can_rename_channels (_matrix->row_index()) && !_matrix->can_remove_channels (_matrix->row_index())) { return; @@ -243,7 +252,7 @@ PortMatrixRowLabels::port_name_x () const } void -PortMatrixRowLabels::render_port_name ( +PortMatrixRowLabels::render_channel_name ( cairo_t* cr, Gdk::Color colour, double xoff, double yoff, ARDOUR::BundleChannel const& bc ) { @@ -264,6 +273,12 @@ PortMatrixRowLabels::render_port_name ( } double +PortMatrixRowLabels::channel_x (ARDOUR::BundleChannel const& bc) const +{ + return 0; +} + +double PortMatrixRowLabels::channel_y (ARDOUR::BundleChannel const& bc) const { uint32_t n = 0; @@ -279,13 +294,13 @@ PortMatrixRowLabels::channel_y (ARDOUR::BundleChannel const& bc) const } void -PortMatrixRowLabels::queue_draw_for (PortMatrixNode const& n) +PortMatrixRowLabels::queue_draw_for (ARDOUR::BundleChannel const & bc) { - if (n.row.bundle) { + if (bc.bundle) { _body->queue_draw_area ( component_to_parent_x (port_name_x()), - component_to_parent_y (channel_y (n.row)), + component_to_parent_y (channel_y (bc)), _longest_port_name + name_pad() * 2, row_height() ); @@ -294,22 +309,10 @@ PortMatrixRowLabels::queue_draw_for (PortMatrixNode const& n) } void -PortMatrixRowLabels::mouseover_changed (PortMatrixNode const& old) -{ - queue_draw_for (old); - queue_draw_for (_body->mouseover()); -} - -void -PortMatrixRowLabels::draw_extra (cairo_t* cr) +PortMatrixRowLabels::mouseover_changed (PortMatrixNode const &) { + clear_channel_highlights (); if (_body->mouseover().row.bundle) { - render_port_name ( - cr, - mouseover_port_colour (), - component_to_parent_x (0), - component_to_parent_y (channel_y (_body->mouseover().row)), - _body->mouseover().row - ); + add_channel_highlight (_body->mouseover().row); } } |