static void annotation_get_props(Annotation *annotation, GPtrArray *props) { text_get_attributes(annotation->text,&annotation->attrs); object_get_props_from_offsets(&annotation->connection.object, annotation_offsets,props); }
static void state_get_props(State * state, GPtrArray *props) { text_get_attributes(state->text,&state->attrs); object_get_props_from_offsets(&state->element.object, state_offsets,props); }
void aadlbox_get_props(Aadlbox * aadlbox, GPtrArray *props) { text_get_attributes(aadlbox->name,&aadlbox->attrs); object_get_props_from_offsets(&aadlbox->element.object, aadlbox_offsets,props); }
static void function_get_props(Function * function, GPtrArray *props) { text_get_attributes (function->text, &function->attrs); object_get_props_from_offsets(&function->element.object, function_offsets, props); }
static void component_get_props(Component * component, GPtrArray *props) { text_get_attributes(component->text,&component->attrs); object_get_props_from_offsets(&component->element.object, component_offsets,props); }
static void other_get_props(Other *other, GPtrArray *props) { text_get_attributes(other->text,&other->attrs); object_get_props_from_offsets(&other->element.object, other_offsets,props); }
static DiaObject * component_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Component *cmp; Element *elem; DiaObject *obj; Point p; DiaFont *font; int i; cmp = g_malloc0(sizeof(Component)); elem = &cmp->element; obj = &elem->object; obj->type = &component_type; obj->ops = &component_ops; obj->flags |= DIA_OBJECT_CAN_PARENT; elem->corner = *startpoint; cmp->line_color = attributes_get_foreground(); cmp->fill_color = attributes_get_background(); font = dia_font_new_from_style (DIA_FONT_SANS, 0.8); p = *startpoint; p.x += COMPONENT_CWIDTH + COMPONENT_MARGIN_X; p.y += 2*COMPONENT_CHEIGHT; cmp->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT); text_get_attributes(cmp->text,&cmp->attrs); dia_font_unref(font); element_init(elem, 8, NUM_CONNECTIONS); for (i=0;i<NUM_CONNECTIONS;i++) { obj->connections[i] = &cmp->connections[i]; cmp->connections[i].object = obj; cmp->connections[i].connected = NULL; } cmp->connections[10].flags = CP_FLAGS_MAIN; elem->extra_spacing.border_trans = COMPONENT_BORDERWIDTH/2.0; cmp->stereotype = NULL; cmp->st_stereotype = NULL; component_update_data(cmp); for (i=0;i<8;i++) { obj->handles[i]->type = HANDLE_NON_MOVABLE; } *handle1 = NULL; *handle2 = NULL; return &cmp->element.object; }
static void objet_get_props(Objet * objet, GPtrArray *props) { text_get_attributes(objet->text,&objet->text_attrs); /* the aligement is _not_ part of the deal */ objet->text_attrs.alignment = ALIGN_CENTER; if (objet->attrib) g_free(objet->attrib); objet->attrib = text_get_string_copy(objet->attributes); object_get_props_from_offsets(&objet->element.object, objet_offsets,props); }
static DiaObject * state_create_activity(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { State *state; Element *elem; DiaObject *obj; Point p; DiaFont *font; int i; state = g_malloc0(sizeof(State)); elem = &state->element; obj = &elem->object; obj->type = &activity_type; obj->ops = &state_ops; elem->corner = *startpoint; elem->width = STATE_WIDTH; elem->height = STATE_HEIGHT; state->line_color = attributes_get_foreground(); state->fill_color = attributes_get_background(); font = dia_font_new_from_style (DIA_FONT_SANS, 0.8); p = *startpoint; p.x += STATE_WIDTH/2.0; p.y += STATE_HEIGHT/2.0; state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER); text_get_attributes(state->text,&state->attrs); element_init(elem, 8, 8); for (i=0;i<8;i++) { obj->connections[i] = &state->connections[i]; state->connections[i].object = obj; state->connections[i].connected = NULL; } elem->extra_spacing.border_trans = 0.0; state_update_data(state); for (i=0;i<8;i++) { obj->handles[i]->type = HANDLE_NON_MOVABLE; } *handle1 = NULL; *handle2 = NULL; return &state->element.object;; }
static gboolean handle_btn1(Annotation *annotation, Property *prop) { Color col; text_get_attributes(annotation->text,&annotation->attrs); col = annotation->attrs.color; /* g_message("in handle_btn1 for object %p col=%.2f:%.2f:%.2f", annotation,col.red,col.green,col.blue); */ col.red = g_random_double(); col.green = g_random_double(); col.blue = g_random_double(); annotation->attrs.color = col; text_set_attributes(annotation->text,&annotation->attrs); /* g_message("end of handle_btn1 for object %p col=%.2f:%.2f:%.2f", annotation,col.red,col.green,col.blue); */ return TRUE; }
/** *NOT A CALLBACK* Caller must set: - obj->type --------------- - obj->ops */ DiaObject *aadlbox_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Aadlbox *aadlbox; Element *elem; DiaObject *obj; Point p; DiaFont *font; aadlbox = g_malloc0(sizeof(Aadlbox)); elem = &aadlbox->element; obj = &elem->object; obj->flags |= DIA_OBJECT_CAN_PARENT; elem->corner = *startpoint; aadlbox->specific = (Aadlbox_specific *) user_data; aadlbox->num_ports = 0; aadlbox->ports = NULL; aadlbox->line_color = attributes_get_foreground(); aadlbox->fill_color = attributes_get_background(); font = dia_font_new_from_style (DIA_FONT_SANS, 0.8); /* The text position is recalculated later */ p.x = 0.0; p.y = 0.0; aadlbox->name = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT); text_get_attributes(aadlbox->name,&aadlbox->attrs); dia_font_unref(font); element_init(elem, 8, 0); /* 8 handles and 0 connection */ elem->extra_spacing.border_trans = AADLBOX_BORDERWIDTH/2.0; aadlbox_update_data(aadlbox); *handle1 = NULL; *handle2 = obj->handles[7]; return &aadlbox->element.object; }
static DiaObject * objet_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Objet *ob; Element *elem; DiaObject *obj; Point p; DiaFont *font; int i; ob = g_malloc0(sizeof(Objet)); elem = &ob->element; obj = &elem->object; obj->type = ¨object_type; obj->ops = &objet_ops; elem->corner = *startpoint; ob->text_attrs.color = color_black; ob->line_width = attributes_get_default_linewidth(); ob->line_color = attributes_get_foreground(); ob->fill_color = attributes_get_background(); font = dia_font_new_from_style(DIA_FONT_SANS, 0.8); ob->show_attributes = FALSE; ob->is_active = FALSE; ob->is_multiple = FALSE; ob->exstate = NULL; ob->stereotype = NULL; ob->st_stereotype = NULL; /* The text position is recalculated later */ p.x = 0.0; p.y = 0.0; ob->attributes = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT); ob->attrib = NULL; ob->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER); text_get_attributes(ob->text,&ob->text_attrs); dia_font_unref(font); element_init(elem, 8, NUM_CONNECTIONS); for (i=0;i<NUM_CONNECTIONS;i++) { obj->connections[i] = &ob->connections[i]; ob->connections[i].object = obj; ob->connections[i].connected = NULL; } ob->connections[8].flags = CP_FLAGS_MAIN; elem->extra_spacing.border_trans = ob->line_width/2.0; objet_update_data(ob); for (i=0;i<8;i++) { obj->handles[i]->type = HANDLE_NON_MOVABLE; } *handle1 = NULL; *handle2 = NULL; return &ob->element.object; }