[dia] DiaContext* for data_add_*() and PropertyType_Save functions
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] DiaContext* for data_add_*() and PropertyType_Save functions
- Date: Sun, 19 Jan 2014 12:02:10 +0000 (UTC)
commit 347b3a0aa151e1ed432574709637e1d147b21ac1
Author: Hans Breuer <hans breuer org>
Date: Mon Jan 6 21:51:26 2014 +0100
DiaContext* for data_add_*() and PropertyType_Save functions
Now save is on par with load again, i.e. both have a context available
to bundled error messages instead of single message_*() calls. Also
this allows other fancy stuff coming next;)
app/load_save.c | 60 +++++++++++-----------
lib/arrows.c | 8 ++--
lib/arrows.h | 2 +-
lib/bezier_conn.c | 10 ++--
lib/beziershape.c | 10 ++--
lib/connection.c | 4 +-
lib/connpoint_line.c | 4 +-
lib/connpoint_line.h | 2 +-
lib/dia_xml.c | 26 +++++-----
lib/dia_xml.h | 35 +++++++-------
lib/element.c | 6 +-
lib/object.c | 6 +-
lib/orth_conn.c | 6 +-
lib/persistence.c | 97 +++++++++++++++++++++++--------------
lib/poly_conn.c | 2 +-
lib/polyshape.c | 2 +-
lib/prop_attr.c | 28 ++++-------
lib/prop_basic.c | 10 ++--
lib/prop_basic.h | 6 +-
lib/prop_dict.c | 28 +++++++----
lib/prop_geomtypes.c | 42 ++++++++--------
lib/prop_inttypes.c | 24 +++++-----
lib/prop_matrix.c | 6 +-
lib/prop_pattern.c | 43 ++++++++++------
lib/prop_pixbuf.c | 12 ++--
lib/prop_text.c | 8 ++--
lib/properties.h | 2 +-
lib/text.c | 16 +++---
lib/text.h | 2 +-
objects/AADL/aadlbox.c | 10 ++--
objects/Database/compound.c | 6 +-
objects/ER/attribute.c | 23 +++++----
objects/ER/entity.c | 16 +++---
objects/ER/participation.c | 2 +-
objects/ER/relationship.c | 20 ++++----
objects/FS/flow-ortho.c | 4 +-
objects/FS/flow.c | 4 +-
objects/FS/function.c | 8 ++--
objects/GRAFCET/boolequation.c | 7 ++-
objects/GRAFCET/boolequation.h | 2 +-
objects/Misc/tree.c | 4 +-
objects/UML/class.c | 68 +++++++++++++-------------
objects/UML/uml.h | 6 +-
objects/UML/umlattribute.c | 18 ++++----
objects/UML/umlformalparameter.c | 9 ++--
objects/UML/umloperation.c | 34 +++++++-------
objects/flowchart/box.c | 22 ++++----
objects/flowchart/diamond.c | 21 ++++----
objects/flowchart/ellipse.c | 19 ++++----
objects/flowchart/parallelogram.c | 29 ++++++-----
objects/network/bus.c | 4 +-
objects/network/wanlink.c | 6 +-
objects/standard/arc.c | 22 ++++----
objects/standard/bezier.c | 20 ++++----
objects/standard/beziergon.c | 16 +++---
objects/standard/box.c | 21 ++++----
objects/standard/ellipse.c | 16 +++---
objects/standard/image.c | 28 ++++++-----
objects/standard/line.c | 30 ++++++------
objects/standard/polygon.c | 24 +++++-----
objects/standard/polyline.c | 24 +++++-----
objects/standard/textobj.c | 8 ++--
objects/standard/zigzagline.c | 24 +++++-----
63 files changed, 566 insertions(+), 516 deletions(-)
---
diff --git a/app/load_save.c b/app/load_save.c
index d105afe..1182ec7 100644
--- a/app/load_save.c
+++ b/app/load_save.c
@@ -867,62 +867,62 @@ diagram_data_write_doc(DiagramData *data, const char *filename, DiaContext *ctx)
tree = xmlNewChild(doc->xmlRootNode, name_space, (const xmlChar *)"diagramdata", NULL);
attr = new_attribute((ObjectNode)tree, "background");
- data_add_color(attr, &data->bg_color);
+ data_add_color(attr, &data->bg_color, ctx);
if (diagram) {
attr = new_attribute((ObjectNode)tree, "pagebreak");
- data_add_color(attr, &diagram->pagebreak_color);
+ data_add_color(attr, &diagram->pagebreak_color, ctx);
}
attr = new_attribute((ObjectNode)tree, "paper");
- pageinfo = data_add_composite(attr, "paper");
+ pageinfo = data_add_composite(attr, "paper", ctx);
data_add_string(composite_add_attribute(pageinfo, "name"),
- data->paper.name);
+ data->paper.name, ctx);
data_add_real(composite_add_attribute(pageinfo, "tmargin"),
- data->paper.tmargin);
+ data->paper.tmargin, ctx);
data_add_real(composite_add_attribute(pageinfo, "bmargin"),
- data->paper.bmargin);
+ data->paper.bmargin, ctx);
data_add_real(composite_add_attribute(pageinfo, "lmargin"),
- data->paper.lmargin);
+ data->paper.lmargin, ctx);
data_add_real(composite_add_attribute(pageinfo, "rmargin"),
- data->paper.rmargin);
+ data->paper.rmargin, ctx);
data_add_boolean(composite_add_attribute(pageinfo, "is_portrait"),
- data->paper.is_portrait);
+ data->paper.is_portrait, ctx);
data_add_real(composite_add_attribute(pageinfo, "scaling"),
- data->paper.scaling);
+ data->paper.scaling, ctx);
data_add_boolean(composite_add_attribute(pageinfo, "fitto"),
- data->paper.fitto);
+ data->paper.fitto, ctx);
if (data->paper.fitto) {
data_add_int(composite_add_attribute(pageinfo, "fitwidth"),
- data->paper.fitwidth);
+ data->paper.fitwidth, ctx);
data_add_int(composite_add_attribute(pageinfo, "fitheight"),
- data->paper.fitheight);
+ data->paper.fitheight, ctx);
}
if (diagram) {
attr = new_attribute((ObjectNode)tree, "grid");
- gridinfo = data_add_composite(attr, "grid");
+ gridinfo = data_add_composite(attr, "grid", ctx);
data_add_boolean(composite_add_attribute(gridinfo, "dynamic"),
- diagram->grid.dynamic);
+ diagram->grid.dynamic, ctx);
data_add_real(composite_add_attribute(gridinfo, "width_x"),
- diagram->grid.width_x);
+ diagram->grid.width_x, ctx);
data_add_real(composite_add_attribute(gridinfo, "width_y"),
- diagram->grid.width_y);
+ diagram->grid.width_y, ctx);
data_add_int(composite_add_attribute(gridinfo, "visible_x"),
- diagram->grid.visible_x);
+ diagram->grid.visible_x, ctx);
data_add_int(composite_add_attribute(gridinfo, "visible_y"),
- diagram->grid.visible_y);
+ diagram->grid.visible_y, ctx);
attr = new_attribute((ObjectNode)tree, "color");
- data_add_composite(gridinfo, "color");
- data_add_color(attr, &diagram->grid.colour);
+ data_add_composite(gridinfo, "color", ctx);
+ data_add_color(attr, &diagram->grid.colour, ctx);
attr = new_attribute((ObjectNode)tree, "guides");
- guideinfo = data_add_composite(attr, "guides");
+ guideinfo = data_add_composite(attr, "guides", ctx);
attr = composite_add_attribute(guideinfo, "hguides");
for (i = 0; i < diagram->guides.nhguides; i++)
- data_add_real(attr, diagram->guides.hguides[i]);
+ data_add_real(attr, diagram->guides.hguides[i], ctx);
attr = composite_add_attribute(guideinfo, "vguides");
for (i = 0; i < diagram->guides.nvguides; i++)
- data_add_real(attr, diagram->guides.vguides[i]);
+ data_add_real(attr, diagram->guides.vguides[i], ctx);
if (g_slist_length(diagram->displays) == 1) {
xmlNodePtr dispinfo;
@@ -930,17 +930,17 @@ diagram_data_write_doc(DiagramData *data, const char *filename, DiaContext *ctx)
DDisplay *ddisp = diagram->displays->data;
attr = new_attribute((ObjectNode)tree, "display");
- dispinfo = data_add_composite(attr, "display");
+ dispinfo = data_add_composite(attr, "display", ctx);
data_add_boolean(composite_add_attribute(dispinfo, "antialiased"),
- ddisp->aa_renderer);
+ ddisp->aa_renderer, ctx);
data_add_boolean(composite_add_attribute(dispinfo, "snap-to-grid"),
- ddisp->grid.snap);
+ ddisp->grid.snap, ctx);
data_add_boolean(composite_add_attribute(dispinfo, "snap-to-object"),
- ddisp->mainpoint_magnetism);
+ ddisp->mainpoint_magnetism, ctx);
data_add_boolean(composite_add_attribute(dispinfo, "show-grid"),
- ddisp->grid.visible);
+ ddisp->grid.visible, ctx);
data_add_boolean(composite_add_attribute(dispinfo, "show-connection-points"),
- ddisp->show_cx_pts);
+ ddisp->show_cx_pts, ctx);
}
}
diff --git a/lib/arrows.c b/lib/arrows.c
index e7207bb..083fe46 100644
--- a/lib/arrows.c
+++ b/lib/arrows.c
@@ -2073,14 +2073,14 @@ sanitize_arrow(Arrow *arrow, DiaContext *ctx)
*/
void
save_arrow(ObjectNode obj_node, Arrow *arrow, gchar *type_attribute,
- gchar *length_attribute, gchar *width_attribute)
+ gchar *length_attribute, gchar *width_attribute, DiaContext *ctx)
{
data_add_enum(new_attribute(obj_node, type_attribute),
- arrow->type);
+ arrow->type, ctx);
data_add_real(new_attribute(obj_node, length_attribute),
- arrow->length);
+ arrow->length, ctx);
data_add_real(new_attribute(obj_node, width_attribute),
- arrow->width);
+ arrow->width, ctx);
}
/** Load arrow information from three attributes.
diff --git a/lib/arrows.h b/lib/arrows.h
index 2a34bf8..07ca513 100644
--- a/lib/arrows.h
+++ b/lib/arrows.h
@@ -120,7 +120,7 @@ calculate_arrow_point(const Arrow *arrow, const Point *to, const Point *from,
real linewidth);
void save_arrow(ObjectNode obj_node, Arrow *arrow, gchar *type_attribute,
- gchar *length_attribute, gchar *width_attribute);
+ gchar *length_attribute, gchar *width_attribute, DiaContext *ctx);
void load_arrow(ObjectNode obj_node, Arrow *arrow, gchar *type_attribute,
gchar *length_attribute, gchar *width_attribute, DiaContext *ctx);
diff --git a/lib/bezier_conn.c b/lib/bezier_conn.c
index cf94c66..65e7053 100644
--- a/lib/bezier_conn.c
+++ b/lib/bezier_conn.c
@@ -862,18 +862,18 @@ bezierconn_save (BezierConn *bezier,
attr = new_attribute(obj_node, "bez_points");
- data_add_point(attr, &bezier->bezier.points[0].p1);
+ data_add_point(attr, &bezier->bezier.points[0].p1, ctx);
for (i = 1; i < bezier->bezier.num_points; i++) {
if (BEZ_MOVE_TO == bezier->bezier.points[i].type)
g_warning("only first BezPoint can be a BEZ_MOVE_TO");
- data_add_point(attr, &bezier->bezier.points[i].p1);
- data_add_point(attr, &bezier->bezier.points[i].p2);
- data_add_point(attr, &bezier->bezier.points[i].p3);
+ data_add_point(attr, &bezier->bezier.points[i].p1, ctx);
+ data_add_point(attr, &bezier->bezier.points[i].p2, ctx);
+ data_add_point(attr, &bezier->bezier.points[i].p3, ctx);
}
attr = new_attribute(obj_node, "corner_types");
for (i = 0; i < bezier->bezier.num_points; i++)
- data_add_enum(attr, bezier->bezier.corner_types[i]);
+ data_add_enum(attr, bezier->bezier.corner_types[i], ctx);
}
/** Load a bezierconn object from XML.
diff --git a/lib/beziershape.c b/lib/beziershape.c
index d1f0577..c243cd2 100644
--- a/lib/beziershape.c
+++ b/lib/beziershape.c
@@ -941,19 +941,19 @@ beziershape_save (BezierShape *bezier,
attr = new_attribute(obj_node, "bez_points");
- data_add_point(attr, &bezier->bezier.points[0].p1);
+ data_add_point(attr, &bezier->bezier.points[0].p1, ctx);
for (i = 1; i < bezier->bezier.num_points; i++) {
if (BEZ_MOVE_TO == bezier->bezier.points[i].type)
g_warning("only first BezPoint can be a BEZ_MOVE_TO");
- data_add_point(attr, &bezier->bezier.points[i].p1);
- data_add_point(attr, &bezier->bezier.points[i].p2);
+ data_add_point(attr, &bezier->bezier.points[i].p1, ctx);
+ data_add_point(attr, &bezier->bezier.points[i].p2, ctx);
if (i < bezier->bezier.num_points - 1)
- data_add_point(attr, &bezier->bezier.points[i].p3);
+ data_add_point(attr, &bezier->bezier.points[i].p3, ctx);
}
attr = new_attribute(obj_node, "corner_types");
for (i = 0; i < bezier->bezier.num_points; i++)
- data_add_enum(attr, bezier->bezier.corner_types[i]);
+ data_add_enum(attr, bezier->bezier.corner_types[i], ctx);
}
/** Load a beziershape object from XML.
diff --git a/lib/connection.c b/lib/connection.c
index e3aec02..6283c5f 100644
--- a/lib/connection.c
+++ b/lib/connection.c
@@ -209,8 +209,8 @@ connection_save(Connection *conn, ObjectNode obj_node, DiaContext *ctx)
object_save(&conn->object, obj_node, ctx);
attr = new_attribute(obj_node, "conn_endpoints");
- data_add_point(attr, &conn->endpoints[0]);
- data_add_point(attr, &conn->endpoints[1]);
+ data_add_point(attr, &conn->endpoints[0], ctx);
+ data_add_point(attr, &conn->endpoints[1], ctx);
}
/** Load a connections data from XML.
diff --git a/lib/connpoint_line.c b/lib/connpoint_line.c
index 00d204a..1d98d5f 100644
--- a/lib/connpoint_line.c
+++ b/lib/connpoint_line.c
@@ -183,9 +183,9 @@ connpointline_load(DiaObject *obj,ObjectNode obj_node,
void
connpointline_save(ConnPointLine *cpl,ObjectNode obj_node,
- const gchar *name)
+ const gchar *name, DiaContext *ctx)
{
- data_add_int(new_attribute(obj_node, name),cpl->num_connections);
+ data_add_int(new_attribute(obj_node, name),cpl->num_connections, ctx);
}
ConnPointLine *
diff --git a/lib/connpoint_line.h b/lib/connpoint_line.h
index 129bb03..8bf972e 100644
--- a/lib/connpoint_line.h
+++ b/lib/connpoint_line.h
@@ -80,7 +80,7 @@ ConnPointLine *connpointline_load(DiaObject *obj,ObjectNode obj_node,
int *realconncount,
DiaContext *ctx);
void connpointline_save(ConnPointLine *cpl,ObjectNode obj_node,
- const gchar *name);
+ const gchar *name, DiaContext *ctx);
ConnPointLine *connpointline_copy(DiaObject *newobj,ConnPointLine *cpl,
int *realconncount);
diff --git a/lib/dia_xml.c b/lib/dia_xml.c
index 8d349cc..aaa6cca 100644
--- a/lib/dia_xml.c
+++ b/lib/dia_xml.c
@@ -1055,7 +1055,7 @@ composite_add_attribute(DataNode composite_node,
* \ingroup DiagramXmlOut
*/
void
-data_add_int(AttributeNode attr, int data)
+data_add_int(AttributeNode attr, int data, DiaContext *ctx)
{
DataNode data_node;
char buffer[20+1]; /* Enought for 64bit int + zero */
@@ -1073,7 +1073,7 @@ data_add_int(AttributeNode attr, int data)
* \ingroup DiagramXmlOut
*/
void
-data_add_enum(AttributeNode attr, int data)
+data_add_enum(AttributeNode attr, int data, DiaContext *ctx)
{
DataNode data_node;
char buffer[20+1]; /* Enought for 64bit int + zero */
@@ -1091,7 +1091,7 @@ data_add_enum(AttributeNode attr, int data)
* \ingroup DiagramXmlOut
*/
void
-data_add_real(AttributeNode attr, real data)
+data_add_real(AttributeNode attr, real data, DiaContext *ctx)
{
DataNode data_node;
char buffer[G_ASCII_DTOSTR_BUF_SIZE]; /* Large enought */
@@ -1109,7 +1109,7 @@ data_add_real(AttributeNode attr, real data)
* \ingroup DiagramXmlOut
*/
void
-data_add_boolean(AttributeNode attr, int data)
+data_add_boolean(AttributeNode attr, int data, DiaContext *ctx)
{
DataNode data_node;
@@ -1153,7 +1153,7 @@ convert_to_hex(float x, char *str)
* \ingroup DiagramXmlOut
*/
void
-data_add_color(AttributeNode attr, const Color *col)
+data_add_color(AttributeNode attr, const Color *col, DiaContext *ctx)
{
char buffer[1+8+1];
DataNode data_node;
@@ -1190,7 +1190,7 @@ _str_point (const Point *point)
* \ingroup DiagramXmlOut
*/
void
-data_add_point(AttributeNode attr, const Point *point)
+data_add_point(AttributeNode attr, const Point *point, DiaContext *ctx)
{
DataNode data_node;
gchar *buffer = _str_point (point);
@@ -1205,7 +1205,7 @@ data_add_point(AttributeNode attr, const Point *point)
* \ingroup DiagramXmlOut
*/
void
-data_add_bezpoint(AttributeNode attr, const BezPoint *point)
+data_add_bezpoint(AttributeNode attr, const BezPoint *point, DiaContext *ctx)
{
DataNode data_node;
gchar *buffer;
@@ -1245,7 +1245,7 @@ data_add_bezpoint(AttributeNode attr, const BezPoint *point)
* \ingroup DiagramXmlOut
*/
void
-data_add_rectangle(AttributeNode attr, const Rectangle *rect)
+data_add_rectangle(AttributeNode attr, const Rectangle *rect, DiaContext *ctx)
{
DataNode data_node;
gchar *buffer;
@@ -1274,7 +1274,7 @@ data_add_rectangle(AttributeNode attr, const Rectangle *rect)
* \ingroup DiagramXmlOut
*/
void
-data_add_string(AttributeNode attr, const char *str)
+data_add_string(AttributeNode attr, const char *str, DiaContext *ctx)
{
xmlChar *escaped_str;
xmlChar *sharped_str;
@@ -1303,11 +1303,11 @@ data_add_string(AttributeNode attr, const char *str)
* \ingroup DiagramXmlOut
*/
void
-data_add_filename(DataNode data, const char *str)
+data_add_filename(DataNode data, const char *str, DiaContext *ctx)
{
char *utf8 = g_filename_to_utf8(str, -1, NULL, NULL, NULL);
- data_add_string(data, utf8);
+ data_add_string(data, utf8, ctx);
g_free(utf8);
}
@@ -1319,7 +1319,7 @@ data_add_filename(DataNode data, const char *str)
* \ingroup DiagramXmlOut
*/
void
-data_add_font(AttributeNode attr, const DiaFont *font)
+data_add_font(AttributeNode attr, const DiaFont *font, DiaContext *ctx)
{
DataNode data_node;
char buffer[20+1]; /* Enought for 64bit int + zero */
@@ -1341,7 +1341,7 @@ data_add_font(AttributeNode attr, const DiaFont *font)
* \ingroup DiagramXmlOut
*/
DataNode
-data_add_composite(AttributeNode attr, const char *type)
+data_add_composite(AttributeNode attr, const char *type, DiaContext *ctx)
{
/* type can be NULL */
DataNode data_node;
diff --git a/lib/dia_xml.h b/lib/dia_xml.h
index 69e861a..0205336 100644
--- a/lib/dia_xml.h
+++ b/lib/dia_xml.h
@@ -86,31 +86,32 @@ DiaFont *data_font(DataNode data, DiaContext *ctx);
AttributeNode new_attribute(ObjectNode obj_node, const char *attrname);
AttributeNode composite_add_attribute(DataNode composite_node,
const char *attrname);
-void data_add_int(AttributeNode attr, int data);
-void data_add_enum(AttributeNode attr, int data);
-void data_add_real(AttributeNode attr, real data);
-void data_add_boolean(AttributeNode attr, int data);
-void data_add_color(AttributeNode attr, const Color *col);
-void data_add_point(AttributeNode attr, const Point *point);
-void data_add_bezpoint(AttributeNode attr, const BezPoint *point);
-void data_add_rectangle(AttributeNode attr, const Rectangle *rect);
-void data_add_string(AttributeNode attr, const char *str);
-void data_add_filename(AttributeNode attr, const char *str);
-void data_add_font(AttributeNode attr, const DiaFont *font);
+void data_add_int(AttributeNode attr, int data, DiaContext *ctx);
+void data_add_enum(AttributeNode attr, int data, DiaContext *ctx);
+void data_add_real(AttributeNode attr, real data, DiaContext *ctx);
+void data_add_boolean(AttributeNode attr, int data, DiaContext *ctx);
+void data_add_color(AttributeNode attr, const Color *col, DiaContext *ctx);
+void data_add_point(AttributeNode attr, const Point *point, DiaContext *ctx);
+void data_add_bezpoint(AttributeNode attr, const BezPoint *point, DiaContext *ctx);
+void data_add_rectangle(AttributeNode attr, const Rectangle *rect, DiaContext *ctx);
+void data_add_string(AttributeNode attr, const char *str, DiaContext *ctx);
+void data_add_filename(AttributeNode attr, const char *str, DiaContext *ctx);
+void data_add_font(AttributeNode attr, const DiaFont *font, DiaContext *ctx);
DataNode data_add_composite(AttributeNode attr,
- const char *type); /* can be NULL */
+ const char *type, /* can be NULL */
+ DiaContext *ctx);
GHashTable *data_dict (DataNode data, DiaContext *ctx);
-void data_add_dict (AttributeNode attr, GHashTable *data);
+void data_add_dict (AttributeNode attr, GHashTable *data, DiaContext *ctx);
-GdkPixbuf *data_pixbuf (DataNode data);
-void data_add_pixbuf (AttributeNode attr, GdkPixbuf *pixbuf);
+GdkPixbuf *data_pixbuf (DataNode data, DiaContext *ctx);
+void data_add_pixbuf (AttributeNode attr, GdkPixbuf *pixbuf, DiaContext *ctx);
DiaMatrix *data_matrix(DataNode data);
-void data_add_matrix(AttributeNode attr, DiaMatrix *matrix);
+void data_add_matrix(AttributeNode attr, DiaMatrix *matrix, DiaContext *ctx);
DiaPattern *data_pattern(DataNode data, DiaContext *ctx);
-void data_add_pattern(AttributeNode attr, DiaPattern *pat);
+void data_add_pattern(AttributeNode attr, DiaPattern *pat, DiaContext *ctx);
xmlDocPtr diaXmlParseFile(const char *filename, DiaContext *ctx, gboolean try_harder);
diff --git a/lib/element.c b/lib/element.c
index b3c4e50..23b6ddf 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -438,11 +438,11 @@ element_save(Element *elem, ObjectNode obj_node, DiaContext *ctx)
object_save(&elem->object, obj_node, ctx);
data_add_point(new_attribute(obj_node, "elem_corner"),
- &elem->corner);
+ &elem->corner, ctx);
data_add_real(new_attribute(obj_node, "elem_width"),
- elem->width);
+ elem->width, ctx);
data_add_real(new_attribute(obj_node, "elem_height"),
- elem->height);
+ elem->height, ctx);
}
void
diff --git a/lib/object.c b/lib/object.c
index 3b623eb..c510d00 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -770,11 +770,11 @@ void
object_save(DiaObject *obj, ObjectNode obj_node, DiaContext *ctx)
{
data_add_point(new_attribute(obj_node, "obj_pos"),
- &obj->position);
+ &obj->position, ctx);
data_add_rectangle(new_attribute(obj_node, "obj_bb"),
- &obj->bounding_box);
+ &obj->bounding_box, ctx);
if (obj->meta && g_hash_table_size (obj->meta) > 0)
- data_add_dict (new_attribute(obj_node, "meta"), obj->meta);
+ data_add_dict (new_attribute(obj_node, "meta"), obj->meta, ctx);
}
/** Load the object-specific parts of an object.
diff --git a/lib/orth_conn.c b/lib/orth_conn.c
index 7239964..741c415 100644
--- a/lib/orth_conn.c
+++ b/lib/orth_conn.c
@@ -622,15 +622,15 @@ orthconn_save(OrthConn *orth, ObjectNode obj_node, DiaContext *ctx)
attr = new_attribute(obj_node, "orth_points");
for (i=0;i<orth->numpoints;i++) {
- data_add_point(attr, &orth->points[i]);
+ data_add_point(attr, &orth->points[i], ctx);
}
attr = new_attribute(obj_node, "orth_orient");
for (i=0;i<orth->numpoints-1;i++) {
- data_add_enum(attr, orth->orientation[i]);
+ data_add_enum(attr, orth->orientation[i], ctx);
}
- data_add_boolean(new_attribute(obj_node, "autorouting"), orth->autorouting);
+ data_add_boolean(new_attribute(obj_node, "autorouting"), orth->autorouting, ctx);
}
void
diff --git a/lib/persistence.c b/lib/persistence.c
index 97e1d5e..2cba2cb 100644
--- a/lib/persistence.c
+++ b/lib/persistence.c
@@ -339,31 +339,40 @@ persistence_load()
}
/* *********************** SAVING FUNCTIONS *********************** */
+typedef struct
+{
+ xmlNodePtr tree;
+ DiaContext *ctx;
+} PersitenceUserData;
/* Save the position of a window */
static void
persistence_save_window(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
PersistentWindow *window_pos = (PersistentWindow *)value;
ObjectNode window;
window = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"window", NULL);
xmlSetProp(window, (const xmlChar *)"role", (xmlChar *) key);
- data_add_int(new_attribute(window, "xpos"), window_pos->x);
- data_add_int(new_attribute(window, "ypos"), window_pos->y);
- data_add_int(new_attribute(window, "width"), window_pos->width);
- data_add_int(new_attribute(window, "height"), window_pos->height);
- data_add_boolean(new_attribute(window, "isopen"), window_pos->isopen);
+ data_add_int(new_attribute(window, "xpos"), window_pos->x, ctx);
+ data_add_int(new_attribute(window, "ypos"), window_pos->y, ctx);
+ data_add_int(new_attribute(window, "width"), window_pos->width, ctx);
+ data_add_int(new_attribute(window, "height"), window_pos->height, ctx);
+ data_add_boolean(new_attribute(window, "isopen"), window_pos->isopen, ctx);
}
/* Save the contents of a string */
static void
persistence_save_list(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode listnode;
GString *buf;
GList *items;
@@ -380,76 +389,89 @@ persistence_save_list(gpointer key, gpointer value, gpointer data)
g_string_append(buf, "\n");
}
- data_add_string(new_attribute(listnode, "listvalue"), buf->str);
+ data_add_string(new_attribute(listnode, "listvalue"), buf->str, ctx);
g_string_free(buf, TRUE);
}
static void
persistence_save_integer(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode integernode;
integernode = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"integer", NULL);
xmlSetProp(integernode, (const xmlChar *)"role", (xmlChar *)key);
- data_add_int(new_attribute(integernode, "intvalue"), *(gint *)value);
+ data_add_int(new_attribute(integernode, "intvalue"), *(gint *)value, ctx);
}
static void
persistence_save_real(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode realnode;
realnode = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"real", NULL);
xmlSetProp(realnode, (const xmlChar *)"role", (xmlChar *)key);
- data_add_real(new_attribute(realnode, "realvalue"), *(real *)value);
+ data_add_real(new_attribute(realnode, "realvalue"), *(real *)value, ctx);
}
static void
persistence_save_boolean(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode booleannode;
booleannode = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"boolean", NULL);
xmlSetProp(booleannode, (const xmlChar *)"role", (xmlChar *)key);
- data_add_boolean(new_attribute(booleannode, "booleanvalue"), *(gboolean *)value);
+ data_add_boolean(new_attribute(booleannode, "booleanvalue"), *(gboolean *)value, ctx);
}
static void
persistence_save_string(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode stringnode;
stringnode = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"string", NULL);
xmlSetProp(stringnode, (const xmlChar *)"role", (xmlChar *)key);
- data_add_string(new_attribute(stringnode, "stringvalue"), (gchar *)value);
+ data_add_string(new_attribute(stringnode, "stringvalue"), (gchar *)value, ctx);
}
static void
persistence_save_color(gpointer key, gpointer value, gpointer data)
-{
- xmlNodePtr tree = (xmlNodePtr)data;
+{
+ PersitenceUserData *ud = (PersitenceUserData *)data;
+ xmlNodePtr tree = ud->tree;
+ DiaContext *ctx = ud->ctx;
ObjectNode colornode;
colornode = (ObjectNode)xmlNewChild(tree, NULL, (const xmlChar *)"color", NULL);
xmlSetProp(colornode, (const xmlChar *)"role", (xmlChar *)key);
- data_add_color(new_attribute(colornode, "colorvalue"), (Color *)value);
+ data_add_color(new_attribute(colornode, "colorvalue"), (Color *)value, ctx);
}
-
static void
-persistence_save_type(xmlDocPtr doc, GHashTable *entries, GHFunc func)
+persistence_save_type(xmlDocPtr doc, DiaContext *ctx, GHashTable *entries, GHFunc func)
{
+ PersitenceUserData ud;
+ ud.tree = doc->xmlRootNode;
+ ud.ctx = ctx;
+
if (entries != NULL && g_hash_table_size(entries) != 0) {
- g_hash_table_foreach(entries, func, doc->xmlRootNode);
+ g_hash_table_foreach(entries, func, &ud);
}
}
@@ -459,8 +481,10 @@ persistence_save()
{
xmlDocPtr doc;
xmlNs *name_space;
+ DiaContext *ctx;
gchar *filename = dia_config_filename("persistence");
+ ctx = dia_context_new ("Persistence");
doc = xmlNewDoc((const xmlChar *)"1.0");
doc->encoding = xmlStrdup((const xmlChar *)"UTF-8");
doc->xmlRootNode = xmlNewDocNode(doc, NULL, (const xmlChar *)"persistence", NULL);
@@ -470,18 +494,19 @@ persistence_save()
(const xmlChar *)"dia");
xmlSetNs(doc->xmlRootNode, name_space);
- persistence_save_type(doc, persistent_windows, persistence_save_window);
- persistence_save_type(doc, persistent_entrystrings, persistence_save_string);
- persistence_save_type(doc, persistent_lists, persistence_save_list);
- persistence_save_type(doc, persistent_integers, persistence_save_integer);
- persistence_save_type(doc, persistent_reals, persistence_save_real);
- persistence_save_type(doc, persistent_booleans, persistence_save_boolean);
- persistence_save_type(doc, persistent_strings, persistence_save_string);
- persistence_save_type(doc, persistent_colors, persistence_save_color);
+ persistence_save_type(doc, ctx, persistent_windows, persistence_save_window);
+ persistence_save_type(doc, ctx, persistent_entrystrings, persistence_save_string);
+ persistence_save_type(doc, ctx, persistent_lists, persistence_save_list);
+ persistence_save_type(doc, ctx, persistent_integers, persistence_save_integer);
+ persistence_save_type(doc, ctx, persistent_reals, persistence_save_real);
+ persistence_save_type(doc, ctx, persistent_booleans, persistence_save_boolean);
+ persistence_save_type(doc, ctx, persistent_strings, persistence_save_string);
+ persistence_save_type(doc, ctx, persistent_colors, persistence_save_color);
xmlDiaSaveFile(filename, doc);
g_free(filename);
xmlFreeDoc(doc);
+ dia_context_release (ctx);
}
/* *********************** USAGE FUNCTIONS *********************** */
diff --git a/lib/poly_conn.c b/lib/poly_conn.c
index a895985..ea337c3 100644
--- a/lib/poly_conn.c
+++ b/lib/poly_conn.c
@@ -429,7 +429,7 @@ polyconn_save(PolyConn *poly, ObjectNode obj_node, DiaContext *ctx)
attr = new_attribute(obj_node, "poly_points");
for (i=0;i<poly->numpoints;i++) {
- data_add_point(attr, &poly->points[i]);
+ data_add_point(attr, &poly->points[i], ctx);
}
}
diff --git a/lib/polyshape.c b/lib/polyshape.c
index 9ab9743..df0afb3 100644
--- a/lib/polyshape.c
+++ b/lib/polyshape.c
@@ -501,7 +501,7 @@ polyshape_save(PolyShape *poly, ObjectNode obj_node, DiaContext *ctx)
attr = new_attribute(obj_node, "poly_points");
for (i=0;i<poly->numpoints;i++) {
- data_add_point(attr, &poly->points[i]);
+ data_add_point(attr, &poly->points[i], ctx);
}
}
diff --git a/lib/prop_attr.c b/lib/prop_attr.c
index 1d89ad0..707f209 100644
--- a/lib/prop_attr.c
+++ b/lib/prop_attr.c
@@ -106,16 +106,10 @@ linestyleprop_load(LinestyleProperty *prop, AttributeNode attr, DataNode data, D
}
static void
-linestyleprop_save(LinestyleProperty *prop, AttributeNode attr)
+linestyleprop_save(LinestyleProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_enum(attr, prop->style);
- data_add_real(attr, prop->dash);
- /* for compatibility. It makes more sense to link the two together */
- /*
- data_add_real(new_attribute(attr->parent, "dashlength"),
- prop->dash);
-
- To hell with compatibility with very old dias ! -- CC */
+ data_add_enum(attr, prop->style, ctx);
+ data_add_real(attr, prop->dash, ctx);
}
static void
@@ -221,19 +215,19 @@ arrowprop_load(ArrowProperty *prop, AttributeNode attr, DataNode data, DiaContex
}
static void
-arrowprop_save(ArrowProperty *prop, AttributeNode attr)
+arrowprop_save(ArrowProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_enum(attr, prop->arrow_data.type);
+ data_add_enum(attr, prop->arrow_data.type, ctx);
if (prop->arrow_data.type != ARROW_NONE) {
ObjectNode obj_node = attr->parent;
gchar *str = g_strconcat(prop->common.descr->name, "_length", NULL);
attr = new_attribute(obj_node, str);
g_free(str);
- data_add_real(attr, prop->arrow_data.length);
+ data_add_real(attr, prop->arrow_data.length, ctx);
str = g_strconcat(prop->common.descr->name, "_width", NULL);
attr = new_attribute(obj_node, str);
g_free(str);
- data_add_real(attr, prop->arrow_data.width);
+ data_add_real(attr, prop->arrow_data.width, ctx);
}
}
@@ -323,9 +317,9 @@ colorprop_load(ColorProperty *prop, AttributeNode attr, DataNode data, DiaContex
}
static void
-colorprop_save(ColorProperty *prop, AttributeNode attr)
+colorprop_save(ColorProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_color(attr,&prop->color_data);
+ data_add_color(attr,&prop->color_data, ctx);
}
static void
@@ -436,9 +430,9 @@ fontprop_load(FontProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-fontprop_save(FontProperty *prop, AttributeNode attr)
+fontprop_save(FontProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_font(attr,prop->font_data);
+ data_add_font(attr,prop->font_data, ctx);
}
static void
diff --git a/lib/prop_basic.c b/lib/prop_basic.c
index 454de5d..495b662 100644
--- a/lib/prop_basic.c
+++ b/lib/prop_basic.c
@@ -150,9 +150,9 @@ commonprop_load(Property *prop, AttributeNode attr, DataNode data, DiaContext *c
}
static void
-commonprop_save(Property *prop, AttributeNode attr)
+commonprop_save(Property *prop, AttributeNode attr, DiaContext *ctx)
{
- prop->real_ops->save(prop,attr);
+ prop->real_ops->save(prop,attr,ctx);
prop->experience |= PXP_SAVED;
}
@@ -277,7 +277,7 @@ noopprop_load(NoopProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
void
-noopprop_save(NoopProperty *prop, AttributeNode attr)
+noopprop_save(NoopProperty *prop, AttributeNode attr, DiaContext *ctx)
{
}
@@ -372,7 +372,7 @@ invalidprop_load(InvalidProperty *prop, AttributeNode attr, DataNode data, DiaCo
}
void
-invalidprop_save(InvalidProperty *prop, AttributeNode attr)
+invalidprop_save(InvalidProperty *prop, AttributeNode attr, DiaContext *ctx)
{
g_assert_not_reached();
}
@@ -467,7 +467,7 @@ unimplementedprop_load(UnimplementedProperty *prop,
}
void
-unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr)
+unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr, DiaContext *ctx)
{
g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
diff --git a/lib/prop_basic.h b/lib/prop_basic.h
index 08504fd..9bba042 100644
--- a/lib/prop_basic.h
+++ b/lib/prop_basic.h
@@ -45,7 +45,7 @@ WIDGET *noopprop_get_widget(NoopProperty *prop, PropDialog *dialog);
void noopprop_reset_widget(NoopProperty *prop, WIDGET *widget);
void noopprop_set_from_widget(NoopProperty *prop, WIDGET *widget);
void noopprop_load(NoopProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx);
-void noopprop_save(NoopProperty *prop, AttributeNode attr);
+void noopprop_save(NoopProperty *prop, AttributeNode attr, DiaContext *ctx);
gboolean noopprop_can_merge(const PropDescription *pd1,
const PropDescription *pd2);
gboolean noopprop_cannot_merge(const PropDescription *pd1,
@@ -68,7 +68,7 @@ void invalidprop_reset_widget(InvalidProperty *prop, WIDGET *widget);
void invalidprop_set_from_widget(InvalidProperty *prop, WIDGET *widget);
void invalidprop_load(InvalidProperty *prop, AttributeNode attr,
DataNode data, DiaContext *ctx);
-void invalidprop_save(InvalidProperty *prop, AttributeNode attr);
+void invalidprop_save(InvalidProperty *prop, AttributeNode attr, DiaContext *ctx);
gboolean invalidprop_can_merge(const PropDescription *pd1,
const PropDescription *pd2);
void invalidprop_get_from_offset(const InvalidProperty *prop,
@@ -91,7 +91,7 @@ void unimplementedprop_set_from_widget(UnimplementedProperty *prop,
WIDGET *widget);
void unimplementedprop_load(UnimplementedProperty *prop,
AttributeNode attr, DataNode data, DiaContext *ctx);
-void unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr);
+void unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr, DiaContext *ctx);
gboolean unimplementedprop_can_merge(const PropDescription *pd1,
const PropDescription *pd2);
void unimplementedprop_get_from_offset(const UnimplementedProperty *prop,
diff --git a/lib/prop_dict.c b/lib/prop_dict.c
index 5c076d3..eada7d1 100644
--- a/lib/prop_dict.c
+++ b/lib/prop_dict.c
@@ -123,24 +123,32 @@ _hash_dup (const GHashTable *src)
}
return dest;
}
-
+typedef struct
+{
+ ObjectNode node;
+ DiaContext *ctx;
+} DictUserData;
static void
_keyvalue_save (gpointer key,
gpointer value,
gpointer user_data)
{
+ DictUserData *ud = (DictUserData *)user_data;
gchar *name = (gchar *)key;
gchar *val = (gchar *)value;
- ObjectNode node = (ObjectNode)user_data;
+ ObjectNode node = ud->node;
+ DiaContext *ctx = ud->ctx;
- data_add_string(new_attribute(node, name), val);
+ data_add_string(new_attribute(node, name), val, ctx);
}
static void
-dictprop_save(DictProperty *prop, AttributeNode attr)
+dictprop_save(DictProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- ObjectNode composite = data_add_composite(attr, "dict");
+ DictUserData ud;
+ ud.node = data_add_composite(attr, "dict", ctx);
+ ud.ctx = ctx;
if (prop->dict)
- g_hash_table_foreach (prop->dict, _keyvalue_save, composite);
+ g_hash_table_foreach (prop->dict, _keyvalue_save, &ud);
}
static void
@@ -375,9 +383,11 @@ data_dict (DataNode data, DiaContext *ctx)
}
void
-data_add_dict (AttributeNode attr, GHashTable *data)
+data_add_dict (AttributeNode attr, GHashTable *data, DiaContext *ctx)
{
- ObjectNode composite = data_add_composite(attr, "dict");
+ DictUserData ud;
+ ud.node = data_add_composite(attr, "dict", ctx);
+ ud.ctx = ctx;
- g_hash_table_foreach (data, _keyvalue_save, composite);
+ g_hash_table_foreach (data, _keyvalue_save, &ud);
}
diff --git a/lib/prop_geomtypes.c b/lib/prop_geomtypes.c
index 8f28581..8632473 100644
--- a/lib/prop_geomtypes.c
+++ b/lib/prop_geomtypes.c
@@ -109,9 +109,9 @@ realprop_load(RealProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-realprop_save(RealProperty *prop, AttributeNode attr)
+realprop_save(RealProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_real(attr, prop->real_data);
+ data_add_real(attr, prop->real_data, ctx);
}
static void
@@ -222,9 +222,9 @@ lengthprop_load(LengthProperty *prop, AttributeNode attr, DataNode data, DiaCont
}
static void
-lengthprop_save(LengthProperty *prop, AttributeNode attr)
+lengthprop_save(LengthProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_real(attr, prop->length_data);
+ data_add_real(attr, prop->length_data, ctx);
}
static void
@@ -329,9 +329,9 @@ fontsizeprop_load(FontsizeProperty *prop, AttributeNode attr, DataNode data, Dia
}
static void
-fontsizeprop_save(FontsizeProperty *prop, AttributeNode attr)
+fontsizeprop_save(FontsizeProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_real(attr, prop->fontsize_data);
+ data_add_real(attr, prop->fontsize_data, ctx);
}
static void
@@ -423,9 +423,9 @@ pointprop_load(PointProperty *prop, AttributeNode attr, DataNode data, DiaContex
}
static void
-pointprop_save(PointProperty *prop, AttributeNode attr)
+pointprop_save(PointProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_point(attr, &prop->point_data);
+ data_add_point(attr, &prop->point_data, ctx);
}
static void
@@ -507,11 +507,11 @@ pointarrayprop_load(PointarrayProperty *prop, AttributeNode attr, DataNode data,
}
static void
-pointarrayprop_save(PointarrayProperty *prop, AttributeNode attr)
+pointarrayprop_save(PointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->pointarray_data->len; i++)
- data_add_point(attr, &g_array_index(prop->pointarray_data,Point,i));
+ data_add_point(attr, &g_array_index(prop->pointarray_data,Point,i), ctx);
}
static void
@@ -587,9 +587,9 @@ bezpointprop_load(BezPointProperty *prop, AttributeNode attr, DataNode data, Dia
}
static void
-bezpointprop_save(BezPointProperty *prop, AttributeNode attr)
+bezpointprop_save(BezPointProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_bezpoint(attr, &prop->bezpoint_data);
+ data_add_bezpoint(attr, &prop->bezpoint_data, ctx);
}
static void
@@ -675,12 +675,12 @@ bezpointarrayprop_load(BezPointarrayProperty *prop,
}
static void
-bezpointarrayprop_save(BezPointarrayProperty *prop, AttributeNode attr)
+bezpointarrayprop_save(BezPointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->bezpointarray_data->len; i++)
data_add_bezpoint(attr,
- &g_array_index(prop->bezpointarray_data,BezPoint,i));
+ &g_array_index(prop->bezpointarray_data,BezPoint,i), ctx);
}
static void
@@ -755,9 +755,9 @@ rectprop_load(RectProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-rectprop_save(RectProperty *prop, AttributeNode attr)
+rectprop_save(RectProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_rectangle(attr, &prop->rect_data);
+ data_add_rectangle(attr, &prop->rect_data, ctx);
}
static void
@@ -825,10 +825,10 @@ endpointsprop_load(EndpointsProperty *prop, AttributeNode attr, DataNode data, D
}
static void
-endpointsprop_save(EndpointsProperty *prop, AttributeNode attr)
+endpointsprop_save(EndpointsProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_point(attr, &prop->endpoints_data[0]);
- data_add_point(attr, &prop->endpoints_data[1]);
+ data_add_point(attr, &prop->endpoints_data[0], ctx);
+ data_add_point(attr, &prop->endpoints_data[1], ctx);
}
static void
@@ -897,9 +897,9 @@ connpoint_lineprop_load(Connpoint_LineProperty *prop, AttributeNode attr,
}
static void
-connpoint_lineprop_save(Connpoint_LineProperty *prop, AttributeNode attr)
+connpoint_lineprop_save(Connpoint_LineProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_int(attr, prop->connpoint_line_data);
+ data_add_int(attr, prop->connpoint_line_data, ctx);
}
static void
diff --git a/lib/prop_inttypes.c b/lib/prop_inttypes.c
index 572023c..b1aaf06 100644
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c
@@ -100,12 +100,12 @@ charprop_load(CharProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-charprop_save(CharProperty *prop, AttributeNode attr)
+charprop_save(CharProperty *prop, AttributeNode attr, DiaContext *ctx)
{
gchar utf[7];
gint n = g_unichar_to_utf8 (prop->char_data, utf);
utf[n] = 0;
- data_add_string (attr, utf);
+ data_add_string (attr, utf, ctx);
}
static void
@@ -210,9 +210,9 @@ boolprop_load(BoolProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-boolprop_save(BoolProperty *prop, AttributeNode attr)
+boolprop_save(BoolProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_boolean(attr, prop->bool_data);
+ data_add_boolean(attr, prop->bool_data, ctx);
}
static void
@@ -320,9 +320,9 @@ intprop_load(IntProperty *prop, AttributeNode attr, DataNode data, DiaContext *c
}
static void
-intprop_save(IntProperty *prop, AttributeNode attr)
+intprop_save(IntProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_int(attr, prop->int_data);
+ data_add_int(attr, prop->int_data, ctx);
}
static void
@@ -411,11 +411,11 @@ intarrayprop_load(IntarrayProperty *prop, AttributeNode attr, DataNode data, Dia
}
static void
-intarrayprop_save(IntarrayProperty *prop, AttributeNode attr)
+intarrayprop_save(IntarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->intarray_data->len; i++)
- data_add_int(attr, g_array_index(prop->intarray_data,gint,i));
+ data_add_int(attr, g_array_index(prop->intarray_data,gint,i), ctx);
}
static void
@@ -570,9 +570,9 @@ enumprop_load(EnumProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-enumprop_save(EnumProperty *prop, AttributeNode attr)
+enumprop_save(EnumProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_enum(attr, prop->enum_data);
+ data_add_enum(attr, prop->enum_data, ctx);
}
static void
@@ -667,11 +667,11 @@ enumarrayprop_load(EnumarrayProperty *prop, AttributeNode attr, DataNode data, D
}
static void
-enumarrayprop_save(EnumarrayProperty *prop, AttributeNode attr)
+enumarrayprop_save(EnumarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->enumarray_data->len; i++)
- data_add_enum(attr, g_array_index(prop->enumarray_data,gint,i));
+ data_add_enum(attr, g_array_index(prop->enumarray_data,gint,i), ctx);
}
static void
diff --git a/lib/prop_matrix.c b/lib/prop_matrix.c
index 2466333..9dcfccd 100644
--- a/lib/prop_matrix.c
+++ b/lib/prop_matrix.c
@@ -116,7 +116,7 @@ _matrix_xml_add_val (DataNode data_node, const char* name, real val)
xmlSetProp(data_node, (const xmlChar *)name, (xmlChar *)buf);
}
void
-data_add_matrix (AttributeNode attr, DiaMatrix *matrix)
+data_add_matrix (AttributeNode attr, DiaMatrix *matrix, DiaContext *ctx)
{
DataNode data_node;
@@ -133,10 +133,10 @@ data_add_matrix (AttributeNode attr, DiaMatrix *matrix)
}
static void
-matrixprop_save(MatrixProperty *prop, AttributeNode attr)
+matrixprop_save(MatrixProperty *prop, AttributeNode attr, DiaContext *ctx)
{
if (prop->matrix) {
- data_add_matrix (attr, prop->matrix);
+ data_add_matrix (attr, prop->matrix, ctx);
}
}
diff --git a/lib/prop_pattern.c b/lib/prop_pattern.c
index e93881a..3005185 100644
--- a/lib/prop_pattern.c
+++ b/lib/prop_pattern.c
@@ -126,46 +126,57 @@ patternprop_load(PatternProperty *prop, AttributeNode attr, DataNode data, DiaCo
prop->pattern = data_pattern (data, ctx);
}
+typedef struct
+{
+ AttributeNode node;
+ DiaContext *ctx;
+} StopUserData;
+
static gboolean
_data_add_stop (real ofs, const Color *col, gpointer user_data)
{
- AttributeNode attr = (AttributeNode)user_data;
- ObjectNode composite = data_add_composite(attr, "color-stop");
-
- data_add_real (composite_add_attribute(composite, "offset"), ofs);
- data_add_color(composite_add_attribute(composite, "color"), col);
+ StopUserData *ud = (StopUserData *)user_data;
+ AttributeNode attr = ud->node;
+ DiaContext *ctx = ud->ctx;
+ ObjectNode composite = data_add_composite(attr, "color-stop", ctx);
+
+ data_add_real (composite_add_attribute(composite, "offset"), ofs, ctx);
+ data_add_color(composite_add_attribute(composite, "color"), col, ctx);
return TRUE;
}
void
-data_add_pattern (AttributeNode attr, DiaPattern *pattern)
+data_add_pattern (AttributeNode attr, DiaPattern *pattern, DiaContext *ctx)
{
- ObjectNode composite = data_add_composite(attr, "pattern");
- AttributeNode comp_attr = composite_add_attribute (composite, "data");
+ ObjectNode composite = data_add_composite(attr, "pattern", ctx);
+ StopUserData ud;
DiaPatternType type;
guint flags;
Point p1, p2;
+ ud.node = composite_add_attribute (composite, "data");
+ ud.ctx = ctx;
+
dia_pattern_get_settings (pattern, &type, &flags);
- data_add_int (composite_add_attribute(composite, "gradient"), type);
- data_add_int (composite_add_attribute(composite, "flags"), flags);
+ data_add_int (composite_add_attribute(composite, "gradient"), type, ctx);
+ data_add_int (composite_add_attribute(composite, "flags"), flags, ctx);
dia_pattern_get_points (pattern, &p1, &p2);
- data_add_point (composite_add_attribute(composite, "p1"), &p1);
- data_add_point (composite_add_attribute(composite, "p2"), &p2);
+ data_add_point (composite_add_attribute(composite, "p1"), &p1, ctx);
+ data_add_point (composite_add_attribute(composite, "p2"), &p2, ctx);
if (type == DIA_RADIAL_GRADIENT) {
real r;
dia_pattern_get_radius (pattern, &r);
- data_add_real (composite_add_attribute(composite, "r"), r);
+ data_add_real (composite_add_attribute(composite, "r"), r, ctx);
}
- dia_pattern_foreach (pattern, _data_add_stop, comp_attr);
+ dia_pattern_foreach (pattern, _data_add_stop, &ud);
}
static void
-patternprop_save(PatternProperty *prop, AttributeNode attr)
+patternprop_save(PatternProperty *prop, AttributeNode attr, DiaContext *ctx)
{
if (prop->pattern) {
- data_add_pattern (attr, prop->pattern);
+ data_add_pattern (attr, prop->pattern, ctx);
}
}
diff --git a/lib/prop_pixbuf.c b/lib/prop_pixbuf.c
index 5a5e588..b51e243 100644
--- a/lib/prop_pixbuf.c
+++ b/lib/prop_pixbuf.c
@@ -107,7 +107,7 @@ pixbuf_decode_base64 (const gchar *b64)
}
GdkPixbuf *
-data_pixbuf (DataNode data)
+data_pixbuf (DataNode data, DiaContext *ctx)
{
GdkPixbuf *pixbuf = NULL;
GdkPixbufLoader *loader;
@@ -156,7 +156,7 @@ data_pixbuf (DataNode data)
static void
pixbufprop_load(PixbufProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
- prop->pixbuf = data_pixbuf (data);
+ prop->pixbuf = data_pixbuf (data, ctx);
}
typedef struct _EncodeData {
@@ -209,9 +209,9 @@ pixbuf_encode_base64 (const GdkPixbuf *pixbuf)
return (gchar *)g_byte_array_free (ed.array, FALSE);
}
void
-data_add_pixbuf (AttributeNode attr, GdkPixbuf *pixbuf)
+data_add_pixbuf (AttributeNode attr, GdkPixbuf *pixbuf, DiaContext *ctx)
{
- ObjectNode composite = data_add_composite(attr, "pixbuf");
+ ObjectNode composite = data_add_composite(attr, "pixbuf", ctx);
AttributeNode comp_attr = composite_add_attribute (composite, "data");
gchar *b64;
@@ -224,10 +224,10 @@ data_add_pixbuf (AttributeNode attr, GdkPixbuf *pixbuf)
}
static void
-pixbufprop_save(PixbufProperty *prop, AttributeNode attr)
+pixbufprop_save(PixbufProperty *prop, AttributeNode attr, DiaContext *ctx)
{
if (prop->pixbuf) {
- data_add_pixbuf (attr, prop->pixbuf);
+ data_add_pixbuf (attr, prop->pixbuf, ctx);
}
}
diff --git a/lib/prop_text.c b/lib/prop_text.c
index 3d517d2..447cd12 100644
--- a/lib/prop_text.c
+++ b/lib/prop_text.c
@@ -192,9 +192,9 @@ stringprop_load(StringProperty *prop, AttributeNode attr, DataNode data, DiaCont
}
static void
-stringprop_save(StringProperty *prop, AttributeNode attr)
+stringprop_save(StringProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- data_add_string(attr, prop->string_data);
+ data_add_string(attr, prop->string_data, ctx);
}
static void
@@ -407,7 +407,7 @@ textprop_load(TextProperty *prop, AttributeNode attr, DataNode data, DiaContext
}
static void
-textprop_save(TextProperty *prop, AttributeNode attr)
+textprop_save(TextProperty *prop, AttributeNode attr, DiaContext *ctx)
{
Text *text = new_text(prop->text_data,
prop->attr.font,
@@ -415,7 +415,7 @@ textprop_save(TextProperty *prop, AttributeNode attr)
&prop->attr.position,
&prop->attr.color,
prop->attr.alignment);
- data_add_text(attr,text);
+ data_add_text(attr, text, ctx);
text_destroy(text);
}
diff --git a/lib/properties.h b/lib/properties.h
index b6ee0fe..435e2e4 100644
--- a/lib/properties.h
+++ b/lib/properties.h
@@ -115,7 +115,7 @@ typedef void (* PropertyType_SetFromWidget)(Property *prop, WIDGET *widget);
/*! load a property from XML node */
typedef void (*PropertyType_Load)(Property *prop, AttributeNode attr, DataNode data, DiaContext *ctx);
/*! save a property to XML node */
-typedef void (*PropertyType_Save)(Property *prop, AttributeNode attr);
+typedef void (*PropertyType_Save)(Property *prop, AttributeNode attr, DiaContext *ctx);
/* If a property descriptor can be merged with another
(DONT_MERGE has already been handled) */
diff --git a/lib/text.c b/lib/text.c
index 6dcda71..592a4bc 100644
--- a/lib/text.c
+++ b/lib/text.c
@@ -1065,27 +1065,27 @@ text_delete_all(Text *text, ObjectChange **change, DiaObject *obj)
}
void
-data_add_text(AttributeNode attr, Text *text)
+data_add_text(AttributeNode attr, Text *text, DiaContext *ctx)
{
DataNode composite;
char *str;
- composite = data_add_composite(attr, "text");
+ composite = data_add_composite(attr, "text", ctx);
str = text_get_string_copy(text);
data_add_string(composite_add_attribute(composite, "string"),
- str);
+ str, ctx);
g_free(str);
data_add_font(composite_add_attribute(composite, "font"),
- text->font);
+ text->font, ctx);
data_add_real(composite_add_attribute(composite, "height"),
- text->height);
+ text->height, ctx);
data_add_point(composite_add_attribute(composite, "pos"),
- &text->position);
+ &text->position, ctx);
data_add_color(composite_add_attribute(composite, "color"),
- &text->color);
+ &text->color, ctx);
data_add_enum(composite_add_attribute(composite, "alignment"),
- text->alignment);
+ text->alignment, ctx);
}
diff --git a/lib/text.h b/lib/text.h
index c9386be..368cff8 100644
--- a/lib/text.h
+++ b/lib/text.h
@@ -102,7 +102,7 @@ real text_get_descent(Text *text);
/** Exposing this is a hack, but currently GTK still captures the key
* events of insensitive clods^H^H^H^H^Hmenu items. LC 21/10 2007*/
gboolean text_delete_key_handler(Focus *focus, ObjectChange **change);
-void data_add_text(AttributeNode attr, Text *text);
+void data_add_text(AttributeNode attr, Text *text, DiaContext *ctx);
Text *data_text(AttributeNode attr, DiaContext *ctx);
gboolean apply_textattr_properties(GPtrArray *props,
diff --git a/objects/AADL/aadlbox.c b/objects/AADL/aadlbox.c
index bc6615e..921eb7b 100755
--- a/objects/AADL/aadlbox.c
+++ b/objects/AADL/aadlbox.c
@@ -930,19 +930,19 @@ aadlbox_save(Aadlbox *aadlbox, ObjectNode obj_node, DiaContext *ctx)
attr = new_attribute(obj_node, "aadlbox_ports");
for (i=0;i<aadlbox->num_ports;i++) {
- composite = data_add_composite(attr, "aadlport");
+ composite = data_add_composite(attr, "aadlport", ctx);
data_add_point(composite_add_attribute(composite, "point"),
- &aadlbox->ports[i]->handle->pos);
+ &aadlbox->ports[i]->handle->pos, ctx);
data_add_enum(composite_add_attribute(composite, "port_type"),
- aadlbox->ports[i]->type);
+ aadlbox->ports[i]->type, ctx);
data_add_string(composite_add_attribute(composite, "port_declaration"),
- aadlbox->ports[i]->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);
+ data_add_point(attr, &aadlbox->connections[i]->pos, ctx);
}
}
diff --git a/objects/Database/compound.c b/objects/Database/compound.c
index 45312d2..524b1a0 100644
--- a/objects/Database/compound.c
+++ b/objects/Database/compound.c
@@ -507,13 +507,13 @@ compound_save (Compound *comp, ObjectNode obj_node, DiaContext *ctx)
for (i = 0; i < obj->num_handles; i++)
{
Handle *h = obj->handles[i];
- data_add_point (attr, &h->pos);
+ data_add_point (attr, &h->pos, ctx);
}
attr = new_attribute (obj_node, PROP_STDNAME_LINE_WIDTH);
- data_add_real (attr, comp->line_width);
+ data_add_real (attr, comp->line_width, ctx);
attr = new_attribute (obj_node, "line_color");
- data_add_color (attr, &comp->line_color);
+ data_add_color (attr, &comp->line_color, ctx);
}
static void
diff --git a/objects/ER/attribute.c b/objects/ER/attribute.c
index d043617..c129b6a 100644
--- a/objects/ER/attribute.c
+++ b/objects/ER/attribute.c
@@ -503,28 +503,29 @@ attribute_save(Attribute *attribute, ObjectNode obj_node,
element_save(&attribute->element, obj_node, ctx);
data_add_real(new_attribute(obj_node, "border_width"),
- attribute->border_width);
+ attribute->border_width, ctx);
data_add_color(new_attribute(obj_node, "border_color"),
- &attribute->border_color);
+ &attribute->border_color, ctx);
data_add_color(new_attribute(obj_node, "inner_color"),
- &attribute->inner_color);
+ &attribute->inner_color, ctx);
data_add_string(new_attribute(obj_node, "name"),
- attribute->name);
+ attribute->name, ctx);
data_add_boolean(new_attribute(obj_node, "key"),
- attribute->key);
+ attribute->key, ctx);
data_add_boolean(new_attribute(obj_node, "weak_key"),
- attribute->weakkey);
+ attribute->weakkey, ctx);
data_add_boolean(new_attribute(obj_node, "derived"),
- attribute->derived);
+ attribute->derived, ctx);
data_add_boolean(new_attribute(obj_node, "multivalued"),
- attribute->multivalue);
+ attribute->multivalue, ctx);
data_add_font (new_attribute (obj_node, "font"),
- attribute->font);
+ attribute->font, ctx);
data_add_real(new_attribute(obj_node, "font_height"),
- attribute->font_height);
+ attribute->font_height, ctx);
}
-static DiaObject *attribute_load(ObjectNode obj_node, int version,DiaContext *ctx)
+static DiaObject *
+attribute_load(ObjectNode obj_node, int version,DiaContext *ctx)
{
Attribute *attribute;
Element *elem;
diff --git a/objects/ER/entity.c b/objects/ER/entity.c
index daf67f6..ed26a2b 100644
--- a/objects/ER/entity.c
+++ b/objects/ER/entity.c
@@ -477,21 +477,21 @@ entity_save(Entity *entity, ObjectNode obj_node, DiaContext *ctx)
element_save(&entity->element, obj_node, ctx);
data_add_real(new_attribute(obj_node, "border_width"),
- entity->border_width);
+ entity->border_width, ctx);
data_add_color(new_attribute(obj_node, "border_color"),
- &entity->border_color);
+ &entity->border_color, ctx);
data_add_color(new_attribute(obj_node, "inner_color"),
- &entity->inner_color);
+ &entity->inner_color, ctx);
data_add_string(new_attribute(obj_node, "name"),
- entity->name);
+ entity->name, ctx);
data_add_boolean(new_attribute(obj_node, "weak"),
- entity->weak);
+ entity->weak, ctx);
data_add_boolean(new_attribute(obj_node, "associative"),
- entity->associative);
+ entity->associative, ctx);
data_add_font (new_attribute (obj_node, "font"),
- entity->font);
+ entity->font, ctx);
data_add_real(new_attribute(obj_node, "font_height"),
- entity->font_height);
+ entity->font_height, ctx);
}
static DiaObject *
diff --git a/objects/ER/participation.c b/objects/ER/participation.c
index b2d99e2..6fea3f9 100644
--- a/objects/ER/participation.c
+++ b/objects/ER/participation.c
@@ -352,7 +352,7 @@ participation_save(Participation *participation, ObjectNode obj_node,
orthconn_save(&participation->orth, obj_node, ctx);
data_add_boolean(new_attribute(obj_node, "total"),
- participation->total);
+ participation->total, ctx);
}
static DiaObject *
diff --git a/objects/ER/relationship.c b/objects/ER/relationship.c
index 8901045..425c01e 100644
--- a/objects/ER/relationship.c
+++ b/objects/ER/relationship.c
@@ -531,25 +531,25 @@ relationship_save(Relationship *relationship, ObjectNode obj_node,
element_save(&relationship->element, obj_node, ctx);
data_add_real(new_attribute(obj_node, "border_width"),
- relationship->border_width);
+ relationship->border_width, ctx);
data_add_color(new_attribute(obj_node, "border_color"),
- &relationship->border_color);
+ &relationship->border_color, ctx);
data_add_color(new_attribute(obj_node, "inner_color"),
- &relationship->inner_color);
+ &relationship->inner_color, ctx);
data_add_string(new_attribute(obj_node, "name"),
- relationship->name);
+ relationship->name, ctx);
data_add_string(new_attribute(obj_node, "left_card"),
- relationship->left_cardinality);
+ relationship->left_cardinality, ctx);
data_add_string(new_attribute(obj_node, "right_card"),
- relationship->right_cardinality);
+ relationship->right_cardinality, ctx);
data_add_boolean(new_attribute(obj_node, "identifying"),
- relationship->identifying);
+ relationship->identifying, ctx);
data_add_boolean(new_attribute(obj_node, "rotated"),
- relationship->rotate);
+ relationship->rotate, ctx);
data_add_font (new_attribute (obj_node, "font"),
- relationship->font);
+ relationship->font, ctx);
data_add_real(new_attribute(obj_node, "font_height"),
- relationship->font_height);
+ relationship->font_height, ctx);
}
static DiaObject *
diff --git a/objects/FS/flow-ortho.c b/objects/FS/flow-ortho.c
index c537548..3f662f2 100644
--- a/objects/FS/flow-ortho.c
+++ b/objects/FS/flow-ortho.c
@@ -539,9 +539,9 @@ orthflow_save(Orthflow *orthflow, ObjectNode obj_node, DiaContext *ctx)
orthconn_save(&orthflow->orth, obj_node, ctx);
data_add_text(new_attribute(obj_node, "text"),
- orthflow->text) ;
+ orthflow->text, ctx) ;
data_add_int(new_attribute(obj_node, "type"),
- orthflow->type);
+ orthflow->type, ctx);
}
static DiaObject *
diff --git a/objects/FS/flow.c b/objects/FS/flow.c
index 3d5ae92..05a88db 100644
--- a/objects/FS/flow.c
+++ b/objects/FS/flow.c
@@ -506,9 +506,9 @@ flow_save(Flow *flow, ObjectNode obj_node, DiaContext *ctx)
connection_save(&flow->connection, obj_node, ctx);
data_add_text(new_attribute(obj_node, "text"),
- flow->text) ;
+ flow->text, ctx) ;
data_add_int(new_attribute(obj_node, "type"),
- flow->type);
+ flow->type, ctx);
}
static DiaObject *
diff --git a/objects/FS/function.c b/objects/FS/function.c
index 95155a0..3e1122e 100644
--- a/objects/FS/function.c
+++ b/objects/FS/function.c
@@ -524,13 +524,13 @@ function_save(Function *pkg, ObjectNode obj_node, DiaContext *ctx)
element_save(&pkg->element, obj_node, ctx);
data_add_text(new_attribute(obj_node, "text"),
- pkg->text);
+ pkg->text, ctx);
data_add_boolean(new_attribute(obj_node, "is_wish"),
- pkg->is_wish);
-
+ pkg->is_wish, ctx);
+
data_add_boolean(new_attribute(obj_node, "is_user"),
- pkg->is_user);
+ pkg->is_user, ctx);
}
static DiaObject *
diff --git a/objects/GRAFCET/boolequation.c b/objects/GRAFCET/boolequation.c
index 7ec2e5c..f446783 100644
--- a/objects/GRAFCET/boolequation.c
+++ b/objects/GRAFCET/boolequation.c
@@ -589,10 +589,11 @@ boolequation_destroy(Boolequation *booleq)
g_free(booleq);
}
-void save_boolequation(ObjectNode obj_node, const gchar *attrname,
- Boolequation *booleq)
+void
+save_boolequation(ObjectNode obj_node, const gchar *attrname,
+ Boolequation *booleq, DiaContext *ctx)
{
- data_add_string(new_attribute(obj_node,attrname),(gchar *)booleq->value);
+ data_add_string(new_attribute(obj_node,attrname),(gchar *)booleq->value, ctx);
}
void
diff --git a/objects/GRAFCET/boolequation.h b/objects/GRAFCET/boolequation.h
index 01986a8..1f2f6b7 100644
--- a/objects/GRAFCET/boolequation.h
+++ b/objects/GRAFCET/boolequation.h
@@ -58,7 +58,7 @@ extern void boolequation_destroy(Boolequation *rcep);
extern void boolequation_set_value(Boolequation *rcep, const gchar *value);
extern void save_boolequation(ObjectNode obj_node, const gchar *attrname,
- Boolequation *rcep);
+ Boolequation *rcep, DiaContext *ctx);
extern void boolequation_set_pos(Boolequation *rcep, Point *pos);
extern void boolequation_draw(Boolequation *rcep, DiaRenderer *renderer);
diff --git a/objects/Misc/tree.c b/objects/Misc/tree.c
index be8205e..cad8823 100644
--- a/objects/Misc/tree.c
+++ b/objects/Misc/tree.c
@@ -622,12 +622,12 @@ tree_save(Tree *tree, ObjectNode obj_node, DiaContext *ctx)
connection_save(&tree->connection, obj_node, ctx);
- data_add_color( new_attribute(obj_node, "line_color"), &tree->line_color);
+ data_add_color( new_attribute(obj_node, "line_color"), &tree->line_color, ctx);
attr = new_attribute(obj_node, "tree_handles");
for (i=0;i<tree->num_handles;i++) {
- data_add_point(attr, &tree->handles[i]->pos);
+ data_add_point(attr, &tree->handles[i]->pos, ctx);
}
}
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 8b56a0a..cdeb398 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -2147,72 +2147,72 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
/* Class info: */
data_add_string(new_attribute(obj_node, "name"),
- umlclass->name);
+ umlclass->name, ctx);
data_add_string(new_attribute(obj_node, "stereotype"),
- umlclass->stereotype);
+ umlclass->stereotype, ctx);
data_add_string(new_attribute(obj_node, "comment"),
- umlclass->comment);
+ umlclass->comment, ctx);
data_add_boolean(new_attribute(obj_node, "abstract"),
- umlclass->abstract);
+ umlclass->abstract, ctx);
data_add_boolean(new_attribute(obj_node, "suppress_attributes"),
- umlclass->suppress_attributes);
+ umlclass->suppress_attributes, ctx);
data_add_boolean(new_attribute(obj_node, "suppress_operations"),
- umlclass->suppress_operations);
+ umlclass->suppress_operations, ctx);
data_add_boolean(new_attribute(obj_node, "visible_attributes"),
- umlclass->visible_attributes);
+ umlclass->visible_attributes, ctx);
data_add_boolean(new_attribute(obj_node, "visible_operations"),
- umlclass->visible_operations);
+ umlclass->visible_operations, ctx);
data_add_boolean(new_attribute(obj_node, "visible_comments"),
- umlclass->visible_comments);
+ umlclass->visible_comments, ctx);
data_add_boolean(new_attribute(obj_node, "wrap_operations"),
- umlclass->wrap_operations);
+ umlclass->wrap_operations, ctx);
data_add_int(new_attribute(obj_node, "wrap_after_char"),
- umlclass->wrap_after_char);
+ umlclass->wrap_after_char, ctx);
data_add_int(new_attribute(obj_node, "comment_line_length"),
- umlclass->comment_line_length);
+ umlclass->comment_line_length, ctx);
data_add_boolean(new_attribute(obj_node, "comment_tagging"),
- umlclass->comment_tagging);
+ umlclass->comment_tagging, ctx);
data_add_boolean(new_attribute(obj_node, "allow_resizing"),
- umlclass->allow_resizing);
+ umlclass->allow_resizing, ctx);
data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
- umlclass->line_width);
+ umlclass->line_width, ctx);
data_add_color(new_attribute(obj_node, "line_color"),
- ¨class->line_color);
+ ¨class->line_color, ctx);
data_add_color(new_attribute(obj_node, "fill_color"),
- ¨class->fill_color);
+ ¨class->fill_color, ctx);
data_add_color(new_attribute(obj_node, "text_color"),
- ¨class->text_color);
+ ¨class->text_color, ctx);
data_add_font (new_attribute (obj_node, "normal_font"),
- umlclass->normal_font);
+ umlclass->normal_font, ctx);
data_add_font (new_attribute (obj_node, "abstract_font"),
- umlclass->abstract_font);
+ umlclass->abstract_font, ctx);
data_add_font (new_attribute (obj_node, "polymorphic_font"),
- umlclass->polymorphic_font);
+ umlclass->polymorphic_font, ctx);
data_add_font (new_attribute (obj_node, "classname_font"),
- umlclass->classname_font);
+ umlclass->classname_font, ctx);
data_add_font (new_attribute (obj_node, "abstract_classname_font"),
- umlclass->abstract_classname_font);
+ umlclass->abstract_classname_font, ctx);
data_add_font (new_attribute (obj_node, "comment_font"),
- umlclass->comment_font);
+ umlclass->comment_font, ctx);
data_add_real (new_attribute (obj_node, "normal_font_height"),
- umlclass->font_height);
+ umlclass->font_height, ctx);
data_add_real (new_attribute (obj_node, "polymorphic_font_height"),
- umlclass->polymorphic_font_height);
+ umlclass->polymorphic_font_height, ctx);
data_add_real (new_attribute (obj_node, "abstract_font_height"),
- umlclass->abstract_font_height);
+ umlclass->abstract_font_height, ctx);
data_add_real (new_attribute (obj_node, "classname_font_height"),
- umlclass->classname_font_height);
+ umlclass->classname_font_height, ctx);
data_add_real (new_attribute (obj_node, "abstract_classname_font_height"),
- umlclass->abstract_classname_font_height);
+ umlclass->abstract_classname_font_height, ctx);
data_add_real (new_attribute (obj_node, "comment_font_height"),
- umlclass->comment_font_height);
+ umlclass->comment_font_height, ctx);
/* Attribute info: */
attr_node = new_attribute(obj_node, "attributes");
list = umlclass->attributes;
while (list != NULL) {
attr = (UMLAttribute *) list->data;
- uml_attribute_write(attr_node, attr);
+ uml_attribute_write(attr_node, attr, ctx);
list = g_list_next(list);
}
@@ -2221,19 +2221,19 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
list = umlclass->operations;
while (list != NULL) {
op = (UMLOperation *) list->data;
- uml_operation_write(attr_node, op);
+ uml_operation_write(attr_node, op, ctx);
list = g_list_next(list);
}
/* Template info: */
data_add_boolean(new_attribute(obj_node, "template"),
- umlclass->template);
+ umlclass->template, ctx);
attr_node = new_attribute(obj_node, "templates");
list = umlclass->formal_params;
while (list != NULL) {
formal_param = (UMLFormalParameter *) list->data;
- uml_formalparameter_write(attr_node, formal_param);
+ uml_formalparameter_write(attr_node, formal_param, ctx);
list = g_list_next(list);
}
}
diff --git a/objects/UML/uml.h b/objects/UML/uml.h
index 44c0ed2..0d30b0c 100644
--- a/objects/UML/uml.h
+++ b/objects/UML/uml.h
@@ -150,9 +150,9 @@ extern UMLFormalParameter *uml_formalparameter_new(void);
extern void uml_attribute_ensure_connection_points (UMLAttribute *attr, DiaObject* obj);
extern void uml_operation_ensure_connection_points (UMLOperation *oper, DiaObject* obj);
-extern void uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr);
-extern void uml_operation_write(AttributeNode attr_node, UMLOperation *op);
-extern void uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param);
+extern void uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr, DiaContext *ctx);
+extern void uml_operation_write(AttributeNode attr_node, UMLOperation *op, DiaContext *ctx);
+extern void uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param, DiaContext *ctx);
#endif /* UML_H */
diff --git a/objects/UML/umlattribute.c b/objects/UML/umlattribute.c
index bb096ee..67c61d9 100644
--- a/objects/UML/umlattribute.c
+++ b/objects/UML/umlattribute.c
@@ -161,26 +161,26 @@ uml_attribute_destroy(UMLAttribute *attr)
}
void
-uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr)
+uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr, DiaContext *ctx)
{
DataNode composite;
- composite = data_add_composite(attr_node, "umlattribute");
+ composite = data_add_composite(attr_node, "umlattribute", ctx);
data_add_string(composite_add_attribute(composite, "name"),
- attr->name);
+ attr->name, ctx);
data_add_string(composite_add_attribute(composite, "type"),
- attr->type);
+ attr->type, ctx);
data_add_string(composite_add_attribute(composite, "value"),
- attr->value);
+ attr->value, ctx);
data_add_string(composite_add_attribute(composite, "comment"),
- attr->comment);
+ attr->comment, ctx);
data_add_enum(composite_add_attribute(composite, "visibility"),
- attr->visibility);
+ attr->visibility, ctx);
data_add_boolean(composite_add_attribute(composite, "abstract"),
- attr->abstract);
+ attr->abstract, ctx);
data_add_boolean(composite_add_attribute(composite, "class_scope"),
- attr->class_scope);
+ attr->class_scope, ctx);
}
/* Warning, the following *must* be strictly ASCII characters (or fix the
diff --git a/objects/UML/umlformalparameter.c b/objects/UML/umlformalparameter.c
index 5ef0c6a..10224f9 100644
--- a/objects/UML/umlformalparameter.c
+++ b/objects/UML/umlformalparameter.c
@@ -90,16 +90,17 @@ uml_formalparameter_destroy(UMLFormalParameter *param)
}
void
-uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param)
+uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param,
+ DiaContext *ctx)
{
DataNode composite;
- composite = data_add_composite(attr_node, "umlformalparameter");
+ composite = data_add_composite(attr_node, "umlformalparameter", ctx);
data_add_string(composite_add_attribute(composite, "name"),
- param->name);
+ param->name, ctx);
data_add_string(composite_add_attribute(composite, "type"),
- param->type);
+ param->type, ctx);
}
char *
diff --git a/objects/UML/umloperation.c b/objects/UML/umloperation.c
index 137259f..bf7924c 100644
--- a/objects/UML/umloperation.c
+++ b/objects/UML/umloperation.c
@@ -247,7 +247,7 @@ uml_operation_destroy(UMLOperation *op)
}
void
-uml_operation_write(AttributeNode attr_node, UMLOperation *op)
+uml_operation_write(AttributeNode attr_node, UMLOperation *op, DiaContext *ctx)
{
GList *list;
UMLParameter *param;
@@ -255,27 +255,27 @@ uml_operation_write(AttributeNode attr_node, UMLOperation *op)
DataNode composite2;
AttributeNode attr_node2;
- composite = data_add_composite(attr_node, "umloperation");
+ composite = data_add_composite(attr_node, "umloperation", ctx);
data_add_string(composite_add_attribute(composite, "name"),
- op->name);
+ op->name, ctx);
data_add_string(composite_add_attribute(composite, "stereotype"),
- op->stereotype);
+ op->stereotype, ctx);
data_add_string(composite_add_attribute(composite, "type"),
- op->type);
+ op->type, ctx);
data_add_enum(composite_add_attribute(composite, "visibility"),
- op->visibility);
+ op->visibility, ctx);
data_add_string(composite_add_attribute(composite, "comment"),
- op->comment);
+ op->comment, ctx);
/* Backward compatibility */
data_add_boolean(composite_add_attribute(composite, "abstract"),
- op->inheritance_type == UML_ABSTRACT);
+ op->inheritance_type == UML_ABSTRACT, ctx);
data_add_enum(composite_add_attribute(composite, "inheritance_type"),
- op->inheritance_type);
+ op->inheritance_type, ctx);
data_add_boolean(composite_add_attribute(composite, "query"),
- op->query);
+ op->query, ctx);
data_add_boolean(composite_add_attribute(composite, "class_scope"),
- op->class_scope);
+ op->class_scope, ctx);
attr_node2 = composite_add_attribute(composite, "parameters");
@@ -283,18 +283,18 @@ uml_operation_write(AttributeNode attr_node, UMLOperation *op)
while (list != NULL) {
param = (UMLParameter *) list->data;
- composite2 = data_add_composite(attr_node2, "umlparameter");
+ composite2 = data_add_composite(attr_node2, "umlparameter", ctx);
data_add_string(composite_add_attribute(composite2, "name"),
- param->name);
+ param->name, ctx);
data_add_string(composite_add_attribute(composite2, "type"),
- param->type);
+ param->type, ctx);
data_add_string(composite_add_attribute(composite2, "value"),
- param->value);
+ param->value, ctx);
data_add_string(composite_add_attribute(composite2, "comment"),
- param->comment);
+ param->comment, ctx);
data_add_enum(composite_add_attribute(composite2, "kind"),
- param->kind);
+ param->kind, ctx);
list = g_list_next(list);
}
}
diff --git a/objects/flowchart/box.c b/objects/flowchart/box.c
index 62f3413..f3330c8 100644
--- a/objects/flowchart/box.c
+++ b/objects/flowchart/box.c
@@ -676,38 +676,38 @@ box_save(Box *box, ObjectNode obj_node, DiaContext *ctx)
if (box->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- box->border_width);
+ box->border_width, ctx);
if (!color_equals(&box->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
- &box->border_color);
+ &box->border_color, ctx);
if (!color_equals(&box->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &box->inner_color);
+ &box->inner_color, ctx);
data_add_boolean(new_attribute(obj_node, "show_background"),
- box->show_background);
+ box->show_background, ctx);
if (box->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- box->line_style);
+ box->line_style, ctx);
if (box->line_style != LINESTYLE_SOLID &&
box->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- box->dashlength);
+ box->dashlength, ctx);
if (box->corner_radius > 0.0)
data_add_real(new_attribute(obj_node, "corner_radius"),
- box->corner_radius);
+ box->corner_radius, ctx);
- data_add_real(new_attribute(obj_node, "padding"), box->padding);
-
- data_add_text(new_attribute(obj_node, "text"), box->text);
+ data_add_real(new_attribute(obj_node, "padding"), box->padding, ctx);
+
+ data_add_text(new_attribute(obj_node, "text"), box->text, ctx);
if (box->text_fitting != TEXTFIT_WHEN_NEEDED)
data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
- box->text_fitting);
+ box->text_fitting, ctx);
}
static DiaObject *
diff --git a/objects/flowchart/diamond.c b/objects/flowchart/diamond.c
index 047843a..62f2070 100644
--- a/objects/flowchart/diamond.c
+++ b/objects/flowchart/diamond.c
@@ -566,34 +566,35 @@ diamond_save(Diamond *diamond, ObjectNode obj_node, DiaContext *ctx)
if (diamond->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- diamond->border_width);
+ diamond->border_width, ctx);
if (!color_equals(&diamond->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
- &diamond->border_color);
+ &diamond->border_color, ctx);
if (!color_equals(&diamond->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &diamond->inner_color);
+ &diamond->inner_color, ctx);
- data_add_boolean(new_attribute(obj_node, "show_background"), diamond->show_background);
+ data_add_boolean(new_attribute(obj_node, "show_background"),
+ diamond->show_background, ctx);
if (diamond->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- diamond->line_style);
+ diamond->line_style, ctx);
if (diamond->line_style != LINESTYLE_SOLID &&
diamond->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- diamond->dashlength);
+ diamond->dashlength, ctx);
- data_add_real(new_attribute(obj_node, "padding"), diamond->padding);
-
- data_add_text(new_attribute(obj_node, "text"), diamond->text);
+ data_add_real(new_attribute(obj_node, "padding"), diamond->padding, ctx);
+
+ data_add_text(new_attribute(obj_node, "text"), diamond->text, ctx);
if (diamond->text_fitting != TEXTFIT_WHEN_NEEDED)
data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
- diamond->text_fitting);
+ diamond->text_fitting, ctx);
}
static DiaObject *
diff --git a/objects/flowchart/ellipse.c b/objects/flowchart/ellipse.c
index 0561917..f1ebab5 100644
--- a/objects/flowchart/ellipse.c
+++ b/objects/flowchart/ellipse.c
@@ -539,34 +539,35 @@ ellipse_save(Ellipse *ellipse, ObjectNode obj_node, DiaContext *ctx)
if (ellipse->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- ellipse->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);
+ &ellipse->border_color, ctx);
if (!color_equals(&ellipse->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &ellipse->inner_color);
+ &ellipse->inner_color, ctx);
- data_add_boolean(new_attribute(obj_node, "show_background"), ellipse->show_background);
+ 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);
+ 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);
+ ellipse->dashlength, ctx);
- data_add_real(new_attribute(obj_node, "padding"), ellipse->padding);
+ data_add_real(new_attribute(obj_node, "padding"), ellipse->padding, ctx);
- data_add_text(new_attribute(obj_node, "text"), ellipse->text);
+ 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);
+ ellipse->text_fitting, ctx);
}
static DiaObject *
diff --git a/objects/flowchart/parallelogram.c b/objects/flowchart/parallelogram.c
index 07c264d..b8c0867 100644
--- a/objects/flowchart/parallelogram.c
+++ b/objects/flowchart/parallelogram.c
@@ -622,36 +622,37 @@ pgram_save(Pgram *pgram, ObjectNode obj_node, DiaContext *ctx)
if (pgram->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- pgram->border_width);
-
+ pgram->border_width, ctx);
+
if (!color_equals(&pgram->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
- &pgram->border_color);
-
+ &pgram->border_color, ctx);
+
if (!color_equals(&pgram->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &pgram->inner_color);
-
- data_add_boolean(new_attribute(obj_node, "show_background"), pgram->show_background);
+ &pgram->inner_color, ctx);
+
+ data_add_boolean(new_attribute(obj_node, "show_background"),
+ pgram->show_background, ctx);
if (pgram->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- pgram->line_style);
+ pgram->line_style, ctx);
if (pgram->line_style != LINESTYLE_SOLID &&
pgram->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- pgram->dashlength);
+ pgram->dashlength, ctx);
data_add_real(new_attribute(obj_node, "shear_angle"),
- pgram->shear_angle);
+ pgram->shear_angle, ctx);
- data_add_real(new_attribute(obj_node, "padding"), pgram->padding);
-
- data_add_text(new_attribute(obj_node, "text"), pgram->text);
+ data_add_real(new_attribute(obj_node, "padding"), pgram->padding, ctx);
+
+ data_add_text(new_attribute(obj_node, "text"), pgram->text, ctx);
if (pgram->text_fitting != TEXTFIT_WHEN_NEEDED)
data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
- pgram->text_fitting);
+ pgram->text_fitting, ctx);
}
static DiaObject *
diff --git a/objects/network/bus.c b/objects/network/bus.c
index 6dad761..7072542 100644
--- a/objects/network/bus.c
+++ b/objects/network/bus.c
@@ -630,12 +630,12 @@ bus_save(Bus *bus, ObjectNode obj_node, DiaContext *ctx)
connection_save(&bus->connection, obj_node, ctx);
- data_add_color( new_attribute(obj_node, "line_color"), &bus->line_color);
+ data_add_color( new_attribute(obj_node, "line_color"), &bus->line_color, ctx);
attr = new_attribute(obj_node, "bus_handles");
for (i=0;i<bus->num_handles;i++) {
- data_add_point(attr, &bus->handles[i]->pos);
+ data_add_point(attr, &bus->handles[i]->pos, ctx);
}
}
diff --git a/objects/network/wanlink.c b/objects/network/wanlink.c
index f8c1a1d..043347a 100644
--- a/objects/network/wanlink.c
+++ b/objects/network/wanlink.c
@@ -308,10 +308,10 @@ wanlink_save(WanLink *wanlink, ObjectNode obj_node,
connection_save((Connection *)wanlink, obj_node, ctx);
attr = new_attribute(obj_node, "width");
- data_add_real(attr, wanlink->width);
+ data_add_real(attr, wanlink->width, ctx);
- data_add_color( new_attribute(obj_node, "line_color"), &wanlink->line_color);
- data_add_color( new_attribute(obj_node, "fill_color"), &wanlink->fill_color);
+ data_add_color( new_attribute(obj_node, "line_color"), &wanlink->line_color, ctx);
+ data_add_color( new_attribute(obj_node, "fill_color"), &wanlink->fill_color, ctx);
}
static DiaObject *
diff --git a/objects/standard/arc.c b/objects/standard/arc.c
index 860cc7c..dd2258e 100644
--- a/objects/standard/arc.c
+++ b/objects/standard/arc.c
@@ -916,37 +916,37 @@ arc_save(Arc *arc, ObjectNode obj_node, DiaContext *ctx)
if (!color_equals(&arc->arc_color, &color_black))
data_add_color(new_attribute(obj_node, "arc_color"),
- &arc->arc_color);
-
+ &arc->arc_color, ctx);
+
if (arc->curve_distance != 0.1)
data_add_real(new_attribute(obj_node, "curve_distance"),
- arc->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);
-
+ arc->line_width, ctx);
+
if (arc->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- arc->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);
+ arc->dashlength, ctx);
if (arc->line_caps != LINECAPS_BUTT)
data_add_enum(new_attribute(obj_node, "line_caps"),
- arc->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");
+ "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");
+ "end_arrow_length", "end_arrow_width", ctx);
}
}
diff --git a/objects/standard/bezier.c b/objects/standard/bezier.c
index 1b6d095..e3286a2 100644
--- a/objects/standard/bezier.c
+++ b/objects/standard/bezier.c
@@ -602,44 +602,44 @@ bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
if (!color_equals(&bezierline->line_color, &color_black))
data_add_color(new_attribute(obj_node, "line_color"),
- &bezierline->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);
+ bezierline->line_width, ctx);
if (bezierline->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- bezierline->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);
+ bezierline->dashlength, ctx);
if (bezierline->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- bezierline->line_join);
+ bezierline->line_join, ctx);
if (bezierline->line_caps != LINECAPS_BUTT)
data_add_enum(new_attribute(obj_node, "line_caps"),
- bezierline->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");
+ "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");
+ "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);
+ bezierline->absolute_start_gap, ctx);
if (bezierline->absolute_end_gap)
data_add_real(new_attribute(obj_node, "absolute_end_gap"),
- bezierline->absolute_end_gap);
+ bezierline->absolute_end_gap, ctx);
}
static DiaObject *
diff --git a/objects/standard/beziergon.c b/objects/standard/beziergon.c
index 1be8598..d9761d0 100644
--- a/objects/standard/beziergon.c
+++ b/objects/standard/beziergon.c
@@ -379,35 +379,35 @@ beziergon_save(Beziergon *beziergon, ObjectNode obj_node,
if (!color_equals(&beziergon->line_color, &color_black))
data_add_color(new_attribute(obj_node, "line_color"),
- &beziergon->line_color);
+ &beziergon->line_color, ctx);
if (beziergon->line_width != 0.1)
data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
- beziergon->line_width);
+ beziergon->line_width, ctx);
if (!color_equals(&beziergon->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &beziergon->inner_color);
+ &beziergon->inner_color, ctx);
data_add_boolean(new_attribute(obj_node, "show_background"),
- beziergon->show_background);
+ beziergon->show_background, ctx);
if (beziergon->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- beziergon->line_style);
+ beziergon->line_style, ctx);
if (beziergon->line_style != LINESTYLE_SOLID &&
beziergon->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- beziergon->dashlength);
+ beziergon->dashlength, ctx);
if (beziergon->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- beziergon->line_join);
+ beziergon->line_join, ctx);
if (beziergon->pattern)
data_add_pattern(new_attribute(obj_node, "pattern"),
- beziergon->pattern);
+ beziergon->pattern, ctx);
}
static DiaObject *
diff --git a/objects/standard/box.c b/objects/standard/box.c
index 80c55c5..b295678 100644
--- a/objects/standard/box.c
+++ b/objects/standard/box.c
@@ -528,42 +528,43 @@ box_save(Box *box, ObjectNode obj_node, DiaContext *ctx)
if (box->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- box->border_width);
+ box->border_width, ctx);
if (!color_equals(&box->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
- &box->border_color);
+ &box->border_color, ctx);
if (!color_equals(&box->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &box->inner_color);
+ &box->inner_color, ctx);
- data_add_boolean(new_attribute(obj_node, "show_background"), box->show_background);
+ data_add_boolean(new_attribute(obj_node, "show_background"),
+ box->show_background, ctx);
if (box->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- box->line_style);
+ box->line_style, ctx);
if (box->line_style != LINESTYLE_SOLID &&
box->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- box->dashlength);
+ box->dashlength, ctx);
if (box->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- box->line_join);
+ box->line_join, ctx);
if (box->corner_radius > 0.0)
data_add_real(new_attribute(obj_node, "corner_radius"),
- box->corner_radius);
+ box->corner_radius, ctx);
if (box->aspect != FREE_ASPECT)
data_add_enum(new_attribute(obj_node, "aspect"),
- box->aspect);
+ box->aspect, ctx);
if (box->pattern)
data_add_pattern(new_attribute(obj_node, "pattern"),
- box->pattern);
+ box->pattern, ctx);
}
static DiaObject *
diff --git a/objects/standard/ellipse.c b/objects/standard/ellipse.c
index 726babe..1264279 100644
--- a/objects/standard/ellipse.c
+++ b/objects/standard/ellipse.c
@@ -506,36 +506,36 @@ ellipse_save(Ellipse *ellipse, ObjectNode obj_node, DiaContext *ctx)
if (ellipse->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- ellipse->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);
+ &ellipse->border_color, ctx);
if (!color_equals(&ellipse->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &ellipse->inner_color);
+ &ellipse->inner_color, ctx);
if (!ellipse->show_background)
data_add_boolean(new_attribute(obj_node, "show_background"),
- ellipse->show_background);
+ ellipse->show_background, ctx);
if (ellipse->aspect != FREE_ASPECT)
data_add_enum(new_attribute(obj_node, "aspect"),
- ellipse->aspect);
+ ellipse->aspect, ctx);
if (ellipse->line_style != LINESTYLE_SOLID) {
data_add_enum(new_attribute(obj_node, "line_style"),
- ellipse->line_style);
+ ellipse->line_style, ctx);
if (ellipse->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- ellipse->dashlength);
+ ellipse->dashlength, ctx);
}
if (ellipse->pattern)
data_add_pattern(new_attribute(obj_node, "pattern"),
- ellipse->pattern);
+ ellipse->pattern, ctx);
}
static DiaObject *ellipse_load(ObjectNode obj_node, int version, DiaContext *ctx)
diff --git a/objects/standard/image.c b/objects/standard/image.c
index eccc3e0..23eefc8 100644
--- a/objects/standard/image.c
+++ b/objects/standard/image.c
@@ -633,23 +633,23 @@ image_save(Image *image, ObjectNode obj_node, DiaContext *ctx)
if (image->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
- image->border_width);
-
+ image->border_width, ctx);
+
if (!color_equals(&image->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
- &image->border_color);
+ &image->border_color, ctx);
if (image->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- image->line_style);
+ image->line_style, ctx);
if (image->line_style != LINESTYLE_SOLID &&
image->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- image->dashlength);
+ image->dashlength, ctx);
- 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, "draw_border"), image->draw_border, ctx);
+ data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect, ctx);
if (image->file != NULL) {
if (g_path_is_absolute(image->file)) { /* Absolute pathname */
@@ -658,29 +658,31 @@ image_save(Image *image, ObjectNode obj_node, DiaContext *ctx)
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);
+ data_add_filename(new_attribute(obj_node, "file"),
+ image->file + strlen(diafile_dir) + 1, ctx);
} else {
/* Save the absolute path: */
- data_add_filename(new_attribute(obj_node, "file"), image->file);
+ data_add_filename(new_attribute(obj_node, "file"), image->file, ctx);
}
g_free(diafile_dir);
} else {
/* Relative path. Must be an erronuous filename...
Just save the filename. */
- data_add_filename(new_attribute(obj_node, "file"), image->file);
+ data_add_filename(new_attribute(obj_node, "file"), image->file, ctx);
}
}
/* 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);
+ data_add_boolean (new_attribute(obj_node, "inline_data"),
+ image->inline_data, ctx);
/* 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);
+ data_add_pixbuf (new_attribute(obj_node, "pixbuf"), pixbuf, ctx);
}
}
@@ -825,7 +827,7 @@ image_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (!image->image) {
attr = object_find_attribute(obj_node, "pixbuf");
if (attr != NULL) {
- GdkPixbuf *pixbuf = data_pixbuf (attribute_first_data(attr));
+ GdkPixbuf *pixbuf = data_pixbuf (attribute_first_data(attr), ctx);
if (pixbuf) {
image->image = dia_image_new_from_pixbuf (pixbuf);
diff --git a/objects/standard/line.c b/objects/standard/line.c
index 2516194..f2f2edf 100644
--- a/objects/standard/line.c
+++ b/objects/standard/line.c
@@ -631,44 +631,44 @@ line_save(Line *line, ObjectNode obj_node, DiaContext *ctx)
connection_save(&line->connection, obj_node, ctx);
- connpointline_save(line->cpl,obj_node,"numcp");
+ 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);
-
+ &line->line_color, ctx);
+
if (line->line_width != 0.1)
data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
- line->line_width);
-
+ line->line_width, ctx);
+
if (line->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- line->line_style);
-
+ line->line_style, ctx);
+
if (line->line_caps != LINECAPS_BUTT)
data_add_enum(new_attribute(obj_node, "line_caps"),
- line->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");
+ "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");
+ "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);
+ line->absolute_start_gap, ctx);
if (line->absolute_end_gap)
data_add_real(new_attribute(obj_node, "absolute_end_gap"),
- line->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);
+ line->dashlength, ctx);
}
static DiaObject *
diff --git a/objects/standard/polygon.c b/objects/standard/polygon.c
index 38cca6a..2444922 100644
--- a/objects/standard/polygon.c
+++ b/objects/standard/polygon.c
@@ -349,35 +349,35 @@ polygon_save(Polygon *polygon, ObjectNode obj_node,
if (!color_equals(&polygon->line_color, &color_black))
data_add_color(new_attribute(obj_node, "line_color"),
- &polygon->line_color);
-
+ &polygon->line_color, ctx);
+
if (polygon->line_width != 0.1)
data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
- polygon->line_width);
-
+ polygon->line_width, ctx);
+
if (!color_equals(&polygon->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
- &polygon->inner_color);
-
+ &polygon->inner_color, ctx);
+
data_add_boolean(new_attribute(obj_node, "show_background"),
- polygon->show_background);
+ polygon->show_background, ctx);
if (polygon->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- polygon->line_style);
+ polygon->line_style, ctx);
if (polygon->line_style != LINESTYLE_SOLID &&
polygon->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- polygon->dashlength);
-
+ polygon->dashlength, ctx);
+
if (polygon->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- polygon->line_join);
+ polygon->line_join, ctx);
if (polygon->pattern)
data_add_pattern(new_attribute(obj_node, "pattern"),
- polygon->pattern);
+ polygon->pattern, ctx);
}
static DiaObject *
diff --git a/objects/standard/polyline.c b/objects/standard/polyline.c
index 79b15b4..8fc8dca 100644
--- a/objects/standard/polyline.c
+++ b/objects/standard/polyline.c
@@ -469,48 +469,48 @@ polyline_save(Polyline *polyline, ObjectNode obj_node,
if (!color_equals(&polyline->line_color, &color_black))
data_add_color(new_attribute(obj_node, "line_color"),
- &polyline->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);
+ polyline->line_width, ctx);
if (polyline->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- polyline->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);
+ polyline->dashlength, ctx);
if (polyline->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- polyline->line_join);
+ polyline->line_join, ctx);
if (polyline->line_caps != LINECAPS_BUTT)
data_add_enum(new_attribute(obj_node, "line_caps"),
- polyline->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");
+ "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");
+ "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);
+ polyline->absolute_start_gap, ctx);
if (polyline->absolute_end_gap)
data_add_real(new_attribute(obj_node, "absolute_end_gap"),
- polyline->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);
+ polyline->corner_radius, ctx);
}
static DiaObject *
diff --git a/objects/standard/textobj.c b/objects/standard/textobj.c
index 067300f..bec7e8e 100644
--- a/objects/standard/textobj.c
+++ b/objects/standard/textobj.c
@@ -354,13 +354,13 @@ 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);
+ textobj->text, ctx);
data_add_enum(new_attribute(obj_node, "valign"),
- textobj->vert_align);
+ textobj->vert_align, ctx);
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);
+ 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);
}
}
diff --git a/objects/standard/zigzagline.c b/objects/standard/zigzagline.c
index 486bfa6..9953a35 100644
--- a/objects/standard/zigzagline.c
+++ b/objects/standard/zigzagline.c
@@ -480,41 +480,41 @@ zigzagline_save(Zigzagline *zigzagline, ObjectNode obj_node,
if (!color_equals(&zigzagline->line_color, &color_black))
data_add_color(new_attribute(obj_node, "line_color"),
- &zigzagline->line_color);
-
+ &zigzagline->line_color, ctx);
+
if (zigzagline->line_width != 0.1)
data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
- zigzagline->line_width);
-
+ zigzagline->line_width, ctx);
+
if (zigzagline->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
- zigzagline->line_style);
-
+ zigzagline->line_style, ctx);
+
if (zigzagline->line_join != LINEJOIN_MITER)
data_add_enum(new_attribute(obj_node, "line_join"),
- zigzagline->line_join);
+ zigzagline->line_join, ctx);
if (zigzagline->line_caps != LINECAPS_BUTT)
data_add_enum(new_attribute(obj_node, "line_caps"),
- zigzagline->line_caps);
+ 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");
+ "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");
+ "end_arrow_length", "end_arrow_width", ctx);
}
if (zigzagline->line_style != LINESTYLE_SOLID &&
zigzagline->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
- zigzagline->dashlength);
+ zigzagline->dashlength, ctx);
if (zigzagline->corner_radius > 0.0)
data_add_real(new_attribute(obj_node, "corner_radius"),
- zigzagline->corner_radius);
+ zigzagline->corner_radius, ctx);
}
static DiaObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]