summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9858713..8d0358d 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -322,6 +322,7 @@ struct GanvCanvasImpl {
bool port_event(GdkEvent* event, GanvPort* port);
void ports_joined(GanvPort* port1, GanvPort* port2);
+ void port_clicked(GdkEvent* event, GanvPort* port);
void move_contents_to_internal(double x, double y, double min_x, double min_y);
@@ -1507,13 +1508,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
ports_joined(port, _connect_port);
unselect_ports();
} else {
- bool modded = event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK);
- if (!modded && _last_selected_port && _last_selected_port->impl->is_input != port->impl->is_input) {
- selection_joined_with(port);
- unselect_ports();
- } else {
- select_port_toggle(port, event->button.state);
- }
+ port_clicked(event, port);
}
port_dragging = false;
} else if (control_dragging) {
@@ -1523,11 +1518,8 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
event->button.y_root == control_start_y) {
select_port_toggle(port, event->button.state);
}
- } else if (_selected_ports.empty() ||
- (event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK))) {
- select_port_toggle(port, event->button.state);
} else {
- selection_joined_with(port);
+ port_clicked(event, port);
}
return true;
@@ -1597,6 +1589,19 @@ GanvCanvasImpl::ports_joined(GanvPort* port1, GanvPort* port2)
}
}
+void
+GanvCanvasImpl::port_clicked(GdkEvent* event, GanvPort* port)
+{
+ const bool modded = event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK);
+ if (!modded && _last_selected_port &&
+ _last_selected_port->impl->is_input != port->impl->is_input) {
+ selection_joined_with(port);
+ unselect_ports();
+ } else {
+ select_port_toggle(port, event->button.state);
+ }
+}
+
/** Update animated "rubber band" selection effect. */
gboolean
GanvCanvasImpl::on_animate_timeout(gpointer data)