- 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 (x != -1) {
+
+ if (_dragging && _moved) {
+
+ 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));
+ }
+ }
+ }
+
+ } else {
+
+ if (Keyboard::modifier_state_equals (s, Keyboard::PrimaryModifier)) {
+ /* associate/disassociate things diagonally down and right until we run out */
+ PortMatrixNode::State s = (PortMatrixNode::State) 0;
+ while (1) {
+ PortMatrixNode const n = position_to_node (x, y);
+ if (n.row.bundle && n.column.bundle) {
+ if (s == (PortMatrixNode::State) 0) {
+ s = get_association (n);
+ }
+ set_association (n, toggle_state (s));
+ } else {
+ break;
+ }
+ x += grid_spacing ();
+ y += grid_spacing ();
+ }
+
+ } else {
+
+ PortMatrixNode const n = position_to_node (x, y);
+ if (n.row.bundle && n.column.bundle) {
+ PortMatrixNode::State const s = get_association (n);
+ set_association (n, toggle_state (s));
+ }