Cleanup to previous commit.

git-svn-id: svn://localhost/ardour2/branches/3.0@5376 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-07-18 02:27:36 +00:00
parent 91dae1fb03
commit fea3992f29
2 changed files with 75 additions and 60 deletions

View file

@ -290,39 +290,35 @@ PortMatrixGrid::button_press (double x, double y, int b, uint32_t t)
}
void
PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
PortMatrixGrid::set_association (PortMatrixNode node)
{
if (b == 1) {
if (_dragging && _moved) {
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
if (_matrix->show_only_bundles()) {
/* XXX: err... */
} else {
for (list<PortMatrixNode>::const_iterator i = p.begin(); i != p.end(); ++i) {
for (uint32_t i = 0; i < node.column.bundle->nchannels(); ++i) {
for (uint32_t j = 0; j < node.row.bundle->nchannels(); ++j) {
ARDOUR::BundleChannel c[2];
c[_matrix->row_index()] = i->row;
c[_matrix->column_index()] = i->column;
PortMatrixNode::State const s = _matrix->get_state (c);
if (s == PortMatrixNode::ASSOCIATED || s == PortMatrixNode::NOT_ASSOCIATED) {
bool const n = !(s == PortMatrixNode::ASSOCIATED);
_matrix->set_state (c, n);
c[_matrix->column_index()] = ARDOUR::BundleChannel (node.column.bundle, i);
c[_matrix->row_index()] = ARDOUR::BundleChannel (node.row.bundle, j);
_matrix->set_state (c, true);
}
}
}
require_render ();
_body->queue_draw ();
} else {
PortMatrixNode const node = position_to_node (x / grid_spacing(), y / grid_spacing());
if (node.row.bundle && node.column.bundle) {
ARDOUR::BundleChannel c[2];
c[_matrix->row_index()] = node.row;
c[_matrix->column_index()] = node.column;
_matrix->set_state (c, true);
}
}
}
void
PortMatrixGrid::toggle_association (PortMatrixNode node)
{
if (_matrix->show_only_bundles()) {
PortMatrixNode::State const s = bundle_to_bundle_state (node.column.bundle, node.row.bundle);
@ -352,18 +348,35 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
PortMatrixNode::State const s = _matrix->get_state (c);
if (s == PortMatrixNode::ASSOCIATED || s == PortMatrixNode::NOT_ASSOCIATED) {
bool const n = !(s == PortMatrixNode::ASSOCIATED);
_matrix->set_state (c, n);
}
}
}
}
void
PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
{
if (b == 1) {
if (_dragging && _moved) {
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
for (list<PortMatrixNode>::const_iterator i = p.begin(); i != p.end(); ++i) {
set_association (*i);
}
} else {
toggle_association (position_to_node (x / grid_spacing(), y / grid_spacing()));
}
require_render ();
_body->queue_draw ();
}
}
_dragging = false;
}

View file

@ -64,6 +64,8 @@ private:
void draw_unknown_indicator (cairo_t *, uint32_t, uint32_t);
PortMatrixNode::State bundle_to_bundle_state (boost::shared_ptr<ARDOUR::Bundle>, boost::shared_ptr<ARDOUR::Bundle>) const;
std::list<PortMatrixNode> nodes_on_line (int, int, int, int) const;
void toggle_association (PortMatrixNode node);
void set_association (PortMatrixNode node);
bool _dragging;
bool _moved;