diff options
author | David Robillard <d@drobilla.net> | 2015-02-21 23:32:24 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-21 23:32:24 +0000 |
commit | ef71a1da33a3c68cad782029cacbc1d01328b4d6 (patch) | |
tree | f5bb6f29c467bf91c0ab8ca5072a81408522a311 /src/text.c | |
parent | 23682cbf1f98f35d4341efe354bee6f770d482e2 (diff) | |
download | ganv-ef71a1da33a3c68cad782029cacbc1d01328b4d6.tar.gz ganv-ef71a1da33a3c68cad782029cacbc1d01328b4d6.tar.bz2 ganv-ef71a1da33a3c68cad782029cacbc1d01328b4d6.zip |
Add API to specify module port order.
Also fix various redundant resize/update issues, improve performance.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5592 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/text.c')
-rw-r--r-- | src/text.c | 40 |
1 files changed, 25 insertions, 15 deletions
@@ -140,24 +140,34 @@ ganv_text_set_property(GObject* object, GanvTextImpl* impl = text->impl; switch (prop_id) { - SET_CASE(X, double, impl->coords.x); - SET_CASE(Y, double, impl->coords.y); - SET_CASE(WIDTH, double, impl->coords.width); - SET_CASE(HEIGHT, double, impl->coords.height); - SET_CASE(COLOR, uint, impl->color) - SET_CASE(FONT_SIZE, double, impl->font_size) + case PROP_X: + impl->coords.x = g_value_get_double(value); + break; + case PROP_Y: + impl->coords.y = g_value_get_double(value); + break; + case PROP_COLOR: + impl->color = g_value_get_uint(value); + break; + case PROP_FONT_SIZE: + impl->font_size = g_value_get_double(value); + impl->needs_layout = TRUE; + break; case PROP_TEXT: free(impl->text); - impl->text = g_value_dup_string(value); + impl->text = g_value_dup_string(value); impl->needs_layout = TRUE; - if (GANV_IS_NODE(GANV_ITEM(text)->impl->parent)) { - ganv_node_resize(GANV_NODE(GANV_ITEM(text)->impl->parent)); - } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); - break; + return; } + if (impl->needs_layout) { + if (GANV_IS_NODE(GANV_ITEM(text)->impl->parent)) { + GANV_NODE(GANV_ITEM(text)->impl->parent)->impl->must_resize = TRUE; + } + } + ganv_item_request_update(GANV_ITEM(text)); } static void @@ -219,14 +229,14 @@ ganv_text_bounds(GanvItem* item, static void ganv_text_update(GanvItem* item, int flags) { - parent_class->update(item, flags); - // Update world-relative bounding box ganv_text_bounds(item, &item->impl->x1, &item->impl->y1, &item->impl->x2, &item->impl->y2); ganv_item_i2w_pair(item, &item->impl->x1, &item->impl->y1, &item->impl->x2, &item->impl->y2); ganv_canvas_request_redraw_w( item->impl->canvas, item->impl->x1, item->impl->y1, item->impl->x2, item->impl->y2); + + parent_class->update(item, flags); } static double @@ -334,7 +344,7 @@ ganv_text_class_init(GanvTextClass* klass) _("The current width of the text."), -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, - G_PARAM_READWRITE)); + G_PARAM_READABLE)); g_object_class_install_property( gobject_class, PROP_HEIGHT, g_param_spec_double( @@ -343,7 +353,7 @@ ganv_text_class_init(GanvTextClass* klass) _("The current height of the text."), -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, - G_PARAM_READWRITE)); + G_PARAM_READABLE)); g_object_class_install_property( gobject_class, PROP_COLOR, g_param_spec_uint( |