diff options
author | David Robillard <d@drobilla.net> | 2016-07-31 18:02:55 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-07-31 18:02:55 -0400 |
commit | 43f43d5e73ba1c36199998bd90ea511efe0eac62 (patch) | |
tree | 5499adcfc2690f4c49d63738e23af9fecc79fa6b | |
parent | f0ce0f3142eef6442e2be8c8c0f202ccb713cf92 (diff) | |
download | ganv-43f43d5e73ba1c36199998bd90ea511efe0eac62.tar.gz ganv-43f43d5e73ba1c36199998bd90ea511efe0eac62.tar.bz2 ganv-43f43d5e73ba1c36199998bd90ea511efe0eac62.zip |
Fix compilation with C++
-rw-r--r-- | ganv/item.h | 2 | ||||
-rw-r--r-- | src/Canvas.cpp | 2 | ||||
-rw-r--r-- | src/boilerplate.h | 9 | ||||
-rw-r--r-- | src/edge.c | 19 | ||||
-rw-r--r-- | src/item.c | 10 | ||||
-rw-r--r-- | src/module.c | 2 | ||||
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/widget.c | 6 |
8 files changed, 34 insertions, 20 deletions
diff --git a/ganv/item.h b/ganv/item.h index c538e5a..5c63d5f 100644 --- a/ganv/item.h +++ b/ganv/item.h @@ -41,7 +41,7 @@ enum { GANV_ITEM_ALWAYS_REDRAW = 1 << 3, GANV_ITEM_VISIBLE = 1 << 4, GANV_ITEM_NEED_UPDATE = 1 << 5, - GANV_ITEM_NEED_VIS = 1 << 6, + GANV_ITEM_NEED_VIS = 1 << 6 }; #define GANV_TYPE_ITEM (ganv_item_get_type()) diff --git a/src/Canvas.cpp b/src/Canvas.cpp index e31bc9d..de04f16 100644 --- a/src/Canvas.cpp +++ b/src/Canvas.cpp @@ -746,7 +746,7 @@ GanvCanvasImpl::layout_dot(const std::string& filename) agsafeset(e, (char*)"headport", (char*)ss.str().c_str(), (char*)""); } if (!ganv_edge_get_constraining(edge)) { - agsafeset(e, (char*)"constraint", "false", (char*)""); + agsafeset(e, (char*)"constraint", (char*)"false", (char*)""); } } else { std::cerr << "Unable to find graphviz node" << std::endl; diff --git a/src/boilerplate.h b/src/boilerplate.h index a6be001..17dd545 100644 --- a/src/boilerplate.h +++ b/src/boilerplate.h @@ -24,12 +24,9 @@ typedef gpointer gobject; #define SET_CASE(prop, type, field) \ case PROP_##prop: { \ const g##type tmp = g_value_get_##type(value); \ - if (field != tmp) { \ - field = tmp; \ - GanvItem* item = GANV_ITEM(object); \ - if (item->impl->canvas) { \ - ganv_item_request_update(item); \ - } \ + if ((field) != tmp) { \ + (field) = tmp; \ + ganv_item_request_update(GANV_ITEM(object)); \ } \ break; \ } @@ -110,13 +110,12 @@ ganv_edge_set_property(GObject* object, g_return_if_fail(object != NULL); g_return_if_fail(GANV_IS_EDGE(object)); + GanvItem* item = GANV_ITEM(object); GanvEdge* edge = GANV_EDGE(object); GanvEdgeImpl* impl = edge->impl; GanvEdgeCoords* coords = &impl->coords; switch (prop_id) { - SET_CASE(TAIL, object, impl->tail); - SET_CASE(HEAD, object, impl->head); SET_CASE(WIDTH, double, coords->width); SET_CASE(HANDLE_RADIUS, double, coords->handle_radius); SET_CASE(DASH_LENGTH, double, impl->dash_length); @@ -128,6 +127,22 @@ ganv_edge_set_property(GObject* object, SET_CASE(SELECTED, boolean, impl->selected); SET_CASE(HIGHLIGHTED, boolean, impl->highlighted); SET_CASE(GHOST, boolean, impl->ghost); + case PROP_TAIL: { + const gobject tmp = g_value_get_object(value); + if (impl->tail != tmp) { + impl->tail = GANV_NODE(tmp); + ganv_item_request_update(item); + } + break; + } + case PROP_HEAD: { + const gobject tmp = g_value_get_object(value); + if (impl->head != tmp) { + impl->head = GANV_NODE(tmp); + ganv_item_request_update(item); + } + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -42,7 +42,7 @@ enum { GANV_CANVAS_UPDATE_REQUESTED = 1 << 0, GANV_CANVAS_UPDATE_AFFINE = 1 << 1, - GANV_CANVAS_UPDATE_VISIBILITY = 1 << 2, + GANV_CANVAS_UPDATE_VISIBILITY = 1 << 2 }; #define GCI_UPDATE_MASK (GANV_CANVAS_UPDATE_REQUESTED \ @@ -662,7 +662,7 @@ ganv_item_class_init(GanvItemClass* klass) (gobject_class, ITEM_PROP_PARENT, g_param_spec_object("parent", NULL, NULL, GANV_TYPE_ITEM, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE))); g_object_class_install_property (gobject_class, ITEM_PROP_X, @@ -670,14 +670,14 @@ ganv_item_class_init(GanvItemClass* klass) _("X"), _("X"), -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + (GParamFlags)(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))); + (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE))); g_object_class_install_property (gobject_class, ITEM_PROP_MANAGED, @@ -685,7 +685,7 @@ ganv_item_class_init(GanvItemClass* klass) _("Managed"), _("Whether the item is managed by its parent"), 0, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE))); item_signals[ITEM_EVENT] = g_signal_new("event", diff --git a/src/module.c b/src/module.c index 44e4b53..0094663 100644 --- a/src/module.c +++ b/src/module.c @@ -43,7 +43,7 @@ G_DEFINE_TYPE(GanvModule, ganv_module, GANV_TYPE_BOX) static GanvBoxClass* parent_class; enum { - PROP_0, + PROP_0 }; static void @@ -154,7 +154,6 @@ ganv_node_set_property(GObject* object, GanvNodeImpl* impl = node->impl; switch (prop_id) { - SET_CASE(PARTNER, object, impl->partner); SET_CASE(DASH_LENGTH, double, impl->dash_length); SET_CASE(DASH_OFFSET, double, impl->dash_offset); SET_CASE(BORDER_WIDTH, double, impl->border_width); @@ -166,6 +165,9 @@ ganv_node_set_property(GObject* object, SET_CASE(HIGHLIGHTED, boolean, impl->highlighted); SET_CASE(DRAGGABLE, boolean, impl->draggable); SET_CASE(GRABBED, boolean, impl->grabbed); + case PROP_PARTNER: + impl->partner = (GanvNode*)g_value_get_object(value); + break; case PROP_SELECTED: if (impl->selected != g_value_get_boolean(value)) { GanvItem* item = GANV_ITEM(object); diff --git a/src/widget.c b/src/widget.c index 0702ca5..9af767d 100644 --- a/src/widget.c +++ b/src/widget.c @@ -218,7 +218,7 @@ ganv_widget_set_property(GObject* object, case PROP_ANCHOR: if (witem->impl->anchor != (GtkAnchorType)g_value_get_enum(value)) { - witem->impl->anchor = g_value_get_enum(value); + witem->impl->anchor = (GtkAnchorType)g_value_get_enum(value); update = TRUE; } break; @@ -436,7 +436,7 @@ ganv_widget_class_init(GanvWidgetClass* klass) GtkObjectClass* object_class = (GtkObjectClass*)klass; GanvItemClass* item_class = (GanvItemClass*)klass; - parent_class = g_type_class_peek_parent(klass); + parent_class = (GanvItemClass*)g_type_class_peek_parent(klass); g_type_class_add_private(klass, sizeof(GanvWidgetImpl)); @@ -448,7 +448,7 @@ ganv_widget_class_init(GanvWidgetClass* klass) "widget", _("Widget"), _("The widget to embed in this item."), GTK_TYPE_WIDGET, - (G_PARAM_READABLE | G_PARAM_WRITABLE))); + (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE))); g_object_class_install_property( gobject_class, PROP_X, g_param_spec_double( |