summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-12 04:27:08 +0000
committerDavid Robillard <d@drobilla.net>2012-05-12 04:27:08 +0000
commit80ef97d123f9d5fa086844398f55c97d5613b8a3 (patch)
treef819dd3cd9c7676204090b75d29fb85d9a0688c6
parentd243e2421573bb537944c58c4baad388930e2888 (diff)
downloadganv-80ef97d123f9d5fa086844398f55c97d5613b8a3.tar.gz
ganv-80ef97d123f9d5fa086844398f55c97d5613b8a3.tar.bz2
ganv-80ef97d123f9d5fa086844398f55c97d5613b8a3.zip
Fix node selection so setting "selected" property does the right thing.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@4369 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/Canvas.cpp10
-rw-r--r--src/node.c14
2 files changed, 18 insertions, 6 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9ab4304..fb42192 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1350,16 +1350,16 @@ GanvCanvasImpl::clear_selection()
{
unselect_ports();
- FOREACH_ITEM(_selected_items, i) {
+ Items items(_selected_items);
+ _selected_items.clear();
+ FOREACH_ITEM(items, i) {
ganv_item_set(GANV_ITEM(*i), "selected", FALSE, NULL);
}
- FOREACH_SELECTED_EDGE(_selected_edges, c) {
+ SelectedEdges edges(_selected_edges);
+ FOREACH_SELECTED_EDGE(edges, c) {
ganv_item_set(GANV_ITEM(*c), "selected", FALSE, NULL);
}
-
- _selected_items.clear();
- _selected_edges.clear();
}
void
diff --git a/src/node.c b/src/node.c
index 0a885c3..85415d8 100644
--- a/src/node.c
+++ b/src/node.c
@@ -139,9 +139,21 @@ ganv_node_set_property(GObject* object,
SET_CASE(BORDER_COLOR, uint, impl->border_color);
SET_CASE(CAN_TAIL, boolean, impl->can_tail);
SET_CASE(CAN_HEAD, boolean, impl->can_head);
- SET_CASE(SELECTED, boolean, impl->selected);
SET_CASE(HIGHLIGHTED, boolean, impl->highlighted);
SET_CASE(DRAGGABLE, boolean, impl->draggable);
+ case PROP_SELECTED:
+ if (impl->selected != g_value_get_boolean(value)) {
+ impl->selected = g_value_get_boolean(value);
+ if (item->canvas) {
+ if (impl->selected) {
+ ganv_canvas_select_node(GANV_CANVAS(item->canvas), node);
+ } else {
+ ganv_canvas_unselect_node(GANV_CANVAS(item->canvas), node);
+ }
+ ganv_item_request_update(item);
+ }
+ }
+ break;
case PROP_CANVAS:
if (!item->parent) {
GanvCanvasBase* canvas = GANV_CANVAS_BASE(g_value_get_object(value));