summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-22 01:04:01 +0000
committerDavid Robillard <d@drobilla.net>2012-04-22 01:04:01 +0000
commit0ae137819d9c97f476ee53a9db42f693ea728f28 (patch)
tree6f99befba0dc0a61799ea5a3b4df276f1620966e
parentc554d1a5c489db95c424ce4910de568b8a885e63 (diff)
downloadganv-0ae137819d9c97f476ee53a9db42f693ea728f28.tar.gz
ganv-0ae137819d9c97f476ee53a9db42f693ea728f28.tar.bz2
ganv-0ae137819d9c97f476ee53a9db42f693ea728f28.zip
Fix bulk connect via port selection.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4225 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/Canvas.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 679d5bc..54e295f 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1069,6 +1069,7 @@ GanvCanvasImpl::connect_drag_handler(GdkEvent* event)
bool
GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
{
+ static bool port_pressed = true;
static bool port_dragging = false;
static bool control_dragging = false;
static double control_start_x = 0;
@@ -1087,18 +1088,27 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
ganv_port_set_control_value(port, 1.0);
}
} else {
- control_dragging = true;
+ control_dragging = port_pressed = true;
control_start_x = event->button.x_root;
control_start_y = event->button.y_root;
control_start_value = ganv_port_get_control_value(port);
+ ganv_item_grab(GANV_ITEM(port),
+ GDK_BUTTON_RELEASE_MASK,
+ NULL, event->button.time);
}
return true;
} else if (!port->impl->is_input) {
- port_dragging = true;
- return true;
- } else if (_last_selected_port && _last_selected_port != port) {
- ports_joined(_last_selected_port, port);
+ port_dragging = port_pressed = true;
+ ganv_item_grab(GANV_ITEM(port),
+ GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|
+ GDK_ENTER_NOTIFY_MASK|GDK_LEAVE_NOTIFY_MASK,
+ NULL, event->button.time);
return true;
+ } else {
+ port_pressed = true;
+ ganv_item_grab(GANV_ITEM(port),
+ GDK_BUTTON_RELEASE_MASK,
+ NULL, event->button.time);
}
}
break;
@@ -1143,6 +1153,10 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
break;
case GDK_BUTTON_RELEASE:
+ if (port_pressed) {
+ ganv_item_ungrab(GANV_ITEM(port), event->button.time);
+ }
+
if (port_dragging) {
if (_connect_port) { // dragging
ports_joined(port, _connect_port);
@@ -1161,6 +1175,12 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
} else if (control_dragging) {
control_dragging = false;
return true;
+ } else if (event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK)) {
+ select_port_toggle(port, event->button.state);
+ return true;
+ } else {
+ selection_joined_with(port);
+ return true;
}
break;
@@ -1177,6 +1197,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
_drag_state = GanvCanvasImpl::EDGE;
_connect_port = port;
port_dragging = false;
+ ganv_item_ungrab(GANV_ITEM(port), event->crossing.time);
ganv_item_grab(
GANV_ITEM(root()),
GDK_BUTTON_PRESS_MASK|GDK_POINTER_MOTION_MASK|GDK_BUTTON_RELEASE_MASK,