summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-14 02:28:37 +0000
committerDavid Robillard <d@drobilla.net>2011-12-14 02:28:37 +0000
commit6bebc2472db2c426f7285ebceb8563c79ac439f2 (patch)
tree22b6f5876188d83ecdd2c7d4384e6e4c4acf28e7 /src
parent4b806a473d03faa24f00fad5e29721622236ed43 (diff)
downloadganv-6bebc2472db2c426f7285ebceb8563c79ac439f2.tar.gz
ganv-6bebc2472db2c426f7285ebceb8563c79ac439f2.tar.bz2
ganv-6bebc2472db2c426f7285ebceb8563c79ac439f2.zip
Make node no longer a subclass of group.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3873 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp4
-rw-r--r--src/canvas-base.c44
-rw-r--r--src/group.c43
-rw-r--r--src/module.c2
-rw-r--r--src/node.c6
-rw-r--r--src/port.c3
6 files changed, 45 insertions, 57 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 768cecb..e901eaa 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1017,8 +1017,8 @@ GanvCanvasImpl::connect_drag_handler(GdkEvent* event)
// Update drag edge for pointer position
ganv_node_move_to(drag_node, x, y);
- ganv_item_request_update(&drag_node->group.item);
- ganv_item_request_update(&drag_edge->item);
+ ganv_item_request_update(GANV_ITEM(drag_node));
+ ganv_item_request_update(GANV_ITEM(drag_edge));
return true;
diff --git a/src/canvas-base.c b/src/canvas-base.c
index 04cdf55..ee284dd 100644
--- a/src/canvas-base.c
+++ b/src/canvas-base.c
@@ -45,7 +45,9 @@ static void add_idle(GanvCanvasBase* canvas);
enum {
ITEM_PROP_0,
- ITEM_PROP_PARENT
+ ITEM_PROP_PARENT,
+ ITEM_PROP_X,
+ ITEM_PROP_Y
};
enum {
@@ -120,7 +122,7 @@ item_post_create_setup(GanvItem* item)
item->x2 + 1, item->y2 + 1);
item->canvas->need_repick = TRUE;
} else {
- g_error("item added to non-parent item\n");
+ g_warning("item added to non-parent item\n");
}
}
@@ -129,11 +131,9 @@ static void
ganv_item_set_property(GObject* gobject, guint param_id,
const GValue* value, GParamSpec* pspec)
{
- GanvItem* item;
-
g_return_if_fail(GANV_IS_ITEM(gobject));
- item = GANV_ITEM(gobject);
+ GanvItem* item = GANV_ITEM(gobject);
switch (param_id) {
case ITEM_PROP_PARENT:
@@ -146,6 +146,14 @@ ganv_item_set_property(GObject* gobject, guint param_id,
item_post_create_setup(item);
}
break;
+ case ITEM_PROP_X:
+ item->x = g_value_get_double(value);
+ ganv_item_request_update(item);
+ break;
+ case ITEM_PROP_Y:
+ item->y = g_value_get_double(value);
+ ganv_item_request_update(item);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
break;
@@ -157,17 +165,20 @@ static void
ganv_item_get_property(GObject* gobject, guint param_id,
GValue* value, GParamSpec* pspec)
{
- GanvItem* item;
-
g_return_if_fail(GANV_IS_ITEM(gobject));
- item = GANV_ITEM(gobject);
+ GanvItem* item = GANV_ITEM(gobject);
switch (param_id) {
case ITEM_PROP_PARENT:
g_value_set_object(value, item->parent);
break;
-
+ case ITEM_PROP_X:
+ g_value_set_double(value, item->x);
+ break;
+ case ITEM_PROP_Y:
+ g_value_set_double(value, item->y);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
break;
@@ -2652,6 +2663,21 @@ ganv_item_class_init(GanvItemClass* class)
GANV_TYPE_ITEM,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
+ g_object_class_install_property
+ (gobject_class, ITEM_PROP_X,
+ g_param_spec_double("x",
+ _("X"),
+ _("X"),
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+ g_object_class_install_property
+ (gobject_class, ITEM_PROP_Y,
+ g_param_spec_double("y",
+ _("Y"),
+ _("Y"),
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
+ (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+
item_signals[ITEM_EVENT]
= g_signal_new("event",
G_TYPE_FROM_CLASS(class),
diff --git a/src/group.c b/src/group.c
index 1ebb42c..0e38396 100644
--- a/src/group.c
+++ b/src/group.c
@@ -27,9 +27,7 @@
#include "./ganv-private.h"
enum {
- GROUP_PROP_0,
- GROUP_PROP_X,
- GROUP_PROP_Y
+ GROUP_PROP_0
};
G_DEFINE_TYPE(GanvGroup, ganv_group, GANV_TYPE_ITEM)
@@ -47,19 +45,7 @@ ganv_group_set_property(GObject* gobject, guint param_id,
{
g_return_if_fail(GANV_IS_GROUP(gobject));
- GanvItem* item = GANV_ITEM(gobject);
-
switch (param_id) {
- case GROUP_PROP_X:
- item->x = g_value_get_double(value);
- ganv_item_request_update(item);
- break;
-
- case GROUP_PROP_Y:
- item->y = g_value_get_double(value);
- ganv_item_request_update(item);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
break;
@@ -70,21 +56,9 @@ static void
ganv_group_get_property(GObject* gobject, guint param_id,
GValue* value, GParamSpec* pspec)
{
- GanvItem* item;
-
g_return_if_fail(GANV_IS_GROUP(gobject));
- item = GANV_ITEM(gobject);
-
switch (param_id) {
- case GROUP_PROP_X:
- g_value_set_double(value, item->x);
- break;
-
- case GROUP_PROP_Y:
- g_value_set_double(value, item->y);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
break;
@@ -460,21 +434,6 @@ ganv_group_class_init(GanvGroupClass* class)
gobject_class->set_property = ganv_group_set_property;
gobject_class->get_property = ganv_group_get_property;
- g_object_class_install_property
- (gobject_class, GROUP_PROP_X,
- g_param_spec_double("x",
- _("X"),
- _("X"),
- -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
- g_object_class_install_property
- (gobject_class, GROUP_PROP_Y,
- g_param_spec_double("y",
- _("Y"),
- _("Y"),
- -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
- (G_PARAM_READABLE | G_PARAM_WRITABLE)));
-
object_class->destroy = ganv_group_destroy;
item_class->add = ganv_group_add;
diff --git a/src/module.c b/src/module.c
index 3bfd378..7b7de6d 100644
--- a/src/module.c
+++ b/src/module.c
@@ -514,7 +514,7 @@ ganv_module_update(GanvItem* item, int flags)
GanvModule* module = GANV_MODULE(item);
FOREACH_PORT(module->impl->ports, p) {
- ganv_item_request_update(GANV_ITEM(*p));
+ ganv_item_invoke_update(GANV_ITEM(*p), flags);
}
if (module->impl->must_resize) {
diff --git a/src/node.c b/src/node.c
index 489293d..a6f9ad5 100644
--- a/src/node.c
+++ b/src/node.c
@@ -24,9 +24,9 @@
guint signal_moved;
-G_DEFINE_TYPE(GanvNode, ganv_node, GANV_TYPE_GROUP)
+G_DEFINE_TYPE(GanvNode, ganv_node, GANV_TYPE_ITEM)
-static GanvGroupClass* parent_class;
+static GanvItemClass* parent_class;
enum {
PROP_0,
@@ -452,7 +452,7 @@ ganv_node_class_init(GanvNodeClass* class)
GtkObjectClass* object_class = (GtkObjectClass*)class;
GanvItemClass* item_class = (GanvItemClass*)class;
- parent_class = GANV_GROUP_CLASS(g_type_class_peek_parent(class));
+ parent_class = GANV_ITEM_CLASS(g_type_class_peek_parent(class));
g_type_class_add_private(class, sizeof(GanvNodeImpl));
diff --git a/src/port.c b/src/port.c
index 674be73..2a49980 100644
--- a/src/port.c
+++ b/src/port.c
@@ -402,6 +402,9 @@ ganv_port_set_control_value(GanvPort* port,
#endif
impl->control->value = value;
+
+ ganv_item_request_update(GANV_ITEM(port));
+ ganv_item_request_update(GANV_ITEM(port->impl->control->rect));
}
void