summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp23
-rw-r--r--src/edge.c12
2 files changed, 30 insertions, 5 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index a30657b..3c59351 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -333,6 +333,7 @@ struct GanvCanvasImpl {
void ports_joined(GanvPort* port1, GanvPort* port2);
void port_clicked(GdkEvent* event, GanvPort* port);
+ void highlight_port(GanvPort* port, bool highlight);
void move_contents_to_internal(double x, double y, double min_x, double min_y);
@@ -1418,7 +1419,7 @@ void
GanvCanvasImpl::end_connect_drag()
{
if (_connect_port) {
- g_object_set(G_OBJECT(_connect_port), "highlighted", FALSE, NULL);
+ highlight_port(_connect_port, false);
}
gtk_object_destroy(GTK_OBJECT(_drag_edge));
gtk_object_destroy(GTK_OBJECT(_drag_node));
@@ -1557,7 +1558,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
gboolean selected;
g_object_get(G_OBJECT(port), "selected", &selected, NULL);
if (!control_dragging && !selected) {
- g_object_set(G_OBJECT(port), "highlighted", TRUE, NULL);
+ highlight_port(port, true);
return true;
}
break;
@@ -1574,7 +1575,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
NULL, event->crossing.time);
return true;
} else if (!control_dragging) {
- g_object_set(G_OBJECT(port), "highlighted", FALSE, NULL);
+ highlight_port(port, false);
return true;
}
break;
@@ -1594,8 +1595,8 @@ GanvCanvasImpl::ports_joined(GanvPort* port1, GanvPort* port2)
return;
}
- g_object_set(G_OBJECT(port1), "highlighted", FALSE, NULL);
- g_object_set(G_OBJECT(port2), "highlighted", FALSE, NULL);
+ highlight_port(port1, false);
+ highlight_port(port2, false);
GanvNode* src_node;
GanvNode* dst_node;
@@ -1631,6 +1632,18 @@ GanvCanvasImpl::port_clicked(GdkEvent* event, GanvPort* port)
}
}
+void
+GanvCanvasImpl::highlight_port(GanvPort* port, bool highlight)
+{
+ g_object_set(G_OBJECT(port), "highlighted", highlight, NULL);
+ ganv_canvas_for_each_edge_on(_gcanvas,
+ GANV_NODE(port),
+ (highlight
+ ? (GanvEdgeFunc)ganv_edge_highlight
+ : (GanvEdgeFunc)ganv_edge_unhighlight),
+ NULL);
+}
+
/* Update animated "rubber band" selection effect. */
gboolean
GanvCanvasImpl::on_animate_timeout(gpointer data)
diff --git a/src/edge.c b/src/edge.c
index 89da897..d3c96cc 100644
--- a/src/edge.c
+++ b/src/edge.c
@@ -689,6 +689,18 @@ ganv_edge_unselect(GanvEdge* edge)
}
void
+ganv_edge_highlight(GanvEdge* edge)
+{
+ ganv_edge_set_highlighted(edge, TRUE);
+}
+
+void
+ganv_edge_unhighlight(GanvEdge* edge)
+{
+ ganv_edge_set_highlighted(edge, FALSE);
+}
+
+void
ganv_edge_set_highlighted(GanvEdge* edge, gboolean highlighted)
{
edge->impl->highlighted = highlighted;