summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-23 19:55:15 +0000
committerDavid Robillard <d@drobilla.net>2011-12-23 19:55:15 +0000
commit0316028e51b17a933be001719c9f69ba5097be03 (patch)
treef121cf496f349ce1299e73f424b8a669195f03fe
parent3d325ba4047580cc228780c19997675626c3b7ca (diff)
downloadganv-0316028e51b17a933be001719c9f69ba5097be03.tar.gz
ganv-0316028e51b17a933be001719c9f69ba5097be03.tar.bz2
ganv-0316028e51b17a933be001719c9f69ba5097be03.zip
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
-rw-r--r--src/Canvas.cpp16
-rw-r--r--src/box.c2
2 files changed, 8 insertions, 10 deletions
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<GanvEdge*, TailHeadOrder> Edges;
typedef std::set<GanvEdge*, HeadTailOrder> DstEdges;
typedef std::set<GanvEdge*> SelectedEdges;
- typedef std::list<GanvPort*> SelectedPorts;
+ typedef std::set<GanvPort*> 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);