2 * (GLABELS) Label and Business Card Creation program for GNOME
4 * label.c: GLabels xml label 1.91 compat module
6 * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <libxml/tree.h>
28 #include <libxml/parser.h>
29 #include <gdk-pixbuf/gdk-pixdata.h>
32 #include "label-object.h"
33 #include "label-text.h"
34 #include "label-box.h"
35 #include "label-line.h"
36 #include "label-ellipse.h"
37 #include "label-image.h"
38 #include "label-barcode.h"
42 #include "xml-label.h"
43 #include "xml-label-04.h"
44 #include "xml-template.h"
50 /*========================================================*/
51 /* Private macros and constants. */
52 /*========================================================*/
54 /*========================================================*/
56 /*========================================================*/
58 /*========================================================*/
59 /* Private globals. */
60 /*========================================================*/
62 /*========================================================*/
63 /* Private function prototypes. */
64 /*========================================================*/
66 static void xml191_parse_objects (xmlNodePtr node,
69 static void xml191_parse_object (xmlNodePtr node,
72 static glLabelObject *xml191_parse_text_props (xmlNodePtr node,
75 static glLabelObject *xml191_parse_box_props (xmlNodePtr node,
78 static glLabelObject *xml191_parse_line_props (xmlNodePtr node,
81 static glLabelObject *xml191_parse_ellipse_props (xmlNodePtr node,
84 static glLabelObject *xml191_parse_image_props (xmlNodePtr node,
87 static glLabelObject *xml191_parse_barcode_props (xmlNodePtr node,
90 static void xml191_parse_merge_fields (xmlNodePtr node,
93 static void xml191_parse_data (xmlNodePtr node,
96 static void xml191_parse_pixdata (xmlNodePtr node,
99 static glTemplate *xml191_parse_sheet (xmlNodePtr node);
101 static void xml191_parse_label (xmlNodePtr label_node,
102 glTemplate *template);
104 static void xml191_parse_layout (xmlNodePtr layout_node,
105 glTemplate *template);
107 static void xml191_parse_markup (xmlNodePtr markup_node,
108 glTemplate *template);
110 static void xml191_parse_alias (xmlNodePtr alias_node,
111 glTemplate *template);
115 /****************************************************************************/
116 /* Parse xml root node and create label. */
117 /****************************************************************************/
119 gl_xml_label_191_parse (xmlNodePtr root,
120 glXMLLabelStatus *status)
124 glTemplate *template;
126 gl_debug (DEBUG_XML, "START");
128 *status = XML_LABEL_OK;
130 if (!xmlStrEqual (root->name, "Document")) {
131 g_warning (_("Bad root node = \"%s\""), root->name);
132 *status = XML_LABEL_ERROR_OPEN_PARSE;
136 label = GL_LABEL(gl_label_new ());
138 /* Pass 1, extract data nodes to pre-load cache. */
139 for (node = root->xmlChildrenNode; node != NULL; node = node->next) {
140 if (xmlStrEqual (node->name, "Data")) {
141 xml191_parse_data (node, label);
145 /* Pass 2, now extract everything else. */
146 for (node = root->xmlChildrenNode; node != NULL; node = node->next) {
148 if (xmlStrEqual (node->name, "Sheet")) {
149 template = xml191_parse_sheet (node);
151 *status = XML_LABEL_UNKNOWN_MEDIA;
154 gl_label_set_template (label, template);
155 gl_template_free (&template);
156 } else if (xmlStrEqual (node->name, "Objects")) {
157 xml191_parse_objects (node, label);
158 } else if (xmlStrEqual (node->name, "Merge_Fields")) {
159 xml191_parse_merge_fields (node, label);
160 } else if (xmlStrEqual (node->name, "Data")) {
161 /* Handled in pass 1. */
163 if (!xmlNodeIsText (node)) {
164 g_warning (_("bad node in Document node = \"%s\""),
170 gl_debug (DEBUG_XML, "END");
175 /*--------------------------------------------------------------------------*/
176 /* PRIVATE. Parse Objects node. */
177 /*--------------------------------------------------------------------------*/
179 xml191_parse_objects (xmlNodePtr objects_node,
182 gboolean rotate_flag;
185 gl_debug (DEBUG_XML, "START");
187 rotate_flag = gl_xml_get_prop_boolean (objects_node, "rotate", FALSE);
188 gl_label_set_rotate_flag (label, rotate_flag);
190 for (node = objects_node->xmlChildrenNode; node != NULL; node = node->next) {
192 if (xmlStrEqual (node->name, "Object")) {
193 xml191_parse_object (node, label);
195 if (!xmlNodeIsText (node)) {
196 g_warning (_("bad node = \"%s\""), node->name);
201 gl_debug (DEBUG_XML, "END");
204 /*--------------------------------------------------------------------------*/
205 /* PRIVATE. Parse XML Object Node */
206 /*--------------------------------------------------------------------------*/
208 xml191_parse_object (xmlNodePtr object_node,
211 glLabelObject *object;
216 gl_debug (DEBUG_XML, "START");
218 string = xmlGetProp (object_node, "type");
220 if ( xmlStrEqual (string, "Text") ) {
221 object = xml191_parse_text_props (object_node, label);
222 } else if ( xmlStrEqual (string, "Box") ) {
223 object = xml191_parse_box_props (object_node, label);
224 } else if ( xmlStrEqual (string, "Line") ) {
225 object = xml191_parse_line_props (object_node, label);
226 } else if ( xmlStrEqual (string, "Ellipse") ) {
227 object = xml191_parse_ellipse_props (object_node, label);
228 } else if ( xmlStrEqual (string, "Image") ) {
229 object = xml191_parse_image_props (object_node, label);
230 } else if ( xmlStrEqual (string, "Barcode") ) {
231 object = xml191_parse_barcode_props (object_node, label);
233 g_warning ("Unknown label object type \"%s\"", string);
240 x = gl_xml_get_prop_length (object_node, "x", 0.0);
241 y = gl_xml_get_prop_length (object_node, "y", 0.0);
243 gl_label_object_set_position (object, x, y);
246 affine[0] = gl_xml_get_prop_double (object_node, "a0", 0.0);
247 affine[1] = gl_xml_get_prop_double (object_node, "a1", 0.0);
248 affine[2] = gl_xml_get_prop_double (object_node, "a2", 0.0);
249 affine[3] = gl_xml_get_prop_double (object_node, "a3", 0.0);
250 affine[4] = gl_xml_get_prop_double (object_node, "a4", 0.0);
251 affine[5] = gl_xml_get_prop_double (object_node, "a5", 0.0);
253 gl_label_object_set_affine (object, affine);
256 gl_debug (DEBUG_XML, "END");
259 /*--------------------------------------------------------------------------*/
260 /* PRIVATE. Parse XML Label->Text Node Properties */
261 /*--------------------------------------------------------------------------*/
262 static glLabelObject *
263 xml191_parse_text_props (xmlNodePtr object_node,
271 GnomeFontWeight font_weight;
272 gboolean font_italic_flag;
274 GtkJustification just;
275 xmlNodePtr line_node, text_node;
276 glTextNode *node_text;
280 gl_debug (DEBUG_XML, "START");
282 object = gl_label_text_new (label);
284 w = gl_xml_get_prop_length (object_node, "w", 0);
285 h = gl_xml_get_prop_length (object_node, "h", 0);
287 font_family = xmlGetProp (object_node, "font_family");
289 font_size = gl_xml_get_prop_double (object_node, "font_size", 0.0);
291 string = xmlGetProp (object_node, "font_weight");
292 font_weight = gl_util_string_to_weight (string);
295 font_italic_flag = gl_xml_get_prop_boolean (object_node, "font_italic", FALSE);
297 string = xmlGetProp (object_node, "justify");
298 just = gl_util_string_to_just (string);
301 color = gl_xml_get_prop_uint (object_node, "color", 0);
304 for (line_node = object_node->xmlChildrenNode;
306 line_node = line_node->next) {
308 if (xmlStrEqual (line_node->name, "Line")) {
311 for (text_node = line_node->xmlChildrenNode;
312 text_node != NULL; text_node = text_node->next) {
314 if (xmlStrEqual (text_node->name, "Field")) {
315 node_text = g_new0 (glTextNode, 1);
316 node_text->field_flag = TRUE;
317 node_text->data = xmlGetProp (text_node, "name");
318 nodes = g_list_append (nodes, node_text);
319 } else if (xmlStrEqual (text_node->name, "Literal")) {
320 node_text = g_new0 (glTextNode, 1);
321 node_text->field_flag = FALSE;
323 xmlNodeGetContent (text_node);
325 g_list_append (nodes, node_text);
326 } else if (!xmlNodeIsText (text_node)) {
327 g_warning ("Unexpected Text Line child: \"%s\"",
332 lines = g_list_append (lines, nodes);
334 } else if (!xmlNodeIsText (line_node)) {
335 g_warning ("Unexpected Text child: \"%s\"",
341 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
342 gl_label_text_set_lines (GL_LABEL_TEXT(object), lines);
343 gl_label_text_set_props (GL_LABEL_TEXT(object),
344 font_family, font_size, font_weight,
348 gl_text_node_lines_free (&lines);
349 g_free (font_family);
351 gl_debug (DEBUG_XML, "END");
353 return GL_LABEL_OBJECT(object);
356 /*--------------------------------------------------------------------------*/
357 /* PRIVATE. Parse XML Label->Box Node Properties */
358 /*--------------------------------------------------------------------------*/
359 static glLabelObject *
360 xml191_parse_box_props (xmlNodePtr node,
365 guint line_color, fill_color;
368 gl_debug (DEBUG_XML, "START");
370 object = gl_label_box_new (label);
372 w = gl_xml_get_prop_length (node, "w", 0);
373 h = gl_xml_get_prop_length (node, "h", 0);
375 line_width = gl_xml_get_prop_length (node, "line_width", 1.0);
377 line_color = gl_xml_get_prop_uint (node, "line_color", 0);
378 fill_color = gl_xml_get_prop_uint (node, "fill_color", 0);
380 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
381 gl_label_box_set_line_width (GL_LABEL_BOX(object), line_width);
382 gl_label_box_set_line_color (GL_LABEL_BOX(object), line_color);
383 gl_label_box_set_fill_color (GL_LABEL_BOX(object), fill_color);
385 gl_debug (DEBUG_XML, "END");
387 return GL_LABEL_OBJECT(object);
390 /*--------------------------------------------------------------------------*/
391 /* PRIVATE. Parse XML Label->Line Node Properties */
392 /*--------------------------------------------------------------------------*/
393 static glLabelObject *
394 xml191_parse_line_props (xmlNodePtr node,
402 gl_debug (DEBUG_XML, "START");
404 object = gl_label_line_new (label);
406 w = gl_xml_get_prop_length (node, "dx", 0);
407 h = gl_xml_get_prop_length (node, "dy", 0);
409 line_width = gl_xml_get_prop_length (node, "line_width", 1.0);
411 line_color = gl_xml_get_prop_uint (node, "line_color", 0);
413 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
414 gl_label_line_set_line_width (GL_LABEL_LINE(object), line_width);
415 gl_label_line_set_line_color (GL_LABEL_LINE(object), line_color);
417 gl_debug (DEBUG_XML, "END");
419 return GL_LABEL_OBJECT(object);
422 /*--------------------------------------------------------------------------*/
423 /* PRIVATE. Parse XML Label->Ellipse Node Properties */
424 /*--------------------------------------------------------------------------*/
425 static glLabelObject *
426 xml191_parse_ellipse_props (xmlNodePtr node,
431 guint line_color, fill_color;
434 gl_debug (DEBUG_XML, "START");
436 object = gl_label_ellipse_new (label);
438 w = gl_xml_get_prop_length (node, "w", 0);
439 h = gl_xml_get_prop_length (node, "h", 0);
441 line_width = gl_xml_get_prop_length (node, "line_width", 1.0);
443 line_color = gl_xml_get_prop_uint (node, "line_color", 0);
444 fill_color = gl_xml_get_prop_uint (node, "fill_color", 0);
446 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
447 gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object), line_width);
448 gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object), line_color);
449 gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object), fill_color);
451 gl_debug (DEBUG_XML, "END");
453 return GL_LABEL_OBJECT(object);
456 /*--------------------------------------------------------------------------*/
457 /* PRIVATE. Parse XML Label->Image Node Properties */
458 /*--------------------------------------------------------------------------*/
459 static glLabelObject *
460 xml191_parse_image_props (xmlNodePtr node,
466 glTextNode *filename;
468 gl_debug (DEBUG_XML, "START");
470 object = gl_label_image_new (label);
472 w = gl_xml_get_prop_length (node, "w", 0);
473 h = gl_xml_get_prop_length (node, "h", 0);
475 filename = g_new0 (glTextNode, 1);
476 for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
477 if (xmlStrEqual (child->name, "Field")) {
478 filename->field_flag = TRUE;
479 filename->data = xmlGetProp (child, "name");
480 } else if (xmlStrEqual (child->name, "File")) {
481 filename->field_flag = FALSE;
482 filename->data = xmlGetProp (child, "src");
483 } else if (!xmlNodeIsText (child)) {
484 g_warning ("Unexpected Image child: \"%s\"", child->name);
488 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
489 gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename);
491 gl_text_node_free (&filename);
493 gl_debug (DEBUG_XML, "END");
495 return GL_LABEL_OBJECT(object);
498 /*--------------------------------------------------------------------------*/
499 /* PRIVATE. Parse XML Label->Barcode Node Properties */
500 /*--------------------------------------------------------------------------*/
501 static glLabelObject *
502 xml191_parse_barcode_props (xmlNodePtr node,
509 glTextNode *text_node;
510 glBarcodeStyle style;
512 gboolean checksum_flag;
515 gl_debug (DEBUG_XML, "START");
517 object = gl_label_barcode_new (label);
519 w = gl_xml_get_prop_length (node, "w", 0);
520 h = gl_xml_get_prop_length (node, "h", 0);
522 color = gl_xml_get_prop_uint (node, "color", 0);
524 string = xmlGetProp (node, "style");
525 style = gl_barcode_text_to_style (string);
528 text_flag = gl_xml_get_prop_boolean (node, "text", FALSE);
529 checksum_flag = gl_xml_get_prop_boolean (node, "checksum", TRUE);
531 text_node = g_new0 (glTextNode, 1);
532 for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
533 if (xmlStrEqual (child->name, "Field")) {
534 text_node->field_flag = TRUE;
535 text_node->data = xmlGetProp (child, "name");
536 } else if (xmlStrEqual (child->name, "Literal")) {
537 text_node->field_flag = FALSE;
538 text_node->data = xmlNodeGetContent (child);
539 } else if (!xmlNodeIsText (child)) {
540 g_warning ("Unexpected Barcode child: \"%s\"", child->name);
544 gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
546 gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
547 gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
548 style, text_flag, checksum_flag, color);
550 gl_text_node_free (&text_node);
552 gl_debug (DEBUG_XML, "END");
554 return GL_LABEL_OBJECT(object);
557 /*--------------------------------------------------------------------------*/
558 /* PRIVATE. Parse XML merge fields tag. */
559 /*--------------------------------------------------------------------------*/
561 xml191_parse_merge_fields (xmlNodePtr node,
568 gl_debug (DEBUG_XML, "START");
570 string = xmlGetProp (node, "type");
571 merge = gl_merge_new (string);
574 string = xmlGetProp (node, "src");
575 gl_merge_set_src (merge, string);
578 gl_label_set_merge (label, merge);
580 g_object_unref (G_OBJECT(merge));
582 gl_debug (DEBUG_XML, "END");
585 /*--------------------------------------------------------------------------*/
586 /* PRIVATE. Parse XML data tag. */
587 /*--------------------------------------------------------------------------*/
589 xml191_parse_data (xmlNodePtr node,
594 gl_debug (DEBUG_XML, "START");
596 for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
598 if (xmlStrEqual (child->name, "Pixdata")) {
599 xml191_parse_pixdata (child, label);
601 if (!xmlNodeIsText (child)) {
602 g_warning (_("bad node in Data node = \"%s\""),
608 gl_debug (DEBUG_XML, "END");
611 /*--------------------------------------------------------------------------*/
612 /* PRIVATE. Parse XML pixbuf data tag. */
613 /*--------------------------------------------------------------------------*/
615 xml191_parse_pixdata (xmlNodePtr node,
618 gchar *name, *base64;
624 GHashTable *pixbuf_cache;
626 gl_debug (DEBUG_XML, "START");
628 name = xmlGetProp (node, "name");
629 base64 = xmlNodeGetContent (node);
631 stream = gl_base64_decode (base64, &stream_length);
632 pixdata = g_new0 (GdkPixdata, 1);
633 ret = gdk_pixdata_deserialize (pixdata, stream_length, stream, NULL);
636 pixbuf = gdk_pixbuf_from_pixdata (pixdata, TRUE, NULL);
638 pixbuf_cache = gl_label_get_pixbuf_cache (label);
639 gl_pixbuf_cache_add_pixbuf (pixbuf_cache, name, pixbuf);
647 gl_debug (DEBUG_XML, "END");
650 /*--------------------------------------------------------------------------*/
651 /* PRIVATE. Parse XML template Node. */
652 /*--------------------------------------------------------------------------*/
654 xml191_parse_sheet (xmlNodePtr sheet_node)
656 glTemplate *template;
661 gl_debug (DEBUG_TEMPLATE, "START");
663 template = g_new0 (glTemplate, 1);
665 template->name = xmlGetProp (sheet_node, "name");
666 template->alias = g_list_append (template->alias, g_strdup (template->name));
667 gl_debug (DEBUG_TEMPLATE, "Sheet = %s", template->name);
669 template->page_size = xmlGetProp (sheet_node, "size");
670 if (xmlStrEqual (template->page_size, "Other")) {
672 template->page_width = gl_xml_get_prop_length (sheet_node, "width", 0);
673 template->page_height = gl_xml_get_prop_length (sheet_node, "height", 0);
676 paper = gl_paper_from_id (template->page_size);
678 /* This should always be an id, but just in case a name
680 g_warning (_("Unknown page size id \"%s\", trying as name"),
681 template->page_size);
682 paper = gl_paper_from_name (template->page_size);
683 g_free (template->page_size);
684 template->page_size = g_strdup (paper->id);
687 template->page_width = paper->width;
688 template->page_height = paper->height;
690 g_warning (_("Unknown page size id or name \"%s\""),
691 template->page_size);
693 gl_paper_free (&paper);
696 description = xmlGetProp (sheet_node, "_description");
697 if (description != NULL) {
698 template->description = gettext (description);
700 template->description = xmlGetProp (sheet_node, "description");
703 for (node = sheet_node->xmlChildrenNode; node != NULL;
705 if (xmlStrEqual (node->name, "Label")) {
706 xml191_parse_label (node, template);
707 } else if (xmlStrEqual (node->name, "Alias")) {
708 xml191_parse_alias (node, template);
710 if (!xmlNodeIsText (node)) {
711 g_warning ("bad node = \"%s\"", node->name);
716 gl_debug (DEBUG_TEMPLATE, "END");
721 /*--------------------------------------------------------------------------*/
722 /* PRIVATE. Parse XML Sheet->Label Node. */
723 /*--------------------------------------------------------------------------*/
725 xml191_parse_label (xmlNodePtr label_node,
726 glTemplate *template)
731 gl_debug (DEBUG_TEMPLATE, "START");
733 style = xmlGetProp (label_node, "style");
734 if (xmlStrEqual (style, "rectangle")) {
735 template->label.style = GL_TEMPLATE_STYLE_RECT;
736 } else if (xmlStrEqual (style, "round")) {
737 template->label.style = GL_TEMPLATE_STYLE_ROUND;
738 } else if (xmlStrEqual (style, "cd")) {
739 template->label.style = GL_TEMPLATE_STYLE_CD;
741 template->label.style = GL_TEMPLATE_STYLE_RECT;
742 g_warning ("Unknown label style in template");
746 switch (template->label.style) {
748 case GL_TEMPLATE_STYLE_RECT:
749 template->label.rect.w = gl_xml_get_prop_length (label_node, "width", 0);
750 template->label.rect.h = gl_xml_get_prop_length (label_node, "height", 0);
751 template->label.rect.r = gl_xml_get_prop_length (label_node, "round", 0);
754 case GL_TEMPLATE_STYLE_ROUND:
755 template->label.round.r = gl_xml_get_prop_length (label_node, "radius", 0);
758 case GL_TEMPLATE_STYLE_CD:
759 template->label.cd.r1 = gl_xml_get_prop_length (label_node, "radius", 0);
760 template->label.cd.r2 = gl_xml_get_prop_length (label_node, "hole", 0);
761 template->label.cd.w = gl_xml_get_prop_length (label_node, "width", 0);
762 template->label.cd.h = gl_xml_get_prop_length (label_node, "height", 0);
770 for (node = label_node->xmlChildrenNode; node != NULL;
772 if (xmlStrEqual (node->name, "Layout")) {
773 xml191_parse_layout (node, template);
774 } else if (xmlStrEqual (node->name, "Markup")) {
775 xml191_parse_markup (node, template);
776 } else if (!xmlNodeIsText (node)) {
777 g_warning ("bad node = \"%s\"", node->name);
781 gl_debug (DEBUG_TEMPLATE, "END");
784 /*--------------------------------------------------------------------------*/
785 /* PRIVATE. Parse XML Sheet->Label->Layout Node. */
786 /*--------------------------------------------------------------------------*/
788 xml191_parse_layout (xmlNodePtr layout_node,
789 glTemplate *template)
792 gdouble x0, y0, dx, dy;
795 gl_debug (DEBUG_TEMPLATE, "START");
797 nx = gl_xml_get_prop_int (layout_node, "nx", 1);
798 ny = gl_xml_get_prop_int (layout_node, "ny", 1);
800 x0 = gl_xml_get_prop_length (layout_node, "x0", 0);
801 y0 = gl_xml_get_prop_length (layout_node, "y0", 0);
803 dx = gl_xml_get_prop_length (layout_node, "dx", 0);
804 dy = gl_xml_get_prop_length (layout_node, "dy", 0);
806 for (node = layout_node->xmlChildrenNode; node != NULL;
808 if (!xmlNodeIsText (node)) {
809 g_warning ("bad node = \"%s\"", node->name);
813 template->label.any.layouts =
814 g_list_append (template->label.any.layouts,
815 gl_template_layout_new (nx, ny, x0, y0, dx, dy));
817 gl_debug (DEBUG_TEMPLATE, "END");
820 /*--------------------------------------------------------------------------*/
821 /* PRIVATE. Parse XML Sheet->Label->Markup Node. */
822 /*--------------------------------------------------------------------------*/
824 xml191_parse_markup (xmlNodePtr markup_node,
825 glTemplate *template)
829 gdouble x1, y1, x2, y2;
832 gl_debug (DEBUG_TEMPLATE, "START");
834 type = xmlGetProp (markup_node, "type");
835 if (xmlStrEqual (type, "margin")) {
837 size = gl_xml_get_prop_length (markup_node, "size", 0);
839 template->label.any.markups =
840 g_list_append (template->label.any.markups,
841 gl_template_markup_margin_new (size));
843 } else if (xmlStrEqual (type, "line")) {
845 x1 = gl_xml_get_prop_length (markup_node, "x1", 0);
846 y1 = gl_xml_get_prop_length (markup_node, "y1", 0);
847 x2 = gl_xml_get_prop_length (markup_node, "x2", 0);
848 y2 = gl_xml_get_prop_length (markup_node, "y2", 0);
850 template->label.any.markups =
851 g_list_append (template->label.any.markups,
852 gl_template_markup_line_new (x1, y1, x2, y2));
856 for (node = markup_node->xmlChildrenNode; node != NULL;
858 if (!xmlNodeIsText (node)) {
859 g_warning ("bad node = \"%s\"", node->name);
863 gl_debug (DEBUG_TEMPLATE, "END");
866 /*--------------------------------------------------------------------------*/
867 /* PRIVATE. Parse XML Sheet->Alias Node. */
868 /*--------------------------------------------------------------------------*/
870 xml191_parse_alias (xmlNodePtr alias_node,
871 glTemplate *template)
873 gl_debug (DEBUG_TEMPLATE, "START");
875 template->alias = g_list_append (template->alias,
876 xmlGetProp (alias_node, "name"));
878 gl_debug (DEBUG_TEMPLATE, "END");