From 0316028e51b17a933be001719c9f69ba5097be03 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 Dec 2011 19:55:15 +0000 Subject: Fix every port drawn after a selected port also appearing selected. git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3903 a436a847-0d15-0410-975c-d299462d15a1 --- src/Canvas.cpp | 16 ++++++---------- src/box.c | 2 ++ 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Canvas.cpp b/src/Canvas.cpp index e057bc1..69fabf6 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -192,7 +192,7 @@ struct GanvCanvasImpl { typedef std::set Edges; typedef std::set DstEdges; typedef std::set SelectedEdges; - typedef std::list SelectedPorts; + typedef std::set SelectedPorts; Edges::const_iterator first_edge_from(const GanvNode* src); DstEdges::const_iterator first_edge_to(const GanvNode* dst); @@ -234,9 +234,9 @@ struct GanvCanvasImpl { Items _selected_items; ///< Currently selected items SelectedEdges _selected_edges; ///< Currently selected edges - SelectedPorts _selected_ports; ///< Selected ports (hilited red) - GanvPort* _connect_port; ///< Port for which a edge is being made - GanvPort* _last_selected_port; + SelectedPorts _selected_ports; ///< Selected ports (hilited red) + GanvPort* _connect_port; ///< Port for which a edge is being made + GanvPort* _last_selected_port; GanvBox* _select_rect; ///< Rectangle for drag selection @@ -623,9 +623,7 @@ GanvCanvasImpl::select_port(GanvPort* p, bool unique) unselect_ports(); } g_object_set(G_OBJECT(p), "selected", TRUE, NULL); - SelectedPorts::iterator i = find(_selected_ports.begin(), _selected_ports.end(), p); - if (i == _selected_ports.end()) - _selected_ports.push_back(p); + _selected_ports.insert(p); _last_selected_port = p; } @@ -683,9 +681,7 @@ GanvCanvasImpl::select_port_toggle(GanvPort* port, int mod_state) void GanvCanvasImpl::unselect_port(GanvPort* p) { - SelectedPorts::iterator i = find(_selected_ports.begin(), _selected_ports.end(), p); - if (i != _selected_ports.end()) - _selected_ports.erase(i); + _selected_ports.erase(p); g_object_set(G_OBJECT(p), "selected", FALSE, NULL); if (_last_selected_port == p) { _last_selected_port = NULL; diff --git a/src/box.c b/src/box.c index 5d9a41a..cbd9006 100644 --- a/src/box.c +++ b/src/box.c @@ -274,6 +274,8 @@ ganv_box_draw(GanvItem* item, cairo_set_line_width(cr, impl->coords.border_width); if (dash_length > 0) { cairo_set_dash(cr, &dash_length, 1, box->node.impl->dash_offset); + } else { + cairo_set_dash(cr, &dash_length, 0, 0); } } cairo_stroke(cr); -- cgit v1.2.1