summaryrefslogtreecommitdiff
path: root/gtk2_ardour/port_matrix_grid.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-11-18 15:16:28 +0000
committerCarl Hetherington <carl@carlh.net>2009-11-18 15:16:28 +0000
commitbe55dcbce3b26d9af7562cedb75dee25eab66623 (patch)
treef8c8ac5eecc0c94a061e8b255d02cb6799ba4889 /gtk2_ardour/port_matrix_grid.cc
parent964e3ee825b5d2c3c9c1d434c1d7bdc40438ee7b (diff)
Primary-modifier click on a node in the port matrix toggles association for everything in a diagonal line down and to the right of the clicked node.
git-svn-id: svn://localhost/ardour2/branches/3.0@6122 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/port_matrix_grid.cc')
-rw-r--r--gtk2_ardour/port_matrix_grid.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/gtk2_ardour/port_matrix_grid.cc b/gtk2_ardour/port_matrix_grid.cc
index c2af484e6c..9a2c5c189f 100644
--- a/gtk2_ardour/port_matrix_grid.cc
+++ b/gtk2_ardour/port_matrix_grid.cc
@@ -24,6 +24,7 @@
#include "port_matrix_grid.h"
#include "port_matrix.h"
#include "port_matrix_body.h"
+#include "keyboard.h"
using namespace std;
@@ -245,16 +246,16 @@ PortMatrixGrid::position_to_node (double x, double y) const
}
void
-PortMatrixGrid::button_press (double x, double y, int b, uint32_t t)
+PortMatrixGrid::button_press (double x, double y, int b, uint32_t t, guint)
{
ARDOUR::BundleChannel const px = position_to_channel (x, y, _matrix->visible_columns());
ARDOUR::BundleChannel const py = position_to_channel (y, x, _matrix->visible_rows());
if (b == 1) {
-
+
_dragging = true;
_drag_valid = (px.bundle && py.bundle);
-
+
_moved = false;
_drag_start_x = x / grid_spacing ();
_drag_start_y = y / grid_spacing ();
@@ -355,7 +356,7 @@ PortMatrixGrid::set_association (PortMatrixNode node, bool s)
}
void
-PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/)
+PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/, guint s)
{
if (b == 1) {
@@ -376,10 +377,30 @@ PortMatrixGrid::button_release (double x, double y, int b, uint32_t /*t*/)
} 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));
+ 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));
+ }
}
}