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); }
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, PROP_STDNAME_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->line_caps != LINECAPS_BUTT) data_add_enum(new_attribute(obj_node, "line_caps"), arc->line_caps); if (arc->start_arrow.type != ARROW_NONE) { save_arrow(obj_node, &arc->start_arrow, "start_arrow", "start_arrow_length", "start_arrow_width"); } if (arc->end_arrow.type != ARROW_NONE) { save_arrow(obj_node, &arc->end_arrow, "end_arrow", "end_arrow_length", "end_arrow_width"); } }