static DiaObject * participation_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Participation *participation; OrthConn *orth; DiaObject *obj; participation = g_malloc0(sizeof(Participation)); orth = &participation->orth; obj = &orth->object; obj->type = &participation_type; obj->ops = &participation_ops; orthconn_init(orth, startpoint); participation_update_data(participation); participation->total = FALSE; *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return &participation->orth.object; }
static DiaObject * arc_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Arc *arc; OrthConn *orth; DiaObject *obj; arc = g_malloc0(sizeof(Arc)); orth = &arc->orth; obj = &orth->object; obj->type = &grafcet_arc_type; obj->ops = &arc_ops; orthconn_init(orth, startpoint); arc->uparrow = TRUE; arc_update_data(arc); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numhandles-1]; return &arc->orth.object; }
static Object * participation_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Participation *participation; OrthConn *orth; Object *obj; participation = g_malloc(sizeof(Participation)); orth = &participation->orth; obj = (Object *) participation; obj->type = &participation_type; obj->ops = &participation_ops; orthconn_init(orth, startpoint); participation_update_data(participation); participation->total = FALSE; participation->properties_dialog = NULL; *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return (Object *)participation; }
static DiaObject * zigzagline_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Zigzagline *zigzagline; OrthConn *orth; DiaObject *obj; Point dummy = {0, 0}; /*zigzagline_init_defaults();*/ zigzagline = g_malloc0(sizeof(Zigzagline)); orth = &zigzagline->orth; obj = &orth->object; obj->type = &zigzagline_type; obj->ops = &zigzagline_ops; if (startpoint) orthconn_init(orth, startpoint); else orthconn_init(orth, &dummy); if (user_data) { MultipointCreateData *pcd = (MultipointCreateData *)user_data; orthconn_set_points (orth, pcd->num_points, pcd->points); } zigzagline->line_width = attributes_get_default_linewidth(); zigzagline->line_color = attributes_get_foreground(); attributes_get_default_line_style(&zigzagline->line_style, &zigzagline->dashlength); zigzagline->line_join = LINEJOIN_MITER; zigzagline->line_caps = LINECAPS_BUTT; zigzagline->start_arrow = attributes_get_default_start_arrow(); zigzagline->end_arrow = attributes_get_default_end_arrow(); zigzagline->corner_radius = 0.0; *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; zigzagline_update_data(zigzagline); return &zigzagline->orth.object; }
static DiaObject * compfeat_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Compfeat *compfeat; OrthConn *orth; DiaObject *obj; Point p; DiaFont *font; font = dia_font_new_from_style(DIA_FONT_MONOSPACE, 0.8); compfeat = g_new0(Compfeat, 1); compfeat->role = compfeat->roletmp = GPOINTER_TO_INT(user_data); compfeat->line_width = 0.1; orth = &compfeat->orth; obj = &orth->object; obj->type = &compfeat_type; obj->ops = &compfeat_ops; orthconn_init(orth, startpoint); p = *startpoint; p.y -= COMPPROP_TEXTOFFSET; compfeat->line_color = attributes_get_foreground(); compfeat->text = new_text("", font, COMPPROP_FONTHEIGHT, &p, &compfeat->line_color, ALIGN_CENTER); dia_font_unref(font); compfeat->text_handle.id = HANDLE_MOVE_TEXT; compfeat->text_handle.type = HANDLE_MINOR_CONTROL; compfeat->text_handle.connect_type = HANDLE_NONCONNECTABLE; compfeat->text_handle.connected_to = NULL; compfeat->text_handle.pos = compfeat->text_pos = p; object_add_handle(obj, &compfeat->text_handle); if (compfeat->role == COMPPROP_FACET || compfeat->role == COMPPROP_EVENTSOURCE) { int pos = obj->num_connections; object_add_connectionpoint(&orth->object, &compfeat->cp); obj->connections[pos] = &compfeat->cp; compfeat->cp.object = obj; compfeat->cp.connected = NULL; } compfeat_update_data(compfeat); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return &compfeat->orth.object; }
static DiaObject * transition_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Transition *transition; OrthConn *orth; DiaObject *obj; Point temp_point; if (transition_font == NULL) { transition_font = dia_font_new_from_style (DIA_FONT_SANS, TRANSITION_FONTHEIGHT); } transition = g_malloc0(sizeof(Transition)); orth = &transition->orth; obj = &orth->object; obj->type = ¨_transition_type; obj->ops = ¨_transition_ops; orthconn_init(orth, startpoint); transition->text_color = color_black; transition->line_color = attributes_get_foreground(); /* Prepare the handles for trigger and guard text */ transition->trigger_text_handle.id = HANDLE_MOVE_TRIGGER_TEXT; transition->trigger_text_handle.type = HANDLE_MINOR_CONTROL; transition->trigger_text_handle.connect_type = HANDLE_NONCONNECTABLE; transition->trigger_text_handle.connected_to = NULL; temp_point = *startpoint; temp_point.y -= TEXT_HANDLE_DISTANCE_FROM_STARTPOINT; transition->trigger_text_pos = temp_point; transition->trigger_text_handle.pos = temp_point; object_add_handle(obj, &transition->trigger_text_handle); transition->guard_text_handle.id = HANDLE_MOVE_GUARD_TEXT; transition->guard_text_handle.type = HANDLE_MINOR_CONTROL; transition->guard_text_handle.connect_type = HANDLE_NONCONNECTABLE; transition->guard_text_handle.connected_to = NULL; temp_point = *startpoint; temp_point.y += TEXT_HANDLE_DISTANCE_FROM_STARTPOINT; transition->guard_text_pos = transition->guard_text_handle.pos = temp_point; object_add_handle(obj, &transition->guard_text_handle); transition->guard_text = NULL; transition->trigger_text = NULL; transition->action_text = NULL; uml_transition_update_data(transition); *handle1 = obj->handles[0]; *handle2 = obj->handles[1]; return obj; }
static DiaObject * realizes_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Realizes *realize; OrthConn *orth; DiaObject *obj; PolyBBExtras *extra; realize = g_malloc0(sizeof(Realizes)); /* old defaults */ realize->font_height = 0.8; realize->font = dia_font_new_from_style (DIA_FONT_MONOSPACE, realize->font_height); realize->line_width = 0.1; orth = &realize->orth; obj = &orth->object; extra = &orth->extra_spacing; obj->type = &realizes_type; obj->ops = &realizes_ops; orthconn_init(orth, startpoint); realize->text_color = color_black; realize->line_color = attributes_get_foreground(); realize->name = NULL; realize->stereotype = NULL; realize->st_stereotype = NULL; realize->text_width = 0; extra->start_trans = realize->line_width/2.0 + REALIZES_TRIANGLESIZE; extra->start_long = extra->middle_trans = extra->end_trans = extra->end_long = realize->line_width/2.0; realizes_update_data(realize); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return &realize->orth.object; }
static DiaObject * dependency_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Dependency *dep; OrthConn *orth; DiaObject *obj; if (dep_font == NULL) { dep_font = dia_font_new_from_style(DIA_FONT_MONOSPACE, DEPENDENCY_FONTHEIGHT); } dep = g_new0(Dependency, 1); orth = &dep->orth; obj = (DiaObject *)dep; obj->type = &dependency_type; obj->ops = &dependency_ops; orthconn_init(orth, startpoint); dep->text_color = color_black; dep->line_color = attributes_get_foreground(); dep->draw_arrow = TRUE; dep->name = NULL; dep->stereotype = NULL; dep->st_stereotype = NULL; dep->text_width = 0; dependency_update_data(dep); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return (DiaObject *)dep; }
static Object * generalization_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Generalization *genlz; OrthConn *orth; Object *obj; if (genlz_font == NULL) { genlz_font = font_getfont("Courier"); } genlz = g_malloc(sizeof(Generalization)); orth = &genlz->orth; obj = (Object *) genlz; obj->type = &generalization_type; obj->ops = &generalization_ops; orthconn_init(orth, startpoint); genlz->name = NULL; genlz->stereotype = NULL; genlz->text_width = 0; genlz->properties_dialog = NULL; generalization_update_data(genlz); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return (Object *)genlz; }
static DiaObject * association_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handle2) { Association *assoc; OrthConn *orth; DiaObject *obj; int i; int user_d; if (assoc_font == NULL) assoc_font = dia_font_new_from_style(DIA_FONT_MONOSPACE, ASSOCIATION_FONTHEIGHT); assoc = g_malloc0(sizeof(Association)); orth = &assoc->orth; obj = &orth->object; obj->type = &association_type; obj->ops = &association_ops; orthconn_init(orth, startpoint); assoc->text_color = color_black; assoc->line_color = attributes_get_foreground(); assoc->name = NULL; assoc->assoc_type = AGGREGATE_NORMAL; assoc->direction = ASSOC_RIGHT; assoc->show_direction = FALSE; for (i=0;i<2;i++) { assoc->end[i].role = NULL; assoc->end[i].multiplicity = NULL; assoc->end[i].arrow = FALSE; assoc->end[i].aggregate = AGGREGATE_NONE; assoc->end[i].text_width = 0.0; assoc->end[i].visibility = UML_IMPLEMENTATION; } assoc->text_width = 0.0; user_d = GPOINTER_TO_INT(user_data); switch (user_d) { case 0: assoc->assoc_type = AGGREGATE_NONE; assoc->show_direction = TRUE; break; case 1: assoc->assoc_type = AGGREGATE_NORMAL; assoc->show_direction = FALSE; break; } association_update_data(assoc); *handle1 = orth->handles[0]; *handle2 = orth->handles[orth->numpoints-2]; return &assoc->orth.object; }