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 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 bezierline_save(Bezierline *bezierline, ObjectNode obj_node, DiaContext *ctx) { if (connpoint_is_autogap(bezierline->bez.object.handles[0]->connected_to) || connpoint_is_autogap(bezierline->bez.object.handles[3*(bezierline->bez.bezier.num_points-1)]->connected_to) || bezierline->absolute_start_gap || bezierline->absolute_end_gap) { Point gap_points[4]; compute_gap_points(bezierline, gap_points); exchange_bez_gap_points(&bezierline->bez,gap_points); bezierconn_update_boundingbox(&bezierline->bez); exchange_bez_gap_points(&bezierline->bez,gap_points); } bezierconn_save(&bezierline->bez, obj_node, ctx); if (!color_equals(&bezierline->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &bezierline->line_color, ctx); if (bezierline->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), bezierline->line_width, ctx); if (bezierline->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), bezierline->line_style, ctx); if (bezierline->line_style != LINESTYLE_SOLID && bezierline->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), bezierline->dashlength, ctx); if (bezierline->line_join != LINEJOIN_MITER) data_add_enum(new_attribute(obj_node, "line_join"), bezierline->line_join, ctx); if (bezierline->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), bezierline->line_caps, ctx); if (bezierline->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &bezierline->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width", ctx); } if (bezierline->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &bezierline->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width", ctx); } if (bezierline->absolute_start_gap) data_add_real(new_attribute(obj_node, "absolute_start_gap"), bezierline->absolute_start_gap, ctx); if (bezierline->absolute_end_gap) data_add_real(new_attribute(obj_node, "absolute_end_gap"), bezierline->absolute_end_gap, ctx); }
static void polyline_save(Polyline *polyline, ObjectNode obj_node, DiaContext *ctx) { polyconn_save(&polyline->poly, obj_node, ctx); if (!color_equals(&polyline->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &polyline->line_color, ctx); if (polyline->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), polyline->line_width, ctx); if (polyline->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), polyline->line_style, ctx); if (polyline->line_style != LINESTYLE_SOLID && polyline->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), polyline->dashlength, ctx); if (polyline->line_join != LINEJOIN_MITER) data_add_enum(new_attribute(obj_node, "line_join"), polyline->line_join, ctx); if (polyline->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), polyline->line_caps, ctx); if (polyline->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &polyline->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width", ctx); } if (polyline->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &polyline->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width", ctx); } if (polyline->absolute_start_gap) data_add_real(new_attribute(obj_node, "absolute_start_gap"), polyline->absolute_start_gap, ctx); if (polyline->absolute_end_gap) data_add_real(new_attribute(obj_node, "absolute_end_gap"), polyline->absolute_end_gap, ctx); if (polyline->corner_radius > 0.0) data_add_real(new_attribute(obj_node, "corner_radius"), polyline->corner_radius, ctx); }
static void line_save(Line *line, ObjectNode obj_node, DiaContext *ctx) { #ifdef DEBUG dia_object_sanity_check((DiaObject*)line, "Saving line"); #endif connection_save(&line->connection, obj_node, ctx); connpointline_save(line->cpl, obj_node, "numcp", ctx); if (!color_equals(&line->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &line->line_color, ctx); if (line->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), line->line_width, ctx); if (line->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), line->line_style, ctx); if (line->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), line->line_caps, ctx); if (line->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &line->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width", ctx); } if (line->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &line->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width", ctx); } if (line->absolute_start_gap) data_add_real(new_attribute(obj_node, "absolute_start_gap"), line->absolute_start_gap, ctx); if (line->absolute_end_gap) data_add_real(new_attribute(obj_node, "absolute_end_gap"), line->absolute_end_gap, ctx); if (line->line_style != LINESTYLE_SOLID && line->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), line->dashlength, ctx); }
void aadlbox_save(Aadlbox *aadlbox, ObjectNode obj_node, DiaContext *ctx) { int i; AttributeNode attr; DataNode composite; element_save(&aadlbox->element, obj_node, ctx); object_save_props(&aadlbox->element.object, obj_node, ctx); attr = new_attribute(obj_node, "aadlbox_ports"); for (i=0;i<aadlbox->num_ports;i++) { composite = data_add_composite(attr, "aadlport", ctx); data_add_point(composite_add_attribute(composite, "point"), &aadlbox->ports[i]->handle->pos, ctx); data_add_enum(composite_add_attribute(composite, "port_type"), aadlbox->ports[i]->type, ctx); data_add_string(composite_add_attribute(composite, "port_declaration"), aadlbox->ports[i]->declaration, ctx); } attr = new_attribute(obj_node, "aadlbox_connections"); for (i=0;i<aadlbox->num_connections;i++) { data_add_point(attr, &aadlbox->connections[i]->pos, ctx); } }
static void enumarrayprop_save(EnumarrayProperty *prop, AttributeNode attr) { guint i; for (i = 0; i < prop->enumarray_data->len; i++) data_add_enum(attr, g_array_index(prop->enumarray_data,gint,i)); }
static void zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node, const char *filename) { orthconn_save(&zigzagline->orth, obj_node); if (!color_equals(&zigzagline->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &zigzagline->line_color); if (zigzagline->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), zigzagline->line_width); if (zigzagline->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), zigzagline->line_style); if (zigzagline->line_join != LINEJOIN_MITER) data_add_enum(new_attribute(obj_node, "line_join"), zigzagline->line_join); if (zigzagline->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), zigzagline->line_caps); if (zigzagline->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &zigzagline->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width"); } if (zigzagline->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &zigzagline->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width"); } if (zigzagline->line_style != LINESTYLE_SOLID && zigzagline->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), zigzagline->dashlength); if (zigzagline->corner_radius > 0.0) data_add_real(new_attribute(obj_node, "corner_radius"), zigzagline->corner_radius); }
static void arc_save(Arc *arc, ObjectNode obj_node, const char *filename) { connection_save(&arc->connection, obj_node); if (!color_equals(&arc->arc_color, &color_black)) data_add_color(new_attribute(obj_node, "arc_color"), &arc->arc_color); if (arc->curve_distance != 0.1) data_add_real(new_attribute(obj_node, "curve_distance"), arc->curve_distance); if (arc->line_width != 0.1) data_add_real(new_attribute(obj_node, "line_width"), arc->line_width); if (arc->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), arc->line_style); if (arc->line_style != LINESTYLE_SOLID && arc->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), arc->dashlength); if (arc->start_arrow.type != ARROW_NONE) { data_add_enum(new_attribute(obj_node, "start_arrow"), arc->start_arrow.type); data_add_real(new_attribute(obj_node, "start_arrow_length"), arc->start_arrow.length); data_add_real(new_attribute(obj_node, "start_arrow_width"), arc->start_arrow.width); } if (arc->end_arrow.type != ARROW_NONE) { data_add_enum(new_attribute(obj_node, "end_arrow"), arc->end_arrow.type); data_add_real(new_attribute(obj_node, "end_arrow_length"), arc->end_arrow.length); data_add_real(new_attribute(obj_node, "end_arrow_width"), arc->end_arrow.width); } }
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 bezierline_save(Bezierline *bezierline, ObjectNode obj_node, const char *filename) { bezierconn_save(&bezierline->bez, obj_node); if (!color_equals(&bezierline->line_color, &color_black)) data_add_color(new_attribute(obj_node, "line_color"), &bezierline->line_color); if (bezierline->line_width != 0.1) data_add_real(new_attribute(obj_node, "line_width"), bezierline->line_width); if (bezierline->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), bezierline->line_style); if (bezierline->line_style != LINESTYLE_SOLID && bezierline->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), bezierline->dashlength); if (bezierline->start_arrow.type != ARROW_NONE) { data_add_enum(new_attribute(obj_node, "start_arrow"), bezierline->start_arrow.type); data_add_real(new_attribute(obj_node, "start_arrow_length"), bezierline->start_arrow.length); data_add_real(new_attribute(obj_node, "start_arrow_width"), bezierline->start_arrow.width); } if (bezierline->end_arrow.type != ARROW_NONE) { data_add_enum(new_attribute(obj_node, "end_arrow"), bezierline->end_arrow.type); data_add_real(new_attribute(obj_node, "end_arrow_length"), bezierline->end_arrow.length); data_add_real(new_attribute(obj_node, "end_arrow_width"), bezierline->end_arrow.width); } }
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 arc_save(Arc *arc, ObjectNode obj_node, DiaContext *ctx) { connection_save(&arc->connection, obj_node, ctx); if (!color_equals(&arc->arc_color, &color_black)) data_add_color(new_attribute(obj_node, "arc_color"), &arc->arc_color, ctx); if (arc->curve_distance != 0.1) data_add_real(new_attribute(obj_node, "curve_distance"), arc->curve_distance, ctx); if (arc->line_width != 0.1) data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH), arc->line_width, ctx); if (arc->line_style != LINESTYLE_SOLID) data_add_enum(new_attribute(obj_node, "line_style"), arc->line_style, ctx); if (arc->line_style != LINESTYLE_SOLID && arc->dashlength != DEFAULT_LINESTYLE_DASHLEN) data_add_real(new_attribute(obj_node, "dashlength"), arc->dashlength, ctx); if (arc->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), arc->line_caps, ctx); if (arc->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &arc->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width", ctx); } if (arc->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &arc->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width", 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->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 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 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 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); }
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 data_add_text(AttributeNode attr, Text *text) { DataNode composite; char *str; composite = data_add_composite(attr, "text"); str = text_get_string_copy(text); data_add_string(composite_add_attribute(composite, "string"), str); g_free(str); data_add_font(composite_add_attribute(composite, "font"), text->font); data_add_real(composite_add_attribute(composite, "height"), text->height); data_add_point(composite_add_attribute(composite, "pos"), &text->position); data_add_color(composite_add_attribute(composite, "color"), &text->color); data_add_enum(composite_add_attribute(composite, "alignment"), text->alignment); }
static void enumprop_save(EnumProperty *prop, AttributeNode attr) { data_add_enum(attr, prop->enum_data); }
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); } }