[dia] arrow: make draw/load/save instance methods
- From: Zander Brown <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] arrow: make draw/load/save instance methods
- Date: Fri, 30 Jul 2021 23:02:59 +0000 (UTC)
commit ecba9bb32f714c0c5ce63e1a56eef6d6808056cc
Author: Zander Brown <zbrown gnome org>
Date: Mon Jun 28 22:28:52 2021 +0100
arrow: make draw/load/save instance methods
lib/arrows.c | 181 ++++++++++++++++++++++++++++++------------
lib/arrows.h | 28 +++----
lib/dia-arrow-cell-renderer.c | 16 ++--
lib/diaarrowchooser.c | 12 +--
lib/diarenderer.c | 158 ++++++++++++++++++++++--------------
lib/dummy_dep.h | 2 +-
lib/libdia.def | 6 +-
objects/GRAFCET/vector.c | 17 ++--
objects/standard/arc.c | 35 +++++---
objects/standard/bezier.c | 34 +++++---
objects/standard/line.c | 34 +++++---
objects/standard/polyline.c | 34 +++++---
objects/standard/zigzagline.c | 34 +++++---
13 files changed, 392 insertions(+), 199 deletions(-)
---
diff --git a/lib/arrows.c b/lib/arrows.c
index b42589171..4e2ba1320 100644
--- a/lib/arrows.c
+++ b/lib/arrows.c
@@ -2358,65 +2358,130 @@ arrow_bbox (const Arrow *self,
polyline_bbox (poly, n_points, &pextra, TRUE, rect);
}
+
/**
- * arrow_draw:
+ * dia_arrow_draw:
+ * @self: the #Arrow to draw.
* @renderer: A renderer instance to draw into
- * @type: Which kind of arrowhead to draw.
* @to: The point that the arrow points to.
* @from: Where the arrow points from (e.g. end of stem)
- * @length: The length of the arrow
- * @width: The width of the arrow
- * @linewidth: The thickness of the lines used to draw the arrow.
+ * @line_width: The thickness of the lines used to draw the arrow.
* @fg_color: The color used for drawing the arrowhead lines
* @bg_color: The color used for drawing the arrowhead interior.
*
* Draw any arrowhead.
+ *
+ * Since: 0.98
*/
void
-arrow_draw (DiaRenderer *renderer,
- ArrowType type,
- Point *to,
- Point *from,
- real length,
- real width,
- real linewidth,
- Color *fg_color,
- Color *bg_color)
+dia_arrow_draw (Arrow *self,
+ DiaRenderer *renderer,
+ Point *to,
+ Point *from,
+ double line_width,
+ Color *fg_color,
+ Color *bg_color)
{
- switch (type) {
+ switch (self->type) {
case ARROW_NONE:
break;
case ARROW_DIMENSION_ORIGIN:
- draw_fill_dot (renderer,to,from,length,width,linewidth,fg_color,NULL);
+ draw_fill_dot (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ NULL);
break;
case ARROW_INTEGRAL_SYMBOL:
- draw_integral (renderer,to,from,length,width,linewidth,fg_color);
+ draw_integral (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color);
break;
case ARROW_ONE_OR_MANY:
- draw_one_or_many (renderer,to,from,length,width,linewidth,fg_color,bg_color);
+ draw_one_or_many (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_NONE_OR_MANY:
- draw_none_or_many (renderer,to,from,length,width,linewidth,fg_color,bg_color);
+ draw_none_or_many (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_ONE_EXACTLY:
- draw_one_exactly (renderer,to,from,length,width,linewidth,fg_color,bg_color);
+ draw_one_exactly (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_ONE_OR_NONE:
- draw_one_or_none (renderer,to,from,length,width,linewidth,fg_color,bg_color);
+ draw_one_or_none (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_ROUNDED:
- draw_rounded (renderer, to, from, length, width, linewidth, fg_color, bg_color);
+ draw_rounded (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_OPEN_ROUNDED:
- draw_open_rounded (renderer, to, from, length, width, linewidth,
- fg_color, bg_color);
+ draw_open_rounded (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_FILLED_DOT_N_TRIANGLE:
- draw_filled_dot_n_triangle (renderer, to, from, length, width, linewidth,
- fg_color, bg_color);
+ draw_filled_dot_n_triangle (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
case ARROW_THREE_DOTS:
- draw_three_dots (renderer,to,from,length,width,linewidth,fg_color);
+ draw_three_dots (renderer,
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color);
break;
case MAX_ARROW_TYPE:
break;
@@ -2445,30 +2510,33 @@ arrow_draw (DiaRenderer *renderer,
case ARROW_BACKSLASH:
default:
{
- int idx = arrow_index_from_type (type);
+ int idx = arrow_index_from_type (self->type);
g_return_if_fail (arrow_types[idx].draw != NULL);
arrow_types[idx].draw (renderer,
- to, from,
- length, width,
- linewidth,
- fg_color, bg_color);
+ to,
+ from,
+ self->length,
+ self->width,
+ line_width,
+ fg_color,
+ bg_color);
break;
}
}
- if ((type != ARROW_NONE) && (render_bounding_boxes ()) && DIA_IS_INTERACTIVE_RENDERER (renderer)) {
- Arrow arrow = {type, length, width};
+
+ if ((self->type != ARROW_NONE) && (render_bounding_boxes ()) && DIA_IS_INTERACTIVE_RENDERER (renderer)) {
DiaRectangle bbox = {0, };
Point p1, p2;
Color col = { 1.0, 0.0, 1.0, 1.0 };
- arrow_bbox (&arrow, linewidth, to, from, &bbox);
+ arrow_bbox (self, line_width, to, from, &bbox);
p1.x = bbox.left;
p1.y = bbox.top;
p2.x = bbox.right;
p2.y = bbox.bottom;
- dia_renderer_set_linewidth (renderer,0.01);
+ dia_renderer_set_linewidth (renderer, 0.01);
dia_renderer_draw_rect (renderer, &p1, &p2, NULL, &col);
}
}
@@ -2504,24 +2572,27 @@ sanitize_arrow (Arrow *self, DiaContext *ctx)
}
}
+
/**
- * save_arrow:
- * @obj_node: The XML node to save to.
+ * dia_arrow_save:
* @arrow: the arrow to save.
+ * @obj_node: The XML node to save to.
* @type_attribute: the name of the attribute of the arrow type.
* @length_attribute: the name of the attribute of the arrow length.
* @width_attribute: the name of the attribte of the arrow width.
* @ctx: a #DiaContext
*
* Save the arrow information into three attributes.
+ *
+ * Since: 0.98
*/
void
-save_arrow (ObjectNode obj_node,
- Arrow *arrow,
- gchar *type_attribute,
- gchar *length_attribute,
- gchar *width_attribute,
- DiaContext *ctx)
+dia_arrow_save (Arrow *arrow,
+ ObjectNode obj_node,
+ char *type_attribute,
+ char *length_attribute,
+ char *width_attribute,
+ DiaContext *ctx)
{
data_add_enum (new_attribute (obj_node, type_attribute),
arrow->type, ctx);
@@ -2533,37 +2604,42 @@ save_arrow (ObjectNode obj_node,
/**
- * load_arrow:
- * @obj_node: The XML node to load from.
+ * dia_arrow_load:
* @arrow: the arrow to store the data info.
+ * @obj_node: The XML node to load from.
* @type_attribute: the name of the attribute of the arrow type.
* @length_attribute: the name of the attribute of the arrow length.
* @width_attribute: the name of the attribte of the arrow width.
* @ctx: the current #DiaContext
*
* Load arrow information from three attributes.
+ *
+ * Since: 0.98
*/
void
-load_arrow (ObjectNode obj_node,
- Arrow *arrow,
- gchar *type_attribute,
- gchar *length_attribute,
- gchar *width_attribute,
- DiaContext *ctx)
+dia_arrow_load (Arrow *arrow,
+ ObjectNode obj_node,
+ char *type_attribute,
+ char *length_attribute,
+ char *width_attribute,
+ DiaContext *ctx)
{
AttributeNode attr;
arrow->type = ARROW_NONE;
arrow->length = DEFAULT_ARROW_LENGTH;
arrow->width = DEFAULT_ARROW_WIDTH;
+
attr = object_find_attribute (obj_node, type_attribute);
if (attr != NULL) {
arrow->type = data_enum (attribute_first_data (attr), ctx);
}
+
attr = object_find_attribute (obj_node, length_attribute);
if (attr != NULL) {
arrow->length = data_real (attribute_first_data (attr),ctx);
}
+
attr = object_find_attribute (obj_node, width_attribute);
if (attr != NULL) {
arrow->width = data_real (attribute_first_data (attr),ctx);
@@ -2572,6 +2648,7 @@ load_arrow (ObjectNode obj_node,
sanitize_arrow (arrow, ctx);
}
+
/**
* arrow_type_from_name:
* @name: The name of an arrow type (case sensitive)
diff --git a/lib/arrows.h b/lib/arrows.h
index 8f6b74313..221293e2e 100644
--- a/lib/arrows.h
+++ b/lib/arrows.h
@@ -148,13 +148,11 @@ struct _Arrow {
Arrow *dia_arrow_copy (Arrow *self);
void dia_arrow_free (Arrow *self);
GType dia_arrow_get_type (void);
-void arrow_draw (DiaRenderer *renderer,
- ArrowType type,
+void dia_arrow_draw (Arrow *self,
+ DiaRenderer *renderer,
Point *to,
Point *from,
- real length,
- real width,
- real linewidth,
+ double line_width,
Color *fg_color,
Color *bg_color);
void arrow_bbox (const Arrow *self,
@@ -168,17 +166,17 @@ void calculate_arrow_point (const Arrow *arrow,
Point *move_arrow,
Point *move_line,
real linewidth);
-void save_arrow (ObjectNode obj_node,
- Arrow *arrow,
- gchar *type_attribute,
- gchar *length_attribute,
- gchar *width_attribute,
+void dia_arrow_save (Arrow *arrow,
+ ObjectNode obj_node,
+ char *type_attribute,
+ char *length_attribute,
+ char *width_attribute,
DiaContext *ctx);
-void load_arrow (ObjectNode obj_node,
- Arrow *arrow,
- gchar *type_attribute,
- gchar *length_attribute,
- gchar *width_attribute,
+void dia_arrow_load (Arrow *arrow,
+ ObjectNode obj_node,
+ char *type_attribute,
+ char *length_attribute,
+ char *width_attribute,
DiaContext *ctx);
ArrowType arrow_type_from_name (const gchar *name);
gint arrow_index_from_type (ArrowType atype);
diff --git a/lib/dia-arrow-cell-renderer.c b/lib/dia-arrow-cell-renderer.c
index f31d6a4a3..aa25a463e 100644
--- a/lib/dia-arrow-cell-renderer.c
+++ b/lib/dia-arrow-cell-renderer.c
@@ -221,15 +221,13 @@ dia_arrow_cell_renderer_render (GtkCellRenderer *cell,
&from,
&to,
&colour_fg);
- arrow_draw (DIA_RENDERER (priv->renderer),
- tmp_arrow.type,
- &arrow_head,
- &from,
- tmp_arrow.length,
- tmp_arrow.width,
- ARROW_LINEWIDTH,
- &colour_fg,
- &colour_bg);
+ dia_arrow_draw (&tmp_arrow,
+ DIA_RENDERER (priv->renderer),
+ &arrow_head,
+ &from,
+ ARROW_LINEWIDTH,
+ &colour_fg,
+ &colour_bg);
dia_renderer_end_render (DIA_RENDERER (priv->renderer));
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index 2a7f84932..ea4f1ab12 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -245,11 +245,13 @@ dia_arrow_preview_expose (GtkWidget *widget, GdkEventExpose *event)
GDK_COLOR_TO_DIA(bg, color_bg);
GDK_COLOR_TO_DIA(fg, color_fg);
dia_renderer_draw_line (DIA_RENDERER (renderer), &from, &to, &color_fg);
- arrow_draw (DIA_RENDERER (renderer), arrow_type.type,
- &arrow_head, &from,
- arrow_type.length,
- arrow_type.width,
- linewidth, &color_fg, &color_bg);
+ dia_arrow_draw (DIA_RENDERER (renderer),
+ arrow_type.type,
+ &arrow_head,
+ &from,
+ linewidth,
+ &color_fg,
+ &color_bg);
}
dia_renderer_end_render (DIA_RENDERER (renderer));
g_clear_object (&renderer);
diff --git a/lib/diarenderer.c b/lib/diarenderer.c
index 3c3121014..382d78c89 100644
--- a/lib/diarenderer.c
+++ b/lib/diarenderer.c
@@ -1352,18 +1352,25 @@ draw_line_with_arrows(DiaRenderer *renderer,
dia_renderer_draw_line (renderer, startpoint, endpoint, color);
/* Actual arrow drawing down here so line styles aren't disturbed */
- if (start_arrow != NULL && start_arrow->type != ARROW_NONE)
- arrow_draw(renderer, start_arrow->type,
- &start_arrow_head, endpoint,
- start_arrow->length, start_arrow->width,
- line_width,
- color, &color_white);
- if (end_arrow != NULL && end_arrow->type != ARROW_NONE)
- arrow_draw(renderer, end_arrow->type,
- &end_arrow_head, startpoint,
- end_arrow->length, end_arrow->width,
- line_width,
- color, &color_white);
+ if (start_arrow != NULL && start_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (start_arrow,
+ renderer,
+ &start_arrow_head,
+ endpoint,
+ line_width,
+ color,
+ &color_white);
+ }
+
+ if (end_arrow != NULL && end_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (end_arrow,
+ renderer,
+ &end_arrow_head,
+ startpoint,
+ line_width,
+ color,
+ &color_white);
+ }
*startpoint = oldstart;
*endpoint = oldend;
@@ -1433,18 +1440,26 @@ draw_polyline_with_arrows(DiaRenderer *renderer,
lastline-firstline,
color);
}
- if (start_arrow != NULL && start_arrow->type != ARROW_NONE)
- arrow_draw(renderer, start_arrow->type,
- &start_arrow_head, &points[firstline+1],
- start_arrow->length, start_arrow->width,
- line_width,
- color, &color_white);
- if (end_arrow != NULL && end_arrow->type != ARROW_NONE)
- arrow_draw(renderer, end_arrow->type,
- &end_arrow_head, &points[lastline-2],
- end_arrow->length, end_arrow->width,
- line_width,
- color, &color_white);
+
+ if (start_arrow != NULL && start_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (start_arrow,
+ renderer,
+ &start_arrow_head,
+ &points[firstline+1],
+ line_width,
+ color,
+ &color_white);
+ }
+
+ if (end_arrow != NULL && end_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (end_arrow,
+ renderer,
+ &end_arrow_head,
+ &points[lastline-2],
+ line_width,
+ color,
+ &color_white);
+ }
points[firstline] = oldstart;
points[lastline-1] = oldend;
@@ -1513,18 +1528,24 @@ draw_rounded_polyline_with_arrows(DiaRenderer *renderer,
lastline-firstline,
color, radius);
}
- if (start_arrow != NULL && start_arrow->type != ARROW_NONE)
- arrow_draw(renderer, start_arrow->type,
- &start_arrow_head, &points[firstline+1],
- start_arrow->length, start_arrow->width,
- line_width,
- color, &color_white);
- if (end_arrow != NULL && end_arrow->type != ARROW_NONE)
- arrow_draw(renderer, end_arrow->type,
- &end_arrow_head, &points[lastline-2],
- end_arrow->length, end_arrow->width,
- line_width,
- color, &color_white);
+
+ if (start_arrow != NULL && start_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (start_arrow,
+ renderer,
+ &start_arrow_head, &points[firstline+1],
+ line_width,
+ color,
+ &color_white);
+ }
+
+ if (end_arrow != NULL && end_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (end_arrow,
+ renderer,
+ &end_arrow_head, &points[lastline-2],
+ line_width,
+ color,
+ &color_white);
+ }
points[firstline] = oldstart;
points[lastline-1] = oldend;
@@ -1802,20 +1823,29 @@ draw_arc_with_arrows (DiaRenderer *renderer,
angle2,
color);
}
- if (start_arrow != NULL && start_arrow->type != ARROW_NONE)
- arrow_draw(renderer, start_arrow->type,
- &start_arrow_head, &start_arrow_end,
- start_arrow->length, start_arrow->width,
- line_width,
- color, &color_white);
- if (end_arrow != NULL && end_arrow->type != ARROW_NONE)
- arrow_draw(renderer, end_arrow->type,
- &end_arrow_head, &end_arrow_end,
- end_arrow->length, end_arrow->width,
- line_width,
- color, &color_white);
+
+ if (start_arrow != NULL && start_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (start_arrow,
+ renderer,
+ &start_arrow_head,
+ &start_arrow_end,
+ line_width,
+ color,
+ &color_white);
+ }
+
+ if (end_arrow != NULL && end_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (end_arrow,
+ renderer,
+ &end_arrow_head,
+ &end_arrow_end,
+ line_width,
+ color,
+ &color_white);
+ }
}
+
/*!
* \brief Draw a bezier line fitting to the given arrows
*
@@ -1859,18 +1889,26 @@ draw_bezier_with_arrows(DiaRenderer *renderer,
point_sub(&points[num_points-1].p3, &move_line);
}
dia_renderer_draw_bezier (renderer, points, num_points, color);
- if (start_arrow != NULL && start_arrow->type != ARROW_NONE)
- arrow_draw(renderer, start_arrow->type,
- &start_arrow_head, &points[1].p1,
- start_arrow->length, start_arrow->width,
- line_width,
- color, &color_white);
- if (end_arrow != NULL && end_arrow->type != ARROW_NONE)
- arrow_draw(renderer, end_arrow->type,
- &end_arrow_head, &points[num_points-1].p2,
- end_arrow->length, end_arrow->width,
- line_width,
- color, &color_white);
+
+ if (start_arrow != NULL && start_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (start_arrow,
+ renderer,
+ &start_arrow_head,
+ &points[1].p1,
+ line_width,
+ color,
+ &color_white);
+ }
+
+ if (end_arrow != NULL && end_arrow->type != ARROW_NONE) {
+ dia_arrow_draw (end_arrow,
+ renderer,
+ &end_arrow_head,
+ &points[num_points-1].p2,
+ line_width,
+ color,
+ &color_white);
+ }
points[0].p1 = startpoint;
points[num_points-1].p3 = endpoint;
diff --git a/lib/dummy_dep.h b/lib/dummy_dep.h
index 42b9eecb7..c4e6e077b 100644
--- a/lib/dummy_dep.h
+++ b/lib/dummy_dep.h
@@ -54,7 +54,7 @@ void *dummy_dep[] G_GNUC_UNUSED = {
new_text,
dia_font_new_from_style, /* font.o */
nearest_pow,
- arrow_draw,
+ dia_arrow_draw,
dia_font_selector_new, /* widgets.o */
dia_state_object_change_new, /* objchange.o */
intl_score_locale, /* intl.o */
diff --git a/lib/libdia.def b/lib/libdia.def
index 9c6793cbe..37eb41580 100644
--- a/lib/libdia.def
+++ b/lib/libdia.def
@@ -4,12 +4,12 @@ EXPORTS
apply_textattr_properties
apply_textstr_properties
arrow_bbox
- arrow_draw
+ dia_arrow_draw
arrow_type_from_name
arrow_get_name_from_type
get_arrow_names
- load_arrow
- save_arrow
+ dia_arrow_load
+ dia_arrow_save
attribute_first_data
attribute_num_data
diff --git a/objects/GRAFCET/vector.c b/objects/GRAFCET/vector.c
index 9472641bb..af51e08c5 100644
--- a/objects/GRAFCET/vector.c
+++ b/objects/GRAFCET/vector.c
@@ -210,6 +210,7 @@ arc_draw (Arc *arc, DiaRenderer *renderer)
OrthConn *orth = &arc->orth;
Point *points;
int n,i;
+ Arrow arrow = { ARC_ARROW_TYPE, ARC_ARROW_LENGTH, ARC_ARROW_WIDTH };
points = &orth->points[0];
n = orth->numpoints;
@@ -229,15 +230,13 @@ arc_draw (Arc *arc, DiaRenderer *renderer)
Point m;
m.x = points[i].x; /* == points[i+1].x */
m.y = .5 * (points[i].y + points[i+1].y) - (.5 * ARC_ARROW_LENGTH);
- arrow_draw (renderer,
- ARC_ARROW_TYPE,
- &m,
- &points[i],
- ARC_ARROW_LENGTH,
- ARC_ARROW_WIDTH,
- ARC_LINE_WIDTH,
- &color_black,
- &color_white);
+ dia_arrow_draw (&arrow,
+ renderer,
+ &m,
+ &points[i],
+ ARC_LINE_WIDTH,
+ &color_black,
+ &color_white);
}
}
}
diff --git a/objects/standard/arc.c b/objects/standard/arc.c
index cf70e6afc..8f06fdfa5 100644
--- a/objects/standard/arc.c
+++ b/objects/standard/arc.c
@@ -971,16 +971,25 @@ arc_save(Arc *arc, ObjectNode obj_node, DiaContext *ctx)
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);
+ dia_arrow_save (&arc->start_arrow,
+ obj_node,
+ "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);
+ dia_arrow_save (&arc->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
}
}
+
static DiaObject *
arc_load(ObjectNode obj_node, int version,DiaContext *ctx)
{
@@ -1030,11 +1039,19 @@ arc_load(ObjectNode obj_node, int version,DiaContext *ctx)
if (attr != NULL)
arc->line_caps = data_enum(attribute_first_data(attr), ctx);
- load_arrow(obj_node, &arc->start_arrow, "start_arrow",
- "start_arrow_length", "start_arrow_width", ctx);
-
- load_arrow(obj_node, &arc->end_arrow, "end_arrow",
- "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_load (&arc->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
+
+ dia_arrow_load (&arc->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
connection_init(conn, 4, 0);
diff --git a/objects/standard/bezier.c b/objects/standard/bezier.c
index 94913ab03..cdc8bcdd5 100644
--- a/objects/standard/bezier.c
+++ b/objects/standard/bezier.c
@@ -638,13 +638,21 @@ bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
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);
+ dia_arrow_save (&bezierline->start_arrow,
+ obj_node,
+ "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);
+ dia_arrow_save (&bezierline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
}
if (bezierline->absolute_start_gap)
@@ -704,11 +712,19 @@ bezierline_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
bezierline->dashlength = data_real(attribute_first_data(attr), ctx);
- load_arrow(obj_node, &bezierline->start_arrow, "start_arrow",
- "start_arrow_length", "start_arrow_width", ctx);
-
- load_arrow(obj_node, &bezierline->end_arrow, "end_arrow",
- "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_load (&bezierline->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
+
+ dia_arrow_load (&bezierline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
bezierline->absolute_start_gap = 0.0;
attr = object_find_attribute(obj_node, "absolute_start_gap");
diff --git a/objects/standard/line.c b/objects/standard/line.c
index ca23815ec..f1c22060f 100644
--- a/objects/standard/line.c
+++ b/objects/standard/line.c
@@ -670,13 +670,21 @@ line_save(Line *line, ObjectNode obj_node, DiaContext *ctx)
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);
+ dia_arrow_save (&line->start_arrow,
+ obj_node,
+ "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);
+ dia_arrow_save (&line->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
}
if (line->absolute_start_gap)
@@ -729,11 +737,19 @@ line_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
line->line_caps = data_enum(attribute_first_data(attr), ctx);
- load_arrow(obj_node, &line->start_arrow,
- "start_arrow", "start_arrow_length", "start_arrow_width", ctx);
-
- load_arrow(obj_node, &line->end_arrow,
- "end_arrow", "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_load (&line->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
+
+ dia_arrow_load (&line->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
line->absolute_start_gap = 0.0;
attr = object_find_attribute(obj_node, "absolute_start_gap");
diff --git a/objects/standard/polyline.c b/objects/standard/polyline.c
index 7536b5df9..cefe120f8 100644
--- a/objects/standard/polyline.c
+++ b/objects/standard/polyline.c
@@ -496,13 +496,21 @@ polyline_save(Polyline *polyline, ObjectNode obj_node,
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);
+ dia_arrow_save (&polyline->start_arrow,
+ obj_node,
+ "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);
+ dia_arrow_save (&polyline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
}
if (polyline->absolute_start_gap)
@@ -565,11 +573,19 @@ polyline_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
polyline->dashlength = data_real(attribute_first_data(attr), ctx);
- load_arrow(obj_node, &polyline->start_arrow, "start_arrow",
- "start_arrow_length", "start_arrow_width", ctx);
-
- load_arrow(obj_node, &polyline->end_arrow, "end_arrow",
- "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_load (&polyline->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
+
+ dia_arrow_load (&polyline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
polyline->absolute_start_gap = 0.0;
attr = object_find_attribute(obj_node, "absolute_start_gap");
diff --git a/objects/standard/zigzagline.c b/objects/standard/zigzagline.c
index 2a3323ae4..5c7f4b4ea 100644
--- a/objects/standard/zigzagline.c
+++ b/objects/standard/zigzagline.c
@@ -512,13 +512,21 @@ zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node,
zigzagline->line_caps, ctx);
if (zigzagline->start_arrow.type != ARROW_NONE) {
- save_arrow(obj_node, &zigzagline->start_arrow, "start_arrow",
- "start_arrow_length", "start_arrow_width", ctx);
+ dia_arrow_save (&zigzagline->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
}
if (zigzagline->end_arrow.type != ARROW_NONE) {
- save_arrow(obj_node, &zigzagline->end_arrow, "end_arrow",
- "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_save (&zigzagline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
}
if (zigzagline->line_style != LINESTYLE_SOLID &&
@@ -574,11 +582,19 @@ zigzagline_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL)
zigzagline->line_caps = data_enum(attribute_first_data(attr), ctx);
- load_arrow(obj_node, &zigzagline->start_arrow, "start_arrow",
- "start_arrow_length", "start_arrow_width", ctx);
-
- load_arrow(obj_node, &zigzagline->end_arrow, "end_arrow",
- "end_arrow_length", "end_arrow_width", ctx);
+ dia_arrow_load (&zigzagline->start_arrow,
+ obj_node,
+ "start_arrow",
+ "start_arrow_length",
+ "start_arrow_width",
+ ctx);
+
+ dia_arrow_load (&zigzagline->end_arrow,
+ obj_node,
+ "end_arrow",
+ "end_arrow_length",
+ "end_arrow_width",
+ ctx);
zigzagline->dashlength = DEFAULT_LINESTYLE_DASHLEN;
attr = object_find_attribute(obj_node, "dashlength");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]