summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_matrix_grid.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-07-19 21:57:51 +0000
committerCarl Hetherington <carl@carlh.net>2009-07-19 21:57:51 +0000
commite11d65d98dc5f21a963beb42eb57b135984e4c08 (patch)
tree0ce216db684c20ee437794434612c0c974cad249 /gtk2_ardour/port_matrix_grid.cc
parent9f5b9f3c3ee1316b98f259f54214c02db2acd10c (diff)
Stop line drags in collapsed groups.
git-svn-id: svn://localhost/ardour2/branches/3.0@5390 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_matrix_grid.cc')
-rw-r--r--gtk2_ardour/port_matrix_grid.cc28
1 files changed, 17 insertions, 11 deletions
diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc
index 4682f6f3c3..bb8dff5953 100644
--- a/gtk2_ardour/port_matrix_grid.cc
+++ b/gtk2_ardour/port_matrix_grid.cc
@@ -30,6 +30,7 @@ using namespace std;
PortMatrixGrid::PortMatrixGrid (PortMatrix* m, PortMatrixBody* b)
: PortMatrixComponent (m, b),
_dragging (false),
+ _drag_valid (false),
_moved (false)
{
@@ -291,18 +292,21 @@ PortMatrixGrid::position_to_node (uint32_t x, uint32_t y) const
void
PortMatrixGrid::button_press (double x, double y, int b, uint32_t t)
{
+ pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> px = position_to_group_and_channel (x / grid_spacing(), _matrix->columns());
+ pair<boost::shared_ptr<PortGroup>, ARDOUR::BundleChannel> py = position_to_group_and_channel (y / grid_spacing(), _matrix->rows());
+
if (b == 1) {
_dragging = true;
+ _drag_valid = (px.second.bundle && py.second.bundle);
+
_moved = false;
_drag_start_x = x / grid_spacing ();
_drag_start_y = y / grid_spacing ();
} else if (b == 3) {
- _matrix->popup_menu (
- position_to_group_and_channel (x / grid_spacing(), _matrix->columns()),
- position_to_group_and_channel (y / grid_spacing(), _matrix->rows()), t);
+ _matrix->popup_menu (px, py, t);
}
}
@@ -408,12 +412,14 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t t)
if (_dragging && _moved) {
- list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
-
- if (!p.empty()) {
- PortMatrixNode::State const s = get_association (p.front());
- for (list<PortMatrixNode>::const_iterator i = p.begin(); i != p.end(); ++i) {
- set_association (*i, toggle_state (s));
+ if (_drag_valid) {
+ list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
+
+ if (!p.empty()) {
+ PortMatrixNode::State const s = get_association (p.front());
+ for (list<PortMatrixNode>::const_iterator i = p.begin(); i != p.end(); ++i) {
+ set_association (*i, toggle_state (s));
+ }
}
}
@@ -462,7 +468,7 @@ PortMatrixGrid::draw_extra (cairo_t* cr)
cairo_stroke (cr);
}
- if (_dragging && _moved) {
+ if (_dragging && _drag_valid && _moved) {
list<PortMatrixNode> const p = nodes_on_line (_drag_start_x, _drag_start_y, _drag_x, _drag_y);
@@ -525,7 +531,7 @@ PortMatrixGrid::motion (double x, double y)
_moved = true;
}
- if (_dragging && _moved) {
+ if (_dragging && _drag_valid && _moved) {
_drag_x = px;
_drag_y = py;
_body->queue_draw ();