static void attribute_save(Attribute *attribute, ObjectNode obj_node, const char *filename) { element_save(&attribute->element, obj_node); data_add_real(new_attribute(obj_node, "border_width"), attribute->border_width); data_add_color(new_attribute(obj_node, "border_color"), &attribute->border_color); data_add_color(new_attribute(obj_node, "inner_color"), &attribute->inner_color); data_add_string(new_attribute(obj_node, "name"), attribute->name); data_add_boolean(new_attribute(obj_node, "key"), attribute->key); data_add_boolean(new_attribute(obj_node, "weak_key"), attribute->weakkey); data_add_boolean(new_attribute(obj_node, "derived"), attribute->derived); data_add_boolean(new_attribute(obj_node, "multivalued"), attribute->multivalue); data_add_font (new_attribute (obj_node, "font"), attribute->font); data_add_real(new_attribute(obj_node, "font_height"), attribute->font_height); }
static void attribute_save(Attribute *attribute, ObjectNode obj_node, DiaContext *ctx) { element_save(&attribute->element, obj_node, ctx); data_add_real(new_attribute(obj_node, "border_width"), attribute->border_width, ctx); data_add_color(new_attribute(obj_node, "border_color"), &attribute->border_color, ctx); data_add_color(new_attribute(obj_node, "inner_color"), &attribute->inner_color, ctx); data_add_string(new_attribute(obj_node, "name"), attribute->name, ctx); data_add_boolean(new_attribute(obj_node, "key"), attribute->key, ctx); data_add_boolean(new_attribute(obj_node, "weak_key"), attribute->weakkey, ctx); data_add_boolean(new_attribute(obj_node, "derived"), attribute->derived, ctx); data_add_boolean(new_attribute(obj_node, "multivalued"), attribute->multivalue, ctx); data_add_font (new_attribute (obj_node, "font"), attribute->font, ctx); data_add_real(new_attribute(obj_node, "font_height"), attribute->font_height, ctx); }
static void image_save(EImage *image, ObjectNode obj_node, const char *filename) { char *diafile_dir; element_save(&image->element, obj_node); if (image->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), image->border_width); if (!color_equals(&image->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &image->border_color); if (image->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), image->line_style); if (image->line_style != LINESTYLE_SOLID && image->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), image->dashlength); data_add_boolean(new_attribute(obj_node, "draw_border"), image->draw_border); data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect); data_add_boolean(new_attribute(obj_node, "keep_orig_aspect"), image->keep_orig_aspect); data_add_string(new_attribute(obj_node, "embed_id"), dtree_conv_longname_to_xml(image->embed_id)); if (image->file != NULL) { if (g_path_is_absolute(image->file)) { /* Absolute pathname */ diafile_dir = get_directory(filename); if (strncmp(diafile_dir, image->file, strlen(diafile_dir))==0) { /* The image pathname has the dia file pathname in the begining */ /* Save the relative path: */ data_add_filename(new_attribute(obj_node, "file"), image->file + strlen(diafile_dir) + 1); } else { /* Save the absolute path: */ data_add_filename(new_attribute(obj_node, "file"), image->file); } g_free(diafile_dir); } else { /* Relative path. Must be an erronous filename... Just save the filename. */ data_add_filename(new_attribute(obj_node, "file"), image->file); } } }
static void function_save(Function *pkg, ObjectNode obj_node, const char *filename) { element_save(&pkg->element, obj_node); data_add_text(new_attribute(obj_node, "text"), pkg->text); data_add_boolean(new_attribute(obj_node, "is_wish"), pkg->is_wish); data_add_boolean(new_attribute(obj_node, "is_user"), pkg->is_user); }
static void ellipse_save(Ellipse *ellipse, ObjectNode obj_node, const char *filename) { element_save(&ellipse->element, obj_node); if (ellipse->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), ellipse->border_width); if (!color_equals(&ellipse->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &ellipse->border_color); if (!color_equals(&ellipse->inner_color, &color_white)) data_add_color(new_attribute(obj_node, "inner_color"), &ellipse->inner_color); if (!ellipse->show_background) data_add_boolean(new_attribute(obj_node, "show_background"), ellipse->show_background); if (ellipse->aspect != FREE_ASPECT) data_add_enum(new_attribute(obj_node, "aspect"), ellipse->aspect); if (ellipse->line_style != LINESTYLE_SOLID) { data_add_enum(new_attribute(obj_node, "line_style"), ellipse->line_style); if (ellipse->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), ellipse->dashlength); } }
static void beziergon_save(Beziergon *beziergon, ObjectNode obj_node, const char *filename) { beziershape_save(&beziergon->bezier, obj_node); if (!color_equals(&beziergon->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &beziergon->line_color); if (beziergon->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), beziergon->line_width); if (!color_equals(&beziergon->inner_color, &color_white)) data_add_color(new_attribute(obj_node, "inner_color"), &beziergon->inner_color); data_add_boolean(new_attribute(obj_node, "show_background"), beziergon->show_background); if (beziergon->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), beziergon->line_style); if (beziergon->line_style != LINESTYLE_SOLID && beziergon->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), beziergon->dashlength); if (beziergon->line_join != LINEJOIN_MITER) data_add_enum(new_attribute(obj_node, "line_join"), beziergon->line_join); }
static void participation_save(Participation *participation, ObjectNode obj_node, DiaContext *ctx) { orthconn_save(&participation->orth, obj_node, ctx); data_add_boolean(new_attribute(obj_node, "total"), participation->total, ctx); }
static void participation_save(Participation *participation, ObjectNode obj_node, const char *filename) { orthconn_save(&participation->orth, obj_node); data_add_boolean(new_attribute(obj_node, "total"), participation->total); }
void uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr) { DataNode composite; composite = data_add_composite(attr_node, "umlattribute"); data_add_string(composite_add_attribute(composite, "name"), attr->name); data_add_string(composite_add_attribute(composite, "type"), attr->type); data_add_string(composite_add_attribute(composite, "value"), attr->value); data_add_enum(composite_add_attribute(composite, "visibility"), attr->visibility); data_add_boolean(composite_add_attribute(composite, "abstract"), attr->abstract); data_add_boolean(composite_add_attribute(composite, "class_scope"), attr->class_scope); }
void uml_operation_write(AttributeNode attr_node, UMLOperation *op) { GList *list; UMLParameter *param; DataNode composite; DataNode composite2; AttributeNode attr_node2; composite = data_add_composite(attr_node, "umloperation"); data_add_string(composite_add_attribute(composite, "name"), op->name); data_add_string(composite_add_attribute(composite, "type"), op->type); data_add_enum(composite_add_attribute(composite, "visibility"), op->visibility); data_add_boolean(composite_add_attribute(composite, "abstract"), op->abstract); data_add_boolean(composite_add_attribute(composite, "class_scope"), op->class_scope); attr_node2 = composite_add_attribute(composite, "parameters"); list = op->parameters; while (list != NULL) { param = (UMLParameter *) list->data; composite2 = data_add_composite(attr_node2, "umlparameter"); data_add_string(composite_add_attribute(composite2, "name"), param->name); data_add_string(composite_add_attribute(composite2, "type"), param->type); data_add_string(composite_add_attribute(composite2, "value"), param->value); data_add_enum(composite_add_attribute(composite2, "kind"), param->kind); list = g_list_next(list); } }
static void textobj_save(Textobj *textobj, ObjectNode obj_node, const char *filename) { object_save(&textobj->object, obj_node); data_add_text(new_attribute(obj_node, "text"), textobj->text); data_add_enum(new_attribute(obj_node, "valign"), textobj->vert_align); if (textobj->show_background) { data_add_color(new_attribute(obj_node, "fill_color"), &textobj->fill_color); data_add_boolean(new_attribute(obj_node, "show_background"), textobj->show_background); } }
static void textobj_save(Textobj *textobj, ObjectNode obj_node, DiaContext *ctx) { object_save(&textobj->object, obj_node, ctx); data_add_text(new_attribute(obj_node, "text"), textobj->text, ctx); data_add_enum(new_attribute(obj_node, "valign"), textobj->vert_align, ctx); if (textobj->show_background) { data_add_color(new_attribute(obj_node, "fill_color"), &textobj->fill_color, ctx); data_add_boolean(new_attribute(obj_node, "show_background"), textobj->show_background, ctx); } if (textobj->margin > 0.0) data_add_real(new_attribute(obj_node, "margin"), textobj->margin, ctx); if (textobj->text_angle != 0.0) data_add_real(new_attribute(obj_node, "text_angle"), textobj->text_angle, ctx); }
static void box_save(Box *box, ObjectNode obj_node, const char *filename) { element_save(&box->element, obj_node); if (box->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), box->border_width); if (!color_equals(&box->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &box->border_color); if (!color_equals(&box->inner_color, &color_white)) data_add_color(new_attribute(obj_node, "inner_color"), &box->inner_color); data_add_boolean(new_attribute(obj_node, "show_background"), box->show_background); if (box->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), box->line_style); if (box->line_style != LINESTYLE_SOLID && box->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), box->dashlength); if (box->line_join != LINEJOIN_MITER) data_add_enum(new_attribute(obj_node, "line_join"), box->line_join); if (box->corner_radius > 0.0) data_add_real(new_attribute(obj_node, "corner_radius"), box->corner_radius); if (box->aspect != FREE_ASPECT) data_add_enum(new_attribute(obj_node, "aspect"), box->aspect); }
static void box_save(Box *box, ObjectNode obj_node, const char *filename) { element_save(&box->element, obj_node); if (box->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), box->border_width); if (!color_equals(&box->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &box->border_color); if (!color_equals(&box->inner_color, &color_white)) data_add_color(new_attribute(obj_node, "inner_color"), &box->inner_color); data_add_boolean(new_attribute(obj_node, "show_background"), box->show_background); if (box->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), box->line_style); if (box->line_style != LINESTYLE_SOLID && box->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), box->dashlength); if (box->corner_radius > 0.0) data_add_real(new_attribute(obj_node, "corner_radius"), box->corner_radius); data_add_real(new_attribute(obj_node, "padding"), box->padding); data_add_text(new_attribute(obj_node, "text"), box->text); if (box->text_fitting != TEXTFIT_WHEN_NEEDED) data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING), box->text_fitting); }
static void ellipse_save(Ellipse *ellipse, ObjectNode obj_node, DiaContext *ctx) { element_save(&ellipse->element, obj_node, ctx); if (ellipse->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), ellipse->border_width, ctx); if (!color_equals(&ellipse->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &ellipse->border_color, ctx); if (!color_equals(&ellipse->inner_color, &color_white)) data_add_color(new_attribute(obj_node, "inner_color"), &ellipse->inner_color, ctx); data_add_boolean(new_attribute(obj_node, "show_background"), ellipse->show_background, ctx); if (ellipse->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), ellipse->line_style, ctx); if (ellipse->line_style != LINESTYLE_SOLID && ellipse->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), ellipse->dashlength, ctx); data_add_real(new_attribute(obj_node, "padding"), ellipse->padding, ctx); data_add_text(new_attribute(obj_node, "text"), ellipse->text, ctx); if (ellipse->text_fitting != TEXTFIT_WHEN_NEEDED) data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING), ellipse->text_fitting, ctx); }
static void image_save(Image *image, ObjectNode obj_node, const char *filename) { char *diafile_dir; element_save(&image->element, obj_node); if (image->border_width != 0.1) data_add_real(new_attribute(obj_node, "border_width"), image->border_width); if (!color_equals(&image->border_color, &color_black)) data_add_color(new_attribute(obj_node, "border_color"), &image->border_color); if (image->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), image->line_style); if (image->line_style != LINESTYLE_SOLID && image->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), image->dashlength); data_add_boolean(new_attribute(obj_node, "draw_border"), image->draw_border); data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect); if (image->file != NULL) { if (g_path_is_absolute(image->file)) { /* Absolute pathname */ diafile_dir = get_directory(filename); if (strncmp(diafile_dir, image->file, strlen(diafile_dir))==0) { /* The image pathname has the dia file pathname in the begining */ /* Save the relative path: */ data_add_filename(new_attribute(obj_node, "file"), image->file + strlen(diafile_dir) + 1); } else { /* Save the absolute path: */ data_add_filename(new_attribute(obj_node, "file"), image->file); } g_free(diafile_dir); } else { /* Relative path. Must be an erronous filename... Just save the filename. */ data_add_filename(new_attribute(obj_node, "file"), image->file); } } /* only save image_data inline if told to do so */ if (image->inline_data) { GdkPixbuf *pixbuf; data_add_boolean (new_attribute(obj_node, "inline_data"), image->inline_data); /* just to be sure to get the currently visible */ pixbuf = (GdkPixbuf *)dia_image_pixbuf (image->image); if (pixbuf != image->pixbuf && image->pixbuf != NULL) message_warning (_("Inconsistent pixbuf during image save.")); if (pixbuf) data_add_pixbuf (new_attribute(obj_node, "pixbuf"), pixbuf); } }
static void boolprop_save(BoolProperty *prop, AttributeNode attr) { data_add_boolean(attr, prop->bool_data); }