Hello world. I am new on this mail list. I am currently a trainee and
my mission is to program new objects for DIA. I have red all the documents I found and I understand now how to create my own object. However, I have some problems. Today's one is this : In my function static DiaObject myObject_create(...) called when my object is created by DIA in order to allocate memory, all the properties are not initialised like I want. I also found in object/standard/box.c the same problem : static DiaObject * box_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Box *box; Element *elem; DiaObject *obj; int i; box = g_malloc0(sizeof(Box)); elem = &box->element; obj = &elem->object; obj->type = &box_type; obj->ops = &box_ops; elem->corner = *startpoint; elem->width = DEFAULT_WIDTH; elem->height = DEFAULT_HEIGHT; box->border_width = attributes_get_default_linewidth(); box->border_color = attributes_get_foreground(); box->inner_color = attributes_get_background(); attributes_get_default_line_style(&box->line_style, &box->dashlength); /* For non-default objects, this is overridden by the default */ box->show_background = default_properties.show_background; // <--- HERE ! box->corner_radius = default_properties.corner_radius; // <--- HERE box->aspect = default_properties.aspect; // <--- AND HERE AGAIN element_init(elem, 8, NUM_CONNECTIONS); for (i=0;i<NUM_CONNECTIONS;i++) { obj->connections[i] = &box->connections[i]; box->connections[i].object = obj; box->connections[i].connected = NULL; } box->connections[8].flags = CP_FLAGS_MAIN; box_update_data(box); *handle1 = NULL; *handle2 = obj->handles[7]; return &box->element.object; } The show_background, corner_radius and aspect properties are not correctly given (contrary to the other properties). Indeed, if you try to write instead : box->show_background = FALSE; box->corner_radius = 5.0; box->aspect = 1;it will not change anything... I have this problem in my own objects, sometimes there is a radius default value altought I would like not, often I give a defaultvalue to a string but it does not work... I am working on Win 2K pro, with the Dia 0.942+CVS Version (may be compiled by the previous trainee). Do you know where the problem come from ? Thanks (i am going to eat and i will read the answers in the afternoon). P.S. : I apologize for my english mystake, I come from France and I do the best I can. |