From: Jim Evins Date: Thu, 27 Sep 2007 04:11:18 +0000 (+0000) Subject: 2007-09-27 Jim Evins X-Git-Tag: glabels-2_3_0~324 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c1dd8eca6b4bdb77ba47a74b0bc760cb90ecbf7a;p=glabels 2007-09-27 Jim Evins * docs/libglabels/libglabels-decl-list.txt: * docs/libglabels/libglabels-docs.sgml: * docs/libglabels/libglabels-sections.txt: * docs/libglabels/libglabels-undocumented.txt: * docs/libglabels/tmpl/enums.sgml: * docs/libglabels/tmpl/init.sgml: * docs/libglabels/tmpl/libglabels-unused.sgml: * docs/libglabels/tmpl/paper.sgml: * docs/libglabels/tmpl/template.sgml: * docs/libglabels/tmpl/xml-paper.sgml: * docs/libglabels/tmpl/xml-template.sgml: * docs/libglabels/tmpl/xml.sgml: * libglabels/Makefile.am: * libglabels/category.c: * libglabels/category.h: * libglabels/enums.h: * libglabels/init.c: * libglabels/init.h: * libglabels/libglabels-private.h: * libglabels/libglabels.h: * libglabels/paper.c: * libglabels/paper.h: * libglabels/template.c: * libglabels/template.h: * libglabels/xml-category.c: * libglabels/xml-category.h: * libglabels/xml-paper.c: * libglabels/xml-paper.h: * libglabels/xml-template.c: * libglabels/xml-template.h: * libglabels/xml.c: * libglabels/xml.h: * src/cairo-label-path.c: * src/cairo-label-path.h: * src/cairo-markup-path.c: * src/cairo-markup-path.h: * src/file.c: * src/glabels-batch.c: * src/glabels.c: * src/label-object.c: * src/label.c: * src/label.h: * src/mini-preview-pixbuf-cache.c: * src/mini-preview-pixbuf.c: * src/mini-preview-pixbuf.h: * src/prefs-dialog.c: * src/prefs-model.c: * src/prefs-model.h: * src/prefs.c: * src/prefs.h: * src/print-op.c: * src/print.c: * src/template-designer.c: * src/view-barcode.c: * src/view-box.c: * src/view-ellipse.c: * src/view-image.c: * src/view-line.c: * src/view.c: * src/wdgt-media-select.c: * src/wdgt-mini-preview.c: * src/wdgt-mini-preview.h: * src/wdgt-print-copies.c: * src/wdgt-print-merge.c: * src/wdgt-rotate-label.c: * src/xml-label-04.c: * src/xml-label.c: Major cleanup of libglabels API -- this breaks API compatibility with older development and stable versions -- as far as I know, there are currently no external users of this library yet. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@674 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 129791cf..b6381355 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,76 @@ +2007-09-27 Jim Evins + + * docs/libglabels/libglabels-decl-list.txt: + * docs/libglabels/libglabels-docs.sgml: + * docs/libglabels/libglabels-sections.txt: + * docs/libglabels/libglabels-undocumented.txt: + * docs/libglabels/tmpl/enums.sgml: + * docs/libglabels/tmpl/init.sgml: + * docs/libglabels/tmpl/libglabels-unused.sgml: + * docs/libglabels/tmpl/paper.sgml: + * docs/libglabels/tmpl/template.sgml: + * docs/libglabels/tmpl/xml-paper.sgml: + * docs/libglabels/tmpl/xml-template.sgml: + * docs/libglabels/tmpl/xml.sgml: + * libglabels/Makefile.am: + * libglabels/category.c: + * libglabels/category.h: + * libglabels/enums.h: + * libglabels/init.c: + * libglabels/init.h: + * libglabels/libglabels-private.h: + * libglabels/libglabels.h: + * libglabels/paper.c: + * libglabels/paper.h: + * libglabels/template.c: + * libglabels/template.h: + * libglabels/xml-category.c: + * libglabels/xml-category.h: + * libglabels/xml-paper.c: + * libglabels/xml-paper.h: + * libglabels/xml-template.c: + * libglabels/xml-template.h: + * libglabels/xml.c: + * libglabels/xml.h: + * src/cairo-label-path.c: + * src/cairo-label-path.h: + * src/cairo-markup-path.c: + * src/cairo-markup-path.h: + * src/file.c: + * src/glabels-batch.c: + * src/glabels.c: + * src/label-object.c: + * src/label.c: + * src/label.h: + * src/mini-preview-pixbuf-cache.c: + * src/mini-preview-pixbuf.c: + * src/mini-preview-pixbuf.h: + * src/prefs-dialog.c: + * src/prefs-model.c: + * src/prefs-model.h: + * src/prefs.c: + * src/prefs.h: + * src/print-op.c: + * src/print.c: + * src/template-designer.c: + * src/view-barcode.c: + * src/view-box.c: + * src/view-ellipse.c: + * src/view-image.c: + * src/view-line.c: + * src/view.c: + * src/wdgt-media-select.c: + * src/wdgt-mini-preview.c: + * src/wdgt-mini-preview.h: + * src/wdgt-print-copies.c: + * src/wdgt-print-merge.c: + * src/wdgt-rotate-label.c: + * src/xml-label-04.c: + * src/xml-label.c: + Major cleanup of libglabels API -- this breaks API compatibility with older + development and stable versions -- as far as I know, there are currently + no external users of this library yet. + 2007-09-14 Jim Evins * src/marshal.list: diff --git a/glabels2/docs/libglabels/libglabels-decl-list.txt b/glabels2/docs/libglabels/libglabels-decl-list.txt index 81caed8b..d6a29794 100644 --- a/glabels2/docs/libglabels/libglabels-decl-list.txt +++ b/glabels2/docs/libglabels/libglabels-decl-list.txt @@ -1,33 +1,33 @@
xml -GL_XML_NAME_SPACE -gl_xml_get_prop_string -gl_xml_get_prop_i18n_string -gl_xml_get_prop_double -gl_xml_get_prop_boolean -gl_xml_get_prop_int -gl_xml_get_prop_uint -gl_xml_get_prop_length -gl_xml_set_prop_string -gl_xml_set_prop_double -gl_xml_set_prop_boolean -gl_xml_set_prop_int -gl_xml_set_prop_uint_hex -gl_xml_set_prop_length -gl_xml_is_node -gl_xml_get_node_content -gl_xml_set_default_units +LGL_XML_NAME_SPACE +lgl_xml_get_prop_string +lgl_xml_get_prop_i18n_string +lgl_xml_get_prop_double +lgl_xml_get_prop_boolean +lgl_xml_get_prop_int +lgl_xml_get_prop_uint +lgl_xml_get_prop_length +lgl_xml_set_prop_string +lgl_xml_set_prop_double +lgl_xml_set_prop_boolean +lgl_xml_set_prop_int +lgl_xml_set_prop_uint_hex +lgl_xml_set_prop_length +lgl_xml_is_node +lgl_xml_get_node_content +lgl_xml_set_default_units
xml-template -gl_xml_template_read_templates_from_file -gl_xml_template_parse_templates_doc -gl_xml_template_parse_template_node -gl_xml_template_write_templates_to_file -gl_xml_template_write_template_to_file -gl_xml_template_create_templates_doc -gl_xml_template_create_template_node +lgl_xml_template_read_templates_from_file +lgl_xml_template_parse_templates_doc +lgl_xml_template_parse_template_node +lgl_xml_template_write_templates_to_file +lgl_xml_template_write_template_to_file +lgl_xml_template_create_templates_doc +lgl_xml_template_create_template_node
@@ -36,101 +36,115 @@ gl_xml_template_create_template_node
enums -glUnitsType +lglUnitsType
template -glTemplate -glTemplateLabelType -glTemplateLayout -glTemplateMarkup -glTemplateOrigin -glTemplateLabelShape -glTemplateMarkupType -gl_template_init -gl_template_register -gl_template_get_name_list_unique -gl_template_get_name_list_all -gl_template_free_name_list -gl_template_from_name -gl_template_get_first_label_type -gl_template_does_page_size_match -gl_template_does_category_match -gl_template_get_label_size -gl_template_get_n_labels -gl_template_get_origins -gl_template_new -gl_template_add_category -gl_template_add_label_type -gl_template_add_alias -gl_template_rect_label_type_new -gl_template_round_label_type_new -gl_template_cd_label_type_new -gl_template_add_layout -gl_template_add_markup -gl_template_layout_new -gl_template_markup_margin_new -gl_template_markup_line_new -gl_template_markup_circle_new -gl_template_dup -gl_template_free -gl_template_label_type_dup -gl_template_label_type_free -gl_template_layout_dup -gl_template_layout_free -gl_template_markup_dup -gl_template_markup_free -gl_template_print_known_templates -gl_template_print_aliases +lglTemplate +lglTemplateFrameAll +lglTemplateFrameRect +lglTemplateFrameRound +lglTemplateFrameCD +lglTemplateLayout +lglTemplateMarkupMargin +lglTemplateMarkupLine +lglTemplateMarkupCircle +lglTemplateMarkupRect +lglTemplateOrigin +lglTemplateFrameShape +lglTemplateFrame +lglTemplateMarkupType +lglTemplateMarkup +lgl_template_init +lgl_template_register +lgl_template_get_name_list_unique +lgl_template_get_name_list_all +lgl_template_free_name_list +lgl_template_from_name +lgl_template_get_first_frame +lgl_template_does_page_size_match +lgl_template_does_category_match +lgl_template_frame_get_size +lgl_template_frame_get_n_labels +lgl_template_frame_get_origins +lgl_template_new +lgl_template_add_category +lgl_template_add_frame +lgl_template_add_alias +lgl_template_frame_rect_new +lgl_template_frame_round_new +lgl_template_frame_cd_new +lgl_template_add_layout +lgl_template_add_markup +lgl_template_layout_new +lgl_template_markup_margin_new +lgl_template_markup_line_new +lgl_template_markup_circle_new +lgl_template_markup_rect_new +lgl_template_dup +lgl_template_free +lgl_template_frame_dup +lgl_template_frame_free +lgl_template_layout_dup +lgl_template_layout_free +lgl_template_markup_dup +lgl_template_markup_free +lgl_template_print_known_templates +lgl_template_print_aliases
xml-paper -gl_xml_paper_read_papers_from_file -gl_xml_paper_parse_papers_doc -gl_xml_paper_parse_paper_node +lgl_xml_paper_read_papers_from_file +lgl_xml_paper_parse_papers_doc +lgl_xml_paper_parse_paper_node
xml-category -gl_xml_category_read_categories_from_file -gl_xml_category_parse_categories_doc -gl_xml_category_parse_category_node +lgl_xml_category_read_categories_from_file +lgl_xml_category_parse_categories_doc +lgl_xml_category_parse_category_node +
+ +
+init +lgl_init
category -glCategory -gl_category_init -gl_category_new -gl_category_dup -gl_category_free -gl_category_get_name_list -gl_category_free_name_list -gl_category_from_name -gl_category_from_id -gl_category_lookup_id_from_name -gl_category_lookup_name_from_id +lglCategory +lgl_category_init +lgl_category_new +lgl_category_dup +lgl_category_free +lgl_category_get_name_list +lgl_category_free_name_list +lgl_category_from_name +lgl_category_from_id +lgl_category_lookup_id_from_name +lgl_category_lookup_name_from_id
paper -glPaper -gl_paper_init -gl_paper_new -gl_paper_dup -gl_paper_free -gl_paper_get_id_list -gl_paper_free_id_list -gl_paper_get_name_list -gl_paper_free_name_list -gl_paper_is_id_known -gl_paper_is_id_other -gl_paper_from_id -gl_paper_from_name -gl_paper_lookup_id_from_name -gl_paper_lookup_name_from_id -gl_paper_print_known_papers +lglPaper +lgl_paper_init +lgl_paper_new +lgl_paper_dup +lgl_paper_free +lgl_paper_get_id_list +lgl_paper_free_id_list +lgl_paper_get_name_list +lgl_paper_free_name_list +lgl_paper_is_id_known +lgl_paper_is_id_other +lgl_paper_from_id +lgl_paper_from_name +lgl_paper_lookup_id_from_name +lgl_paper_lookup_name_from_id +lgl_paper_print_known_papers
diff --git a/glabels2/docs/libglabels/libglabels-docs.sgml b/glabels2/docs/libglabels/libglabels-docs.sgml index 41d28203..3d8059cb 100644 --- a/glabels2/docs/libglabels/libglabels-docs.sgml +++ b/glabels2/docs/libglabels/libglabels-docs.sgml @@ -1,18 +1,28 @@ + + LibGlabels Reference Manual - LibGlabels - - + Basic LibGlabels Usage + + + + + + + + Working Directly With LibGlabels XML + + diff --git a/glabels2/docs/libglabels/libglabels-sections.txt b/glabels2/docs/libglabels/libglabels-sections.txt index 279c4178..38385777 100644 --- a/glabels2/docs/libglabels/libglabels-sections.txt +++ b/glabels2/docs/libglabels/libglabels-sections.txt @@ -1,112 +1,155 @@
-libglabels +init libglabels/libglabels.h +lgl_init
enums libglabels/enums.h -glUnitsType +lglUnitsType
paper libglabels/paper.h -glPaper -gl_paper_init -gl_paper_new -gl_paper_dup -gl_paper_free -gl_paper_get_id_list -gl_paper_free_id_list -gl_paper_get_name_list -gl_paper_free_name_list -gl_paper_is_id_known -gl_paper_is_id_other -gl_paper_from_id -gl_paper_from_name -gl_paper_lookup_id_from_name -gl_paper_lookup_name_from_id -gl_paper_print_known_papers +lglPaper +lgl_paper_init +lgl_paper_new +lgl_paper_dup +lgl_paper_free +lgl_paper_get_id_list +lgl_paper_free_id_list +lgl_paper_get_name_list +lgl_paper_free_name_list +lgl_paper_is_id_known +lgl_paper_is_id_other +lgl_paper_from_id +lgl_paper_from_name +lgl_paper_lookup_id_from_name +lgl_paper_lookup_name_from_id +lgl_paper_print_known_papers +
+ +
+category +libglabels/category.h +lglCategory +lgl_category_init +lgl_category_new +lgl_category_dup +lgl_category_free +lgl_category_get_name_list +lgl_category_free_name_list +lgl_category_from_name +lgl_category_from_id +lgl_category_lookup_id_from_name +lgl_category_lookup_name_from_id
template libglabels/template.h -glTemplate -glTemplateLabelType -glTemplateLayout -glTemplateMarkup -glTemplateOrigin -glTemplateLabelShape -glTemplateMarkupType -gl_template_init -gl_template_register -gl_template_get_name_list -gl_template_free_name_list -gl_template_from_name -gl_template_get_name_with_desc -gl_template_get_first_label_type -gl_template_get_label_size -gl_template_get_n_labels -gl_template_get_origins -gl_template_new -gl_template_add_label_type -gl_template_add_alias -gl_template_rect_label_type_new -gl_template_round_label_type_new -gl_template_cd_label_type_new -gl_template_add_layout -gl_template_add_markup -gl_template_layout_new -gl_template_markup_margin_new -gl_template_markup_line_new -gl_template_markup_circle_new -gl_template_dup -gl_template_free -gl_template_label_type_dup -gl_template_label_type_free -gl_template_layout_dup -gl_template_layout_free -gl_template_markup_dup -gl_template_markup_free -gl_template_print_known_templates -gl_template_print_aliases +lglTemplate +lglTemplateFrameAll +lglTemplateFrameRect +lglTemplateFrameRound +lglTemplateFrameCD +lglTemplateLayout +lglTemplateMarkupMargin +lglTemplateMarkupLine +lglTemplateMarkupCircle +lglTemplateMarkupRect +lglTemplateOrigin +lglTemplateFrameShape +lglTemplateFrame +lglTemplateMarkupType +lglTemplateMarkup +lgl_template_init +lgl_template_register +lgl_template_get_name_list_unique +lgl_template_get_name_list_all +lgl_template_free_name_list +lgl_template_from_name +lgl_template_get_first_frame +lgl_template_does_page_size_match +lgl_template_does_category_match +lgl_template_frame_get_size +lgl_template_frame_get_n_labels +lgl_template_frame_get_origins +lgl_template_new +lgl_template_add_category +lgl_template_add_frame +lgl_template_add_alias +lgl_template_frame_rect_new +lgl_template_frame_round_new +lgl_template_frame_cd_new +lgl_template_add_layout +lgl_template_add_markup +lgl_template_layout_new +lgl_template_markup_margin_new +lgl_template_markup_line_new +lgl_template_markup_circle_new +lgl_template_markup_rect_new +lgl_template_dup +lgl_template_free +lgl_template_frame_dup +lgl_template_frame_free +lgl_template_layout_dup +lgl_template_layout_free +lgl_template_markup_dup +lgl_template_markup_free +lgl_template_print_known_templates +lgl_template_print_aliases
xml-paper libglabels/xml-paper.h -gl_xml_paper_read_papers_from_file -gl_xml_paper_parse_papers_doc -gl_xml_paper_parse_paper_node +lgl_xml_paper_read_papers_from_file +lgl_xml_paper_parse_papers_doc +lgl_xml_paper_parse_paper_node +
+ +
+xml-category +libglabels/xml-category.h +lgl_xml_category_read_categories_from_file +lgl_xml_category_parse_categories_doc +lgl_xml_category_parse_category_node
xml-template libglabels/xml-templates.h -gl_xml_template_read_templates_from_file -gl_xml_template_parse_templates_doc -gl_xml_template_parse_template_node -gl_xml_template_write_templates_to_file -gl_xml_template_write_template_to_file -gl_xml_template_create_templates_doc -gl_xml_template_create_template_node +lgl_xml_template_read_templates_from_file +lgl_xml_template_parse_templates_doc +lgl_xml_template_parse_template_node +lgl_xml_template_write_templates_to_file +lgl_xml_template_write_template_to_file +lgl_xml_template_create_templates_doc +lgl_xml_template_create_template_node
xml libglabels/xml.h -gl_xml_get_prop_double -gl_xml_get_prop_boolean -gl_xml_get_prop_int -gl_xml_get_prop_uint -gl_xml_get_prop_length -gl_xml_set_prop_double -gl_xml_set_prop_boolean -gl_xml_set_prop_int -gl_xml_set_prop_uint_hex -gl_xml_set_prop_length -gl_xml_set_default_units +LGL_XML_NAME_SPACE +lgl_xml_get_prop_string +lgl_xml_get_prop_i18n_string +lgl_xml_get_prop_double +lgl_xml_get_prop_boolean +lgl_xml_get_prop_int +lgl_xml_get_prop_uint +lgl_xml_get_prop_length +lgl_xml_set_prop_string +lgl_xml_set_prop_double +lgl_xml_set_prop_boolean +lgl_xml_set_prop_int +lgl_xml_set_prop_uint_hex +lgl_xml_set_prop_length +lgl_xml_is_node +lgl_xml_get_node_content +lgl_xml_set_default_units
diff --git a/glabels2/docs/libglabels/libglabels-undocumented.txt b/glabels2/docs/libglabels/libglabels-undocumented.txt index 544dfd37..27c5f539 100644 --- a/glabels2/docs/libglabels/libglabels-undocumented.txt +++ b/glabels2/docs/libglabels/libglabels-undocumented.txt @@ -1,52 +1,65 @@ -52% symbol docs coverage. -46 symbols documented. -1 symbols incomplete. -43 not documented. +55% symbol docs coverage. +71 symbols documented. +0 symbols incomplete. +57 not documented. -glPaper -glTemplate -glTemplateLabelShape -glTemplateLabelType -glTemplateLayout -glTemplateMarkup -glTemplateMarkupType -glTemplateOrigin -glUnitsType (GL_UNITS_POINT, GL_UNITS_INCH, GL_UNITS_MM, GL_UNITS_CM, GL_UNITS_PICA, GL_UNITS_FIRST, GL_UNITS_LAST) -gl_template_add_alias -gl_template_add_label_type -gl_template_add_layout -gl_template_add_markup -gl_template_cd_label_type_new -gl_template_dup -gl_template_free -gl_template_free_name_list -gl_template_from_name -gl_template_get_first_label_type -gl_template_get_label_size -gl_template_get_n_labels -gl_template_get_origins -gl_template_init -gl_template_label_type_dup -gl_template_label_type_free -gl_template_layout_dup -gl_template_layout_free -gl_template_layout_new -gl_template_markup_circle_new -gl_template_markup_dup -gl_template_markup_free -gl_template_markup_line_new -gl_template_markup_margin_new -gl_template_new -gl_template_print_aliases -gl_template_print_known_templates -gl_template_rect_label_type_new -gl_template_register -gl_template_round_label_type_new -gl_xml_template_create_templates_doc +LGL_XML_NAME_SPACE +lglCategory +lglPaper +lglTemplate +lglTemplateFrame +lglTemplateFrameAll +lglTemplateFrameCD +lglTemplateFrameRect +lglTemplateFrameRound +lglTemplateFrameShape +lglTemplateLayout +lglTemplateMarkup +lglTemplateMarkupCircle +lglTemplateMarkupLine +lglTemplateMarkupMargin +lglTemplateMarkupRect +lglTemplateMarkupType +lglTemplateOrigin +lglUnitsType +lgl_template_add_alias +lgl_template_add_category +lgl_template_add_frame +lgl_template_add_layout +lgl_template_add_markup +lgl_template_does_category_match +lgl_template_does_page_size_match +lgl_template_dup +lgl_template_frame_cd_new +lgl_template_frame_dup +lgl_template_frame_free +lgl_template_frame_get_n_labels +lgl_template_frame_get_origins +lgl_template_frame_get_size +lgl_template_frame_rect_new +lgl_template_frame_round_new +lgl_template_free +lgl_template_free_name_list +lgl_template_from_name +lgl_template_get_first_frame +lgl_template_get_name_list_all +lgl_template_get_name_list_unique +lgl_template_init +lgl_template_layout_dup +lgl_template_layout_free +lgl_template_layout_new +lgl_template_markup_circle_new +lgl_template_markup_dup +lgl_template_markup_free +lgl_template_markup_line_new +lgl_template_markup_margin_new +lgl_template_markup_rect_new +lgl_template_new +lgl_template_print_aliases +lgl_template_print_known_templates +lgl_template_register +lgl_xml_template_create_templates_doc -libglabels:Long_Description -libglabels:Short_Description -template:Long_Description -template:Short_Description +init:Long_Description diff --git a/glabels2/docs/libglabels/tmpl/enums.sgml b/glabels2/docs/libglabels/tmpl/enums.sgml index 41985e9d..86ba624d 100644 --- a/glabels2/docs/libglabels/tmpl/enums.sgml +++ b/glabels2/docs/libglabels/tmpl/enums.sgml @@ -17,20 +17,16 @@ This section defines enumerations used to interact with libglabels. - + -Enumerations for the units of length supported by libglabels. Internally -all lengths are in points. Externally libglabels supports points ("pt"), -inches ("in"), millimeters ("mm"), centimeters ("cm"), and picas ("pc"). -These units are identical to the absolute length units supported in -the CSS2 Specification (Section 4.3.2). + -@GL_UNITS_POINT: -@GL_UNITS_INCH: -@GL_UNITS_MM: -@GL_UNITS_CM: -@GL_UNITS_PICA: -@GL_UNITS_FIRST: -@GL_UNITS_LAST: +@LGL_UNITS_POINT: +@LGL_UNITS_INCH: +@LGL_UNITS_MM: +@LGL_UNITS_CM: +@LGL_UNITS_PICA: +@LGL_UNITS_FIRST: +@LGL_UNITS_LAST: diff --git a/glabels2/docs/libglabels/tmpl/init.sgml b/glabels2/docs/libglabels/tmpl/init.sgml new file mode 100644 index 00000000..e14a31aa --- /dev/null +++ b/glabels2/docs/libglabels/tmpl/init.sgml @@ -0,0 +1,26 @@ + +Library Initialization + + +Initialization of the LibGlabels library. + + + + + + + + + + + + + + + + + + + + + diff --git a/glabels2/docs/libglabels/tmpl/libglabels-unused.sgml b/glabels2/docs/libglabels/tmpl/libglabels-unused.sgml index 5c82261f..f6e47fdd 100644 --- a/glabels2/docs/libglabels/tmpl/libglabels-unused.sgml +++ b/glabels2/docs/libglabels/tmpl/libglabels-unused.sgml @@ -1,22 +1,1105 @@ + + + + + + + + + + + + + + + + + + + + + +libglabels + + - + + + + + +@id: +@name: + + + + + + +@id: +@name: +@width: +@height: + + + + + + +@name: +@description: +@page_size: +@page_width: +@page_height: +@categories: +@frames: +@aliases: + + + + + + + + + + + + +@shape: +@id: +@layouts: +@markups: + + + + + + +@shape: +@id: +@layouts: +@markups: +@r1: +@r2: +@w: +@h: +@waste: + + + + + + +@shape: +@id: +@layouts: +@markups: +@w: +@h: +@r: +@x_waste: +@y_waste: + + + + + + +@shape: +@id: +@layouts: +@markups: +@r: +@waste: + + + + + + +@GL_TEMPLATE_FRAME_SHAPE_RECT: +@GL_TEMPLATE_FRAME_SHAPE_ROUND: +@GL_TEMPLATE_FRAME_SHAPE_CD: + + + + + + +@GL_TEMPLATE_SHAPE_RECT: +@GL_TEMPLATE_SHAPE_ROUND: +@GL_TEMPLATE_SHAPE_CD: + + + + + + +@id: +@layouts: +@markups: +@shape: + + + + + + +@nx: +@ny: +@x0: +@y0: +@dx: +@dy: + + + + + + + + + + + + +@type: +@x0: +@y0: +@r: + + + + + + +@type: +@x1: +@y1: +@x2: +@y2: + + + + + + +@type: +@size: + + + + + + +@type: +@x1: +@y1: +@w: +@h: +@r: + + + + + + +@GL_TEMPLATE_MARKUP_MARGIN: +@GL_TEMPLATE_MARKUP_LINE: +@GL_TEMPLATE_MARKUP_CIRCLE: +@GL_TEMPLATE_MARKUP_RECT: + + + + + + +@x: +@y: + + + +Enumerations for the units of length supported by libglabels. Internally +all lengths are in points. Externally libglabels supports points ("pt"), +inches ("in"), millimeters ("mm"), centimeters ("cm"), and picas ("pc"). +These units are identical to the absolute length units supported in +the CSS2 Specification (Section 4.3.2). + + +@GL_UNITS_POINT: +@GL_UNITS_INCH: +@GL_UNITS_MM: +@GL_UNITS_CM: +@GL_UNITS_PICA: +@GL_UNITS_FIRST: +@GL_UNITS_LAST: + + + + + + +@orig: +@Returns: + + + + + + +@category: + + + + + + +@names: + + + + + + +@id: +@Returns: + + + + + + +@name: +@Returns: + + + + + + +@Returns: + + + + + + + + + + + + +@name: +@Returns: + + + + + + +@id: +@Returns: + + + + + + +@id: +@name: +@Returns: + + + + + + +@orig: +@Returns: + + + + + + +@paper: + + + + + + +@ids: + + + + + + +@names: + + + + + + +@id: +@Returns: + + + + + + +@name: +@Returns: + + + + + + +@Returns: + + + + + + +@Returns: + + + + + + + + + + + + +@id: +@Returns: + + + + + + +@id: +@Returns: + + + + + + +@name: +@Returns: + + + + + + +@id: +@Returns: + + + + + + +@id: +@name: +@width: +@height: +@Returns: + + + + + + + + + + + + +@template: +@alias: + + + + + + +@template: +@category: + + + + + + +@template: +@frame: + + + + + + +@template: +@label_type: + + + + + + +@frame: +@layout: + + + + + + +@frame: +@markup: + + + + + + +@id: +@r1: +@r2: +@w: +@h: +@waste: +@Returns: + + + + + + +@template: +@category: +@Returns: + + + + + + +@template: +@page_size: +@Returns: + + + + + + +@orig: +@Returns: + + + + + + +@id: +@r1: +@r2: +@w: +@h: +@waste: +@Returns: + + + + + + +@orig_frame: +@Returns: + + + + + + +@frame: + + + + + + +@frame: +@Returns: + + + + + + +@frame: +@Returns: + + + + + + +@frame: +@w: +@h: + + + + + + +@id: +@w: +@h: +@r: +@x_waste: +@y_waste: +@Returns: + + + + + + +@id: +@r: +@waste: +@Returns: + + + + + + +@template: + + + + + + +@names: + + + + + + +@name: +@Returns: + + + + + + +@template: +@Returns: + + + + + + +@template: +@Returns: + + + + + + +@label_type: +@w: +@h: + + + + + + +@label_type: +@Returns: + + + + + + +@page_size: +@Returns: + + + + + + +@page_size: +@category: +@Returns: + + + + + + +@page_size: +@category: +@Returns: + + + + + + +@template: +@Returns: + + + + + + +@label_type: +@Returns: + + + + + + + + + + + + +@orig_ltype: +@Returns: + + + + + + +@ltype: + + + + + + +@orig_layout: +@Returns: + + + + + + +@layout: + + + + + + +@nx: +@ny: +@x0: +@y0: +@dx: +@dy: +@Returns: + + + + + + +@x0: +@y0: +@r: +@Returns: + + + + + + +@orig_markup: +@Returns: + + + + + + +@markup: + + + + + + +@x1: +@y1: +@x2: +@y2: +@Returns: + + + + + + +@size: +@Returns: + + + + + + +@x1: +@y1: +@w: +@h: +@r: +@Returns: + + +@name: +@description: @page_size: +@page_width: +@page_height: @Returns: - + + + + + +@template: + + + + + + + + + + + + +@id: +@w: +@h: +@r: +@x_waste: +@y_waste: +@Returns: + + + + + + +@template: + + + + + + +@id: +@r: +@waste: +@Returns: + + + + + + +@categories_doc: +@Returns: + + + + + + +@category_node: +@Returns: + + + + + + +@utf8_filename: +@Returns: + + + + + + +@node: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + +@node: +@name: +@Returns: + + + + + + +@paper_node: +@Returns: + + + + + + +@papers_doc: +@Returns: + + + + + + +@utf8_filename: +@Returns: + + + + + + +@units: + + + + + + +@node: +@property: +@val: + + + + + + +@node: +@property: +@val: + + + + + + +@node: +@property: +@val: + + + + + + +@node: +@property: +@val: + + + + + + +@node: +@property: +@val: + + + + + + +@node: +@property: +@val: + + @template: +@root: +@ns: + + + + + + +@templates: +@Returns: + + + + + + +@template_node: +@Returns: + + + + + + +@templates_doc: +@Returns: + + + + + + +@utf8_filename: @Returns: + + + + + +@template: +@utf8_filename: + + + + + + +@templates: +@utf8_filename: + diff --git a/glabels2/docs/libglabels/tmpl/paper.sgml b/glabels2/docs/libglabels/tmpl/paper.sgml index 4b64ad7c..f783b05e 100644 --- a/glabels2/docs/libglabels/tmpl/paper.sgml +++ b/glabels2/docs/libglabels/tmpl/paper.sgml @@ -1,5 +1,5 @@ -Paper Definitions +Paper Sizes Paper size definitions @@ -18,7 +18,7 @@ and related functions. - + @@ -28,14 +28,14 @@ and related functions. @width: @height: - + - + @@ -47,7 +47,7 @@ and related functions. @Returns: - + @@ -56,7 +56,7 @@ and related functions. @Returns: - + @@ -64,7 +64,7 @@ and related functions. @paper: - + @@ -72,7 +72,7 @@ and related functions. @Returns: - + @@ -80,7 +80,7 @@ and related functions. @ids: - + @@ -88,7 +88,7 @@ and related functions. @Returns: - + @@ -96,7 +96,7 @@ and related functions. @names: - + @@ -105,7 +105,7 @@ and related functions. @Returns: - + @@ -114,7 +114,7 @@ and related functions. @Returns: - + @@ -123,7 +123,7 @@ and related functions. @Returns: - + @@ -132,7 +132,7 @@ and related functions. @Returns: - + @@ -141,7 +141,7 @@ and related functions. @Returns: - + @@ -150,7 +150,7 @@ and related functions. @Returns: - + diff --git a/glabels2/docs/libglabels/tmpl/template.sgml b/glabels2/docs/libglabels/tmpl/template.sgml index 52dbd008..592e9bbd 100644 --- a/glabels2/docs/libglabels/tmpl/template.sgml +++ b/glabels2/docs/libglabels/tmpl/template.sgml @@ -1,12 +1,13 @@ -template +Templates - +Template definitions - +This section describes a set of structures representing stationary templates and related +functions. @@ -17,7 +18,7 @@ template - + @@ -28,20 +29,62 @@ template @page_width: @page_height: @categories: -@label_types: +@frames: @aliases: - + +@shape: @id: @layouts: @markups: + + + + + + +@shape: +@id: +@layouts: +@markups: +@w: +@h: +@r: +@x_waste: +@y_waste: + + + + + + @shape: +@id: +@layouts: +@markups: +@r: +@waste: - + + + + + +@shape: +@id: +@layouts: +@markups: +@r1: +@r2: +@w: +@h: +@waste: + + @@ -53,14 +96,48 @@ template @dx: @dy: - + + + + + +@type: +@size: + + + + + + +@type: +@x1: +@y1: +@x2: +@y2: + + + + + + +@type: +@x0: +@y0: +@r: + + @type: +@x1: +@y1: +@w: +@h: +@r: - + @@ -68,32 +145,45 @@ template @x: @y: - + -@GL_TEMPLATE_SHAPE_RECT: -@GL_TEMPLATE_SHAPE_ROUND: -@GL_TEMPLATE_SHAPE_CD: +@LGL_TEMPLATE_FRAME_SHAPE_RECT: +@LGL_TEMPLATE_FRAME_SHAPE_ROUND: +@LGL_TEMPLATE_FRAME_SHAPE_CD: - + -@GL_TEMPLATE_MARKUP_MARGIN: -@GL_TEMPLATE_MARKUP_LINE: -@GL_TEMPLATE_MARKUP_CIRCLE: - + +@LGL_TEMPLATE_MARKUP_MARGIN: +@LGL_TEMPLATE_MARKUP_LINE: +@LGL_TEMPLATE_MARKUP_CIRCLE: +@LGL_TEMPLATE_MARKUP_RECT: + + + + + - + + + + + + + + @@ -101,7 +191,27 @@ template @template: - + + + + + +@page_size: +@category: +@Returns: + + + + + + + +@page_size: +@category: +@Returns: + + + @@ -109,7 +219,7 @@ template @names: - + @@ -118,7 +228,7 @@ template @Returns: - + @@ -127,35 +237,55 @@ template @Returns: - + -@label_type: +@template: +@page_size: +@Returns: + + + + + + + +@template: +@category: +@Returns: + + + + + + + +@frame: @w: @h: - + -@label_type: +@frame: @Returns: - + -@label_type: +@frame: @Returns: - + @@ -168,16 +298,25 @@ template @Returns: - + @template: -@label_type: +@category: - + + + + + +@template: +@frame: + + + @@ -186,7 +325,7 @@ template @alias: - + @@ -200,7 +339,7 @@ template @Returns: - + @@ -211,7 +350,7 @@ template @Returns: - + @@ -225,25 +364,25 @@ template @Returns: - + -@label_type: +@frame: @layout: - + -@label_type: +@frame: @markup: - + @@ -257,7 +396,7 @@ template @Returns: - + @@ -266,7 +405,7 @@ template @Returns: - + @@ -278,7 +417,7 @@ template @Returns: - + @@ -289,7 +428,20 @@ template @Returns: - + + + + + +@x1: +@y1: +@w: +@h: +@r: +@Returns: + + + @@ -298,7 +450,7 @@ template @Returns: - + @@ -306,24 +458,24 @@ template @template: - + -@orig_ltype: +@orig_frame: @Returns: - + -@ltype: +@frame: - + @@ -332,7 +484,7 @@ template @Returns: - + @@ -340,7 +492,7 @@ template @layout: - + @@ -349,7 +501,7 @@ template @Returns: - + @@ -357,14 +509,14 @@ template @markup: - + - + diff --git a/glabels2/docs/libglabels/tmpl/xml-paper.sgml b/glabels2/docs/libglabels/tmpl/xml-paper.sgml index b125962c..0909d2cf 100644 --- a/glabels2/docs/libglabels/tmpl/xml-paper.sgml +++ b/glabels2/docs/libglabels/tmpl/xml-paper.sgml @@ -18,7 +18,7 @@ XML paper definition files. - + @@ -27,7 +27,7 @@ XML paper definition files. @Returns: - + @@ -36,7 +36,7 @@ XML paper definition files. @Returns: - + diff --git a/glabels2/docs/libglabels/tmpl/xml-template.sgml b/glabels2/docs/libglabels/tmpl/xml-template.sgml index 0a30e009..40060a6d 100644 --- a/glabels2/docs/libglabels/tmpl/xml-template.sgml +++ b/glabels2/docs/libglabels/tmpl/xml-template.sgml @@ -19,7 +19,7 @@ template files and document files. - + @@ -28,7 +28,7 @@ template files and document files. @Returns: - + @@ -37,7 +37,7 @@ template files and document files. @Returns: - + @@ -46,7 +46,7 @@ template files and document files. @Returns: - + @@ -55,7 +55,7 @@ template files and document files. @utf8_filename: - + @@ -64,7 +64,7 @@ template files and document files. @utf8_filename: - + @@ -73,7 +73,7 @@ template files and document files. @Returns: - + diff --git a/glabels2/docs/libglabels/tmpl/xml.sgml b/glabels2/docs/libglabels/tmpl/xml.sgml index a1022b72..e0803379 100644 --- a/glabels2/docs/libglabels/tmpl/xml.sgml +++ b/glabels2/docs/libglabels/tmpl/xml.sgml @@ -21,7 +21,36 @@ These functions are basically wrappers to functions from libxml2. - + + + + + + + + + + + + +@node: +@property: +@default_val: +@Returns: + + + + + + + +@node: +@property: +@default_val: +@Returns: + + + @@ -32,7 +61,7 @@ These functions are basically wrappers to functions from libxml2. @Returns: - + @@ -43,7 +72,7 @@ These functions are basically wrappers to functions from libxml2. @Returns: - + @@ -54,7 +83,7 @@ These functions are basically wrappers to functions from libxml2. @Returns: - + @@ -65,7 +94,7 @@ These functions are basically wrappers to functions from libxml2. @Returns: - + @@ -76,7 +105,7 @@ These functions are basically wrappers to functions from libxml2. @Returns: - + @@ -86,7 +115,7 @@ These functions are basically wrappers to functions from libxml2. @val: - + @@ -96,7 +125,7 @@ These functions are basically wrappers to functions from libxml2. @val: - + @@ -106,7 +135,7 @@ These functions are basically wrappers to functions from libxml2. @val: - + @@ -116,7 +145,7 @@ These functions are basically wrappers to functions from libxml2. @val: - + @@ -126,7 +155,36 @@ These functions are basically wrappers to functions from libxml2. @val: - + + + + + +@node: +@property: +@val: + + + + + + + +@node: +@name: +@Returns: + + + + + + + +@node: +@Returns: + + + diff --git a/glabels2/libglabels/Makefile.am b/glabels2/libglabels/Makefile.am index 85139b5b..bdf42eeb 100644 --- a/glabels2/libglabels/Makefile.am +++ b/glabels2/libglabels/Makefile.am @@ -17,6 +17,8 @@ libglabelsincludedir=$(includedir)/libglabels libglabels_la_SOURCES = \ libglabels-private.h \ + init.h \ + init.c \ enums.h \ paper.h \ paper.c \ diff --git a/glabels2/libglabels/category.c b/glabels2/libglabels/category.c index 4bd94d4b..03576e88 100644 --- a/glabels2/libglabels/category.c +++ b/glabels2/libglabels/category.c @@ -62,16 +62,16 @@ static GList *read_category_files_from_dir (GList *categories, /** - * gl_category_init: + * lgl_category_init: * * Initialize libglabels category module by reading all category definition * files located in system and user template directories. + * + * The end user would typically call lgl_init() instead. */ void -gl_category_init (void) +lgl_category_init (void) { - glCategory *other; - if (categories) { return; /* Already initialized. */ } @@ -81,23 +81,23 @@ gl_category_init (void) /** - * gl_category_new: + * lgl_category_new: * @id: Id of category definition. (E.g. label, card, etc.) Should be * unique. * @name: Localized name of category. * - * Allocates and constructs a new #glCategory structure. + * Allocates and constructs a new #lglCategory structure. * - * Returns: a pointer to a newly allocated #glCategory structure. + * Returns: a pointer to a newly allocated #lglCategory structure. * */ -glCategory * -gl_category_new (gchar *id, - gchar *name) +lglCategory * +lgl_category_new (gchar *id, + gchar *name) { - glCategory *category; + lglCategory *category; - category = g_new0 (glCategory,1); + category = g_new0 (lglCategory,1); category->id = g_strdup (id); category->name = g_strdup (name); @@ -106,21 +106,21 @@ gl_category_new (gchar *id, /** - * gl_category_dup: - * @orig: #glCategory structure to be duplicated. + * lgl_category_dup: + * @orig: #lglCategory structure to be duplicated. * - * Duplicates an existing #glCategory structure. + * Duplicates an existing #lglCategory structure. * - * Returns: a pointer to a newly allocated #glCategory structure. + * Returns: a pointer to a newly allocated #lglCategory structure. * */ -glCategory *gl_category_dup (const glCategory *orig) +lglCategory *lgl_category_dup (const lglCategory *orig) { - glCategory *category; + lglCategory *category; g_return_val_if_fail (orig, NULL); - category = g_new0 (glCategory,1); + category = g_new0 (lglCategory,1); category->id = g_strdup (orig->id); category->name = g_strdup (orig->name); @@ -130,13 +130,13 @@ glCategory *gl_category_dup (const glCategory *orig) /** - * gl_category_free: - * @category: pointer to #glCategory structure to be freed. + * lgl_category_free: + * @category: pointer to #lglCategory structure to be freed. * - * Free all memory associated with an existing #glCategory structure. + * Free all memory associated with an existing #lglCategory structure. * */ -void gl_category_free (glCategory *category) +void lgl_category_free (lglCategory *category) { if ( category != NULL ) { @@ -154,26 +154,26 @@ void gl_category_free (glCategory *category) /** - * gl_category_get_name_list: + * lgl_category_get_name_list: * - * Get a list of all localized category names known to libglabels. + * Get a list of all localized category names known to liblglabels. * * Returns: a list of localized category names. * */ GList * -gl_category_get_name_list (void) +lgl_category_get_name_list (void) { GList *names = NULL; GList *p; - glCategory *category; + lglCategory *category; if (!categories) { - gl_category_init (); + lgl_category_init (); } for ( p=categories; p != NULL; p=p->next ) { - category = (glCategory *)p->data; + category = (lglCategory *)p->data; names = g_list_append (names, g_strdup (category->name)); } @@ -182,15 +182,15 @@ gl_category_get_name_list (void) /** - * gl_category_free_name_list: + * lgl_category_free_name_list: * @names: List of localized category name strings to be freed. * * Free up all storage associated with a name list obtained with - * gl_category_get_name_list(). + * lgl_category_get_name_list(). * */ void -gl_category_free_name_list (GList *names) +lgl_category_free_name_list (GList *names) { GList *p; @@ -204,33 +204,33 @@ gl_category_free_name_list (GList *names) /** - * gl_category_from_id: + * lgl_category_from_id: * @id: category id string * * Lookup category definition from id string. * - * Returns: pointer to a newly allocated #glCategory structure. + * Returns: pointer to a newly allocated #lglCategory structure. * */ -glCategory * -gl_category_from_id (const gchar *id) +lglCategory * +lgl_category_from_id (const gchar *id) { - GList *p; - glCategory *category; + GList *p; + lglCategory *category; if (!categories) { - gl_category_init (); + lgl_category_init (); } if (id == NULL) { /* If no id, return first category as a default */ - return gl_category_dup ((glCategory *) categories->data); + return lgl_category_dup ((lglCategory *) categories->data); } for (p = categories; p != NULL; p = p->next) { - category = (glCategory *) p->data; + category = (lglCategory *) p->data; if (g_strcasecmp (category->id, id) == 0) { - return gl_category_dup (category); + return lgl_category_dup (category); } } @@ -239,33 +239,33 @@ gl_category_from_id (const gchar *id) /** - * gl_category_from_name: + * lgl_category_from_name: * @name: localized category name string * * Lookup category definition from localized category name string. * - * Returns: pointer to a newly allocated #glCategory structure. + * Returns: pointer to a newly allocated #lglCategory structure. * */ -glCategory * -gl_category_from_name (const gchar *name) +lglCategory * +lgl_category_from_name (const gchar *name) { - GList *p; - glCategory *category; + GList *p; + lglCategory *category; if (!categories) { - gl_category_init (); + lgl_category_init (); } if (name == NULL) { /* If no name, return first category as a default */ - return gl_category_dup ((glCategory *) categories->data); + return lgl_category_dup ((lglCategory *) categories->data); } for (p = categories; p != NULL; p = p->next) { - category = (glCategory *) p->data; + category = (lglCategory *) p->data; if (g_strcasecmp (category->name, name) == 0) { - return gl_category_dup (category); + return lgl_category_dup (category); } } @@ -274,7 +274,7 @@ gl_category_from_name (const gchar *name) /** - * gl_category_lookup_id_from_name: + * lgl_category_lookup_id_from_name: * @name: localized category name stringp * * Lookup category name string from localized category name string. @@ -283,18 +283,18 @@ gl_category_from_name (const gchar *name) * */ gchar * -gl_category_lookup_id_from_name (const gchar *name) +lgl_category_lookup_id_from_name (const gchar *name) { - glCategory *category = NULL; - gchar *id = NULL; + lglCategory *category = NULL; + gchar *id = NULL; if (name != NULL) { - category = gl_category_from_name (name); + category = lgl_category_from_name (name); if ( category != NULL ) { id = g_strdup (category->id); - gl_category_free (category); + lgl_category_free (category); category = NULL; } } @@ -303,7 +303,7 @@ gl_category_lookup_id_from_name (const gchar *name) } /** - * gl_category_lookup_name_from_id: + * lgl_category_lookup_name_from_id: * @id: category id string * * Lookup localized category name string from category id string. @@ -312,18 +312,18 @@ gl_category_lookup_id_from_name (const gchar *name) * */ gchar * -gl_category_lookup_name_from_id (const gchar *id) +lgl_category_lookup_name_from_id (const gchar *id) { - glCategory *category = NULL; - gchar *name = NULL; + lglCategory *category = NULL; + gchar *name = NULL; if (id != NULL) { - category = gl_category_from_id (id); + category = lgl_category_from_id (id); if ( category != NULL ) { name = g_strdup (category->name); - gl_category_free (category); + lgl_category_free (category); category = NULL; } } @@ -340,11 +340,11 @@ read_categories (void) gchar *data_dir; GList *categories = NULL; - data_dir = GL_SYSTEM_DATA_DIR; + data_dir = LGL_SYSTEM_DATA_DIR; categories = read_category_files_from_dir (categories, data_dir); g_free (data_dir); - data_dir = GL_USER_DATA_DIR; + data_dir = LGL_USER_DATA_DIR; categories = read_category_files_from_dir (categories, data_dir); g_free (data_dir); @@ -394,7 +394,7 @@ read_category_files_from_dir (GList *categories, full_filename = g_build_filename (dirname, filename, NULL); new_categories = - gl_xml_category_read_categories_from_file (full_filename); + lgl_xml_category_read_categories_from_file (full_filename); g_free (full_filename); categories = g_list_concat (categories, new_categories); diff --git a/glabels2/libglabels/category.h b/glabels2/libglabels/category.h index 0d46a668..43c17c23 100644 --- a/glabels2/libglabels/category.h +++ b/glabels2/libglabels/category.h @@ -36,44 +36,44 @@ G_BEGIN_DECLS /* * Template class */ -typedef struct _glCategory glCategory; +typedef struct _lglCategory lglCategory; -struct _glCategory { - gchar *id; /* Unique ID of paper definition */ - gchar *name; /* Localized name of paper */ +struct _lglCategory { + gchar *id; /* Unique ID of category */ + gchar *name; /* Localized name of category */ }; /* * Module initialization */ -void gl_category_init (void); +void lgl_category_init (void); /* * Category construction */ -glCategory *gl_category_new (gchar *id, - gchar *name); +lglCategory *lgl_category_new (gchar *id, + gchar *name); -glCategory *gl_category_dup (const glCategory *orig); -void gl_category_free (glCategory *category); +lglCategory *lgl_category_dup (const lglCategory *orig); +void lgl_category_free (lglCategory *category); /* * Known category name lists */ -GList *gl_category_get_name_list (void); -void gl_category_free_name_list (GList *names); +GList *lgl_category_get_name_list (void); +void lgl_category_free_name_list (GList *names); /* * Query functions */ -glCategory *gl_category_from_name (const gchar *name); -glCategory *gl_category_from_id (const gchar *id); -gchar *gl_category_lookup_id_from_name (const gchar *name); -gchar *gl_category_lookup_name_from_id (const gchar *id); +lglCategory *lgl_category_from_name (const gchar *name); +lglCategory *lgl_category_from_id (const gchar *id); +gchar *lgl_category_lookup_id_from_name (const gchar *name); +gchar *lgl_category_lookup_name_from_id (const gchar *id); G_END_DECLS diff --git a/glabels2/libglabels/enums.h b/glabels2/libglabels/enums.h index 59ec7049..d139dc25 100644 --- a/glabels2/libglabels/enums.h +++ b/glabels2/libglabels/enums.h @@ -32,15 +32,15 @@ G_BEGIN_DECLS /* Units of distance */ typedef enum { - GL_UNITS_POINT, /* encoded as "pt" */ - GL_UNITS_INCH, /* encoded as "in" */ - GL_UNITS_MM, /* encoded as "mm" */ - GL_UNITS_CM, /* encoded as "cm" */ - GL_UNITS_PICA, /* encoded as "pc" */ - - GL_UNITS_FIRST = GL_UNITS_POINT, - GL_UNITS_LAST = GL_UNITS_PICA, -} glUnitsType; + LGL_UNITS_POINT, /* encoded as "pt" */ + LGL_UNITS_INCH, /* encoded as "in" */ + LGL_UNITS_MM, /* encoded as "mm" */ + LGL_UNITS_CM, /* encoded as "cm" */ + LGL_UNITS_PICA, /* encoded as "pc" */ + + LGL_UNITS_FIRST = LGL_UNITS_POINT, + LGL_UNITS_LAST = LGL_UNITS_PICA, +} lglUnitsType; G_END_DECLS diff --git a/glabels2/libglabels/init.c b/glabels2/libglabels/init.c new file mode 100644 index 00000000..61ccbc1f --- /dev/null +++ b/glabels2/libglabels/init.c @@ -0,0 +1,69 @@ +/* + * (LIBGLABELS) Template library for GLABELS + * + * init.c: initialization module + * + * Copyright (C) 2003, 2004 Jim Evins . + * + * This file is part of the LIBGLABELS library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA + */ +#include + +#include "init.h" + +#include "paper.h" +#include "category.h" +#include "template.h" + +/*===========================================*/ +/* Private types */ +/*===========================================*/ + +/*===========================================*/ +/* Private globals */ +/*===========================================*/ + + + +/*===========================================*/ +/* Local function prototypes */ +/*===========================================*/ + +/** + * lgl_init: + * + * Initialize all libglabels subsystems. This function reads in all files + * containing paper definitions, category definitions, and templates to build + * its template data base. This function will search both system and user template + * directories for these files. + */ +void +lgl_init (void) +{ + static gboolean initialized = FALSE; + + if (!initialized) + { + + lgl_paper_init(); + lgl_category_init(); + lgl_template_init(); + + initialized = TRUE; + } +} diff --git a/glabels2/libglabels/init.h b/glabels2/libglabels/init.h new file mode 100644 index 00000000..6a160634 --- /dev/null +++ b/glabels2/libglabels/init.h @@ -0,0 +1,42 @@ +/* + * (LIBGLABELS) Template library for GLABELS + * + * init.h: initialization module header file + * + * Copyright (C) 2007 Jim Evins . + * + * This file is part of the LIBGLABELS library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA + */ + +#ifndef __INIT_H__ +#define __INIT_H__ + +#include + +G_BEGIN_DECLS + + +/* + * Module initialization + */ +void lgl_init (void); + + +G_END_DECLS + +#endif diff --git a/glabels2/libglabels/libglabels-private.h b/glabels2/libglabels/libglabels-private.h index a6a78e73..c6c8d289 100644 --- a/glabels2/libglabels/libglabels-private.h +++ b/glabels2/libglabels/libglabels-private.h @@ -30,8 +30,8 @@ #include /* Data system and user data directories. (must free w/ g_free()) */ -#define GL_SYSTEM_DATA_DIR g_build_filename (LIBGLABELS_TEMPLATE_DIR, NULL) -#define GL_USER_DATA_DIR g_build_filename (g_get_home_dir (), ".glabels", NULL) +#define LGL_SYSTEM_DATA_DIR g_build_filename (LIBGLABELS_TEMPLATE_DIR, NULL) +#define LGL_USER_DATA_DIR g_build_filename (g_get_home_dir (), ".glabels", NULL) #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "LibGlabels" diff --git a/glabels2/libglabels/libglabels.h b/glabels2/libglabels/libglabels.h index bb99d1b8..34dffa27 100644 --- a/glabels2/libglabels/libglabels.h +++ b/glabels2/libglabels/libglabels.h @@ -26,6 +26,7 @@ #ifndef __LIBGLABELS_H__ #define __LIBGLABELS_H__ +#include #include #include #include diff --git a/glabels2/libglabels/paper.c b/glabels2/libglabels/paper.c index c19c9433..50ff6419 100644 --- a/glabels2/libglabels/paper.c +++ b/glabels2/libglabels/paper.c @@ -56,15 +56,17 @@ static GList *read_paper_files_from_dir (GList *papers, const gchar *dirname); /** - * gl_paper_init: + * lgl_paper_init: * * Initialize libglabels paper module by reading all paper definition * files located in system and user template directories. + * + * The end user would typically call lgl_init() instead. */ void -gl_paper_init (void) +lgl_paper_init (void) { - glPaper *other; + lglPaper *other; if (papers) { return; /* Already initialized. */ @@ -73,33 +75,33 @@ gl_paper_init (void) papers = read_papers (); /* Create and append an "Other" entry. */ - other = gl_paper_new ("Other", _("Other"), 0.0, 0.0); + other = lgl_paper_new ("Other", _("Other"), 0.0, 0.0); papers = g_list_append (papers, other); } /** - * gl_paper_new: + * lgl_paper_new: * @id: Id of paper definition. (E.g. US-Letter, A4, etc.) Should be * unique. * @name: Localized name of paper. * @width: Width of paper in points. * @height: Height of paper in points. * - * Allocates and constructs a new #glPaper structure. + * Allocates and constructs a new #lglPaper structure. * - * Returns: a pointer to a newly allocated #glPaper structure. + * Returns: a pointer to a newly allocated #lglPaper structure. * */ -glPaper * -gl_paper_new (gchar *id, - gchar *name, - gdouble width, - gdouble height) +lglPaper * +lgl_paper_new (gchar *id, + gchar *name, + gdouble width, + gdouble height) { - glPaper *paper; + lglPaper *paper; - paper = g_new0 (glPaper,1); + paper = g_new0 (lglPaper,1); paper->id = g_strdup (id); paper->name = g_strdup (name); paper->width = width; @@ -110,21 +112,21 @@ gl_paper_new (gchar *id, /** - * gl_paper_dup: - * @orig: #glPaper structure to be duplicated. + * lgl_paper_dup: + * @orig: #lglPaper structure to be duplicated. * - * Duplicates an existing #glPaper structure. + * Duplicates an existing #lglPaper structure. * - * Returns: a pointer to a newly allocated #glPaper structure. + * Returns: a pointer to a newly allocated #lglPaper structure. * */ -glPaper *gl_paper_dup (const glPaper *orig) +lglPaper *lgl_paper_dup (const lglPaper *orig) { - glPaper *paper; + lglPaper *paper; g_return_val_if_fail (orig, NULL); - paper = g_new0 (glPaper,1); + paper = g_new0 (lglPaper,1); paper->id = g_strdup (orig->id); paper->name = g_strdup (orig->name); @@ -136,13 +138,13 @@ glPaper *gl_paper_dup (const glPaper *orig) /** - * gl_paper_free: - * @paper: pointer to #glPaper structure to be freed. + * lgl_paper_free: + * @paper: pointer to #lglPaper structure to be freed. * - * Free all memory associated with an existing #glPaper structure. + * Free all memory associated with an existing #lglPaper structure. * */ -void gl_paper_free (glPaper *paper) +void lgl_paper_free (lglPaper *paper) { if ( paper != NULL ) { @@ -160,7 +162,7 @@ void gl_paper_free (glPaper *paper) /** - * gl_paper_get_id_list: + * lgl_paper_get_id_list: * * Get a list of all paper ids known to libglabels. * @@ -168,18 +170,18 @@ void gl_paper_free (glPaper *paper) * */ GList * -gl_paper_get_id_list (void) +lgl_paper_get_id_list (void) { GList *ids = NULL; GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } for ( p=papers; p != NULL; p=p->next ) { - paper = (glPaper *)p->data; + paper = (lglPaper *)p->data; ids = g_list_append (ids, g_strdup (paper->id)); } @@ -187,15 +189,15 @@ gl_paper_get_id_list (void) } /** - * gl_paper_free_id_list: + * lgl_paper_free_id_list: * @ids: List of id strings to be freed. * * Free up all storage associated with an id list obtained with - * gl_paper_get_id_list(). + * lgl_paper_get_id_list(). * */ void -gl_paper_free_id_list (GList *ids) +lgl_paper_free_id_list (GList *ids) { GList *p; @@ -209,7 +211,7 @@ gl_paper_free_id_list (GList *ids) /** - * gl_paper_get_name_list: + * lgl_paper_get_name_list: * * Get a list of all localized paper names known to libglabels. * @@ -217,18 +219,18 @@ gl_paper_free_id_list (GList *ids) * */ GList * -gl_paper_get_name_list (void) +lgl_paper_get_name_list (void) { GList *names = NULL; GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } for ( p=papers; p != NULL; p=p->next ) { - paper = (glPaper *)p->data; + paper = (lglPaper *)p->data; names = g_list_append (names, g_strdup (paper->name)); } @@ -237,15 +239,15 @@ gl_paper_get_name_list (void) /** - * gl_paper_free_name_list: + * lgl_paper_free_name_list: * @names: List of localized paper name strings to be freed. * * Free up all storage associated with a name list obtained with - * gl_paper_get_name_list(). + * lgl_paper_get_name_list(). * */ void -gl_paper_free_name_list (GList *names) +lgl_paper_free_name_list (GList *names) { GList *p; @@ -259,7 +261,7 @@ gl_paper_free_name_list (GList *names) /** - * gl_paper_is_id_known: + * lgl_paper_is_id_known: * @id: paper id to test * * Determine if given paper id is known to libglabels. @@ -268,13 +270,13 @@ gl_paper_free_name_list (GList *names) * */ gboolean -gl_paper_is_id_known (const gchar *id) +lgl_paper_is_id_known (const gchar *id) { GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } if (id == NULL) { @@ -282,7 +284,7 @@ gl_paper_is_id_known (const gchar *id) } for (p = papers; p != NULL; p = p->next) { - paper = (glPaper *) p->data; + paper = (lglPaper *) p->data; if (g_strcasecmp (paper->id, id) == 0) { return TRUE; } @@ -293,7 +295,7 @@ gl_paper_is_id_known (const gchar *id) /** - * gl_paper_is_id_other: + * lgl_paper_is_id_other: * @id: paper id to test * * Determine if given paper id is the special id "Other." @@ -302,7 +304,7 @@ gl_paper_is_id_known (const gchar *id) * */ gboolean -gl_paper_is_id_other (const gchar *id) +lgl_paper_is_id_other (const gchar *id) { if (id == NULL) { return FALSE; @@ -313,33 +315,33 @@ gl_paper_is_id_other (const gchar *id) /** - * gl_paper_from_id: + * lgl_paper_from_id: * @id: paper id string * * Lookup paper definition from id string. * - * Returns: pointer to a newly allocated #glPaper structure. + * Returns: pointer to a newly allocated #lglPaper structure. * */ -glPaper * -gl_paper_from_id (const gchar *id) +lglPaper * +lgl_paper_from_id (const gchar *id) { GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } if (id == NULL) { /* If no id, return first paper as a default */ - return gl_paper_dup ((glPaper *) papers->data); + return lgl_paper_dup ((lglPaper *) papers->data); } for (p = papers; p != NULL; p = p->next) { - paper = (glPaper *) p->data; + paper = (lglPaper *) p->data; if (g_strcasecmp (paper->id, id) == 0) { - return gl_paper_dup (paper); + return lgl_paper_dup (paper); } } @@ -348,33 +350,33 @@ gl_paper_from_id (const gchar *id) /** - * gl_paper_from_name: + * lgl_paper_from_name: * @name: localized paper name string * * Lookup paper definition from localized paper name string. * - * Returns: pointer to a newly allocated #glPaper structure. + * Returns: pointer to a newly allocated #lglPaper structure. * */ -glPaper * -gl_paper_from_name (const gchar *name) +lglPaper * +lgl_paper_from_name (const gchar *name) { GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } if (name == NULL) { /* If no name, return first paper as a default */ - return gl_paper_dup ((glPaper *) papers->data); + return lgl_paper_dup ((lglPaper *) papers->data); } for (p = papers; p != NULL; p = p->next) { - paper = (glPaper *) p->data; + paper = (lglPaper *) p->data; if (g_strcasecmp (paper->name, name) == 0) { - return gl_paper_dup (paper); + return lgl_paper_dup (paper); } } @@ -383,7 +385,7 @@ gl_paper_from_name (const gchar *name) /** - * gl_paper_lookup_id_from_name: + * lgl_paper_lookup_id_from_name: * @name: localized paper name stringp * * Lookup paper name string from localized paper name string. @@ -392,18 +394,18 @@ gl_paper_from_name (const gchar *name) * */ gchar * -gl_paper_lookup_id_from_name (const gchar *name) +lgl_paper_lookup_id_from_name (const gchar *name) { - glPaper *paper = NULL; - gchar *id = NULL; + lglPaper *paper = NULL; + gchar *id = NULL; if (name != NULL) { - paper = gl_paper_from_name (name); + paper = lgl_paper_from_name (name); if ( paper != NULL ) { id = g_strdup (paper->id); - gl_paper_free (paper); + lgl_paper_free (paper); paper = NULL; } } @@ -412,7 +414,7 @@ gl_paper_lookup_id_from_name (const gchar *name) } /** - * gl_paper_lookup_name_from_id: + * lgl_paper_lookup_name_from_id: * @id: paper id string * * Lookup localized paper name string from paper id string. @@ -421,18 +423,18 @@ gl_paper_lookup_id_from_name (const gchar *name) * */ gchar * -gl_paper_lookup_name_from_id (const gchar *id) +lgl_paper_lookup_name_from_id (const gchar *id) { - glPaper *paper = NULL; - gchar *name = NULL; + lglPaper *paper = NULL; + gchar *name = NULL; if (id != NULL) { - paper = gl_paper_from_id (id); + paper = lgl_paper_from_id (id); if ( paper != NULL ) { name = g_strdup (paper->name); - gl_paper_free (paper); + lgl_paper_free (paper); paper = NULL; } } @@ -449,11 +451,11 @@ read_papers (void) gchar *data_dir; GList *papers = NULL; - data_dir = GL_SYSTEM_DATA_DIR; + data_dir = LGL_SYSTEM_DATA_DIR; papers = read_paper_files_from_dir (papers, data_dir); g_free (data_dir); - data_dir = GL_USER_DATA_DIR; + data_dir = LGL_USER_DATA_DIR; papers = read_paper_files_from_dir (papers, data_dir); g_free (data_dir); @@ -503,7 +505,7 @@ read_paper_files_from_dir (GList *papers, full_filename = g_build_filename (dirname, filename, NULL); new_papers = - gl_xml_paper_read_papers_from_file (full_filename); + lgl_xml_paper_read_papers_from_file (full_filename); g_free (full_filename); papers = g_list_concat (papers, new_papers); @@ -522,25 +524,25 @@ read_paper_files_from_dir (GList *papers, /** - * gl_paper_print_known_papers: + * lgl_paper_print_known_papers: * * For debugging purposes: print a list of all paper definitions known to * libglabels. * */ void -gl_paper_print_known_papers (void) +lgl_paper_print_known_papers (void) { GList *p; - glPaper *paper; + lglPaper *paper; if (!papers) { - gl_paper_init (); + lgl_paper_init (); } g_print ("%s():\n", __FUNCTION__); for (p = papers; p != NULL; p = p->next) { - paper = (glPaper *) p->data; + paper = (lglPaper *) p->data; g_print ("PAPER id=\"%s\", name=\"%s\", width=%gpts, height=%gpts\n", paper->id, paper->name, paper->width, paper->height); diff --git a/glabels2/libglabels/paper.h b/glabels2/libglabels/paper.h index 9137dadf..25a5cb82 100644 --- a/glabels2/libglabels/paper.h +++ b/glabels2/libglabels/paper.h @@ -33,11 +33,11 @@ G_BEGIN_DECLS /* - * glPaper structure + * lglPaper structure */ -typedef struct _glPaper glPaper; +typedef struct _lglPaper lglPaper; -struct _glPaper { +struct _lglPaper { gchar *id; /* Unique ID of paper definition */ gchar *name; /* Localized name of paper */ gdouble width; /* Width (in points) */ @@ -48,53 +48,53 @@ struct _glPaper { /* * Module initialization */ -void gl_paper_init (void); +void lgl_paper_init (void); /* * Paper construction */ -glPaper *gl_paper_new (gchar *id, - gchar *name, - gdouble width, - gdouble height); +lglPaper *lgl_paper_new (gchar *id, + gchar *name, + gdouble width, + gdouble height); -glPaper *gl_paper_dup (const glPaper *orig); +lglPaper *lgl_paper_dup (const lglPaper *orig); -void gl_paper_free (glPaper *paper); +void lgl_paper_free (lglPaper *paper); /* * ID lists */ -GList *gl_paper_get_id_list (void); -void gl_paper_free_id_list (GList *ids); +GList *lgl_paper_get_id_list (void); +void lgl_paper_free_id_list (GList *ids); /* * Name lists */ -GList *gl_paper_get_name_list (void); -void gl_paper_free_name_list (GList *names); +GList *lgl_paper_get_name_list (void); +void lgl_paper_free_name_list (GList *names); /* * Query functions */ -gboolean gl_paper_is_id_known (const gchar *id); -gboolean gl_paper_is_id_other (const gchar *id); +gboolean lgl_paper_is_id_known (const gchar *id); +gboolean lgl_paper_is_id_other (const gchar *id); -glPaper *gl_paper_from_id (const gchar *id); -glPaper *gl_paper_from_name (const gchar *name); +lglPaper *lgl_paper_from_id (const gchar *id); +lglPaper *lgl_paper_from_name (const gchar *name); -gchar *gl_paper_lookup_id_from_name (const gchar *name); -gchar *gl_paper_lookup_name_from_id (const gchar *id); +gchar *lgl_paper_lookup_id_from_name (const gchar *name); +gchar *lgl_paper_lookup_name_from_id (const gchar *id); /* * Debugging */ -void gl_paper_print_known_papers (void); +void lgl_paper_print_known_papers (void); G_END_DECLS diff --git a/glabels2/libglabels/template.c b/glabels2/libglabels/template.c index 1a10477e..e13ddb25 100644 --- a/glabels2/libglabels/template.c +++ b/glabels2/libglabels/template.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include "libglabels-private.h" #include "xml.h" @@ -55,21 +57,22 @@ static GList *templates = NULL; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static glTemplate *template_full_page (const gchar *page_size); +static lglTemplate *template_full_page (const gchar *page_size); -static GList *read_templates (void); +static GList *read_templates (void); -static GList *read_template_files_from_dir (GList *templates, - const gchar *dirname); -static gint compare_origins (gconstpointer a, - gconstpointer b, - gpointer user_data); +static GList *read_template_files_from_dir (GList *templates, + const gchar *dirname); + +static gint compare_origins (gconstpointer a, + gconstpointer b, + gpointer user_data); /*****************************************************************************/ /* Initialize module. */ /*****************************************************************************/ void -gl_template_init (void) +lgl_template_init (void) { GList *page_sizes, *p; @@ -79,31 +82,31 @@ gl_template_init (void) templates = read_templates (); - page_sizes = gl_paper_get_id_list (); + page_sizes = lgl_paper_get_id_list (); for ( p=page_sizes; p != NULL; p=p->next ) { - if ( !gl_paper_is_id_other (p->data) ) { + if ( !lgl_paper_is_id_other (p->data) ) { templates = g_list_append (templates, template_full_page (p->data)); } } - gl_paper_free_id_list (page_sizes); + lgl_paper_free_id_list (page_sizes); } /*****************************************************************************/ /* Register template: if not in current list, add it. */ /*****************************************************************************/ void -gl_template_register (const glTemplate *template) +lgl_template_register (const lglTemplate *template) { - GList *p_tmplt, *pa1; - glTemplate *template1; + GList *p_tmplt, *pa1; + lglTemplate *template1; if (!templates) { - gl_template_init (); + lgl_template_init (); } for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { - template1 = (glTemplate *) p_tmplt->data; + template1 = (lglTemplate *) p_tmplt->data; for (pa1=template1->aliases; pa1!=NULL; pa1=pa1->next) { @@ -118,19 +121,19 @@ gl_template_register (const glTemplate *template) } - if (gl_paper_is_id_known (template->page_size)) { + if (lgl_paper_is_id_known (template->page_size)) { gchar *dir, *filename, *abs_filename; templates = g_list_append (templates, - gl_template_dup (template)); + lgl_template_dup (template)); /* FIXME: make sure filename is unique */ - dir = GL_USER_DATA_DIR; + dir = LGL_USER_DATA_DIR; mkdir (dir, 0775); /* Try to make sure directory exists. */ filename = g_strconcat (template->name, ".template", NULL); abs_filename = g_build_filename (dir, filename, NULL); - gl_xml_template_write_template_to_file (template, abs_filename); + lgl_xml_template_write_template_to_file (template, abs_filename); g_free (dir); g_free (filename); g_free (abs_filename); @@ -145,23 +148,23 @@ gl_template_register (const glTemplate *template) /* Get a list of valid names of unique templates for given page size */ /*********************************************************************************/ GList * -gl_template_get_name_list_unique (const gchar *page_size, - const gchar *category) +lgl_template_get_name_list_unique (const gchar *page_size, + const gchar *category) { - GList *p_tmplt; - glTemplate *template; - GList *names = NULL; + GList *p_tmplt; + lglTemplate *template; + GList *names = NULL; if (!templates) { - gl_template_init (); + lgl_template_init (); } for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { - template = (glTemplate *) p_tmplt->data; - if (gl_template_does_page_size_match (template, page_size) && - gl_template_does_category_match (template, category)) + template = (lglTemplate *) p_tmplt->data; + if (lgl_template_does_page_size_match (template, page_size) && + lgl_template_does_category_match (template, category)) { names = g_list_insert_sorted (names, g_strdup (template->name), (GCompareFunc)g_strcasecmp); @@ -175,24 +178,24 @@ gl_template_get_name_list_unique (const gchar *page_size, /* Get a list of all valid template names for given page size (includes aliases) */ /*********************************************************************************/ GList * -gl_template_get_name_list_all (const gchar *page_size, - const gchar *category) +lgl_template_get_name_list_all (const gchar *page_size, + const gchar *category) { - GList *p_tmplt, *p_alias; - glTemplate *template; - gchar *str; - GList *names = NULL; + GList *p_tmplt, *p_alias; + lglTemplate *template; + gchar *str; + GList *names = NULL; if (!templates) { - gl_template_init (); + lgl_template_init (); } for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { - template = (glTemplate *) p_tmplt->data; - if (gl_template_does_page_size_match (template, page_size) && - gl_template_does_category_match (template, category)) + template = (lglTemplate *) p_tmplt->data; + if (lgl_template_does_page_size_match (template, page_size) && + lgl_template_does_category_match (template, category)) { for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) @@ -211,7 +214,7 @@ gl_template_get_name_list_all (const gchar *page_size, /* Free a list of template names. */ /*****************************************************************************/ void -gl_template_free_name_list (GList *names) +lgl_template_free_name_list (GList *names) { GList *p_name; @@ -226,76 +229,76 @@ gl_template_free_name_list (GList *names) /*****************************************************************************/ /* Return a template structure from a name. */ /*****************************************************************************/ -glTemplate * -gl_template_from_name (const gchar *name) +lglTemplate * +lgl_template_from_name (const gchar *name) { - GList *p_tmplt, *p_alias; - glTemplate *template; + GList *p_tmplt, *p_alias; + lglTemplate *template; if (!templates) { - gl_template_init (); + lgl_template_init (); } if (name == NULL) { /* If no name, return first template as a default */ - return gl_template_dup ((glTemplate *) templates->data); + return lgl_template_dup ((lglTemplate *) templates->data); } for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) { - template = (glTemplate *) p_tmplt->data; + template = (lglTemplate *) p_tmplt->data; for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next) { if (g_strcasecmp (p_alias->data, name) == 0) { - return gl_template_dup (template); + return lgl_template_dup (template); } } } /* No matching template has been found so return the first template */ - return gl_template_dup ((glTemplate *) templates->data); + return lgl_template_dup ((lglTemplate *) templates->data); } /*****************************************************************************/ /* Get first label type in template. */ /*****************************************************************************/ -const glTemplateLabelType * -gl_template_get_first_label_type (const glTemplate *template) +const lglTemplateFrame * +lgl_template_get_first_frame (const lglTemplate *template) { g_return_val_if_fail (template, NULL); - return (glTemplateLabelType *)template->label_types->data; + return (lglTemplateFrame *)template->frames->data; } /****************************************************************************/ /* Get raw label size (width and height). */ /****************************************************************************/ void -gl_template_get_label_size (const glTemplateLabelType *label_type, - gdouble *w, - gdouble *h) +lgl_template_frame_get_size (const lglTemplateFrame *frame, + gdouble *w, + gdouble *h) { - g_return_if_fail (label_type); + g_return_if_fail (frame); - switch (label_type->shape) { - case GL_TEMPLATE_SHAPE_RECT: - *w = label_type->size.rect.w; - *h = label_type->size.rect.h; + switch (frame->shape) { + case LGL_TEMPLATE_FRAME_SHAPE_RECT: + *w = frame->rect.w; + *h = frame->rect.h; break; - case GL_TEMPLATE_SHAPE_ROUND: - *w = 2.0 * label_type->size.round.r; - *h = 2.0 * label_type->size.round.r; + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: + *w = 2.0 * frame->round.r; + *h = 2.0 * frame->round.r; break; - case GL_TEMPLATE_SHAPE_CD: - if (label_type->size.cd.w == 0.0) { - *w = 2.0 * label_type->size.cd.r1; + case LGL_TEMPLATE_FRAME_SHAPE_CD: + if (frame->cd.w == 0.0) { + *w = 2.0 * frame->cd.r1; } else { - *w = label_type->size.cd.w; + *w = frame->cd.w; } - if (label_type->size.cd.h == 0.0) { - *h = 2.0 * label_type->size.cd.r1; + if (frame->cd.h == 0.0) { + *h = 2.0 * frame->cd.r1; } else { - *h = label_type->size.cd.h; + *h = frame->cd.h; } break; default: @@ -309,16 +312,16 @@ gl_template_get_label_size (const glTemplateLabelType *label_type, /* Get total number of labels per sheet of a label type. */ /****************************************************************************/ gint -gl_template_get_n_labels (const glTemplateLabelType *label_type) +lgl_template_frame_get_n_labels (const lglTemplateFrame *frame) { - gint n_labels = 0; - GList *p; - glTemplateLayout *layout; + gint n_labels = 0; + GList *p; + lglTemplateLayout *layout; - g_return_val_if_fail (label_type, 0); + g_return_val_if_fail (frame, 0); - for ( p=label_type->layouts; p != NULL; p=p->next ) { - layout = (glTemplateLayout *)p->data; + for ( p=frame->all.layouts; p != NULL; p=p->next ) { + layout = (lglTemplateLayout *)p->data; n_labels += layout->nx * layout->ny; } @@ -329,22 +332,22 @@ gl_template_get_n_labels (const glTemplateLabelType *label_type) /****************************************************************************/ /* Get array of origins of individual labels. */ /****************************************************************************/ -glTemplateOrigin * -gl_template_get_origins (const glTemplateLabelType *label_type) +lglTemplateOrigin * +lgl_template_frame_get_origins (const lglTemplateFrame *frame) { - gint i_label, n_labels, ix, iy; - glTemplateOrigin *origins; - GList *p; - glTemplateLayout *layout; + gint i_label, n_labels, ix, iy; + lglTemplateOrigin *origins; + GList *p; + lglTemplateLayout *layout; - g_return_val_if_fail (label_type, NULL); + g_return_val_if_fail (frame, NULL); - n_labels = gl_template_get_n_labels (label_type); - origins = g_new0 (glTemplateOrigin, n_labels); + n_labels = lgl_template_frame_get_n_labels (frame); + origins = g_new0 (lglTemplateOrigin, n_labels); i_label = 0; - for ( p=label_type->layouts; p != NULL; p=p->next ) { - layout = (glTemplateLayout *)p->data; + for ( p=frame->all.layouts; p != NULL; p=p->next ) { + layout = (lglTemplateLayout *)p->data; for (iy = 0; iy < layout->ny; iy++) { for (ix = 0; ix < layout->nx; ix++, i_label++) { @@ -354,7 +357,7 @@ gl_template_get_origins (const glTemplateLabelType *label_type) } } - g_qsort_with_data (origins, n_labels, sizeof(glTemplateOrigin), + g_qsort_with_data (origins, n_labels, sizeof(lglTemplateOrigin), compare_origins, NULL); return origins; @@ -363,16 +366,16 @@ gl_template_get_origins (const glTemplateLabelType *label_type) /*****************************************************************************/ /* Create a new template with given properties. */ /*****************************************************************************/ -glTemplate * -gl_template_new (const gchar *name, - const gchar *description, - const gchar *page_size, - gdouble page_width, - gdouble page_height) +lglTemplate * +lgl_template_new (const gchar *name, + const gchar *description, + const gchar *page_size, + gdouble page_width, + gdouble page_height) { - glTemplate *template; + lglTemplate *template; - template = g_new0 (glTemplate,1); + template = g_new0 (lglTemplate,1); template->name = g_strdup (name); template->description = g_strdup (description); @@ -391,10 +394,10 @@ gl_template_new (const gchar *name, /* Does page size match given id? */ /*****************************************************************************/ gboolean -gl_template_does_page_size_match (const glTemplate *template, - const gchar *page_size) +lgl_template_does_page_size_match (const lglTemplate *template, + const gchar *page_size) { - g_return_if_fail (template); + g_return_val_if_fail (template, FALSE); /* NULL matches everything. */ if (page_size == NULL) @@ -409,12 +412,12 @@ gl_template_does_page_size_match (const glTemplate *template, /* Does category match given id? */ /*****************************************************************************/ gboolean -gl_template_does_category_match (const glTemplate *template, - const gchar *category) +lgl_template_does_category_match (const lglTemplate *template, + const gchar *category) { GList *p; - g_return_if_fail (template); + g_return_val_if_fail (template, FALSE); /* NULL matches everything. */ if (category == NULL) @@ -437,8 +440,8 @@ gl_template_does_category_match (const glTemplate *template, /* Add category to category list of template. */ /*****************************************************************************/ void -gl_template_add_category (glTemplate *template, - const gchar *category) +lgl_template_add_category (lglTemplate *template, + const gchar *category) { g_return_if_fail (template); g_return_if_fail (category); @@ -451,22 +454,21 @@ gl_template_add_category (glTemplate *template, /* Add label type structure to label type list of template. */ /*****************************************************************************/ void -gl_template_add_label_type (glTemplate *template, - glTemplateLabelType *label_type) +lgl_template_add_frame (lglTemplate *template, + lglTemplateFrame *frame) { g_return_if_fail (template); - g_return_if_fail (label_type); + g_return_if_fail (frame); - template->label_types = g_list_append (template->label_types, - label_type); + template->frames = g_list_append (template->frames, frame); } /*****************************************************************************/ /* Add alias to alias list of template. */ /*****************************************************************************/ void -gl_template_add_alias (glTemplate *template, - const gchar *alias) +lgl_template_add_alias (lglTemplate *template, + const gchar *alias) { g_return_if_fail (template); g_return_if_fail (alias); @@ -478,120 +480,118 @@ gl_template_add_alias (glTemplate *template, /*****************************************************************************/ /* Create a new label type structure for a rectangular label. */ /*****************************************************************************/ -glTemplateLabelType * -gl_template_rect_label_type_new (const gchar *id, - gdouble w, - gdouble h, - gdouble r, - gdouble x_waste, - gdouble y_waste) +lglTemplateFrame * +lgl_template_frame_rect_new (const gchar *id, + gdouble w, + gdouble h, + gdouble r, + gdouble x_waste, + gdouble y_waste) { - glTemplateLabelType *label_type; + lglTemplateFrame *frame; - label_type = g_new0 (glTemplateLabelType, 1); + frame = g_new0 (lglTemplateFrame, 1); - label_type->id = g_strdup (id); - label_type->shape = GL_TEMPLATE_SHAPE_RECT; + frame->shape = LGL_TEMPLATE_FRAME_SHAPE_RECT; + frame->rect.id = g_strdup (id); - label_type->size.rect.w = w; - label_type->size.rect.h = h; - label_type->size.rect.r = r; - label_type->size.rect.x_waste = x_waste; - label_type->size.rect.y_waste = y_waste; + frame->rect.w = w; + frame->rect.h = h; + frame->rect.r = r; + frame->rect.x_waste = x_waste; + frame->rect.y_waste = y_waste; - return label_type; + return frame; } /*****************************************************************************/ /* Create a new label type structure for a round label. */ /*****************************************************************************/ -glTemplateLabelType * -gl_template_round_label_type_new (const gchar *id, - gdouble r, - gdouble waste) +lglTemplateFrame * +lgl_template_frame_round_new (const gchar *id, + gdouble r, + gdouble waste) { - glTemplateLabelType *label_type; + lglTemplateFrame *frame; - label_type = g_new0 (glTemplateLabelType, 1); + frame = g_new0 (lglTemplateFrame, 1); - label_type->id = g_strdup (id); - label_type->shape = GL_TEMPLATE_SHAPE_ROUND; + frame->shape = LGL_TEMPLATE_FRAME_SHAPE_ROUND; + frame->round.id = g_strdup (id); - label_type->size.round.r = r; - label_type->size.round.waste = waste; + frame->round.r = r; + frame->round.waste = waste; - return label_type; + return frame; } /*****************************************************************************/ /* Create a new label type structure for a CD/DVD label. */ /*****************************************************************************/ -glTemplateLabelType * -gl_template_cd_label_type_new (const gchar *id, - gdouble r1, - gdouble r2, - gdouble w, - gdouble h, - gdouble waste) +lglTemplateFrame * +lgl_template_frame_cd_new (const gchar *id, + gdouble r1, + gdouble r2, + gdouble w, + gdouble h, + gdouble waste) { - glTemplateLabelType *label_type; + lglTemplateFrame *frame; - label_type = g_new0 (glTemplateLabelType, 1); + frame = g_new0 (lglTemplateFrame, 1); - label_type->id = g_strdup (id); - label_type->shape = GL_TEMPLATE_SHAPE_CD; + frame->shape = LGL_TEMPLATE_FRAME_SHAPE_CD; + frame->cd.id = g_strdup (id); - label_type->size.cd.r1 = r1; - label_type->size.cd.r2 = r2; - label_type->size.cd.w = w; - label_type->size.cd.h = h; - label_type->size.cd.waste = waste; + frame->cd.r1 = r1; + frame->cd.r2 = r2; + frame->cd.w = w; + frame->cd.h = h; + frame->cd.waste = waste; - return label_type; + return frame; } /*****************************************************************************/ /* Add a layout to a label type. */ /*****************************************************************************/ void -gl_template_add_layout (glTemplateLabelType *label_type, - glTemplateLayout *layout) +lgl_template_add_layout (lglTemplateFrame *frame, + lglTemplateLayout *layout) { - g_return_if_fail (label_type); + g_return_if_fail (frame); g_return_if_fail (layout); - label_type->layouts = g_list_append (label_type->layouts, - layout); + frame->all.layouts = g_list_append (frame->all.layouts, layout); } /*****************************************************************************/ /* Add a markup item to a label type. */ /*****************************************************************************/ void -gl_template_add_markup (glTemplateLabelType *label_type, - glTemplateMarkup *markup) +lgl_template_add_markup (lglTemplateFrame *frame, + lglTemplateMarkup *markup) { - g_return_if_fail (label_type); + g_return_if_fail (frame); g_return_if_fail (markup); - label_type->markups = g_list_append (label_type->markups, - markup); + frame->all.markups = g_list_append (frame->all.markups, markup); } /*****************************************************************************/ /* Create new layout structure. */ /*****************************************************************************/ -glTemplateLayout * -gl_template_layout_new (gint nx, - gint ny, - gdouble x0, - gdouble y0, - gdouble dx, - gdouble dy) +lglTemplateLayout * +lgl_template_layout_new (gint nx, + gint ny, + gdouble x0, + gdouble y0, + gdouble dx, + gdouble dy) { - glTemplateLayout *layout; + lglTemplateLayout *layout; - layout = g_new0 (glTemplateLayout, 1); + layout = g_new0 (lglTemplateLayout, 1); layout->nx = nx; layout->ny = ny; @@ -606,15 +606,15 @@ gl_template_layout_new (gint nx, /*****************************************************************************/ /* Create new margin markup structure. */ /*****************************************************************************/ -glTemplateMarkup * -gl_template_markup_margin_new (gdouble size) +lglTemplateMarkup * +lgl_template_markup_margin_new (gdouble size) { - glTemplateMarkup *markup; + lglTemplateMarkup *markup; - markup = g_new0 (glTemplateMarkup, 1); + markup = g_new0 (lglTemplateMarkup, 1); - markup->type = GL_TEMPLATE_MARKUP_MARGIN; - markup->data.margin.size = size; + markup->type = LGL_TEMPLATE_MARKUP_MARGIN; + markup->margin.size = size; return markup; } @@ -622,21 +622,21 @@ gl_template_markup_margin_new (gdouble size) /*****************************************************************************/ /* Create new markup line structure. */ /*****************************************************************************/ -glTemplateMarkup * -gl_template_markup_line_new (gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2) +lglTemplateMarkup * +lgl_template_markup_line_new (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2) { - glTemplateMarkup *markup; + lglTemplateMarkup *markup; - markup = g_new0 (glTemplateMarkup, 1); + markup = g_new0 (lglTemplateMarkup, 1); - markup->type = GL_TEMPLATE_MARKUP_LINE; - markup->data.line.x1 = x1; - markup->data.line.y1 = y1; - markup->data.line.x2 = x2; - markup->data.line.y2 = y2; + markup->type = LGL_TEMPLATE_MARKUP_LINE; + markup->line.x1 = x1; + markup->line.y1 = y1; + markup->line.x2 = x2; + markup->line.y2 = y2; return markup; } @@ -644,19 +644,19 @@ gl_template_markup_line_new (gdouble x1, /*****************************************************************************/ /* Create new markup circle structure. */ /*****************************************************************************/ -glTemplateMarkup * -gl_template_markup_circle_new (gdouble x0, - gdouble y0, - gdouble r) +lglTemplateMarkup * +lgl_template_markup_circle_new (gdouble x0, + gdouble y0, + gdouble r) { - glTemplateMarkup *markup; + lglTemplateMarkup *markup; - markup = g_new0 (glTemplateMarkup, 1); + markup = g_new0 (lglTemplateMarkup, 1); - markup->type = GL_TEMPLATE_MARKUP_CIRCLE; - markup->data.circle.x0 = x0; - markup->data.circle.y0 = y0; - markup->data.circle.r = r; + markup->type = LGL_TEMPLATE_MARKUP_CIRCLE; + markup->circle.x0 = x0; + markup->circle.y0 = y0; + markup->circle.r = r; return markup; } @@ -664,23 +664,23 @@ gl_template_markup_circle_new (gdouble x0, /*****************************************************************************/ /* Create new markup rect structure. */ /*****************************************************************************/ -glTemplateMarkup * -gl_template_markup_rect_new (gdouble x1, - gdouble y1, - gdouble w, - gdouble h, - gdouble r) +lglTemplateMarkup * +lgl_template_markup_rect_new (gdouble x1, + gdouble y1, + gdouble w, + gdouble h, + gdouble r) { - glTemplateMarkup *markup; + lglTemplateMarkup *markup; - markup = g_new0 (glTemplateMarkup, 1); + markup = g_new0 (lglTemplateMarkup, 1); - markup->type = GL_TEMPLATE_MARKUP_RECT; - markup->data.rect.x1 = x1; - markup->data.rect.y1 = y1; - markup->data.rect.w = w; - markup->data.rect.h = h; - markup->data.rect.r = r; + markup->type = LGL_TEMPLATE_MARKUP_RECT; + markup->rect.x1 = x1; + markup->rect.y1 = y1; + markup->rect.w = w; + markup->rect.h = h; + markup->rect.r = r; return markup; } @@ -689,39 +689,38 @@ gl_template_markup_rect_new (gdouble x1, /*****************************************************************************/ /* Copy a template. */ /*****************************************************************************/ -glTemplate * -gl_template_dup (const glTemplate *orig_template) +lglTemplate * +lgl_template_dup (const lglTemplate *orig_template) { - glTemplate *template; + lglTemplate *template; GList *p; - glTemplateLabelType *label_type; + lglTemplateFrame *frame; g_return_val_if_fail (orig_template, NULL); - template = gl_template_new (orig_template->name, - orig_template->description, - orig_template->page_size, - orig_template->page_width, - orig_template->page_height); + template = lgl_template_new (orig_template->name, + orig_template->description, + orig_template->page_size, + orig_template->page_width, + orig_template->page_height); for ( p=orig_template->categories; p != NULL; p=p->next ) { - gl_template_add_category (template, p->data); + lgl_template_add_category (template, p->data); } - for ( p=orig_template->label_types; p != NULL; p=p->next ) { + for ( p=orig_template->frames; p != NULL; p=p->next ) { - label_type = (glTemplateLabelType *)p->data; + frame = (lglTemplateFrame *)p->data; - gl_template_add_label_type (template, - gl_template_label_type_dup (label_type)); + lgl_template_add_frame (template, lgl_template_frame_dup (frame)); } for ( p=orig_template->aliases; p != NULL; p=p->next ) { if (g_strcasecmp (template->name, p->data) != 0) { - gl_template_add_alias (template, p->data); + lgl_template_add_alias (template, p->data); } } @@ -733,10 +732,10 @@ gl_template_dup (const glTemplate *orig_template) /* Free up a template. */ /*****************************************************************************/ void -gl_template_free (glTemplate *template) +lgl_template_free (lglTemplate *template) { - GList *p; - glTemplateLabelType *label_type; + GList *p; + lglTemplateFrame *frame; if ( template != NULL ) { @@ -758,15 +757,15 @@ gl_template_free (glTemplate *template) g_list_free (template->categories); template->categories = NULL; - for ( p=template->label_types; p != NULL; p=p->next ) { + for ( p=template->frames; p != NULL; p=p->next ) { - label_type = (glTemplateLabelType *)p->data; + frame = (lglTemplateFrame *)p->data; - gl_template_label_type_free (label_type); + lgl_template_frame_free (frame); p->data = NULL; } - g_list_free (template->label_types); - template->label_types = NULL; + g_list_free (template->frames); + template->frames = NULL; for ( p=template->aliases; p != NULL; p=p->next ) { @@ -786,43 +785,43 @@ gl_template_free (glTemplate *template) /*****************************************************************************/ /* Copy a template label type. */ /*****************************************************************************/ -glTemplateLabelType * -gl_template_label_type_dup (const glTemplateLabelType *orig_label_type) +lglTemplateFrame * +lgl_template_frame_dup (const lglTemplateFrame *orig_frame) { - glTemplateLabelType *label_type; + lglTemplateFrame *frame; GList *p; - glTemplateLayout *layout; - glTemplateMarkup *markup; + lglTemplateLayout *layout; + lglTemplateMarkup *markup; - g_return_val_if_fail (orig_label_type, NULL); + g_return_val_if_fail (orig_frame, NULL); - switch (orig_label_type->shape) { + switch (orig_frame->shape) { - case GL_TEMPLATE_SHAPE_RECT: - label_type = - gl_template_rect_label_type_new (orig_label_type->id, - orig_label_type->size.rect.w, - orig_label_type->size.rect.h, - orig_label_type->size.rect.r, - orig_label_type->size.rect.x_waste, - orig_label_type->size.rect.y_waste); + case LGL_TEMPLATE_FRAME_SHAPE_RECT: + frame = + lgl_template_frame_rect_new (orig_frame->all.id, + orig_frame->rect.w, + orig_frame->rect.h, + orig_frame->rect.r, + orig_frame->rect.x_waste, + orig_frame->rect.y_waste); break; - case GL_TEMPLATE_SHAPE_ROUND: - label_type = - gl_template_round_label_type_new (orig_label_type->id, - orig_label_type->size.round.r, - orig_label_type->size.round.waste); + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: + frame = + lgl_template_frame_round_new (orig_frame->all.id, + orig_frame->round.r, + orig_frame->round.waste); break; - case GL_TEMPLATE_SHAPE_CD: - label_type = - gl_template_cd_label_type_new (orig_label_type->id, - orig_label_type->size.cd.r1, - orig_label_type->size.cd.r2, - orig_label_type->size.cd.w, - orig_label_type->size.cd.h, - orig_label_type->size.cd.waste); + case LGL_TEMPLATE_FRAME_SHAPE_CD: + frame = + lgl_template_frame_cd_new (orig_frame->all.id, + orig_frame->cd.r1, + orig_frame->cd.r2, + orig_frame->cd.w, + orig_frame->cd.h, + orig_frame->cd.waste); break; default: @@ -830,61 +829,59 @@ gl_template_label_type_dup (const glTemplateLabelType *orig_label_type) break; } - for ( p=orig_label_type->layouts; p != NULL; p=p->next ) { + for ( p=orig_frame->all.layouts; p != NULL; p=p->next ) { - layout = (glTemplateLayout *)p->data; + layout = (lglTemplateLayout *)p->data; - gl_template_add_layout (label_type, - gl_template_layout_dup (layout)); + lgl_template_add_layout (frame, lgl_template_layout_dup (layout)); } - for ( p=orig_label_type->markups; p != NULL; p=p->next ) { + for ( p=orig_frame->all.markups; p != NULL; p=p->next ) { - markup = (glTemplateMarkup *)p->data; + markup = (lglTemplateMarkup *)p->data; - gl_template_add_markup (label_type, - gl_template_markup_dup (markup)); + lgl_template_add_markup (frame, lgl_template_markup_dup (markup)); } - return label_type; + return frame; } /*****************************************************************************/ /* Free up a template label type. */ /*****************************************************************************/ void -gl_template_label_type_free (glTemplateLabelType *label_type) +lgl_template_frame_free (lglTemplateFrame *frame) { - GList *p; - glTemplateLayout *layout; - glTemplateMarkup *markup; + GList *p; + lglTemplateLayout *layout; + lglTemplateMarkup *markup; - if ( label_type != NULL ) { + if ( frame != NULL ) { - g_free (label_type->id); - label_type->id = NULL; + g_free (frame->all.id); + frame->all.id = NULL; - for ( p=label_type->layouts; p != NULL; p=p->next ) { + for ( p=frame->all.layouts; p != NULL; p=p->next ) { - layout = (glTemplateLayout *)p->data; + layout = (lglTemplateLayout *)p->data; - gl_template_layout_free (layout); + lgl_template_layout_free (layout); p->data = NULL; } - g_list_free (label_type->layouts); - label_type->layouts = NULL; + g_list_free (frame->all.layouts); + frame->all.layouts = NULL; - for ( p=label_type->markups; p != NULL; p=p->next ) { + for ( p=frame->all.markups; p != NULL; p=p->next ) { - markup = (glTemplateMarkup *)p->data; + markup = (lglTemplateMarkup *)p->data; - gl_template_markup_free (markup); + lgl_template_markup_free (markup); p->data = NULL; } - g_list_free (label_type->markups); - label_type->markups = NULL; + g_list_free (frame->all.markups); + frame->all.markups = NULL; - g_free (label_type); + g_free (frame); } @@ -893,14 +890,14 @@ gl_template_label_type_free (glTemplateLabelType *label_type) /*****************************************************************************/ /* Duplicate layout structure. */ /*****************************************************************************/ -glTemplateLayout * -gl_template_layout_dup (const glTemplateLayout *orig_layout) +lglTemplateLayout * +lgl_template_layout_dup (const lglTemplateLayout *orig_layout) { - glTemplateLayout *layout; + lglTemplateLayout *layout; g_return_val_if_fail (orig_layout, NULL); - layout = g_new0 (glTemplateLayout, 1); + layout = g_new0 (lglTemplateLayout, 1); /* copy contents */ *layout = *orig_layout; @@ -912,7 +909,7 @@ gl_template_layout_dup (const glTemplateLayout *orig_layout) /* Free layout structure. */ /*****************************************************************************/ void -gl_template_layout_free (glTemplateLayout *layout) +lgl_template_layout_free (lglTemplateLayout *layout) { g_free (layout); } @@ -920,14 +917,14 @@ gl_template_layout_free (glTemplateLayout *layout) /*****************************************************************************/ /* Duplicate markup structure. */ /*****************************************************************************/ -glTemplateMarkup * -gl_template_markup_dup (const glTemplateMarkup *orig_markup) +lglTemplateMarkup * +lgl_template_markup_dup (const lglTemplateMarkup *orig_markup) { - glTemplateMarkup *markup; + lglTemplateMarkup *markup; g_return_val_if_fail (orig_markup, NULL); - markup = g_new0 (glTemplateMarkup, 1); + markup = g_new0 (lglTemplateMarkup, 1); *markup = *orig_markup; @@ -938,7 +935,7 @@ gl_template_markup_dup (const glTemplateMarkup *orig_markup) /* Free markup structure. */ /*****************************************************************************/ void -gl_template_markup_free (glTemplateMarkup *markup) +lgl_template_markup_free (lglTemplateMarkup *markup) { g_free (markup); } @@ -946,47 +943,45 @@ gl_template_markup_free (glTemplateMarkup *markup) /*--------------------------------------------------------------------------*/ /* PRIVATE. Make a template for a full page of the given page size. */ /*--------------------------------------------------------------------------*/ -static glTemplate * +static lglTemplate * template_full_page (const gchar *page_size) { - glPaper *paper = NULL; - glTemplate *template = NULL; - glTemplateLabelType *label_type = NULL; + lglPaper *paper = NULL; + lglTemplate *template = NULL; + lglTemplateFrame *frame = NULL; gchar *name; g_return_val_if_fail (page_size, NULL); - paper = gl_paper_from_id (page_size); + paper = lgl_paper_from_id (page_size); if ( paper == NULL ) { return NULL; } name = g_strdup_printf (_("Generic %s full page"), page_size); - template = gl_template_new (name, - FULL_PAGE, - page_size, - paper->width, - paper->height); + template = lgl_template_new (name, + FULL_PAGE, + page_size, + paper->width, + paper->height); - label_type = gl_template_rect_label_type_new ("0", - paper->width, - paper->height, - 0.0, - 0.0, - 0.0); - gl_template_add_label_type (template, label_type); + frame = lgl_template_frame_rect_new ("0", + paper->width, + paper->height, + 0.0, + 0.0, + 0.0); + lgl_template_add_frame (template, frame); - gl_template_add_layout (label_type, - gl_template_layout_new (1, 1, 0., 0., 0., 0.)); + lgl_template_add_layout (frame, lgl_template_layout_new (1, 1, 0., 0., 0., 0.)); - gl_template_add_markup (label_type, - gl_template_markup_margin_new (9.0)); + lgl_template_add_markup (frame, lgl_template_markup_margin_new (9.0)); g_free (name); name = NULL; - gl_paper_free (paper); + lgl_paper_free (paper); paper = NULL; return template; @@ -1001,11 +996,11 @@ read_templates (void) gchar *data_dir; GList *templates = NULL; - data_dir = GL_SYSTEM_DATA_DIR; + data_dir = LGL_SYSTEM_DATA_DIR; templates = read_template_files_from_dir (templates, data_dir); g_free (data_dir); - data_dir = GL_USER_DATA_DIR; + data_dir = LGL_USER_DATA_DIR; templates = read_template_files_from_dir (templates, data_dir); g_free (data_dir); @@ -1052,7 +1047,7 @@ read_template_files_from_dir (GList *templates, full_filename = g_build_filename (dirname, filename, NULL); new_templates = - gl_xml_template_read_templates_from_file (full_filename); + lgl_xml_template_read_templates_from_file (full_filename); g_free (full_filename); templates = g_list_concat (templates, new_templates); @@ -1074,7 +1069,7 @@ compare_origins (gconstpointer a, gconstpointer b, gpointer user_data) { - const glTemplateOrigin *a_origin = a, *b_origin = b; + const lglTemplateOrigin *a_origin = a, *b_origin = b; if ( a_origin->y < b_origin->y ) { return -1; @@ -1095,14 +1090,14 @@ compare_origins (gconstpointer a, /* Print all known templates (for debugging purposes). */ /*****************************************************************************/ void -gl_template_print_known_templates (void) +lgl_template_print_known_templates (void) { - GList *p; - glTemplate *template; + GList *p; + lglTemplate *template; g_print ("%s():\n", __FUNCTION__); for (p=templates; p!=NULL; p=p->next) { - template = (glTemplate *)p->data; + template = (lglTemplate *)p->data; g_print("TEMPLATE name=\"%s\", description=\"%s\"\n", template->name, template->description); @@ -1116,14 +1111,14 @@ gl_template_print_known_templates (void) /* Print all aliases of a template (for debugging purposes). */ /*****************************************************************************/ void -gl_template_print_aliases (const glTemplate *template) +lgl_template_print_aliases (const lglTemplate *template) { GList *p; g_print ("%s():\n", __FUNCTION__); for (p=template->aliases; p!=NULL; p=p->next) { - g_print("Alias = \"%s\"\n", p->data); + g_print("Alias = \"%s\"\n", (gchar *)p->data); } g_print ("\n"); diff --git a/glabels2/libglabels/template.h b/glabels2/libglabels/template.h index bce48425..4bc91b03 100644 --- a/glabels2/libglabels/template.h +++ b/glabels2/libglabels/template.h @@ -33,16 +33,28 @@ G_BEGIN_DECLS -typedef struct _glTemplate glTemplate; -typedef struct _glTemplateLabelType glTemplateLabelType; -typedef struct _glTemplateLayout glTemplateLayout; -typedef struct _glTemplateMarkup glTemplateMarkup; -typedef struct _glTemplateOrigin glTemplateOrigin; +typedef struct _lglTemplate lglTemplate; + +typedef union _lglTemplateFrame lglTemplateFrame; +typedef struct _lglTemplateFrameAll lglTemplateFrameAll; +typedef struct _lglTemplateFrameRect lglTemplateFrameRect; +typedef struct _lglTemplateFrameRound lglTemplateFrameRound; +typedef struct _lglTemplateFrameCD lglTemplateFrameCD; + +typedef struct _lglTemplateLayout lglTemplateLayout; + +typedef union _lglTemplateMarkup lglTemplateMarkup; +typedef struct _lglTemplateMarkupMargin lglTemplateMarkupMargin; +typedef struct _lglTemplateMarkupLine lglTemplateMarkupLine; +typedef struct _lglTemplateMarkupCircle lglTemplateMarkupCircle; +typedef struct _lglTemplateMarkupRect lglTemplateMarkupRect; + +typedef struct _lglTemplateOrigin lglTemplateOrigin; /* * Top-level Template Structure */ -struct _glTemplate { +struct _lglTemplate { gchar *name; gchar *description; @@ -53,10 +65,10 @@ struct _glTemplate { /* List of (gchar *) category ids. */ GList *categories; - /* List of (glTemplateLabelType *) label type structures. - * Currently glabels only supports a single label type per + /* List of (lglTemplateFrame *) label frame structures. + * Currently glabels only supports a single label frame per * template. */ - GList *label_types; + GList *frames; /* List of (gchar *) aliases. */ GList *aliases; @@ -65,59 +77,92 @@ struct _glTemplate { /* - * Possible Label Shapes + * Possible Frame Shapes */ typedef enum { - GL_TEMPLATE_SHAPE_RECT, - GL_TEMPLATE_SHAPE_ROUND, - GL_TEMPLATE_SHAPE_CD, -} glTemplateLabelShape; + LGL_TEMPLATE_FRAME_SHAPE_RECT, + LGL_TEMPLATE_FRAME_SHAPE_ROUND, + LGL_TEMPLATE_FRAME_SHAPE_CD, +} lglTemplateFrameShape; /* - * Label Type Structure + * Frame Structure */ -struct _glTemplateLabelType{ +struct _lglTemplateFrameAll { + + /* Begin Common Fields */ + lglTemplateFrameShape shape; + + gchar *id; /* Id, currently always "0" */ + GList *layouts; /* List of lglTemplateLayouts */ + GList *markups; /* List of lglTemplateMarkups */ + /* End Common Fields */ +}; + +struct _lglTemplateFrameRect { + + /* Begin Common Fields */ + lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_RECT. */ gchar *id; /* Id, currently always "0" */ - GList *layouts; /* List of glTemplateLayouts */ - GList *markups; /* List of glTemplateMarkups */ + GList *layouts; /* List of lglTemplateLayouts */ + GList *markups; /* List of lglTemplateMarkups */ + /* End Common Fields */ + + gdouble w; /* Width */ + gdouble h; /* Height */ + gdouble r; /* Corner radius */ + gdouble x_waste; /* Amount of horiz overprint allowed. */ + gdouble y_waste; /* Amount of vert overprint allowed. */ +}; - glTemplateLabelShape shape; +struct _lglTemplateFrameRound { + + /* Begin Common Fields */ + lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_ROUND. */ + + gchar *id; /* Id, currently always "0" */ + GList *layouts; /* List of lglTemplateLayouts */ + GList *markups; /* List of lglTemplateMarkups */ + /* End Common Fields */ - union { + gdouble r; /* Radius */ + gdouble waste; /* Amount of overprint allowed. */ +}; - struct { - gdouble w; /* Width */ - gdouble h; /* Height */ - gdouble r; /* Corner radius */ - gdouble x_waste; /* Amount of horiz overprint allowed. */ - gdouble y_waste; /* Amount of vert overprint allowed. */ - } rect; +struct _lglTemplateFrameCD { - struct { - gdouble r; /* Radius */ - gdouble waste; /* Amount of overprint allowed. */ + /* Begin Common Fields */ + lglTemplateFrameShape shape; /* Always LGL_TEMPLATE_FRAME_SHAPE_CD. */ - } round; + gchar *id; /* Id, currently always "0" */ + GList *layouts; /* List of lglTemplateLayouts */ + GList *markups; /* List of lglTemplateMarkups */ + /* End Common Fields */ + + gdouble r1; /* Outer radius */ + gdouble r2; /* Inner radius (hole) */ + gdouble w; /* Clip width, business card CDs */ + gdouble h; /* Clip height, business card CDs */ + gdouble waste; /* Amount of overprint allowed. */ +}; - struct { - gdouble r1; /* Outer radius */ - gdouble r2; /* Inner radius (hole) */ - gdouble w; /* Clip width, business card CDs */ - gdouble h; /* Clip height, business card CDs */ - gdouble waste; /* Amount of overprint allowed. */ - } cd; +union _lglTemplateFrame{ - } size; + lglTemplateFrameShape shape; + lglTemplateFrameAll all; + lglTemplateFrameRect rect; + lglTemplateFrameRound round; + lglTemplateFrameCD cd; }; /* * Label Layout Structure */ -struct _glTemplateLayout { +struct _lglTemplateLayout { gint nx; /* Number of labels across */ gint ny; /* Number of labels up and down */ @@ -135,51 +180,63 @@ struct _glTemplateLayout { * Possible Markup Types */ typedef enum { - GL_TEMPLATE_MARKUP_MARGIN, - GL_TEMPLATE_MARKUP_LINE, - GL_TEMPLATE_MARKUP_CIRCLE, - GL_TEMPLATE_MARKUP_RECT, -} glTemplateMarkupType; + LGL_TEMPLATE_MARKUP_MARGIN, + LGL_TEMPLATE_MARKUP_LINE, + LGL_TEMPLATE_MARKUP_CIRCLE, + LGL_TEMPLATE_MARKUP_RECT, +} lglTemplateMarkupType; /* * Label Markup Structure (Helpful lines drawn in glabels to help locate objects) */ -struct _glTemplateMarkup { +struct _lglTemplateMarkupMargin { + + lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_MARGIN */ + + gdouble size; /* Margin size */ +}; + +struct _lglTemplateMarkupLine { - glTemplateMarkupType type; + lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_LINE */ - union { + gdouble x1, y1; /* 1st endpoint */ + gdouble x2, y2; /* 2nd endpoint */ +}; + +struct _lglTemplateMarkupCircle { - struct { - gdouble size; /* Margin size */ - } margin; + lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_CIRCLE */ + + gdouble x0, y0; /* Center of circle */ + gdouble r; /* Radius of circle */ +}; - struct { - gdouble x1, y1; /* 1st endpoint */ - gdouble x2, y2; /* 2nd endpoint */ - } line; +struct _lglTemplateMarkupRect { + + lglTemplateMarkupType type; /* Always LGL_TEMPLATE_MARKUP_RECT */ + + gdouble x1, y1; /* Upper left corner */ + gdouble w, h; /* Width and height. */ + gdouble r; /* Radius of corners. */ +}; - struct { - gdouble x0, y0; /* Center of circle */ - gdouble r; /* Radius of circle */ - } circle; - - struct { - gdouble x1, y1; /* Upper left corner */ - gdouble w, h; /* Width and height. */ - gdouble r; /* Radius of corners. */ - } rect; +union _lglTemplateMarkup { - } data; + lglTemplateMarkupType type; + lglTemplateMarkupMargin margin; + lglTemplateMarkupLine line; + lglTemplateMarkupCircle circle; + lglTemplateMarkupRect rect; }; /* * Origin coordinates */ -struct _glTemplateOrigin { +struct _lglTemplateOrigin { gdouble x, y; /* Label origin relative to upper * upper left hand corner of paper */ @@ -191,133 +248,133 @@ struct _glTemplateOrigin { /* * Module Initialization */ -void gl_template_init (void); +void lgl_template_init (void); -void gl_template_register (const glTemplate *template); +void lgl_template_register (const lglTemplate *template); /* * Known templates query functions */ -GList *gl_template_get_name_list_unique (const gchar *page_size, - const gchar *category); +GList *lgl_template_get_name_list_unique (const gchar *page_size, + const gchar *category); -GList *gl_template_get_name_list_all (const gchar *page_size, - const gchar *category); +GList *lgl_template_get_name_list_all (const gchar *page_size, + const gchar *category); -void gl_template_free_name_list (GList *names); +void lgl_template_free_name_list (GList *names); -glTemplate *gl_template_from_name (const gchar *name); +lglTemplate *lgl_template_from_name (const gchar *name); /* * Template query functions */ -const glTemplateLabelType *gl_template_get_first_label_type (const glTemplate *template); +const lglTemplateFrame *lgl_template_get_first_frame (const lglTemplate *template); -gboolean gl_template_does_page_size_match (const glTemplate *template, - const gchar *page_size); +gboolean lgl_template_does_page_size_match (const lglTemplate *template, + const gchar *page_size); -gboolean gl_template_does_category_match (const glTemplate *template, - const gchar *category); +gboolean lgl_template_does_category_match (const lglTemplate *template, + const gchar *category); /* - * Label Type query functions + * Frame query functions */ -void gl_template_get_label_size (const glTemplateLabelType *label_type, - gdouble *w, - gdouble *h); +void lgl_template_frame_get_size (const lglTemplateFrame *frame, + gdouble *w, + gdouble *h); -gint gl_template_get_n_labels (const glTemplateLabelType *label_type); +gint lgl_template_frame_get_n_labels (const lglTemplateFrame *frame); -glTemplateOrigin *gl_template_get_origins (const glTemplateLabelType *label_type); +lglTemplateOrigin *lgl_template_frame_get_origins (const lglTemplateFrame *frame); /* * Template Construction */ -glTemplate *gl_template_new (const gchar *name, - const gchar *description, - const gchar *page_size, - gdouble page_width, - gdouble page_height); +lglTemplate *lgl_template_new (const gchar *name, + const gchar *description, + const gchar *page_size, + gdouble page_width, + gdouble page_height); -void gl_template_add_category (glTemplate *template, - const gchar *category); +void lgl_template_add_category (lglTemplate *template, + const gchar *category); -void gl_template_add_label_type (glTemplate *template, - glTemplateLabelType *label_type); +void lgl_template_add_frame (lglTemplate *template, + lglTemplateFrame *frame); -void gl_template_add_alias (glTemplate *template, - const gchar *alias); +void lgl_template_add_alias (lglTemplate *template, + const gchar *alias); -glTemplateLabelType *gl_template_rect_label_type_new (const gchar *id, - gdouble w, - gdouble h, - gdouble r, - gdouble x_waste, - gdouble y_waste); +lglTemplateFrame *lgl_template_frame_rect_new (const gchar *id, + gdouble w, + gdouble h, + gdouble r, + gdouble x_waste, + gdouble y_waste); -glTemplateLabelType *gl_template_round_label_type_new (const gchar *id, - gdouble r, - gdouble waste); +lglTemplateFrame *lgl_template_frame_round_new (const gchar *id, + gdouble r, + gdouble waste); -glTemplateLabelType *gl_template_cd_label_type_new (const gchar *id, - gdouble r1, - gdouble r2, - gdouble w, - gdouble h, - gdouble waste); +lglTemplateFrame *lgl_template_frame_cd_new (const gchar *id, + gdouble r1, + gdouble r2, + gdouble w, + gdouble h, + gdouble waste); -void gl_template_add_layout (glTemplateLabelType *label_type, - glTemplateLayout *layout); +void lgl_template_add_layout (lglTemplateFrame *frame, + lglTemplateLayout *layout); -void gl_template_add_markup (glTemplateLabelType *label_type, - glTemplateMarkup *markup); +void lgl_template_add_markup (lglTemplateFrame *frame, + lglTemplateMarkup *markup); -glTemplateLayout *gl_template_layout_new (gint nx, - gint ny, - gdouble x0, - gdouble y0, - gdouble dx, - gdouble dy); +lglTemplateLayout *lgl_template_layout_new (gint nx, + gint ny, + gdouble x0, + gdouble y0, + gdouble dx, + gdouble dy); -glTemplateMarkup *gl_template_markup_margin_new (gdouble size); +lglTemplateMarkup *lgl_template_markup_margin_new (gdouble size); -glTemplateMarkup *gl_template_markup_line_new (gdouble x1, - gdouble y1, - gdouble x2, - gdouble y2); +lglTemplateMarkup *lgl_template_markup_line_new (gdouble x1, + gdouble y1, + gdouble x2, + gdouble y2); -glTemplateMarkup *gl_template_markup_circle_new (gdouble x0, - gdouble y0, - gdouble r); +lglTemplateMarkup *lgl_template_markup_circle_new (gdouble x0, + gdouble y0, + gdouble r); -glTemplateMarkup *gl_template_markup_rect_new (gdouble x1, - gdouble y1, - gdouble w, - gdouble h, - gdouble r); +lglTemplateMarkup *lgl_template_markup_rect_new (gdouble x1, + gdouble y1, + gdouble w, + gdouble h, + gdouble r); -glTemplate *gl_template_dup (const glTemplate *orig); +lglTemplate *lgl_template_dup (const lglTemplate *orig); -void gl_template_free (glTemplate *template); +void lgl_template_free (lglTemplate *template); -glTemplateLabelType *gl_template_label_type_dup (const glTemplateLabelType *orig_ltype); -void gl_template_label_type_free (glTemplateLabelType *ltype); +lglTemplateFrame *lgl_template_frame_dup (const lglTemplateFrame *orig_frame); +void lgl_template_frame_free (lglTemplateFrame *frame); -glTemplateLayout *gl_template_layout_dup (const glTemplateLayout *orig_layout); -void gl_template_layout_free (glTemplateLayout *layout); +lglTemplateLayout *lgl_template_layout_dup (const lglTemplateLayout *orig_layout); +void lgl_template_layout_free (lglTemplateLayout *layout); -glTemplateMarkup *gl_template_markup_dup (const glTemplateMarkup *orig_markup); -void gl_template_markup_free (glTemplateMarkup *markup); +lglTemplateMarkup *lgl_template_markup_dup (const lglTemplateMarkup *orig_markup); +void lgl_template_markup_free (lglTemplateMarkup *markup); /* * Debugging functions */ -void gl_template_print_known_templates (void); -void gl_template_print_aliases (const glTemplate *template); +void lgl_template_print_known_templates (void); +void lgl_template_print_aliases (const lglTemplate *template); G_END_DECLS diff --git a/glabels2/libglabels/xml-category.c b/glabels2/libglabels/xml-category.c index e161a83c..0e759c9a 100644 --- a/glabels2/libglabels/xml-category.c +++ b/glabels2/libglabels/xml-category.c @@ -49,16 +49,16 @@ /** - * gl_xml_category_read_categories_from_file: + * lgl_xml_category_read_categories_from_file: * @utf8_filename: Filename of categories file (name encoded as UTF-8) * * Read category definitions from a file. * - * Returns: a list of #glCategory structures. + * Returns: a list of #lglCategory structures. * */ GList * -gl_xml_category_read_categories_from_file (gchar *utf8_filename) +lgl_xml_category_read_categories_from_file (gchar *utf8_filename) { gchar *filename; GList *categories; @@ -79,7 +79,7 @@ gl_xml_category_read_categories_from_file (gchar *utf8_filename) return NULL; } - categories = gl_xml_category_parse_categories_doc (categories_doc); + categories = lgl_xml_category_parse_categories_doc (categories_doc); g_free (filename); xmlFreeDoc (categories_doc); @@ -89,21 +89,21 @@ gl_xml_category_read_categories_from_file (gchar *utf8_filename) /** - * gl_xml_category_parse_categories_doc: + * lgl_xml_category_parse_categories_doc: * @categories_doc: libxml #xmlDocPtr tree, representing a categories * definition file. * * Read category definitions from a libxml #xmlDocPtr tree. * - * Returns: a list of #glCategory structures. + * Returns: a list of #lglCategory structures. * */ GList * -gl_xml_category_parse_categories_doc (xmlDocPtr categories_doc) +lgl_xml_category_parse_categories_doc (xmlDocPtr categories_doc) { - GList *categories = NULL; - xmlNodePtr root, node; - glCategory *category; + GList *categories = NULL; + xmlNodePtr root, node; + lglCategory *category; LIBXML_TEST_VERSION; @@ -114,7 +114,7 @@ gl_xml_category_parse_categories_doc (xmlDocPtr categories_doc) xmlFreeDoc (categories_doc); return categories; } - if (!gl_xml_is_node (root, "Glabels-categories")) { + if (!lgl_xml_is_node (root, "Glabels-categories")) { g_message ("\"%s\" is not a glabels category file (wrong root node)", categories_doc->name); xmlFreeDoc (categories_doc); @@ -123,12 +123,12 @@ gl_xml_category_parse_categories_doc (xmlDocPtr categories_doc) for (node = root->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Category")) { - category = gl_xml_category_parse_category_node (node); + if (lgl_xml_is_node (node, "Category")) { + category = lgl_xml_category_parse_category_node (node); categories = g_list_append (categories, category); } else { if ( !xmlNodeIsText(node) ) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -140,26 +140,26 @@ gl_xml_category_parse_categories_doc (xmlDocPtr categories_doc) /** - * gl_xml_category_parse_category_node: + * lgl_xml_category_parse_category_node: * @category_node: libxml #xmlNodePtr category node from a #xmlDocPtr tree. * * Read a single category definition from a libxml #xmlNodePtr node. * - * Returns: a pointer to a newly created #glCategory structure. + * Returns: a pointer to a newly created #lglCategory structure. * */ -glCategory * -gl_xml_category_parse_category_node (xmlNodePtr category_node) +lglCategory * +lgl_xml_category_parse_category_node (xmlNodePtr category_node) { - glCategory *category; + lglCategory *category; gchar *id, *name; LIBXML_TEST_VERSION; - id = gl_xml_get_prop_string (category_node, "id", NULL); - name = gl_xml_get_prop_i18n_string (category_node, "name", NULL); + id = lgl_xml_get_prop_string (category_node, "id", NULL); + name = lgl_xml_get_prop_i18n_string (category_node, "name", NULL); - category = gl_category_new (id, name); + category = lgl_category_new (id, name); g_free (id); g_free (name); diff --git a/glabels2/libglabels/xml-category.h b/glabels2/libglabels/xml-category.h index de82a493..ef01d9fb 100644 --- a/glabels2/libglabels/xml-category.h +++ b/glabels2/libglabels/xml-category.h @@ -34,11 +34,11 @@ G_BEGIN_DECLS -GList *gl_xml_category_read_categories_from_file (gchar *utf8_filename); +GList *lgl_xml_category_read_categories_from_file (gchar *utf8_filename); -GList *gl_xml_category_parse_categories_doc (xmlDocPtr categories_doc); +GList *lgl_xml_category_parse_categories_doc (xmlDocPtr categories_doc); -glCategory *gl_xml_category_parse_category_node (xmlNodePtr category_node); +lglCategory *lgl_xml_category_parse_category_node (xmlNodePtr category_node); G_END_DECLS diff --git a/glabels2/libglabels/xml-paper.c b/glabels2/libglabels/xml-paper.c index b0727ef2..0eda5a39 100644 --- a/glabels2/libglabels/xml-paper.c +++ b/glabels2/libglabels/xml-paper.c @@ -49,16 +49,16 @@ /** - * gl_xml_paper_read_papers_from_file: + * lgl_xml_paper_read_papers_from_file: * @utf8_filename: Filename of papers file (name encoded as UTF-8) * * Read paper definitions from a file. * - * Returns: a list of #glPaper structures. + * Returns: a list of #lglPaper structures. * */ GList * -gl_xml_paper_read_papers_from_file (gchar *utf8_filename) +lgl_xml_paper_read_papers_from_file (gchar *utf8_filename) { gchar *filename; GList *papers; @@ -79,7 +79,7 @@ gl_xml_paper_read_papers_from_file (gchar *utf8_filename) return NULL; } - papers = gl_xml_paper_parse_papers_doc (papers_doc); + papers = lgl_xml_paper_parse_papers_doc (papers_doc); g_free (filename); xmlFreeDoc (papers_doc); @@ -89,20 +89,20 @@ gl_xml_paper_read_papers_from_file (gchar *utf8_filename) /** - * gl_xml_paper_parse_papers_doc: + * lgl_xml_paper_parse_papers_doc: * @papers_doc: libxml #xmlDocPtr tree, representing a papers definition file. * * Read paper definitions from a libxml #xmlDocPtr tree. * - * Returns: a list of #glPaper structures. + * Returns: a list of #lglPaper structures. * */ GList * -gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) +lgl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) { GList *papers = NULL; xmlNodePtr root, node; - glPaper *paper; + lglPaper *paper; LIBXML_TEST_VERSION; @@ -113,7 +113,7 @@ gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) xmlFreeDoc (papers_doc); return papers; } - if (!gl_xml_is_node (root, "Glabels-paper-sizes")) { + if (!lgl_xml_is_node (root, "Glabels-paper-sizes")) { g_message ("\"%s\" is not a glabels paper file (wrong root node)", papers_doc->name); xmlFreeDoc (papers_doc); @@ -122,12 +122,12 @@ gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) for (node = root->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Paper-size")) { - paper = gl_xml_paper_parse_paper_node (node); + if (lgl_xml_is_node (node, "Paper-size")) { + paper = lgl_xml_paper_parse_paper_node (node); papers = g_list_append (papers, paper); } else { if ( !xmlNodeIsText(node) ) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -139,31 +139,31 @@ gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc) /** - * gl_xml_paper_parse_paper_node: + * lgl_xml_paper_parse_paper_node: * @paper_node: libxml #xmlNodePtr paper node from a #xmlDocPtr tree. * * Read a single paper definition from a libxml #xmlNodePtr node. * - * Returns: a pointer to a newly created #glPaper structure. + * Returns: a pointer to a newly created #lglPaper structure. * */ -glPaper * -gl_xml_paper_parse_paper_node (xmlNodePtr paper_node) +lglPaper * +lgl_xml_paper_parse_paper_node (xmlNodePtr paper_node) { - glPaper *paper; + lglPaper *paper; gchar *id, *name; gdouble width, height; LIBXML_TEST_VERSION; - id = gl_xml_get_prop_string (paper_node, "id", NULL); + id = lgl_xml_get_prop_string (paper_node, "id", NULL); - name = gl_xml_get_prop_i18n_string (paper_node, "name", NULL); + name = lgl_xml_get_prop_i18n_string (paper_node, "name", NULL); - width = gl_xml_get_prop_length (paper_node, "width", 0); - height = gl_xml_get_prop_length (paper_node, "height", 0); + width = lgl_xml_get_prop_length (paper_node, "width", 0); + height = lgl_xml_get_prop_length (paper_node, "height", 0); - paper = gl_paper_new (id, name, width, height); + paper = lgl_paper_new (id, name, width, height); g_free (id); g_free (name); diff --git a/glabels2/libglabels/xml-paper.h b/glabels2/libglabels/xml-paper.h index 02dbacc0..df90bcff 100644 --- a/glabels2/libglabels/xml-paper.h +++ b/glabels2/libglabels/xml-paper.h @@ -34,11 +34,11 @@ G_BEGIN_DECLS -GList *gl_xml_paper_read_papers_from_file (gchar *utf8_filename); +GList *lgl_xml_paper_read_papers_from_file (gchar *utf8_filename); -GList *gl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc); +GList *lgl_xml_paper_parse_papers_doc (xmlDocPtr papers_doc); -glPaper *gl_xml_paper_parse_paper_node (xmlNodePtr paper_node); +lglPaper *lgl_xml_paper_parse_paper_node (xmlNodePtr paper_node); G_END_DECLS diff --git a/glabels2/libglabels/xml-template.c b/glabels2/libglabels/xml-template.c index e4477609..35cd6771 100644 --- a/glabels2/libglabels/xml-template.c +++ b/glabels2/libglabels/xml-template.c @@ -50,45 +50,45 @@ /* Local function prototypes */ /*===========================================*/ static void xml_parse_meta_node (xmlNodePtr label_node, - glTemplate *template); + lglTemplate *template); static void xml_parse_label_rectangle_node (xmlNodePtr label_node, - glTemplate *template); + lglTemplate *template); static void xml_parse_label_round_node (xmlNodePtr label_node, - glTemplate *template); + lglTemplate *template); static void xml_parse_label_cd_node (xmlNodePtr label_node, - glTemplate *template); + lglTemplate *template); static void xml_parse_layout_node (xmlNodePtr layout_node, - glTemplateLabelType *label_type); + lglTemplateFrame *frame); static void xml_parse_markup_margin_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type); + lglTemplateFrame *frame); static void xml_parse_markup_line_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type); + lglTemplateFrame *frame); static void xml_parse_markup_circle_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type); + lglTemplateFrame *frame); static void xml_parse_markup_rect_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type); + lglTemplateFrame *frame); static void xml_parse_alias_node (xmlNodePtr alias_node, - glTemplate *template); + lglTemplate *template); static void xml_create_meta_node (const gchar *category, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_label_node (const glTemplateLabelType *label_type, +static void xml_create_label_node (const lglTemplateFrame *frame, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_layout_node (const glTemplateLayout *layout, +static void xml_create_layout_node (const lglTemplateLayout *layout, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_markup_margin_node (const glTemplateMarkup *margin, +static void xml_create_markup_margin_node (const lglTemplateMarkup *margin, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_markup_line_node (const glTemplateMarkup *line, +static void xml_create_markup_line_node (const lglTemplateMarkup *line, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_markup_circle_node (const glTemplateMarkup *circle, +static void xml_create_markup_circle_node (const lglTemplateMarkup *circle, xmlNodePtr root, const xmlNsPtr ns); -static void xml_create_markup_rect_node (const glTemplateMarkup *circle, +static void xml_create_markup_rect_node (const lglTemplateMarkup *circle, xmlNodePtr root, const xmlNsPtr ns); static void xml_create_alias_node (const gchar *name, @@ -97,16 +97,16 @@ static void xml_create_alias_node (const gchar *name, /** - * gl_xml_template_read_templates_from_file: + * lgl_xml_template_read_templates_from_file: * @utf8_filename: Filename of papers file (name encoded as UTF-8) * * Read glabels templates from template file. * - * Returns: a list of #glTemplate structures. + * Returns: a list of #lglTemplate structures. * */ GList * -gl_xml_template_read_templates_from_file (const gchar *utf8_filename) +lgl_xml_template_read_templates_from_file (const gchar *utf8_filename) { gchar *filename; xmlDocPtr templates_doc; @@ -127,7 +127,7 @@ gl_xml_template_read_templates_from_file (const gchar *utf8_filename) return templates; } - templates = gl_xml_template_parse_templates_doc (templates_doc); + templates = lgl_xml_template_parse_templates_doc (templates_doc); g_free (filename); xmlFreeDoc (templates_doc); @@ -137,21 +137,21 @@ gl_xml_template_read_templates_from_file (const gchar *utf8_filename) /** - * gl_xml_template_parse_templates_doc: + * lgl_xml_template_parse_templates_doc: * @templates_doc: libxml #xmlDocPtr tree, representing template file. * * Read glabels templates from a libxml #xmlDocPtr tree. * - * Returns: a list of #glTemplate structures. + * Returns: a list of #lglTemplate structures. * */ GList * -gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) +lgl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) { - GList *templates = NULL; - xmlNodePtr root, node; - glTemplate *template; + GList *templates = NULL; + xmlNodePtr root, node; + lglTemplate *template; LIBXML_TEST_VERSION; @@ -161,7 +161,7 @@ gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) templates_doc->URL); return templates; } - if (!gl_xml_is_node (root, "Glabels-templates")) { + if (!lgl_xml_is_node (root, "Glabels-templates")) { g_message ("\"%s\" is not a glabels template file (wrong root node)", templates_doc->URL); return templates; @@ -169,12 +169,12 @@ gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) for (node = root->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Template")) { - template = gl_xml_template_parse_template_node (node); + if (lgl_xml_is_node (node, "Template")) { + template = lgl_xml_template_parse_template_node (node); templates = g_list_append (templates, template); } else { if ( !xmlNodeIsText(node) ) { - if (!gl_xml_is_node (node,"comment")) { + if (!lgl_xml_is_node (node,"comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -186,42 +186,42 @@ gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc) /** - * gl_xml_template_parse_template_node: + * lgl_xml_template_parse_template_node: * @template_node: libxml #xmlNodePtr template node from a #xmlDocPtr tree. * * Read a single glabels template from a libxml #xmlNodePtr node. * - * Returns: a pointer to a newly created #glTemplate structure. + * Returns: a pointer to a newly created #lglTemplate structure. * */ -glTemplate * -gl_xml_template_parse_template_node (const xmlNodePtr template_node) +lglTemplate * +lgl_xml_template_parse_template_node (const xmlNodePtr template_node) { gchar *name; gchar *description; gchar *page_size; gdouble page_width, page_height; - glPaper *paper = NULL; - glTemplate *template; + lglPaper *paper = NULL; + lglTemplate *template; xmlNodePtr node; - name = gl_xml_get_prop_string (template_node, "name", NULL); - description = gl_xml_get_prop_i18n_string (template_node, "description", NULL); - page_size = gl_xml_get_prop_string (template_node, "size", NULL); + name = lgl_xml_get_prop_string (template_node, "name", NULL); + description = lgl_xml_get_prop_i18n_string (template_node, "description", NULL); + page_size = lgl_xml_get_prop_string (template_node, "size", NULL); - if (gl_paper_is_id_other (page_size)) { + if (lgl_paper_is_id_other (page_size)) { - page_width = gl_xml_get_prop_length (template_node, "width", 0); - page_height = gl_xml_get_prop_length (template_node, "height", 0); + page_width = lgl_xml_get_prop_length (template_node, "width", 0); + page_height = lgl_xml_get_prop_length (template_node, "height", 0); } else { - paper = gl_paper_from_id (page_size); + paper = lgl_paper_from_id (page_size); if (paper == NULL) { /* This should always be an id, but just in case a name slips by! */ g_message (_("Unknown page size id \"%s\", trying as name"), page_size); - paper = gl_paper_from_name (page_size); + paper = lgl_paper_from_name (page_size); g_free (page_size); page_size = g_strdup (paper->id); } @@ -232,30 +232,30 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node) g_message (_("Unknown page size id or name \"%s\""), page_size); } - gl_paper_free (paper); + lgl_paper_free (paper); paper = NULL; } - template = gl_template_new (name, + template = lgl_template_new (name, description, page_size, page_width, page_height); for (node = template_node->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Meta")) { + if (lgl_xml_is_node (node, "Meta")) { xml_parse_meta_node (node, template); - } else if (gl_xml_is_node (node, "Label-rectangle")) { + } else if (lgl_xml_is_node (node, "Label-rectangle")) { xml_parse_label_rectangle_node (node, template); - } else if (gl_xml_is_node (node, "Label-round")) { + } else if (lgl_xml_is_node (node, "Label-round")) { xml_parse_label_round_node (node, template); - } else if (gl_xml_is_node (node, "Label-cd")) { + } else if (lgl_xml_is_node (node, "Label-cd")) { xml_parse_label_cd_node (node, template); - } else if (gl_xml_is_node (node, "Alias")) { + } else if (lgl_xml_is_node (node, "Alias")) { xml_parse_alias_node (node, template); } else { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node,"comment")) { + if (!lgl_xml_is_node (node,"comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -273,16 +273,16 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node) /* PRIVATE. Parse XML Template->Meta Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_meta_node (xmlNodePtr meta_node, - glTemplate *template) +xml_parse_meta_node (xmlNodePtr meta_node, + lglTemplate *template) { gchar *category; - category = gl_xml_get_prop_string (meta_node, "category", NULL); + category = lgl_xml_get_prop_string (meta_node, "category", NULL); if (category != NULL) { - gl_template_add_category (template, category); + lgl_template_add_category (template, category); g_free (category); } } @@ -291,48 +291,48 @@ xml_parse_meta_node (xmlNodePtr meta_node, /* PRIVATE. Parse XML Template->Label-rectangle Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_label_rectangle_node (xmlNodePtr label_node, - glTemplate *template) +xml_parse_label_rectangle_node (xmlNodePtr label_node, + lglTemplate *template) { gchar *id; gchar *tmp; gdouble x_waste, y_waste; gdouble w, h, r; - glTemplateLabelType *label_type; + lglTemplateFrame *frame; xmlNodePtr node; - id = gl_xml_get_prop_string (label_node, "id", NULL); + id = lgl_xml_get_prop_string (label_node, "id", NULL); - if (tmp = gl_xml_get_prop_string (label_node, "waste", NULL)) { + if ((tmp = lgl_xml_get_prop_string (label_node, "waste", NULL))) { /* Handle single "waste" property. */ - x_waste = y_waste = gl_xml_get_prop_length (label_node, "waste", 0); + x_waste = y_waste = lgl_xml_get_prop_length (label_node, "waste", 0); g_free (tmp); } else { - x_waste = gl_xml_get_prop_length (label_node, "x_waste", 0); - y_waste = gl_xml_get_prop_length (label_node, "y_waste", 0); + x_waste = lgl_xml_get_prop_length (label_node, "x_waste", 0); + y_waste = lgl_xml_get_prop_length (label_node, "y_waste", 0); } - w = gl_xml_get_prop_length (label_node, "width", 0); - h = gl_xml_get_prop_length (label_node, "height", 0); - r = gl_xml_get_prop_length (label_node, "round", 0); + w = lgl_xml_get_prop_length (label_node, "width", 0); + h = lgl_xml_get_prop_length (label_node, "height", 0); + r = lgl_xml_get_prop_length (label_node, "round", 0); - label_type = gl_template_rect_label_type_new ((gchar *)id, w, h, r, x_waste, y_waste); - gl_template_add_label_type (template, label_type); + frame = lgl_template_frame_rect_new ((gchar *)id, w, h, r, x_waste, y_waste); + lgl_template_add_frame (template, frame); for (node = label_node->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Layout")) { - xml_parse_layout_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-margin")) { - xml_parse_markup_margin_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-line")) { - xml_parse_markup_line_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-circle")) { - xml_parse_markup_circle_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-rect")) { - xml_parse_markup_rect_node (node, label_type); + if (lgl_xml_is_node (node, "Layout")) { + xml_parse_layout_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-margin")) { + xml_parse_markup_margin_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-line")) { + xml_parse_markup_line_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-circle")) { + xml_parse_markup_circle_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-rect")) { + xml_parse_markup_rect_node (node, frame); } else if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -345,36 +345,36 @@ xml_parse_label_rectangle_node (xmlNodePtr label_node, /* PRIVATE. Parse XML Template->Label-round Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_label_round_node (xmlNodePtr label_node, - glTemplate *template) +xml_parse_label_round_node (xmlNodePtr label_node, + lglTemplate *template) { gchar *id; gdouble waste; gdouble r; - glTemplateLabelType *label_type; + lglTemplateFrame *frame; xmlNodePtr node; - id = gl_xml_get_prop_string (label_node, "id", NULL); - waste = gl_xml_get_prop_length (label_node, "waste", 0); - r = gl_xml_get_prop_length (label_node, "radius", 0); + id = lgl_xml_get_prop_string (label_node, "id", NULL); + waste = lgl_xml_get_prop_length (label_node, "waste", 0); + r = lgl_xml_get_prop_length (label_node, "radius", 0); - label_type = gl_template_round_label_type_new ((gchar *)id, r, waste); - gl_template_add_label_type (template, label_type); + frame = lgl_template_frame_round_new ((gchar *)id, r, waste); + lgl_template_add_frame (template, frame); for (node = label_node->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Layout")) { - xml_parse_layout_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-margin")) { - xml_parse_markup_margin_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-line")) { - xml_parse_markup_line_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-circle")) { - xml_parse_markup_circle_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-rect")) { - xml_parse_markup_rect_node (node, label_type); + if (lgl_xml_is_node (node, "Layout")) { + xml_parse_layout_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-margin")) { + xml_parse_markup_margin_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-line")) { + xml_parse_markup_line_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-circle")) { + xml_parse_markup_circle_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-rect")) { + xml_parse_markup_rect_node (node, frame); } else if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -387,39 +387,39 @@ xml_parse_label_round_node (xmlNodePtr label_node, /* PRIVATE. Parse XML Template->Label-cd Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_label_cd_node (xmlNodePtr label_node, - glTemplate *template) +xml_parse_label_cd_node (xmlNodePtr label_node, + lglTemplate *template) { gchar *id; gdouble waste; gdouble r1, r2, w, h; - glTemplateLabelType *label_type; + lglTemplateFrame *frame; xmlNodePtr node; - id = gl_xml_get_prop_string (label_node, "id", NULL); - waste = gl_xml_get_prop_length (label_node, "waste", 0); - r1 = gl_xml_get_prop_length (label_node, "radius", 0); - r2 = gl_xml_get_prop_length (label_node, "hole", 0); - w = gl_xml_get_prop_length (label_node, "width", 0); - h = gl_xml_get_prop_length (label_node, "height", 0); + id = lgl_xml_get_prop_string (label_node, "id", NULL); + waste = lgl_xml_get_prop_length (label_node, "waste", 0); + r1 = lgl_xml_get_prop_length (label_node, "radius", 0); + r2 = lgl_xml_get_prop_length (label_node, "hole", 0); + w = lgl_xml_get_prop_length (label_node, "width", 0); + h = lgl_xml_get_prop_length (label_node, "height", 0); - label_type = gl_template_cd_label_type_new ((gchar *)id, r1, r2, w, h, waste); - gl_template_add_label_type (template, label_type); + frame = lgl_template_frame_cd_new ((gchar *)id, r1, r2, w, h, waste); + lgl_template_add_frame (template, frame); for (node = label_node->xmlChildrenNode; node != NULL; node = node->next) { - if (gl_xml_is_node (node, "Layout")) { - xml_parse_layout_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-margin")) { - xml_parse_markup_margin_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-line")) { - xml_parse_markup_line_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-circle")) { - xml_parse_markup_circle_node (node, label_type); - } else if (gl_xml_is_node (node, "Markup-rect")) { - xml_parse_markup_rect_node (node, label_type); + if (lgl_xml_is_node (node, "Layout")) { + xml_parse_layout_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-margin")) { + xml_parse_markup_margin_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-line")) { + xml_parse_markup_line_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-circle")) { + xml_parse_markup_circle_node (node, frame); + } else if (lgl_xml_is_node (node, "Markup-rect")) { + xml_parse_markup_rect_node (node, frame); } else if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -432,29 +432,28 @@ xml_parse_label_cd_node (xmlNodePtr label_node, /* PRIVATE. Parse XML Template->Label->Layout Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_layout_node (xmlNodePtr layout_node, - glTemplateLabelType *label_type) +xml_parse_layout_node (xmlNodePtr layout_node, + lglTemplateFrame *frame) { gint nx, ny; gdouble x0, y0, dx, dy; xmlNodePtr node; - nx = gl_xml_get_prop_int (layout_node, "nx", 1); - ny = gl_xml_get_prop_int (layout_node, "ny", 1); + nx = lgl_xml_get_prop_int (layout_node, "nx", 1); + ny = lgl_xml_get_prop_int (layout_node, "ny", 1); - x0 = gl_xml_get_prop_length (layout_node, "x0", 0); - y0 = gl_xml_get_prop_length (layout_node, "y0", 0); + x0 = lgl_xml_get_prop_length (layout_node, "x0", 0); + y0 = lgl_xml_get_prop_length (layout_node, "y0", 0); - dx = gl_xml_get_prop_length (layout_node, "dx", 0); - dy = gl_xml_get_prop_length (layout_node, "dy", 0); + dx = lgl_xml_get_prop_length (layout_node, "dx", 0); + dy = lgl_xml_get_prop_length (layout_node, "dy", 0); - gl_template_add_layout (label_type, - gl_template_layout_new (nx, ny, x0, y0, dx, dy)); + lgl_template_add_layout (frame, lgl_template_layout_new (nx, ny, x0, y0, dx, dy)); for (node = layout_node->xmlChildrenNode; node != NULL; node = node->next) { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -466,21 +465,20 @@ xml_parse_layout_node (xmlNodePtr layout_node, /* PRIVATE. Parse XML Template->Label->Markup-margin Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_markup_margin_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type) +xml_parse_markup_margin_node (xmlNodePtr markup_node, + lglTemplateFrame *frame) { gdouble size; xmlNodePtr node; - size = gl_xml_get_prop_length (markup_node, "size", 0); + size = lgl_xml_get_prop_length (markup_node, "size", 0); - gl_template_add_markup (label_type, - gl_template_markup_margin_new (size)); + lgl_template_add_markup (frame, lgl_template_markup_margin_new (size)); for (node = markup_node->xmlChildrenNode; node != NULL; node = node->next) { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -492,24 +490,23 @@ xml_parse_markup_margin_node (xmlNodePtr markup_node, /* PRIVATE. Parse XML Template->Label->Markup-line Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_markup_line_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type) +xml_parse_markup_line_node (xmlNodePtr markup_node, + lglTemplateFrame *frame) { gdouble x1, y1, x2, y2; xmlNodePtr node; - x1 = gl_xml_get_prop_length (markup_node, "x1", 0); - y1 = gl_xml_get_prop_length (markup_node, "y1", 0); - x2 = gl_xml_get_prop_length (markup_node, "x2", 0); - y2 = gl_xml_get_prop_length (markup_node, "y2", 0); + x1 = lgl_xml_get_prop_length (markup_node, "x1", 0); + y1 = lgl_xml_get_prop_length (markup_node, "y1", 0); + x2 = lgl_xml_get_prop_length (markup_node, "x2", 0); + y2 = lgl_xml_get_prop_length (markup_node, "y2", 0); - gl_template_add_markup (label_type, - gl_template_markup_line_new (x1, y1, x2, y2)); + lgl_template_add_markup (frame, lgl_template_markup_line_new (x1, y1, x2, y2)); for (node = markup_node->xmlChildrenNode; node != NULL; node = node->next) { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -521,23 +518,22 @@ xml_parse_markup_line_node (xmlNodePtr markup_node, /* PRIVATE. Parse XML Template->Label->Markup-circle Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_markup_circle_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type) +xml_parse_markup_circle_node (xmlNodePtr markup_node, + lglTemplateFrame *frame) { gdouble x0, y0, r; xmlNodePtr node; - x0 = gl_xml_get_prop_length (markup_node, "x0", 0); - y0 = gl_xml_get_prop_length (markup_node, "y0", 0); - r = gl_xml_get_prop_length (markup_node, "radius", 0); + x0 = lgl_xml_get_prop_length (markup_node, "x0", 0); + y0 = lgl_xml_get_prop_length (markup_node, "y0", 0); + r = lgl_xml_get_prop_length (markup_node, "radius", 0); - gl_template_add_markup (label_type, - gl_template_markup_circle_new (x0, y0, r)); + lgl_template_add_markup (frame, lgl_template_markup_circle_new (x0, y0, r)); for (node = markup_node->xmlChildrenNode; node != NULL; node = node->next) { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -549,25 +545,24 @@ xml_parse_markup_circle_node (xmlNodePtr markup_node, /* PRIVATE. Parse XML Template->Label->Markup-rect Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_markup_rect_node (xmlNodePtr markup_node, - glTemplateLabelType *label_type) +xml_parse_markup_rect_node (xmlNodePtr markup_node, + lglTemplateFrame *frame) { gdouble x1, y1, w, h, r; xmlNodePtr node; - x1 = gl_xml_get_prop_length (markup_node, "x1", 0); - y1 = gl_xml_get_prop_length (markup_node, "y1", 0); - w = gl_xml_get_prop_length (markup_node, "w", 0); - h = gl_xml_get_prop_length (markup_node, "h", 0); - r = gl_xml_get_prop_length (markup_node, "r", 0); + x1 = lgl_xml_get_prop_length (markup_node, "x1", 0); + y1 = lgl_xml_get_prop_length (markup_node, "y1", 0); + w = lgl_xml_get_prop_length (markup_node, "w", 0); + h = lgl_xml_get_prop_length (markup_node, "h", 0); + r = lgl_xml_get_prop_length (markup_node, "r", 0); - gl_template_add_markup (label_type, - gl_template_markup_rect_new (x1, y1, w, h, r)); + lgl_template_add_markup (frame, lgl_template_markup_rect_new (x1, y1, w, h, r)); for (node = markup_node->xmlChildrenNode; node != NULL; node = node->next) { if (!xmlNodeIsText (node)) { - if (!gl_xml_is_node (node, "comment")) { + if (!lgl_xml_is_node (node, "comment")) { g_message ("bad node = \"%s\"",node->name); } } @@ -579,46 +574,46 @@ xml_parse_markup_rect_node (xmlNodePtr markup_node, /* PRIVATE. Parse XML Template->Alias Node. */ /*--------------------------------------------------------------------------*/ static void -xml_parse_alias_node (xmlNodePtr alias_node, - glTemplate *template) +xml_parse_alias_node (xmlNodePtr alias_node, + lglTemplate *template) { gchar *name; - name = gl_xml_get_prop_string (alias_node, "name", NULL); + name = lgl_xml_get_prop_string (alias_node, "name", NULL); - gl_template_add_alias (template, (gchar *)name); + lgl_template_add_alias (template, (gchar *)name); g_free (name); } /** - * gl_xml_template_write_templates_to_file: - * @templates: List of #glTemplate structures + * lgl_xml_template_write_templates_to_file: + * @templates: List of #lglTemplate structures * @utf8_filename: Filename of templates file (name encoded as UTF-8) * - * Write a list of #glTemplate structures to a glabels XML template file. + * Write a list of #lglTemplate structures to a glabels XML template file. * */ void -gl_xml_template_write_templates_to_file (GList *templates, - const gchar *utf8_filename) +lgl_xml_template_write_templates_to_file (GList *templates, + const gchar *utf8_filename) { xmlDocPtr doc; xmlNsPtr ns; gint xml_ret; GList *p; - glTemplate *template; + lglTemplate *template; gchar *filename; doc = xmlNewDoc ((xmlChar *)"1.0"); doc->xmlRootNode = xmlNewDocNode (doc, NULL, (xmlChar *)"Glabels-templates", NULL); - ns = xmlNewNs (doc->xmlRootNode, (xmlChar *)GL_XML_NAME_SPACE, NULL); + ns = xmlNewNs (doc->xmlRootNode, (xmlChar *)LGL_XML_NAME_SPACE, NULL); xmlSetNs (doc->xmlRootNode, ns); for (p=templates; p!=NULL; p=p->next) { - template = (glTemplate *)p->data; - gl_xml_template_create_template_node (template, doc->xmlRootNode, ns); + template = (lglTemplate *)p->data; + lgl_xml_template_create_template_node (template, doc->xmlRootNode, ns); } filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL); @@ -640,62 +635,65 @@ gl_xml_template_write_templates_to_file (GList *templates, /** - * gl_xml_template_write_template_to_file: - * @template: #glTemplate structure to be written + * lgl_xml_template_write_template_to_file: + * @template: #lglTemplate structure to be written * @utf8_filename: Filename of templates file (name encoded as UTF-8) * - * Write a single #glTemplate structures to a glabels XML template file. + * Write a single #lglTemplate structures to a glabels XML template file. * */ void -gl_xml_template_write_template_to_file (const glTemplate *template, - const gchar *utf8_filename) +lgl_xml_template_write_template_to_file (const lglTemplate *template, + const gchar *utf8_filename) { GList *templates = NULL; templates = g_list_append (templates, (gpointer)template); - gl_xml_template_write_templates_to_file (templates, utf8_filename); + lgl_xml_template_write_templates_to_file (templates, utf8_filename); g_list_free (templates); } /** - * gl_xml_template_create_template_node: - * @template: #glTemplate structure to be written + * lgl_xml_template_create_template_node: + * @template: #lglTemplate structure to be written * @root: parent node to receive new child node * @ns: a libxml #xmlNsPtr * - * Add a single #glTemplate child node to given #xmlNodePtr. + * Add a single #lglTemplate child node to given #xmlNodePtr. * */ void -gl_xml_template_create_template_node (const glTemplate *template, - xmlNodePtr root, - const xmlNsPtr ns) +lgl_xml_template_create_template_node (const lglTemplate *template, + xmlNodePtr root, + const xmlNsPtr ns) { - xmlNodePtr node; - GList *p; - glTemplateLabelType *label_type; + xmlNodePtr node; + GList *p; + lglTemplateFrame *frame; node = xmlNewChild (root, ns, (xmlChar *)"Template", NULL); - gl_xml_set_prop_string (node, "name", template->name); + lgl_xml_set_prop_string (node, "name", template->name); - gl_xml_set_prop_string (node, "size", template->page_size); + lgl_xml_set_prop_string (node, "size", template->page_size); if (xmlStrEqual ((xmlChar *)template->page_size, (xmlChar *)"Other")) { - gl_xml_set_prop_length (node, "width", template->page_width); - gl_xml_set_prop_length (node, "height", template->page_height); + lgl_xml_set_prop_length (node, "width", template->page_width); + lgl_xml_set_prop_length (node, "height", template->page_height); } - gl_xml_set_prop_string (node, "description", template->description); + lgl_xml_set_prop_string (node, "description", template->description); - for ( p=template->label_types; p != NULL; p=p->next ) { - label_type = (glTemplateLabelType *)p->data; - xml_create_label_node (label_type, node, ns); + for ( p=template->categories; p != NULL; p=p->next ) { + xml_create_meta_node ( p->data, node, ns ); + } + for ( p=template->frames; p != NULL; p=p->next ) { + frame = (lglTemplateFrame *)p->data; + xml_create_label_node (frame, node, ns); } for ( p=template->aliases; p != NULL; p=p->next ) { @@ -717,7 +715,7 @@ xml_create_meta_node (const gchar *category, xmlNodePtr node; node = xmlNewChild (root, ns, (xmlChar *)"Meta", NULL); - gl_xml_set_prop_string (node, "category", category); + lgl_xml_set_prop_string (node, "category", category); } @@ -725,46 +723,46 @@ xml_create_meta_node (const gchar *category, /* PRIVATE. Add XML Template->Label Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_label_node (const glTemplateLabelType *label_type, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_label_node (const lglTemplateFrame *frame, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; GList *p; - glTemplateMarkup *markup; - glTemplateLayout *layout; + lglTemplateMarkup *markup; + lglTemplateLayout *layout; - switch (label_type->shape) { + switch (frame->shape) { - case GL_TEMPLATE_SHAPE_RECT: + case LGL_TEMPLATE_FRAME_SHAPE_RECT: node = xmlNewChild(root, ns, (xmlChar *)"Label-rectangle", NULL); - gl_xml_set_prop_string (node, "id", label_type->id); - gl_xml_set_prop_length (node, "width", label_type->size.rect.w); - gl_xml_set_prop_length (node, "height", label_type->size.rect.h); - gl_xml_set_prop_length (node, "round", label_type->size.rect.r); - gl_xml_set_prop_length (node, "x_waste", label_type->size.rect.x_waste); - gl_xml_set_prop_length (node, "y_waste", label_type->size.rect.y_waste); + lgl_xml_set_prop_string (node, "id", frame->all.id); + lgl_xml_set_prop_length (node, "width", frame->rect.w); + lgl_xml_set_prop_length (node, "height", frame->rect.h); + lgl_xml_set_prop_length (node, "round", frame->rect.r); + lgl_xml_set_prop_length (node, "x_waste", frame->rect.x_waste); + lgl_xml_set_prop_length (node, "y_waste", frame->rect.y_waste); break; - case GL_TEMPLATE_SHAPE_ROUND: + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: node = xmlNewChild(root, ns, (xmlChar *)"Label-round", NULL); - gl_xml_set_prop_string (node, "id", label_type->id); - gl_xml_set_prop_length (node, "radius", label_type->size.round.r); - gl_xml_set_prop_length (node, "waste", label_type->size.round.waste); + lgl_xml_set_prop_string (node, "id", frame->all.id); + lgl_xml_set_prop_length (node, "radius", frame->round.r); + lgl_xml_set_prop_length (node, "waste", frame->round.waste); break; - case GL_TEMPLATE_SHAPE_CD: + case LGL_TEMPLATE_FRAME_SHAPE_CD: node = xmlNewChild(root, ns, (xmlChar *)"Label-cd", NULL); - gl_xml_set_prop_string (node, "id", label_type->id); - gl_xml_set_prop_length (node, "radius", label_type->size.cd.r1); - gl_xml_set_prop_length (node, "hole", label_type->size.cd.r2); - if (label_type->size.cd.w != 0.0) { - gl_xml_set_prop_length (node, "width", label_type->size.cd.w); + lgl_xml_set_prop_string (node, "id", frame->all.id); + lgl_xml_set_prop_length (node, "radius", frame->cd.r1); + lgl_xml_set_prop_length (node, "hole", frame->cd.r2); + if (frame->cd.w != 0.0) { + lgl_xml_set_prop_length (node, "width", frame->cd.w); } - if (label_type->size.cd.h != 0.0) { - gl_xml_set_prop_length (node, "height", label_type->size.cd.h); + if (frame->cd.h != 0.0) { + lgl_xml_set_prop_length (node, "height", frame->cd.h); } - gl_xml_set_prop_length (node, "waste", label_type->size.cd.waste); + lgl_xml_set_prop_length (node, "waste", frame->cd.waste); break; default: @@ -774,19 +772,19 @@ xml_create_label_node (const glTemplateLabelType *label_type, } - for ( p=label_type->markups; p != NULL; p=p->next ) { - markup = (glTemplateMarkup *)p->data; + for ( p=frame->all.markups; p != NULL; p=p->next ) { + markup = (lglTemplateMarkup *)p->data; switch (markup->type) { - case GL_TEMPLATE_MARKUP_MARGIN: + case LGL_TEMPLATE_MARKUP_MARGIN: xml_create_markup_margin_node (markup, node, ns); break; - case GL_TEMPLATE_MARKUP_LINE: + case LGL_TEMPLATE_MARKUP_LINE: xml_create_markup_line_node (markup, node, ns); break; - case GL_TEMPLATE_MARKUP_CIRCLE: + case LGL_TEMPLATE_MARKUP_CIRCLE: xml_create_markup_circle_node (markup, node, ns); break; - case GL_TEMPLATE_MARKUP_RECT: + case LGL_TEMPLATE_MARKUP_RECT: xml_create_markup_rect_node (markup, node, ns); break; default: @@ -795,8 +793,8 @@ xml_create_label_node (const glTemplateLabelType *label_type, } } - for ( p=label_type->layouts; p != NULL; p=p->next ) { - layout = (glTemplateLayout *)p->data; + for ( p=frame->all.layouts; p != NULL; p=p->next ) { + layout = (lglTemplateLayout *)p->data; xml_create_layout_node (layout, node, ns); } @@ -806,19 +804,19 @@ xml_create_label_node (const glTemplateLabelType *label_type, /* PRIVATE. Add XML Template->Label->Layout Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_layout_node (const glTemplateLayout *layout, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_layout_node (const lglTemplateLayout *layout, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; node = xmlNewChild(root, ns, (xmlChar *)"Layout", NULL); - gl_xml_set_prop_int (node, "nx", layout->nx); - gl_xml_set_prop_int (node, "ny", layout->ny); - gl_xml_set_prop_length (node, "x0", layout->x0); - gl_xml_set_prop_length (node, "y0", layout->y0); - gl_xml_set_prop_length (node, "dx", layout->dx); - gl_xml_set_prop_length (node, "dy", layout->dy); + lgl_xml_set_prop_int (node, "nx", layout->nx); + lgl_xml_set_prop_int (node, "ny", layout->ny); + lgl_xml_set_prop_length (node, "x0", layout->x0); + lgl_xml_set_prop_length (node, "y0", layout->y0); + lgl_xml_set_prop_length (node, "dx", layout->dx); + lgl_xml_set_prop_length (node, "dy", layout->dy); } @@ -826,15 +824,15 @@ xml_create_layout_node (const glTemplateLayout *layout, /* PRIVATE. Add XML Template->Label->Markup-margin Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_markup_margin_node (const glTemplateMarkup *markup, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_markup_margin_node (const lglTemplateMarkup *markup, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; node = xmlNewChild(root, ns, (xmlChar *)"Markup-margin", NULL); - gl_xml_set_prop_length (node, "size", markup->data.margin.size); + lgl_xml_set_prop_length (node, "size", markup->margin.size); } @@ -842,18 +840,18 @@ xml_create_markup_margin_node (const glTemplateMarkup *markup, /* PRIVATE. Add XML Template->Label->Markup-line Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_markup_line_node (const glTemplateMarkup *markup, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_markup_line_node (const lglTemplateMarkup *markup, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; node = xmlNewChild(root, ns, (xmlChar *)"Markup-line", NULL); - gl_xml_set_prop_length (node, "x1", markup->data.line.x1); - gl_xml_set_prop_length (node, "y1", markup->data.line.y1); - gl_xml_set_prop_length (node, "x2", markup->data.line.x2); - gl_xml_set_prop_length (node, "y2", markup->data.line.y2); + lgl_xml_set_prop_length (node, "x1", markup->line.x1); + lgl_xml_set_prop_length (node, "y1", markup->line.y1); + lgl_xml_set_prop_length (node, "x2", markup->line.x2); + lgl_xml_set_prop_length (node, "y2", markup->line.y2); } @@ -861,17 +859,17 @@ xml_create_markup_line_node (const glTemplateMarkup *markup, /* PRIVATE. Add XML Template->Label->Markup-circle Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_markup_circle_node (const glTemplateMarkup *markup, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_markup_circle_node (const lglTemplateMarkup *markup, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; node = xmlNewChild(root, ns, (xmlChar *)"Markup-circle", NULL); - gl_xml_set_prop_length (node, "x0", markup->data.circle.x0); - gl_xml_set_prop_length (node, "y0", markup->data.circle.y0); - gl_xml_set_prop_length (node, "radius", markup->data.circle.r); + lgl_xml_set_prop_length (node, "x0", markup->circle.x0); + lgl_xml_set_prop_length (node, "y0", markup->circle.y0); + lgl_xml_set_prop_length (node, "radius", markup->circle.r); } @@ -879,19 +877,19 @@ xml_create_markup_circle_node (const glTemplateMarkup *markup, /* PRIVATE. Add XML Template->Label->Markup-rect Node. */ /*--------------------------------------------------------------------------*/ static void -xml_create_markup_rect_node (const glTemplateMarkup *markup, - xmlNodePtr root, - const xmlNsPtr ns) +xml_create_markup_rect_node (const lglTemplateMarkup *markup, + xmlNodePtr root, + const xmlNsPtr ns) { xmlNodePtr node; node = xmlNewChild(root, ns, (xmlChar *)"Markup-rect", NULL); - gl_xml_set_prop_length (node, "x1", markup->data.rect.x1); - gl_xml_set_prop_length (node, "y1", markup->data.rect.y1); - gl_xml_set_prop_length (node, "w", markup->data.rect.w); - gl_xml_set_prop_length (node, "h", markup->data.rect.h); - gl_xml_set_prop_length (node, "r", markup->data.rect.r); + lgl_xml_set_prop_length (node, "x1", markup->rect.x1); + lgl_xml_set_prop_length (node, "y1", markup->rect.y1); + lgl_xml_set_prop_length (node, "w", markup->rect.w); + lgl_xml_set_prop_length (node, "h", markup->rect.h); + lgl_xml_set_prop_length (node, "r", markup->rect.r); } @@ -906,7 +904,7 @@ xml_create_alias_node (const gchar *name, xmlNodePtr node; node = xmlNewChild (root, ns, (xmlChar *)"Alias", NULL); - gl_xml_set_prop_string (node, "name", name); + lgl_xml_set_prop_string (node, "name", name); } diff --git a/glabels2/libglabels/xml-template.h b/glabels2/libglabels/xml-template.h index 1d1632f1..ec704c2a 100644 --- a/glabels2/libglabels/xml-template.h +++ b/glabels2/libglabels/xml-template.h @@ -33,24 +33,24 @@ G_BEGIN_DECLS -GList *gl_xml_template_read_templates_from_file (const gchar *utf8_filename); +GList *lgl_xml_template_read_templates_from_file (const gchar *utf8_filename); -GList *gl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc); +GList *lgl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc); -glTemplate *gl_xml_template_parse_template_node (const xmlNodePtr template_node); +lglTemplate *lgl_xml_template_parse_template_node (const xmlNodePtr template_node); -void gl_xml_template_write_templates_to_file (GList *templates, - const gchar *utf8_filename); +void lgl_xml_template_write_templates_to_file (GList *templates, + const gchar *utf8_filename); -void gl_xml_template_write_template_to_file (const glTemplate *template, - const gchar *utf8_filename); +void lgl_xml_template_write_template_to_file (const lglTemplate *template, + const gchar *utf8_filename); -xmlDocPtr gl_xml_template_create_templates_doc (GList *templates); +xmlDocPtr lgl_xml_template_create_templates_doc (GList *templates); -void gl_xml_template_create_template_node (const glTemplate *template, - xmlNodePtr root, - const xmlNsPtr ns); +void lgl_xml_template_create_template_node (const lglTemplate *template, + xmlNodePtr root, + const xmlNsPtr ns); G_END_DECLS diff --git a/glabels2/libglabels/xml.c b/glabels2/libglabels/xml.c index 19fab3f9..0943d908 100644 --- a/glabels2/libglabels/xml.c +++ b/glabels2/libglabels/xml.c @@ -62,23 +62,23 @@ static UnitTableEntry unit_table[] = { /* These names are identical to the absolute length units supported in the CSS2 Specification (Section 4.3.2) */ - /* This table must be sorted exactly as the enumerations in glUnitsType */ + /* This table must be sorted exactly as the enumerations in lglUnitsType */ - /* [GL_UNITS_POINT] */ {(xmlChar *)"pt", POINTS_PER_POINT}, - /* [GL_UNITS_INCH] */ {(xmlChar *)"in", POINTS_PER_INCH}, - /* [GL_UNITS_MM] */ {(xmlChar *)"mm", POINTS_PER_MM}, - /* [GL_UNITS_CM] */ {(xmlChar *)"cm", POINTS_PER_CM}, - /* [GL_UNITS_PICA] */ {(xmlChar *)"pc", POINTS_PER_PICA}, + /* [LGL_UNITS_POINT] */ {(xmlChar *)"pt", POINTS_PER_POINT}, + /* [LGL_UNITS_INCH] */ {(xmlChar *)"in", POINTS_PER_INCH}, + /* [LGL_UNITS_MM] */ {(xmlChar *)"mm", POINTS_PER_MM}, + /* [LGL_UNITS_CM] */ {(xmlChar *)"cm", POINTS_PER_CM}, + /* [LGL_UNITS_PICA] */ {(xmlChar *)"pc", POINTS_PER_PICA}, }; -static glUnitsType default_units = GL_UNITS_POINT; +static lglUnitsType default_units = LGL_UNITS_POINT; /****************************************************************************/ /** - * gl_xml_get_prop_string: + * lgl_xml_get_prop_string: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -90,9 +90,9 @@ static glUnitsType default_units = GL_UNITS_POINT; * */ gchar * -gl_xml_get_prop_string (xmlNodePtr node, - const gchar *property, - const gchar *default_val) +lgl_xml_get_prop_string (xmlNodePtr node, + const gchar *property, + const gchar *default_val) { gchar *val; xmlChar *string; @@ -113,7 +113,7 @@ gl_xml_get_prop_string (xmlNodePtr node, /** - * gl_xml_get_prop_i18n_string: + * lgl_xml_get_prop_i18n_string: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -125,9 +125,9 @@ gl_xml_get_prop_string (xmlNodePtr node, * */ gchar * -gl_xml_get_prop_i18n_string (xmlNodePtr node, - const gchar *property, - const gchar *default_val) +lgl_xml_get_prop_i18n_string (xmlNodePtr node, + const gchar *property, + const gchar *default_val) { gchar *_property; gchar *val; @@ -161,7 +161,7 @@ gl_xml_get_prop_i18n_string (xmlNodePtr node, /** - * gl_xml_get_prop_double: + * lgl_xml_get_prop_double: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -172,9 +172,9 @@ gl_xml_get_prop_i18n_string (xmlNodePtr node, * */ gdouble -gl_xml_get_prop_double (xmlNodePtr node, - const gchar *property, - gdouble default_val) +lgl_xml_get_prop_double (xmlNodePtr node, + const gchar *property, + gdouble default_val) { gdouble val; xmlChar *string; @@ -191,7 +191,7 @@ gl_xml_get_prop_double (xmlNodePtr node, /** - * gl_xml_get_prop_boolean: + * lgl_xml_get_prop_boolean: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -202,7 +202,7 @@ gl_xml_get_prop_double (xmlNodePtr node, * */ gboolean -gl_xml_get_prop_boolean (xmlNodePtr node, +lgl_xml_get_prop_boolean (xmlNodePtr node, const gchar *property, gboolean default_val) { @@ -222,7 +222,7 @@ gl_xml_get_prop_boolean (xmlNodePtr node, /** - * gl_xml_get_prop_int: + * lgl_xml_get_prop_int: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -233,9 +233,9 @@ gl_xml_get_prop_boolean (xmlNodePtr node, * */ gint -gl_xml_get_prop_int (xmlNodePtr node, - const gchar *property, - gint default_val) +lgl_xml_get_prop_int (xmlNodePtr node, + const gchar *property, + gint default_val) { gint val; xmlChar *string; @@ -252,7 +252,7 @@ gl_xml_get_prop_int (xmlNodePtr node, /** - * gl_xml_get_prop_uint: + * lgl_xml_get_prop_uint: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -263,9 +263,9 @@ gl_xml_get_prop_int (xmlNodePtr node, * */ guint -gl_xml_get_prop_uint (xmlNodePtr node, - const gchar *property, - guint default_val) +lgl_xml_get_prop_uint (xmlNodePtr node, + const gchar *property, + guint default_val) { guint val; xmlChar *string; @@ -282,7 +282,7 @@ gl_xml_get_prop_uint (xmlNodePtr node, /** - * gl_xml_get_prop_length: + * lgl_xml_get_prop_length: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @default_val: a default value to return if property not found @@ -298,9 +298,9 @@ gl_xml_get_prop_uint (xmlNodePtr node, * */ gdouble -gl_xml_get_prop_length (xmlNodePtr node, - const gchar *property, - gdouble default_val) +lgl_xml_get_prop_length (xmlNodePtr node, + const gchar *property, + gdouble default_val) { gdouble val; xmlChar *string; @@ -315,14 +315,14 @@ gl_xml_get_prop_length (xmlNodePtr node, if (unit != string) { unit = (xmlChar *)g_strchug ((gchar *)unit); if (strlen ((char *)unit) > 0 ) { - for (i=GL_UNITS_FIRST; i<=GL_UNITS_LAST; i++) { + for (i=LGL_UNITS_FIRST; i<=LGL_UNITS_LAST; i++) { if (xmlStrcasecmp (unit, unit_table[i].name) == 0) { val *= unit_table[i].points_per_unit; break; } } - if (i>GL_UNITS_LAST) { - g_message ("Line %d, Node \"%s\", Property \"%s\": Unknown unit \"%s\", assuming points", + if (i>LGL_UNITS_LAST) { + g_message ("Line %ld, Node \"%s\", Property \"%s\": Unknown unit \"%s\", assuming points", xmlGetLineNo (node), node->name, property, unit); } @@ -341,7 +341,7 @@ gl_xml_get_prop_length (xmlNodePtr node, /** - * gl_xml_set_prop_string: + * lgl_xml_set_prop_string: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the value to set @@ -350,9 +350,9 @@ gl_xml_get_prop_length (xmlNodePtr node, * */ void -gl_xml_set_prop_string (xmlNodePtr node, - const gchar *property, - const gchar *val) +lgl_xml_set_prop_string (xmlNodePtr node, + const gchar *property, + const gchar *val) { if (val != NULL) { xmlSetProp (node, (xmlChar *)property, (xmlChar *)val); @@ -361,7 +361,7 @@ gl_xml_set_prop_string (xmlNodePtr node, /** - * gl_xml_set_prop_double: + * lgl_xml_set_prop_double: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the value to set @@ -370,9 +370,9 @@ gl_xml_set_prop_string (xmlNodePtr node, * */ void -gl_xml_set_prop_double (xmlNodePtr node, - const gchar *property, - gdouble val) +lgl_xml_set_prop_double (xmlNodePtr node, + const gchar *property, + gdouble val) { gchar *string, buffer[G_ASCII_DTOSTR_BUF_SIZE]; @@ -384,7 +384,7 @@ gl_xml_set_prop_double (xmlNodePtr node, /** - * gl_xml_set_prop_boolean: + * lgl_xml_set_prop_boolean: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the value to set @@ -393,15 +393,15 @@ gl_xml_set_prop_double (xmlNodePtr node, * */ void -gl_xml_set_prop_boolean (xmlNodePtr node, - const gchar *property, - gboolean val) +lgl_xml_set_prop_boolean (xmlNodePtr node, + const gchar *property, + gboolean val) { xmlSetProp (node, (xmlChar *)property, (xmlChar *)(val ? "True" : "False")); } /** - * gl_xml_set_prop_int: + * lgl_xml_set_prop_int: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the value to set @@ -410,9 +410,9 @@ gl_xml_set_prop_boolean (xmlNodePtr node, * */ void -gl_xml_set_prop_int (xmlNodePtr node, - const gchar *property, - gint val) +lgl_xml_set_prop_int (xmlNodePtr node, + const gchar *property, + gint val) { gchar *string; @@ -422,7 +422,7 @@ gl_xml_set_prop_int (xmlNodePtr node, } /** - * gl_xml_set_prop_uint_hex: + * lgl_xml_set_prop_uint_hex: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the value to set @@ -431,9 +431,9 @@ gl_xml_set_prop_int (xmlNodePtr node, * */ void -gl_xml_set_prop_uint_hex (xmlNodePtr node, - const gchar *property, - guint val) +lgl_xml_set_prop_uint_hex (xmlNodePtr node, + const gchar *property, + guint val) { gchar *string; @@ -443,7 +443,7 @@ gl_xml_set_prop_uint_hex (xmlNodePtr node, } /** - * gl_xml_set_prop_length: + * lgl_xml_set_prop_length: * @node: the libxml2 #xmlNodePtr of the node * @property: the property name * @val: the length to set in internal units (points) @@ -451,13 +451,13 @@ gl_xml_set_prop_uint_hex (xmlNodePtr node, * Set a property from a length, performing any necessary conversion. * Length properties are formatted as a number followed by a units string. * The units of the formatted property is determined by the most recent call to - * gl_xml_set_default_units(). + * lgl_xml_set_default_units(). * */ void -gl_xml_set_prop_length (xmlNodePtr node, - const gchar *property, - gdouble val) +lgl_xml_set_prop_length (xmlNodePtr node, + const gchar *property, + gdouble val) { gchar *string, buffer[G_ASCII_DTOSTR_BUF_SIZE]; gchar *string_unit; @@ -474,9 +474,9 @@ gl_xml_set_prop_length (xmlNodePtr node, } /** - * gl_xml_is_node + * lgl_xml_is_node * @node: the libxml2 #xmlNodePtr of the node - * @property: the node name + * @name : the node name * * Test if a node name matches given name. * @@ -484,15 +484,15 @@ gl_xml_set_prop_length (xmlNodePtr node, * */ gboolean -gl_xml_is_node (xmlNodePtr node, - const gchar *name) +lgl_xml_is_node (xmlNodePtr node, + const gchar *name) { return xmlStrEqual (node->name, (xmlChar *)name); } /** - * gl_xml_get_node_content + * lgl_xml_get_node_content * @node: the libxml2 #xmlNodePtr of the node * * Get the content of a node. @@ -501,7 +501,7 @@ gl_xml_is_node (xmlNodePtr node, * be freed with g_free(). */ gchar * -gl_xml_get_node_content (xmlNodePtr node) +lgl_xml_get_node_content (xmlNodePtr node) { xmlChar *xml_content; gchar *g_content; @@ -521,17 +521,17 @@ gl_xml_get_node_content (xmlNodePtr node) /** - * gl_xml_set_default_units: - * @units: default units selection (#glUnitsType) + * lgl_xml_set_default_units: + * @units: default units selection (#lglUnitsType) * * Set the default units when formatting lengths. See - * gl_xml_set_prop_length(). + * lgl_xml_set_prop_length(). * */ void -gl_xml_set_default_units (glUnitsType units) +lgl_xml_set_default_units (lglUnitsType units) { - g_return_if_fail ((units >= GL_UNITS_FIRST) && (units <= GL_UNITS_LAST)); + g_return_if_fail ((units >= LGL_UNITS_FIRST) && (units <= LGL_UNITS_LAST)); default_units = units; } diff --git a/glabels2/libglabels/xml.h b/glabels2/libglabels/xml.h index 4b3bb056..3bfd01a4 100644 --- a/glabels2/libglabels/xml.h +++ b/glabels2/libglabels/xml.h @@ -31,81 +31,81 @@ #include "enums.h" -#define GL_XML_NAME_SPACE "http://snaught.com/glabels/2.0/" +#define LGL_XML_NAME_SPACE "http://snaught.com/glabels/2.0/" G_BEGIN_DECLS /* * Get property functions */ -gchar * gl_xml_get_prop_string (xmlNodePtr node, - const gchar *property, - const gchar *default_val); +gchar * lgl_xml_get_prop_string (xmlNodePtr node, + const gchar *property, + const gchar *default_val); -gchar * gl_xml_get_prop_i18n_string (xmlNodePtr node, - const gchar *property, - const gchar *default_val); +gchar * lgl_xml_get_prop_i18n_string (xmlNodePtr node, + const gchar *property, + const gchar *default_val); -gdouble gl_xml_get_prop_double (xmlNodePtr node, - const gchar *property, - gdouble default_val); +gdouble lgl_xml_get_prop_double (xmlNodePtr node, + const gchar *property, + gdouble default_val); -gboolean gl_xml_get_prop_boolean (xmlNodePtr node, - const gchar *property, - gboolean default_val); +gboolean lgl_xml_get_prop_boolean (xmlNodePtr node, + const gchar *property, + gboolean default_val); -gint gl_xml_get_prop_int (xmlNodePtr node, - const gchar *property, - gint default_val); +gint lgl_xml_get_prop_int (xmlNodePtr node, + const gchar *property, + gint default_val); -guint gl_xml_get_prop_uint (xmlNodePtr node, - const gchar *property, - guint default_val); +guint lgl_xml_get_prop_uint (xmlNodePtr node, + const gchar *property, + guint default_val); -gdouble gl_xml_get_prop_length (xmlNodePtr node, - const gchar *property, - gdouble default_val); +gdouble lgl_xml_get_prop_length (xmlNodePtr node, + const gchar *property, + gdouble default_val); /* * Set property functions */ -void gl_xml_set_prop_string (xmlNodePtr node, - const gchar *property, - const gchar *val); +void lgl_xml_set_prop_string (xmlNodePtr node, + const gchar *property, + const gchar *val); -void gl_xml_set_prop_double (xmlNodePtr node, - const gchar *property, - gdouble val); +void lgl_xml_set_prop_double (xmlNodePtr node, + const gchar *property, + gdouble val); -void gl_xml_set_prop_boolean (xmlNodePtr node, - const gchar *property, - gboolean val); +void lgl_xml_set_prop_boolean (xmlNodePtr node, + const gchar *property, + gboolean val); -void gl_xml_set_prop_int (xmlNodePtr node, - const gchar *property, - gint val); +void lgl_xml_set_prop_int (xmlNodePtr node, + const gchar *property, + gint val); -void gl_xml_set_prop_uint_hex (xmlNodePtr node, - const gchar *property, - guint val); +void lgl_xml_set_prop_uint_hex (xmlNodePtr node, + const gchar *property, + guint val); -void gl_xml_set_prop_length (xmlNodePtr node, - const gchar *property, - gdouble val); +void lgl_xml_set_prop_length (xmlNodePtr node, + const gchar *property, + gdouble val); /* * Other node functions */ -gboolean gl_xml_is_node (xmlNodePtr node, - const gchar *name); +gboolean lgl_xml_is_node (xmlNodePtr node, + const gchar *name); -gchar * gl_xml_get_node_content (xmlNodePtr node); +gchar * lgl_xml_get_node_content (xmlNodePtr node); /* * Misc functions */ -void gl_xml_set_default_units (glUnitsType units); +void lgl_xml_set_default_units (lglUnitsType units); G_END_DECLS diff --git a/glabels2/src/cairo-label-path.c b/glabels2/src/cairo-label-path.c index cb63bb26..d9861f6e 100644 --- a/glabels2/src/cairo-label-path.c +++ b/glabels2/src/cairo-label-path.c @@ -44,15 +44,15 @@ /*===========================================*/ static void gl_cairo_rect_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag); static void gl_cairo_round_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag); static void gl_cairo_cd_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag); @@ -62,27 +62,27 @@ static void gl_cairo_cd_label_path (cairo_t *cr, /*--------------------------------------------------------------------------*/ void gl_cairo_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); - switch (label_type->shape) { + switch (frame->shape) { - case GL_TEMPLATE_SHAPE_RECT: + case LGL_TEMPLATE_FRAME_SHAPE_RECT: gl_cairo_rect_label_path (cr, template, rotate_flag, waste_flag); break; - case GL_TEMPLATE_SHAPE_ROUND: + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: gl_cairo_round_label_path (cr, template, rotate_flag, waste_flag); break; - case GL_TEMPLATE_SHAPE_CD: + case LGL_TEMPLATE_FRAME_SHAPE_CD: gl_cairo_cd_label_path (cr, template, rotate_flag, waste_flag); break; @@ -99,38 +99,38 @@ gl_cairo_label_path (cairo_t *cr, /*--------------------------------------------------------------------------*/ static void gl_cairo_rect_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag) { - const glTemplateLabelType *label_type; - gdouble w, h, r; - gdouble x_waste, y_waste; + const lglTemplateFrame *frame; + gdouble w, h, r; + gdouble x_waste, y_waste; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (template); - r = label_type->size.rect.r; + frame = lgl_template_get_first_frame (template); + r = frame->rect.r; x_waste = 0.0; y_waste = 0.0; if (rotate_flag) { - gl_template_get_label_size (label_type, &h, &w); + lgl_template_frame_get_size (frame, &h, &w); if (waste_flag) { - x_waste = label_type->size.rect.y_waste; - y_waste = label_type->size.rect.x_waste; + x_waste = frame->rect.y_waste; + y_waste = frame->rect.x_waste; } } else { - gl_template_get_label_size (label_type, &w, &h); + lgl_template_frame_get_size (frame, &w, &h); if (waste_flag) { - x_waste = label_type->size.rect.x_waste; - y_waste = label_type->size.rect.y_waste; + x_waste = frame->rect.x_waste; + y_waste = frame->rect.y_waste; } } @@ -157,30 +157,30 @@ gl_cairo_rect_label_path (cairo_t *cr, /*--------------------------------------------------------------------------*/ static void gl_cairo_round_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag) { - const glTemplateLabelType *label_type; - gdouble w, h; - gdouble waste; + const lglTemplateFrame *frame; + gdouble w, h; + gdouble waste; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); if (rotate_flag) { - gl_template_get_label_size (label_type, &h, &w); + lgl_template_frame_get_size (frame, &h, &w); } else { - gl_template_get_label_size (label_type, &w, &h); + lgl_template_frame_get_size (frame, &w, &h); } if (waste_flag) { - waste = label_type->size.round.waste; + waste = frame->round.waste; } else { @@ -198,39 +198,39 @@ gl_cairo_round_label_path (cairo_t *cr, /*--------------------------------------------------------------------------*/ static void gl_cairo_cd_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag) { - const glTemplateLabelType *label_type; - gdouble w, h; - gdouble xc, yc; - gdouble r1, r2; - gdouble theta1, theta2; - gdouble waste; + const lglTemplateFrame *frame; + gdouble w, h; + gdouble xc, yc; + gdouble r1, r2; + gdouble theta1, theta2; + gdouble waste; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); if (rotate_flag) { - gl_template_get_label_size (label_type, &h, &w); + lgl_template_frame_get_size (frame, &h, &w); } else { - gl_template_get_label_size (label_type, &w, &h); + lgl_template_frame_get_size (frame, &w, &h); } xc = w/2.0; yc = h/2.0; - r1 = label_type->size.cd.r1; - r2 = label_type->size.cd.r2; + r1 = frame->cd.r1; + r2 = frame->cd.r2; if (waste_flag) { - waste = label_type->size.cd.waste; + waste = frame->cd.waste; } else { diff --git a/glabels2/src/cairo-label-path.h b/glabels2/src/cairo-label-path.h index 386f63b3..ad0495f5 100644 --- a/glabels2/src/cairo-label-path.h +++ b/glabels2/src/cairo-label-path.h @@ -31,7 +31,7 @@ G_BEGIN_DECLS void gl_cairo_label_path (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag, gboolean waste_flag); diff --git a/glabels2/src/cairo-markup-path.c b/glabels2/src/cairo-markup-path.c index 8889b376..191782e6 100644 --- a/glabels2/src/cairo-markup-path.c +++ b/glabels2/src/cairo-markup-path.c @@ -43,53 +43,53 @@ /* Local function prototypes */ /*===========================================*/ -static void gl_cairo_markup_margin_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label); +static void gl_cairo_markup_margin_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label); -static void gl_cairo_markup_margin_rect_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label); +static void gl_cairo_markup_margin_rect_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label); -static void gl_cairo_markup_margin_round_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label); +static void gl_cairo_markup_margin_round_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label); -static void gl_cairo_markup_margin_cd_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label); +static void gl_cairo_markup_margin_cd_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label); -static void gl_cairo_markup_line_path (cairo_t *cr, - const glTemplateMarkup *markup); +static void gl_cairo_markup_line_path (cairo_t *cr, + const lglTemplateMarkup *markup); -static void gl_cairo_markup_circle_path (cairo_t *cr, - const glTemplateMarkup *markup); +static void gl_cairo_markup_circle_path (cairo_t *cr, + const lglTemplateMarkup *markup); -static void gl_cairo_markup_rect_path (cairo_t *cr, - const glTemplateMarkup *markup); +static void gl_cairo_markup_rect_path (cairo_t *cr, + const lglTemplateMarkup *markup); /*--------------------------------------------------------------------------*/ /* Create markup path */ /*--------------------------------------------------------------------------*/ void -gl_cairo_markup_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label) +gl_cairo_markup_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label) { gl_debug (DEBUG_PATH, "START"); switch (markup->type) { - case GL_TEMPLATE_MARKUP_MARGIN: + case LGL_TEMPLATE_MARKUP_MARGIN: gl_cairo_markup_margin_path (cr, markup, label); break; - case GL_TEMPLATE_MARKUP_LINE: + case LGL_TEMPLATE_MARKUP_LINE: gl_cairo_markup_line_path (cr, markup); break; - case GL_TEMPLATE_MARKUP_CIRCLE: + case LGL_TEMPLATE_MARKUP_CIRCLE: gl_cairo_markup_circle_path (cr, markup); break; - case GL_TEMPLATE_MARKUP_RECT: + case LGL_TEMPLATE_MARKUP_RECT: gl_cairo_markup_rect_path (cr, markup); break; default: @@ -105,26 +105,26 @@ gl_cairo_markup_path (cairo_t *cr, /*---------------------------------------------------------------------------*/ static void gl_cairo_markup_margin_path (cairo_t *cr, - const glTemplateMarkup *markup, + const lglTemplateMarkup *markup, glLabel *label) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); - switch (label_type->shape) { + switch (frame->shape) { - case GL_TEMPLATE_SHAPE_RECT: + case LGL_TEMPLATE_FRAME_SHAPE_RECT: gl_cairo_markup_margin_rect_path (cr, markup, label); break; - case GL_TEMPLATE_SHAPE_ROUND: + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: gl_cairo_markup_margin_round_path (cr, markup, label); break; - case GL_TEMPLATE_SHAPE_CD: + case LGL_TEMPLATE_FRAME_SHAPE_CD: gl_cairo_markup_margin_cd_path (cr, markup, label); break; @@ -140,23 +140,23 @@ gl_cairo_markup_margin_path (cairo_t *cr, /* PRIVATE. Draw simple recangular margin. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_margin_rect_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label) +gl_cairo_markup_margin_rect_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label) { - const glTemplateLabelType *label_type; - gdouble w, h, r, m; + const lglTemplateFrame *frame; + gdouble w, h, r, m; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); - m = markup->data.margin.size; + m = markup->margin.size; gl_label_get_size (label, &w, &h); w = w - 2*m; h = h - 2*m; - r = MAX (label_type->size.rect.r - m, 0.0); + r = MAX (frame->rect.r - m, 0.0); if ( r == 0.0 ) { @@ -179,19 +179,19 @@ gl_cairo_markup_margin_rect_path (cairo_t *cr, /* PRIVATE. Draw round margin. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_margin_round_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label) +gl_cairo_markup_margin_round_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label) { - const glTemplateLabelType *label_type; - gdouble r, m; + const lglTemplateFrame *frame; + gdouble r, m; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); - r = label_type->size.round.r; - m = markup->data.margin.size; + r = frame->round.r; + m = markup->margin.size; cairo_arc (cr, r, r, r-m, 0, 2*G_PI); cairo_close_path (cr); @@ -203,27 +203,27 @@ gl_cairo_markup_margin_round_path (cairo_t *cr, /* PRIVATE. Draw CD margins. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_margin_cd_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label) +gl_cairo_markup_margin_cd_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label) { - const glTemplateLabelType *label_type; - gdouble m, r1, r2; - gdouble theta1, theta2; - gdouble xc, yc; - gdouble w, h; + const lglTemplateFrame *frame; + gdouble m, r1, r2; + gdouble theta1, theta2; + gdouble xc, yc; + gdouble w, h; gl_debug (DEBUG_PATH, "START"); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); gl_label_get_size (label, &w, &h); xc = w/2.0; yc = h/2.0; - m = markup->data.margin.size; - r1 = label_type->size.cd.r1 - m; - r2 = label_type->size.cd.r2 + m; + m = markup->margin.size; + r1 = frame->cd.r1 - m; + r2 = frame->cd.r2 + m; /* @@ -252,13 +252,13 @@ gl_cairo_markup_margin_cd_path (cairo_t *cr, /* PRIVATE. Draw line markup. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_line_path (cairo_t *cr, - const glTemplateMarkup *markup) +gl_cairo_markup_line_path (cairo_t *cr, + const lglTemplateMarkup *markup) { gl_debug (DEBUG_PATH, "START"); - cairo_move_to (cr, markup->data.line.x1, markup->data.line.y1); - cairo_line_to (cr, markup->data.line.x2, markup->data.line.y2); + cairo_move_to (cr, markup->line.x1, markup->line.y1); + cairo_line_to (cr, markup->line.x2, markup->line.y2); gl_debug (DEBUG_PATH, "END"); } @@ -267,14 +267,14 @@ gl_cairo_markup_line_path (cairo_t *cr, /* PRIVATE. Draw circle markup. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_circle_path (cairo_t *cr, - const glTemplateMarkup *markup) +gl_cairo_markup_circle_path (cairo_t *cr, + const lglTemplateMarkup *markup) { gl_debug (DEBUG_PATH, "START"); cairo_arc (cr, - markup->data.circle.x0, markup->data.circle.y0, - markup->data.circle.r, + markup->circle.x0, markup->circle.y0, + markup->circle.r, 0.0, 2*G_PI); cairo_close_path (cr); @@ -285,14 +285,14 @@ gl_cairo_markup_circle_path (cairo_t *cr, /* PRIVATE. Draw rect markup. */ /*---------------------------------------------------------------------------*/ static void -gl_cairo_markup_rect_path (cairo_t *cr, - const glTemplateMarkup *markup) +gl_cairo_markup_rect_path (cairo_t *cr, + const lglTemplateMarkup *markup) { - gdouble x1 = markup->data.rect.x1; - gdouble y1 = markup->data.rect.y1; - gdouble w = markup->data.rect.w; - gdouble h = markup->data.rect.h; - gdouble r = markup->data.rect.r; + gdouble x1 = markup->rect.x1; + gdouble y1 = markup->rect.y1; + gdouble w = markup->rect.w; + gdouble h = markup->rect.h; + gdouble r = markup->rect.r; gl_debug (DEBUG_PATH, "START"); diff --git a/glabels2/src/cairo-markup-path.h b/glabels2/src/cairo-markup-path.h index 75ebcf6b..9dfab554 100644 --- a/glabels2/src/cairo-markup-path.h +++ b/glabels2/src/cairo-markup-path.h @@ -31,9 +31,9 @@ G_BEGIN_DECLS -void gl_cairo_markup_path (cairo_t *cr, - const glTemplateMarkup *markup, - glLabel *label); +void gl_cairo_markup_path (cairo_t *cr, + const lglTemplateMarkup *markup, + glLabel *label); G_END_DECLS diff --git a/glabels2/src/file.c b/glabels2/src/file.c index 85162ea9..65adec7d 100644 --- a/glabels2/src/file.c +++ b/glabels2/src/file.c @@ -119,10 +119,10 @@ new_response (GtkDialog *dialog, gint response, gpointer user_data) { - glTemplate *template; - glLabel *label; - glWindow *window; - GtkWidget *new_window; + lglTemplate *template; + glLabel *label; + glWindow *window; + GtkWidget *new_window; gl_debug (DEBUG_FILE, "START"); @@ -142,13 +142,13 @@ new_response (GtkDialog *dialog, rotate_flag = gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog)); - template = gl_template_from_name (sheet_name); + template = lgl_template_from_name (sheet_name); label = GL_LABEL(gl_label_new ()); gl_label_set_template (label, template); gl_label_set_rotate_flag (label, rotate_flag); - gl_template_free (template); + lgl_template_free (template); window = GL_WINDOW (g_object_get_data (G_OBJECT (dialog), @@ -219,8 +219,8 @@ properties_response (GtkDialog *dialog, gint response, gpointer user_data) { - glTemplate *template; - glLabel *label; + lglTemplate *template; + glLabel *label; gl_debug (DEBUG_FILE, "START"); @@ -240,7 +240,7 @@ properties_response (GtkDialog *dialog, rotate_flag = gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog)); - template = gl_template_from_name (sheet_name); + template = lgl_template_from_name (sheet_name); label = GL_LABEL(g_object_get_data (G_OBJECT (dialog), "label")); gl_label_set_template (label, template); diff --git a/glabels2/src/glabels-batch.c b/glabels2/src/glabels-batch.c index 28a4ad45..7e3023b1 100644 --- a/glabels2/src/glabels-batch.c +++ b/glabels2/src/glabels-batch.c @@ -121,8 +121,7 @@ main (int argc, char **argv) /* initialize components */ gl_debug_init (); gl_merge_init (); - gl_paper_init (); - gl_template_init (); + lgl_init (); /* now print the files */ for (p = file_list; p; p = p->next) { diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c index 1e957f40..c6eb728f 100644 --- a/glabels2/src/glabels.c +++ b/glabels2/src/glabels.c @@ -119,9 +119,8 @@ main (int argc, char **argv) /* Initialize subsystems */ gl_debug_init (); gl_stock_init (); - gl_paper_init (); + lgl_init (); gl_prefs_init (); - gl_template_init (); gl_mini_preview_pixbuf_cache_init (); gl_merge_init (); gl_recent_init (); diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c index 24cfdb20..fd79e28a 100644 --- a/glabels2/src/label-object.c +++ b/glabels2/src/label-object.c @@ -197,7 +197,6 @@ static void gl_label_object_finalize (GObject *object) { glLabelObject *label_object = GL_LABEL_OBJECT (object); - glLabel *parent; gl_debug (DEBUG_LABEL, "START"); diff --git a/glabels2/src/label.c b/glabels2/src/label.c index d335a7bd..a72975d4 100644 --- a/glabels2/src/label.c +++ b/glabels2/src/label.c @@ -193,7 +193,7 @@ gl_label_finalize (GObject *object) g_object_unref (G_OBJECT(p->data)); } - gl_template_free (label->template); + lgl_template_free (label->template); g_free (label->priv->filename); if (label->priv->merge != NULL) { g_object_unref (G_OBJECT(label->priv->merge)); @@ -374,8 +374,8 @@ gl_label_lower_object_to_bottom (glLabel *label, /* set template. */ /****************************************************************************/ extern void -gl_label_set_template (glLabel *label, - glTemplate *template) +gl_label_set_template (glLabel *label, + lglTemplate *template) { gl_debug (DEBUG_LABEL, "START"); @@ -384,8 +384,8 @@ gl_label_set_template (glLabel *label, if ((label->template == NULL) || (g_strcasecmp (template->name, label->template->name) != 0)) { - gl_template_free (label->template); - label->template = gl_template_dup (template); + lgl_template_free (label->template); + label->template = lgl_template_dup (template); label->priv->modified_flag = TRUE; @@ -432,8 +432,8 @@ gl_label_get_size (glLabel *label, gdouble *w, gdouble *h) { - glTemplate *template; - const glTemplateLabelType *label_type; + lglTemplate *template; + const lglTemplateFrame *frame; gl_debug (DEBUG_LABEL, "START"); @@ -445,12 +445,12 @@ gl_label_get_size (glLabel *label, *w = *h = 0; return; } - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); if (!label->rotate_flag) { - gl_template_get_label_size (label_type, w, h); + lgl_template_frame_get_size (frame, w, h); } else { - gl_template_get_label_size (label_type, h, w); + lgl_template_frame_get_size (frame, h, w); } gl_debug (DEBUG_LABEL, "END"); diff --git a/glabels2/src/label.h b/glabels2/src/label.h index d03cb824..f6e0c23b 100644 --- a/glabels2/src/label.h +++ b/glabels2/src/label.h @@ -55,7 +55,7 @@ typedef struct _glLabelPrivate glLabelPrivate; struct _glLabel { GObject object; - glTemplate *template; + lglTemplate *template; gboolean rotate_flag; GList *objects; @@ -102,7 +102,7 @@ void gl_label_lower_object_to_bottom (glLabel *label, void gl_label_set_template (glLabel *label, - glTemplate *template); + lglTemplate *template); void gl_label_set_rotate_flag (glLabel *label, gboolean rotate_flag); diff --git a/glabels2/src/mini-preview-pixbuf-cache.c b/glabels2/src/mini-preview-pixbuf-cache.c index b87d657a..a260e3d8 100644 --- a/glabels2/src/mini-preview-pixbuf-cache.c +++ b/glabels2/src/mini-preview-pixbuf-cache.c @@ -59,12 +59,12 @@ gl_mini_preview_pixbuf_cache_init (void) mini_preview_pixbuf_cache = g_hash_table_new (g_str_hash, g_str_equal); - names = gl_template_get_name_list_unique (NULL, NULL); + names = lgl_template_get_name_list_unique (NULL, NULL); for ( p=names; p != NULL; p=p->next ) { gl_mini_preview_pixbuf_cache_add_by_name ((gchar *)p->data); } - gl_template_free_name_list (names); + lgl_template_free_name_list (names); gl_debug (DEBUG_PIXBUF_CACHE, "END pixbuf_cache=%p", mini_preview_pixbuf_cache); } @@ -75,14 +75,14 @@ gl_mini_preview_pixbuf_cache_init (void) void gl_mini_preview_pixbuf_cache_add_by_name (gchar *name) { - glTemplate *template; - GdkPixbuf *pixbuf; + lglTemplate *template; + GdkPixbuf *pixbuf; gl_debug (DEBUG_PIXBUF_CACHE, "START"); - template = gl_template_from_name (name); + template = lgl_template_from_name (name); pixbuf = gl_mini_preview_pixbuf_new (template, 72, 72); - gl_template_free (template); + lgl_template_free (template); g_hash_table_insert (mini_preview_pixbuf_cache, g_strdup (name), pixbuf); diff --git a/glabels2/src/mini-preview-pixbuf.c b/glabels2/src/mini-preview-pixbuf.c index b83afbc0..91b269a3 100644 --- a/glabels2/src/mini-preview-pixbuf.c +++ b/glabels2/src/mini-preview-pixbuf.c @@ -59,15 +59,15 @@ /*===========================================*/ static void draw_paper (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble scale); static void draw_label_outlines (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble scale); static void draw_label_outline (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble x0, gdouble y0); @@ -78,9 +78,9 @@ static void draw_label_outline (cairo_t *cr, /* Create new pixbuf with mini preview of template */ /****************************************************************************/ GdkPixbuf * -gl_mini_preview_pixbuf_new (glTemplate *template, - gint width, - gint height) +gl_mini_preview_pixbuf_new (lglTemplate *template, + gint width, + gint height) { cairo_surface_t *surface; cairo_t *cr; @@ -141,7 +141,7 @@ gl_mini_preview_pixbuf_new (glTemplate *template, /*--------------------------------------------------------------------------*/ static void draw_paper (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble scale) { gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -163,12 +163,12 @@ draw_paper (cairo_t *cr, /*--------------------------------------------------------------------------*/ static void draw_label_outlines (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble scale) { - const glTemplateLabelType *label_type; - gint i, n_labels; - glTemplateOrigin *origins; + const lglTemplateFrame *frame; + gint i, n_labels; + lglTemplateOrigin *origins; gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -176,10 +176,10 @@ draw_label_outlines (cairo_t *cr, cairo_set_line_width (cr, LABEL_OUTLINE_WIDTH_PIXELS/scale); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); - n_labels = gl_template_get_n_labels (label_type); - origins = gl_template_get_origins (label_type); + n_labels = lgl_template_frame_get_n_labels (frame); + origins = lgl_template_frame_get_origins (frame); for ( i=0; i < n_labels; i++ ) { @@ -199,7 +199,7 @@ draw_label_outlines (cairo_t *cr, /*--------------------------------------------------------------------------*/ static void draw_label_outline (cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble x0, gdouble y0) { diff --git a/glabels2/src/mini-preview-pixbuf.h b/glabels2/src/mini-preview-pixbuf.h index 05bd3235..ddad146b 100644 --- a/glabels2/src/mini-preview-pixbuf.h +++ b/glabels2/src/mini-preview-pixbuf.h @@ -31,9 +31,9 @@ G_BEGIN_DECLS -GdkPixbuf *gl_mini_preview_pixbuf_new (glTemplate *template, - gint width, - gint height); +GdkPixbuf *gl_mini_preview_pixbuf_new (lglTemplate *template, + gint width, + gint height); G_END_DECLS diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index 68233510..218f11da 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -452,17 +452,17 @@ update_locale_page_from_prefs (glPrefsDialog *dialog) dialog->priv->stop_signals = TRUE; switch (gl_prefs->units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_points_radio), TRUE); break; - case GL_UNITS_INCH: + case LGL_UNITS_INCH: gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_inches_radio), TRUE); break; - case GL_UNITS_MM: + case LGL_UNITS_MM: gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_mm_radio), TRUE); @@ -577,17 +577,17 @@ update_prefs_from_locale_page (glPrefsDialog *dialog) if (gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_points_radio))) { - gl_prefs->units = GL_UNITS_POINT; + gl_prefs->units = LGL_UNITS_POINT; } if (gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_inches_radio))) { - gl_prefs->units = GL_UNITS_INCH; + gl_prefs->units = LGL_UNITS_INCH; } if (gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(dialog->priv->units_mm_radio))) { - gl_prefs->units = GL_UNITS_MM; + gl_prefs->units = LGL_UNITS_MM; } if (gtk_toggle_button_get_active ( diff --git a/glabels2/src/prefs-model.c b/glabels2/src/prefs-model.c index 45dc3da0..62b814b4 100644 --- a/glabels2/src/prefs-model.c +++ b/glabels2/src/prefs-model.c @@ -72,7 +72,7 @@ #define PREF_MAX_RECENTS "/max-recents" /* Default values */ -#define DEFAULT_UNITS_STRING units_to_string (GL_UNITS_INCH) +#define DEFAULT_UNITS_STRING units_to_string (LGL_UNITS_INCH) #define DEFAULT_PAGE_SIZE "US-Letter" #define DEFAULT_FONT_FAMILY "Sans" @@ -132,8 +132,8 @@ static gdouble get_float (GConfClient *client, const gchar *key, gdouble def); -static glUnitsType string_to_units (const gchar *string); -static const gchar *units_to_string (glUnitsType units); +static lglUnitsType string_to_units (const gchar *string); +static const gchar *units_to_string (lglUnitsType units); @@ -369,8 +369,8 @@ gl_prefs_model_save_settings (glPrefsModel *prefs_model) void gl_prefs_model_load_settings (glPrefsModel *prefs_model) { - gchar *string; - glPaper *paper; + gchar *string; + lglPaper *paper; gl_debug (DEBUG_PREFS, "START"); @@ -506,11 +506,11 @@ gl_prefs_model_load_settings (glPrefsModel *prefs_model) /* Proof read the default page size -- it must be a valid id. */ /* (For compatability with older versions.) */ /* Note: paper module must be initialized for this to work. */ - paper = gl_paper_from_id (prefs_model->default_page_size); + paper = lgl_paper_from_id (prefs_model->default_page_size); if ( paper == NULL ) { prefs_model->default_page_size = g_strdup (DEFAULT_PAGE_SIZE); } else { - gl_paper_free (paper); + lgl_paper_free (paper); paper = NULL; } @@ -648,35 +648,35 @@ get_float (GConfClient *client, /*---------------------------------------------------------------------------*/ /* PRIVATE. Utilities to deal with units. */ /*---------------------------------------------------------------------------*/ -static glUnitsType +static lglUnitsType string_to_units (const gchar *string) { - glUnitsType units; + lglUnitsType units; if (g_strcasecmp (string, "Points") == 0) { - units = GL_UNITS_POINT; + units = LGL_UNITS_POINT; } else if (g_strcasecmp (string, "Inches") == 0) { - units = GL_UNITS_INCH; + units = LGL_UNITS_INCH; } else if (g_strcasecmp (string, "Millimeters") == 0) { - units = GL_UNITS_MM; + units = LGL_UNITS_MM; } else { - units = GL_UNITS_INCH; + units = LGL_UNITS_INCH; } return units; } static const -gchar *units_to_string (glUnitsType units) +gchar *units_to_string (lglUnitsType units) { switch (units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: return "Points"; break; - case GL_UNITS_INCH: + case LGL_UNITS_INCH: return "Inches"; break; - case GL_UNITS_MM: + case LGL_UNITS_MM: return "Millimeters"; break; default: diff --git a/glabels2/src/prefs-model.h b/glabels2/src/prefs-model.h index 5d6f5654..2303e171 100644 --- a/glabels2/src/prefs-model.h +++ b/glabels2/src/prefs-model.h @@ -57,7 +57,7 @@ struct _glPrefsModel { GConfClient *gconf_client; /* Units */ - glUnitsType units; + lglUnitsType units; /* Page size */ gchar *default_page_size; diff --git a/glabels2/src/prefs.c b/glabels2/src/prefs.c index 23636c89..c2ef4e3a 100644 --- a/glabels2/src/prefs.c +++ b/glabels2/src/prefs.c @@ -80,7 +80,7 @@ gl_prefs_get_page_size (void) /****************************************************************************/ /* Get desired units. */ /****************************************************************************/ -glUnitsType +lglUnitsType gl_prefs_get_units (void) { return gl_prefs->units; @@ -94,11 +94,11 @@ gl_prefs_get_units_per_point (void) { switch (gl_prefs->units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: return 1.0; /* points */ - case GL_UNITS_INCH: + case LGL_UNITS_INCH: return 1.0 / 72.0; /* inches */ - case GL_UNITS_MM: + case LGL_UNITS_MM: return 0.35277778; /* mm */ default: g_message ("Illegal units"); /* Should not happen */ @@ -114,11 +114,11 @@ gl_prefs_get_units_precision (void) { switch (gl_prefs->units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: return 1; /* points */ - case GL_UNITS_INCH: + case LGL_UNITS_INCH: return 3; /* inches */ - case GL_UNITS_MM: + case LGL_UNITS_MM: return 1; /* mm */ default: g_message ("Illegal units"); /* Should not happen */ @@ -134,11 +134,11 @@ gl_prefs_get_units_step_size (void) { switch (gl_prefs->units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: return 0.1; /* points */ - case GL_UNITS_INCH: + case LGL_UNITS_INCH: return 0.001; /* inches */ - case GL_UNITS_MM: + case LGL_UNITS_MM: return 0.1; /* mm */ default: g_message ("Illegal units"); /* Should not happen */ @@ -154,11 +154,11 @@ gl_prefs_get_units_string (void) { switch (gl_prefs->units) { - case GL_UNITS_POINT: + case LGL_UNITS_POINT: return _("points"); - case GL_UNITS_INCH: + case LGL_UNITS_INCH: return _("inches"); - case GL_UNITS_MM: + case LGL_UNITS_MM: return _("mm"); default: g_message ("Illegal units"); /* Should not happen */ diff --git a/glabels2/src/prefs.h b/glabels2/src/prefs.h index ce08f137..b4da528d 100644 --- a/glabels2/src/prefs.h +++ b/glabels2/src/prefs.h @@ -38,7 +38,7 @@ void gl_prefs_init (void); const gchar *gl_prefs_get_page_size (void); -glUnitsType gl_prefs_get_units (void); +lglUnitsType gl_prefs_get_units (void); const gchar *gl_prefs_get_units_string (void); diff --git a/glabels2/src/print-op.c b/glabels2/src/print-op.c index 302e54e6..ef21aa0c 100644 --- a/glabels2/src/print-op.c +++ b/glabels2/src/print-op.c @@ -215,16 +215,16 @@ static void gl_print_op_construct (glPrintOp *op, glLabel *label) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; op->priv->label = label; op->priv->force_outline_flag = FALSE; - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); op->priv->n_sheets = 1; op->priv->first = 1; - op->priv->last = gl_template_get_n_labels (label_type); + op->priv->last = lgl_template_frame_get_n_labels (frame); op->priv->n_copies = 1; gtk_print_operation_set_custom_tab_label ( GTK_PRINT_OPERATION (op), @@ -363,8 +363,8 @@ gl_print_op_construct_batch (glPrintOp *op, gboolean crop_marks_flag) { - glMerge *merge = NULL; - const glTemplateLabelType *label_type = NULL; + glMerge *merge = NULL; + const lglTemplateFrame *frame = NULL; op->priv->label = label; op->priv->force_outline_flag = FALSE; @@ -378,12 +378,12 @@ gl_print_op_construct_batch (glPrintOp *op, merge = gl_label_get_merge (label); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); if (merge == NULL) { op->priv->merge_flag = FALSE; - op->priv->last = gl_template_get_n_labels (label_type); + op->priv->last = lgl_template_frame_get_n_labels (frame); } else @@ -392,7 +392,7 @@ gl_print_op_construct_batch (glPrintOp *op, op->priv->n_sheets = ceil ((double)(first-1 + n_copies * gl_merge_get_record_count(merge)) - / gl_template_get_n_labels (label_type));; + / lgl_template_frame_get_n_labels (frame));; g_object_unref (G_OBJECT(merge)); diff --git a/glabels2/src/print.c b/glabels2/src/print.c index b4310017..84b70129 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -55,8 +55,8 @@ typedef struct _PrintInfo { cairo_t *cr; /* gLabels Template */ - glTemplate *template; - gboolean label_rotate_flag; + lglTemplate *template; + gboolean label_rotate_flag; /* page size */ gdouble page_width; @@ -106,17 +106,17 @@ gl_print_simple_sheet (glLabel *label, gboolean reverse_flag, gboolean crop_marks_flag) { - PrintInfo *pi; - const glTemplateLabelType *label_type; - gint i_label; - glTemplateOrigin *origins; + PrintInfo *pi; + const lglTemplateFrame *frame; + gint i_label; + lglTemplateOrigin *origins; gl_debug (DEBUG_PRINT, "START"); pi = print_info_new (cr, label); - label_type = gl_template_get_first_label_type (pi->template); - origins = gl_template_get_origins (label_type); + frame = lgl_template_get_first_frame (pi->template); + origins = lgl_template_frame_get_origins (frame); if (crop_marks_flag) { print_crop_marks (pi); @@ -154,11 +154,11 @@ gl_print_collated_merge_sheet (glLabel *label, glMerge *merge; const GList *record_list; PrintInfo *pi; - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gint i_label, n_labels_per_page, i_copy; glMergeRecord *record; GList *p; - glTemplateOrigin *origins; + lglTemplateOrigin *origins; gl_debug (DEBUG_PRINT, "START"); @@ -166,10 +166,10 @@ gl_print_collated_merge_sheet (glLabel *label, record_list = gl_merge_get_record_list (merge); pi = print_info_new (cr, label); - label_type = gl_template_get_first_label_type (pi->template); + frame = lgl_template_get_first_frame (pi->template); - n_labels_per_page = gl_template_get_n_labels (label_type); - origins = gl_template_get_origins (label_type); + n_labels_per_page = lgl_template_frame_get_n_labels (frame); + origins = lgl_template_frame_get_origins (frame); if (crop_marks_flag) { print_crop_marks (pi); @@ -245,11 +245,11 @@ gl_print_uncollated_merge_sheet (glLabel *label, glMerge *merge; const GList *record_list; PrintInfo *pi; - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gint i_label, n_labels_per_page, i_copy; glMergeRecord *record; GList *p; - glTemplateOrigin *origins; + lglTemplateOrigin *origins; gl_debug (DEBUG_PRINT, "START"); @@ -257,10 +257,10 @@ gl_print_uncollated_merge_sheet (glLabel *label, record_list = gl_merge_get_record_list (merge); pi = print_info_new (cr, label); - label_type = gl_template_get_first_label_type (pi->template); + frame = lgl_template_get_first_frame (pi->template); - n_labels_per_page = gl_template_get_n_labels (label_type); - origins = gl_template_get_origins (label_type); + n_labels_per_page = lgl_template_frame_get_n_labels (frame); + origins = lgl_template_frame_get_origins (frame); if (crop_marks_flag) { print_crop_marks (pi); @@ -376,19 +376,19 @@ print_info_free (PrintInfo **pi) static void print_crop_marks (PrintInfo *pi) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gdouble w, h, page_w, page_h; GList *p; - glTemplateLayout *layout; + lglTemplateLayout *layout; gdouble xmin, ymin, xmax, ymax, dx, dy; gdouble x1, y1, x2, y2, x3, y3, x4, y4; gint ix, iy, nx, ny; gl_debug (DEBUG_PRINT, "START"); - label_type = gl_template_get_first_label_type (pi->template); + frame = lgl_template_get_first_frame (pi->template); - gl_template_get_label_size (label_type, &w, &h); + lgl_template_frame_get_size (frame, &w, &h); page_w = pi->page_width; page_h = pi->page_height; @@ -398,9 +398,9 @@ print_crop_marks (PrintInfo *pi) cairo_set_source_rgb (pi->cr, OUTLINE_RGB_ARGS); cairo_set_line_width (pi->cr, OUTLINE_WIDTH); - for (p=label_type->layouts; p != NULL; p=p->next) { + for (p=frame->all.layouts; p != NULL; p=p->next) { - layout = (glTemplateLayout *)p->data; + layout = (lglTemplateLayout *)p->data; xmin = layout->x0; ymin = layout->y0; @@ -490,12 +490,12 @@ print_label (PrintInfo *pi, gboolean outline_flag, gboolean reverse_flag) { - const glTemplateLabelType *label_type; - gdouble width, height; + const lglTemplateFrame *frame; + gdouble width, height; gl_debug (DEBUG_PRINT, "START"); - label_type = gl_template_get_first_label_type (pi->template); + frame = lgl_template_get_first_frame (pi->template); gl_label_get_size (label, &width, &height); diff --git a/glabels2/src/template-designer.c b/glabels2/src/template-designer.c index 30122587..708fa5b2 100644 --- a/glabels2/src/template-designer.c +++ b/glabels2/src/template-designer.c @@ -264,7 +264,7 @@ static void layout_page_changed_cb (glTemplateDesigner *dial static void print_test_cb (glTemplateDesigner *dialog); -static glTemplate *build_template (glTemplateDesigner *dialog); +static lglTemplate *build_template (glTemplateDesigner *dialog); /*****************************************************************************/ @@ -519,11 +519,11 @@ construct_pg_size_page (glTemplateDesigner *dialog, TRUE); /* Load page size combo */ - page_sizes = gl_paper_get_name_list (); + page_sizes = lgl_paper_get_name_list (); gl_util_combo_box_set_strings (GTK_COMBO_BOX (dialog->priv->pg_size_combo), page_sizes); - gl_paper_free_name_list (page_sizes); + lgl_paper_free_name_list (page_sizes); default_page_size_id = gl_prefs_get_page_size (); - default_page_size_name = gl_paper_lookup_name_from_id (default_page_size_id); + default_page_size_name = lgl_paper_lookup_name_from_id (default_page_size_id); gl_util_combo_box_set_active_text (GTK_COMBO_BOX (dialog->priv->pg_size_combo), default_page_size_name); g_free (default_page_size_name); @@ -1111,10 +1111,10 @@ cancel_cb (glTemplateDesigner *dialog) static void apply_cb (glTemplateDesigner *dialog) { - glTemplate *template; + lglTemplate *template; template = build_template (dialog); - gl_template_register (template); + lgl_template_register (template); gl_mini_preview_pixbuf_cache_add_by_name (template->name); } @@ -1263,8 +1263,8 @@ name_page_changed_cb (glTemplateDesigner *dialog) static void pg_size_page_changed_cb (glTemplateDesigner *dialog) { - gchar *page_size_name; - glPaper *paper; + gchar *page_size_name; + lglPaper *paper; page_size_name = @@ -1272,7 +1272,7 @@ pg_size_page_changed_cb (glTemplateDesigner *dialog) if (page_size_name && strlen(page_size_name)) { - paper = gl_paper_from_name (page_size_name); + paper = lgl_paper_from_name (page_size_name); if ( g_strcasecmp (paper->id, "Other") == 0 ) { @@ -1297,7 +1297,7 @@ pg_size_page_changed_cb (glTemplateDesigner *dialog) paper->height * dialog->priv->units_per_point); } - gl_paper_free (paper); + lgl_paper_free (paper); } g_free (page_size_name); @@ -1430,7 +1430,7 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) gint nlayouts; gdouble nx_1, ny_1, x0_1, y0_1, dx_1, dy_1; gdouble nx_2, ny_2, x0_2, y0_2, dx_2, dy_2; - glTemplate *template; + lglTemplate *template; if (dialog->priv->stop_signals) return; dialog->priv->stop_signals = TRUE; @@ -1539,7 +1539,7 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) template = build_template (dialog); gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(dialog->priv->layout_mini_preview), template); - gl_template_free (template); + lgl_template_free (template); dialog->priv->stop_signals = FALSE; @@ -1551,7 +1551,7 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) static void layout_page_changed_cb (glTemplateDesigner *dialog) { - glTemplate *template; + lglTemplate *template; if (dialog->priv->stop_signals) return; dialog->priv->stop_signals = TRUE; @@ -1561,7 +1561,7 @@ layout_page_changed_cb (glTemplateDesigner *dialog) gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(dialog->priv->layout_mini_preview), template); - gl_template_free (template); + lgl_template_free (template); dialog->priv->stop_signals = FALSE; } @@ -1572,9 +1572,9 @@ layout_page_changed_cb (glTemplateDesigner *dialog) static void print_test_cb (glTemplateDesigner *dialog) { - GObject *label; - glTemplate *template; - glPrintOp *print_op; + GObject *label; + lglTemplate *template; + glPrintOp *print_op; label = gl_label_new (); @@ -1588,27 +1588,27 @@ print_test_cb (glTemplateDesigner *dialog) GTK_WINDOW (dialog), NULL); - gl_template_free (template); + lgl_template_free (template); g_object_unref (G_OBJECT(label)); } /*--------------------------------------------------------------------------*/ /* Build a template based on current assistant settings. */ /*--------------------------------------------------------------------------*/ -static glTemplate * +static lglTemplate * build_template (glTemplateDesigner *dialog) { gdouble upp; gchar *brand, *part_num, *name, *desc; gchar *page_size_name; - glPaper *paper; - glTemplateLabelShape shape; - glTemplateLabelType *label_type=NULL; + lglPaper *paper; + lglTemplateFrameShape shape; + lglTemplateFrame *frame=NULL; gdouble w=0, h=0, r=0, radius=0, hole=0, waste=0, x_waste=0, y_waste=0, margin=0; gint nlayouts; gdouble nx_1, ny_1, x0_1, y0_1, dx_1, dy_1; gdouble nx_2, ny_2, x0_2, y0_2, dx_2, dy_2; - glTemplate *template; + lglTemplate *template; upp = dialog->priv->units_per_point; @@ -1619,7 +1619,7 @@ build_template (glTemplateDesigner *dialog) page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->priv->pg_size_combo)); - paper = gl_paper_from_name (page_size_name); + paper = lgl_paper_from_name (page_size_name); if ( g_strcasecmp (paper->id, "Other") == 0 ) { paper->width = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->pg_w_spin)) @@ -1630,7 +1630,7 @@ build_template (glTemplateDesigner *dialog) } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_rect_radio))) { - shape = GL_TEMPLATE_SHAPE_RECT; + shape = LGL_TEMPLATE_FRAME_SHAPE_RECT; w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_w_spin)); h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_h_spin)); r = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->rect_r_spin)); @@ -1640,14 +1640,14 @@ build_template (glTemplateDesigner *dialog) } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_round_radio))) { - shape = GL_TEMPLATE_SHAPE_ROUND; + shape = LGL_TEMPLATE_FRAME_SHAPE_ROUND; r = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_r_spin)); waste = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_waste_spin)); margin = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->round_margin_spin)); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->priv->shape_cd_radio))) { - shape = GL_TEMPLATE_SHAPE_CD; + shape = LGL_TEMPLATE_FRAME_SHAPE_CD; radius = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->cd_radius_spin)); hole = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->cd_hole_spin)); w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->cd_w_spin)); @@ -1671,41 +1671,38 @@ build_template (glTemplateDesigner *dialog) dy_2 = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->layout2_dy_spin)); - template = gl_template_new (name, desc, paper->id, paper->width, paper->height); + template = lgl_template_new (name, desc, paper->id, paper->width, paper->height); switch (shape) { - case GL_TEMPLATE_SHAPE_RECT: - label_type = - gl_template_rect_label_type_new ("0", - w/upp, h/upp, r/upp, - x_waste/upp, y_waste/upp); + case LGL_TEMPLATE_FRAME_SHAPE_RECT: + frame = lgl_template_frame_rect_new ("0", + w/upp, h/upp, r/upp, + x_waste/upp, y_waste/upp); break; - case GL_TEMPLATE_SHAPE_ROUND: - label_type = - gl_template_round_label_type_new ("0", r/upp, waste/upp); + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: + frame = lgl_template_frame_round_new ("0", r/upp, waste/upp); break; - case GL_TEMPLATE_SHAPE_CD: - label_type = - gl_template_cd_label_type_new ("0", - radius/upp, hole/upp, - w/upp, h/upp, - waste/upp); + case LGL_TEMPLATE_FRAME_SHAPE_CD: + frame = lgl_template_frame_cd_new ("0", + radius/upp, hole/upp, + w/upp, h/upp, + waste/upp); break; } - gl_template_add_label_type (template, label_type); + lgl_template_add_frame (template, frame); - gl_template_add_markup (label_type, - gl_template_markup_margin_new (margin/upp)); + lgl_template_add_markup (frame, + lgl_template_markup_margin_new (margin/upp)); - gl_template_add_layout (label_type, - gl_template_layout_new (nx_1, ny_1, + lgl_template_add_layout (frame, + lgl_template_layout_new (nx_1, ny_1, x0_1/upp, y0_1/upp, dx_1/upp, dy_1/upp)); if (nlayouts > 1) { - gl_template_add_layout (label_type, - gl_template_layout_new (nx_2, ny_2, + lgl_template_add_layout (frame, + lgl_template_layout_new (nx_2, ny_2, x0_2/upp, y0_2/upp, dx_2/upp, @@ -1718,7 +1715,7 @@ build_template (glTemplateDesigner *dialog) g_free (desc); g_free (page_size_name); - gl_paper_free (paper); + lgl_paper_free (paper); return template; } diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 309287ae..559d134f 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -404,7 +404,6 @@ gl_view_barcode_create_button_press_event (glView *view, GObject *object; glTextNode *text_node; glColorNode *line_color_node; - glViewObject *view_barcode; gl_view_unselect_all (view); diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index bd72252f..710bce27 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -442,7 +442,6 @@ gl_view_box_create_button_press_event (glView *view, GObject *object; glColorNode *fill_color_node; glColorNode *line_color_node; - glViewObject *view_box; gl_view_unselect_all (view); diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index cebbc863..bed1eb7d 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -442,7 +442,6 @@ gl_view_ellipse_create_button_press_event (glView *view, GObject *object; glColorNode *fill_color_node; glColorNode *line_color_node; - glViewObject *view_ellipse; gl_view_unselect_all (view); diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c index 0d2aa526..c1ec5946 100644 --- a/glabels2/src/view-image.c +++ b/glabels2/src/view-image.c @@ -395,7 +395,6 @@ gl_view_image_create_button_press_event (glView *view, gdouble y) { GObject *object; - glViewObject *view_image; gl_view_unselect_all (view); diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index 23a8c92f..7b0412d1 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -425,7 +425,6 @@ gl_view_line_create_button_press_event (glView *view, { GObject *object; glColorNode *line_color_node; - glViewObject *view_line; gl_view_unselect_all (view); diff --git a/glabels2/src/view.c b/glabels2/src/view.c index 2ed87598..2636eb9d 100644 --- a/glabels2/src/view.c +++ b/glabels2/src/view.c @@ -843,7 +843,7 @@ draw_grid_layer (glView *view, gdouble w, h; gdouble x, y; gdouble x0, y0; - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gl_debug (DEBUG_VIEW, "START"); @@ -853,11 +853,11 @@ draw_grid_layer (glView *view, if (view->grid_visible) { - label_type = gl_template_get_first_label_type (view->label->template); + frame = lgl_template_get_first_frame (view->label->template); gl_label_get_size (view->label, &w, &h); - if (label_type->shape == GL_TEMPLATE_SHAPE_RECT) { + if (frame->shape == LGL_TEMPLATE_FRAME_SHAPE_RECT) { x0 = 0.0; y0 = 0.0; } else { @@ -902,9 +902,9 @@ draw_markup_layer (glView *view, cairo_t *cr) { glLabel *label; - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; GList *p; - glTemplateMarkup *markup; + lglTemplateMarkup *markup; g_return_if_fail (view && GL_IS_VIEW (view)); g_return_if_fail (view->label && GL_IS_LABEL (view->label)); @@ -913,16 +913,16 @@ draw_markup_layer (glView *view, { label = view->label; - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); cairo_save (cr); cairo_set_line_width (cr, MARKUP_LINE_WIDTH_PIXELS/(view->home_scale * view->zoom)); cairo_set_source_rgb (cr, MARKUP_RGB_ARGS); - for ( p=label_type->markups; p != NULL; p=p->next ) + for ( p=frame->all.markups; p != NULL; p=p->next ) { - markup = (glTemplateMarkup *)p->data; + markup = (lglTemplateMarkup *)p->data; gl_cairo_markup_path (cr, markup, label); diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index 8674273c..31311f27 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -99,8 +99,8 @@ static void filter_changed_cb (GtkComboBox *combo, static void template_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data); -static gchar *get_layout_desc (const glTemplate *template); -static gchar *get_label_size_desc (const glTemplate *template); +static gchar *get_layout_desc (const lglTemplate *template); +static gchar *get_label_size_desc (const lglTemplate *template); static void load_list (GtkListStore *store, GtkTreeSelection *selection, GList *list); @@ -221,25 +221,25 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select) g_object_unref (gui); page_size_id = gl_prefs_get_page_size (); - page_size_name = gl_paper_lookup_name_from_id (page_size_id); + page_size_name = lgl_paper_lookup_name_from_id (page_size_id); /* Page size selection control */ gl_util_combo_box_add_text_model (GTK_COMBO_BOX (media_select->priv->page_size_combo)); - page_sizes = gl_paper_get_name_list (); + page_sizes = lgl_paper_get_name_list (); page_sizes = g_list_prepend (page_sizes, g_strdup (_("Any"))); gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->priv->page_size_combo), page_sizes); - gl_paper_free_name_list (page_sizes); + lgl_paper_free_name_list (page_sizes); gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo), page_size_name); /* Category selection control */ gl_util_combo_box_add_text_model (GTK_COMBO_BOX (media_select->priv->category_combo)); - categories = gl_category_get_name_list (); + categories = lgl_category_get_name_list (); categories = g_list_prepend (categories, g_strdup (_("Any"))); gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->priv->category_combo), categories); gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->category_combo), _("Any")); - gl_category_free_name_list (categories); + lgl_category_free_name_list (categories); /* Actual selection control */ media_select->priv->template_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING); @@ -260,9 +260,9 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select) gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->template_treeview), column); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview)); - template_names = gl_template_get_name_list_all (page_size_id, NULL); + template_names = lgl_template_get_name_list_all (page_size_id, NULL); load_list (media_select->priv->template_store, selection, template_names); - gl_template_free_name_list (template_names); + lgl_template_free_name_list (template_names); /* Connect signals to controls */ g_signal_connect (G_OBJECT (media_select->priv->page_size_combo), "changed", @@ -306,14 +306,14 @@ filter_changed_cb (GtkComboBox *combo, { gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = \"%s\"", page_size_name); gl_debug (DEBUG_MEDIA_SELECT, "category_name = \"%s\"", category_name); - page_size_id = gl_paper_lookup_id_from_name (page_size_name); - category_id = gl_category_lookup_id_from_name (category_name); + page_size_id = lgl_paper_lookup_id_from_name (page_size_name); + category_id = lgl_category_lookup_id_from_name (category_name); gl_debug (DEBUG_MEDIA_SELECT, "page_size_id = \"%s\"", page_size_id); gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id); - template_names = gl_template_get_name_list_all (page_size_id, category_id); + template_names = lgl_template_get_name_list_all (page_size_id, category_id); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview)); load_list (media_select->priv->template_store, selection, template_names); - gl_template_free_name_list (template_names); + lgl_template_free_name_list (template_names); g_free (page_size_id); /* Emit our "changed" signal */ @@ -435,12 +435,12 @@ gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select, page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo)); - *page_size_id = gl_paper_lookup_id_from_name (page_size_name); + *page_size_id = lgl_paper_lookup_id_from_name (page_size_name); category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo)); - *category_id = gl_category_lookup_id_from_name (category_name); + *category_id = lgl_category_lookup_id_from_name (category_name); g_free (page_size_name); g_free (category_name); @@ -459,7 +459,7 @@ gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select, gl_debug (DEBUG_MEDIA_SELECT, "START"); - page_size_name = gl_paper_lookup_name_from_id (page_size_id); + page_size_name = lgl_paper_lookup_name_from_id (page_size_id); if (page_size_name == NULL) { page_size_name = g_strdup (_("Any")); @@ -468,7 +468,7 @@ gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select, gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo), page_size_name); - category_name = gl_category_lookup_name_from_id (category_id); + category_name = lgl_category_lookup_name_from_id (category_id); if (category_name == NULL) { category_name = g_strdup (_("Any")); @@ -486,15 +486,15 @@ gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select, /* PRIVATE. Get a description of the layout and number of labels. */ /*--------------------------------------------------------------------------*/ static gchar * -get_layout_desc (const glTemplate *template) +get_layout_desc (const lglTemplate *template) { - const glTemplateLabelType *label_type; - gint n_labels; - gchar *string; + const lglTemplateFrame *frame; + gint n_labels; + gchar *string; - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); - n_labels = gl_template_get_n_labels (label_type); + n_labels = lgl_template_frame_get_n_labels (frame); string = g_strdup_printf (_("%d per sheet"), n_labels); @@ -505,63 +505,63 @@ get_layout_desc (const glTemplate *template) /* PRIVATE. Get label size description. */ /*--------------------------------------------------------------------------*/ static gchar * -get_label_size_desc (const glTemplate *template) +get_label_size_desc (const lglTemplate *template) { - glUnitsType units; + lglUnitsType units; const gchar *units_string; gdouble units_per_point; - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gchar *string = NULL; units = gl_prefs_get_units (); units_string = gl_prefs_get_units_string (); units_per_point = gl_prefs_get_units_per_point (); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); - switch (label_type->shape) { - case GL_TEMPLATE_SHAPE_RECT: - if ( units == GL_UNITS_INCH ) { + switch (frame->shape) { + case LGL_TEMPLATE_FRAME_SHAPE_RECT: + if ( units == LGL_UNITS_INCH ) { gchar *xstr, *ystr; - xstr = gl_util_fraction (label_type->size.rect.w*units_per_point); - ystr = gl_util_fraction (label_type->size.rect.h*units_per_point); + xstr = gl_util_fraction (frame->rect.w*units_per_point); + ystr = gl_util_fraction (frame->rect.h*units_per_point); string = g_strdup_printf (_("%s x %s %s"), xstr, ystr, units_string); g_free (xstr); g_free (ystr); } else { string = g_strdup_printf (_("%.5g x %.5g %s"), - label_type->size.rect.w*units_per_point, - label_type->size.rect.h*units_per_point, + frame->rect.w*units_per_point, + frame->rect.h*units_per_point, units_string); } break; - case GL_TEMPLATE_SHAPE_ROUND: - if ( units == GL_UNITS_INCH ) { + case LGL_TEMPLATE_FRAME_SHAPE_ROUND: + if ( units == LGL_UNITS_INCH ) { gchar *dstr; - dstr = gl_util_fraction (2.0*label_type->size.round.r*units_per_point); + dstr = gl_util_fraction (2.0*frame->round.r*units_per_point); string = g_strdup_printf (_("%s %s diameter"), dstr, units_string); g_free (dstr); } else { string = g_strdup_printf (_("%.5g %s diameter"), - 2.0*label_type->size.round.r*units_per_point, + 2.0*frame->round.r*units_per_point, units_string); } break; - case GL_TEMPLATE_SHAPE_CD: - if ( units == GL_UNITS_INCH ) { + case LGL_TEMPLATE_FRAME_SHAPE_CD: + if ( units == LGL_UNITS_INCH ) { gchar *dstr; - dstr = gl_util_fraction (2.0*label_type->size.cd.r1*units_per_point); + dstr = gl_util_fraction (2.0*frame->cd.r1*units_per_point); string = g_strdup_printf (_("%s %s diameter"), dstr, units_string); g_free (dstr); } else { string = g_strdup_printf (_("%.5g %s diameter"), - 2.0*label_type->size.cd.r1*units_per_point, + 2.0*frame->cd.r1*units_per_point, units_string); } break; @@ -582,7 +582,7 @@ load_list (GtkListStore *store, { GList *p; GtkTreeIter iter; - glTemplate *template; + lglTemplate *template; GdkPixbuf *pixbuf; gchar *size; gchar *layout; @@ -600,7 +600,7 @@ load_list (GtkListStore *store, gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data); - template = gl_template_from_name (p->data); + template = lgl_template_from_name (p->data); pixbuf = gl_mini_preview_pixbuf_cache_get_pixbuf (template->name); @@ -614,7 +614,7 @@ load_list (GtkListStore *store, g_free (size); g_free (layout); - gl_template_free (template); + lgl_template_free (template); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, diff --git a/glabels2/src/wdgt-mini-preview.c b/glabels2/src/wdgt-mini-preview.c index bb12059e..a11b5087 100644 --- a/glabels2/src/wdgt-mini-preview.c +++ b/glabels2/src/wdgt-mini-preview.c @@ -65,7 +65,7 @@ struct _glWdgtMiniPreviewPrivate { gint height; gint width; - glTemplate *template; + lglTemplate *template; gdouble scale; gdouble offset_x; gdouble offset_y; @@ -126,7 +126,7 @@ static void draw_paper (glWdgtMiniPreview *preview, gdouble line_width); static void draw_labels (glWdgtMiniPreview *preview, cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble line_width); static gint find_closest_label (glWdgtMiniPreview *preview, @@ -204,7 +204,7 @@ gl_wdgt_mini_preview_finalize (GObject *object) g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_MINI_PREVIEW (object)); - gl_template_free (preview->priv->template); + lgl_template_free (preview->priv->template); g_free (preview->priv->centers); g_free (preview->priv); @@ -254,16 +254,16 @@ gl_wdgt_mini_preview_construct (glWdgtMiniPreview *preview, void gl_wdgt_mini_preview_set_label_by_name (glWdgtMiniPreview *preview, const gchar *name) { - glTemplate *template; + lglTemplate *template; gl_debug (DEBUG_MINI_PREVIEW, "START"); /* Fetch template */ - template = gl_template_from_name (name); + template = lgl_template_from_name (name); gl_wdgt_mini_preview_set_template (preview, template); - gl_template_free (template); + lgl_template_free (template); gl_debug (DEBUG_MINI_PREVIEW, "END"); } @@ -272,22 +272,22 @@ void gl_wdgt_mini_preview_set_label_by_name (glWdgtMiniPreview *preview, /* Set label for mini-preview to determine geometry. */ /****************************************************************************/ void gl_wdgt_mini_preview_set_template (glWdgtMiniPreview *preview, - const glTemplate *template) + const lglTemplate *template) { - const glTemplateLabelType *label_type; - glTemplateOrigin *origins; + const lglTemplateFrame *frame; + lglTemplateOrigin *origins; gdouble w, h; gint i; gl_debug (DEBUG_MINI_PREVIEW, "START"); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); /* * Set template */ - gl_template_free (preview->priv->template); - preview->priv->template = gl_template_dup (template); + lgl_template_free (preview->priv->template); + preview->priv->template = lgl_template_dup (template); /* * Set scale and offsets @@ -305,15 +305,15 @@ void gl_wdgt_mini_preview_set_template (glWdgtMiniPreview *preview, /* * Set labels per sheet */ - preview->priv->labels_per_sheet = gl_template_get_n_labels (label_type); + preview->priv->labels_per_sheet = lgl_template_frame_get_n_labels (frame); /* * Initialize centers */ g_free (preview->priv->centers); preview->priv->centers = g_new0 (LabelCenter, preview->priv->labels_per_sheet); - origins = gl_template_get_origins (label_type); - gl_template_get_label_size (label_type, &w, &h); + origins = lgl_template_frame_get_origins (frame); + lgl_template_frame_get_size (frame, &w, &h); for ( i=0; ipriv->labels_per_sheet; i++ ) { preview->priv->centers[i].x = origins[i].x + w/2.0; @@ -570,8 +570,8 @@ static void draw (glWdgtMiniPreview *preview, cairo_t *cr) { - glTemplate *template = preview->priv->template; - gdouble shadow_x, shadow_y; + lglTemplate *template = preview->priv->template; + gdouble shadow_x, shadow_y; gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -670,21 +670,21 @@ draw_paper (glWdgtMiniPreview *preview, static void draw_labels (glWdgtMiniPreview *preview, cairo_t *cr, - glTemplate *template, + lglTemplate *template, gdouble line_width) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gint i, n_labels; - glTemplateOrigin *origins; + lglTemplateOrigin *origins; GtkStyle *style; guint highlight_color; gl_debug (DEBUG_MINI_PREVIEW, "START"); - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); - n_labels = gl_template_get_n_labels (label_type); - origins = gl_template_get_origins (label_type); + n_labels = lgl_template_frame_get_n_labels (frame); + origins = lgl_template_frame_get_origins (frame); style = gtk_widget_get_style (GTK_WIDGET(preview)); highlight_color = gl_color_from_gdk_color (&style->base[GTK_STATE_SELECTED]); diff --git a/glabels2/src/wdgt-mini-preview.h b/glabels2/src/wdgt-mini-preview.h index b3ddde6b..8754b857 100644 --- a/glabels2/src/wdgt-mini-preview.h +++ b/glabels2/src/wdgt-mini-preview.h @@ -72,7 +72,7 @@ void gl_wdgt_mini_preview_set_label_by_name (glWdgtMiniPreview *preview, const gchar *name); void gl_wdgt_mini_preview_set_template (glWdgtMiniPreview *preview, - const glTemplate *template); + const lglTemplate *template); void gl_wdgt_mini_preview_highlight_range (glWdgtMiniPreview *preview, gint first_label, diff --git a/glabels2/src/wdgt-print-copies.c b/glabels2/src/wdgt-print-copies.c index d487f9ee..a63db098 100644 --- a/glabels2/src/wdgt-print-copies.c +++ b/glabels2/src/wdgt-print-copies.c @@ -125,16 +125,16 @@ static void gl_wdgt_print_copies_construct (glWdgtPrintCopies *copies, glLabel *label) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; GtkWidget *whbox, *wvbox, *whbox1; GSList *radio_group = NULL; GtkObject *adjust; whbox = GTK_WIDGET (copies); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); - copies->labels_per_sheet = gl_template_get_n_labels (label_type); + copies->labels_per_sheet = lgl_template_frame_get_n_labels (frame); /* mini_preview canvas */ copies->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, diff --git a/glabels2/src/wdgt-print-merge.c b/glabels2/src/wdgt-print-merge.c index f8b05909..7dfef3a5 100644 --- a/glabels2/src/wdgt-print-merge.c +++ b/glabels2/src/wdgt-print-merge.c @@ -124,16 +124,16 @@ static void gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, glLabel * label) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; GtkWidget *whbox, *wvbox, *whbox1; GtkObject *adjust; GdkPixbuf *pixbuf; whbox = GTK_WIDGET (merge); - label_type = gl_template_get_first_label_type (label->template); + frame = lgl_template_get_first_frame (label->template); - merge->labels_per_sheet = gl_template_get_n_labels (label_type); + merge->labels_per_sheet = lgl_template_frame_get_n_labels (frame); /* mini_preview canvas */ merge->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT, diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c index b3a4e8ad..3dab6b3b 100644 --- a/glabels2/src/wdgt-rotate-label.c +++ b/glabels2/src/wdgt-rotate-label.c @@ -64,7 +64,7 @@ struct _glWdgtRotateLabelPrivate { GtkWidget *rotate_check; GtkWidget *rotate_drawingarea; - glTemplate *template; + lglTemplate *template; }; enum { @@ -90,7 +90,7 @@ static void entry_changed_cb (GtkToggleButton *toggle, gpointer user_data); static void drawingarea_update (GtkDrawingArea *drawing_area, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag); static gboolean expose_cb (GtkWidget *drawingarea, @@ -139,7 +139,7 @@ gl_wdgt_rotate_label_finalize (GObject *object) g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object)); if (rotate_label->priv->template) { - gl_template_free (rotate_label->priv->template); + lgl_template_free (rotate_label->priv->template); rotate_label->priv->template = NULL; } g_free (rotate_label->priv); @@ -228,10 +228,10 @@ entry_changed_cb (GtkToggleButton *toggle, /*--------------------------------------------------------------------------*/ static void drawingarea_update (GtkDrawingArea *drawing_area, - glTemplate *template, + lglTemplate *template, gboolean rotate_flag) { - const glTemplateLabelType *label_type; + const lglTemplateFrame *frame; gdouble m, m_canvas, w, h, scale; GtkStyle *style; guint line_color, fill_color, shadow_color; @@ -250,15 +250,15 @@ drawingarea_update (GtkDrawingArea *drawing_area, return; } - label_type = gl_template_get_first_label_type (template); + frame = lgl_template_get_first_frame (template); if (rotate_flag) { - gl_template_get_label_size (label_type, &h, &w); + lgl_template_frame_get_size (frame, &h, &w); } else { - gl_template_get_label_size (label_type, &w, &h); + lgl_template_frame_get_size (frame, &w, &h); } m = MAX (w, h); scale = MINI_PREVIEW_MAX_PIXELS / m; @@ -359,8 +359,8 @@ void gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label, gchar *name) { - glTemplate *template; - const glTemplateLabelType *label_type; + lglTemplate *template; + const lglTemplateFrame *frame; gdouble raw_w, raw_h; if (name == NULL) @@ -376,11 +376,11 @@ gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label, } else { - template = gl_template_from_name (name); - label_type = gl_template_get_first_label_type (template); + template = lgl_template_from_name (name); + frame = lgl_template_get_first_frame (template); rotate_label->priv->template = template; - gl_template_get_label_size (label_type, &raw_w, &raw_h); + lgl_template_frame_get_size (frame, &raw_w, &raw_h); gtk_widget_set_sensitive (rotate_label->priv->rotate_check, (raw_w != raw_h)); diff --git a/glabels2/src/xml-label-04.c b/glabels2/src/xml-label-04.c index 5fd1d15b..68d146b0 100644 --- a/glabels2/src/xml-label-04.c +++ b/glabels2/src/xml-label-04.c @@ -82,7 +82,7 @@ glLabel *gl_xml_label_04_parse (xmlNodePtr root, label = GL_LABEL (gl_label_new ()); - rotate_flag = gl_xml_get_prop_boolean (root, "rotate", FALSE); + rotate_flag = lgl_xml_get_prop_boolean (root, "rotate", FALSE); gl_label_set_rotate_flag (label, rotate_flag); for (node = root->xmlChildrenNode; node != NULL; node = node->next) { @@ -140,19 +140,19 @@ static gboolean xml04_parse_media_description (xmlNodePtr node, glLabel *label) { - xmlChar *template_name; - glTemplate *template; - gboolean ret; + xmlChar *template_name; + lglTemplate *template; + gboolean ret; gl_debug (DEBUG_XML, "START"); template_name = xmlNodeGetContent (node); - template = gl_template_from_name ((gchar *)template_name); + template = lgl_template_from_name ((gchar *)template_name); if (template == NULL) { g_message ("Undefined template \"%s\"", template_name); /* Get a default */ - template = gl_template_from_name (NULL); + template = lgl_template_from_name (NULL); ret = FALSE; } else { ret = TRUE; @@ -160,7 +160,7 @@ xml04_parse_media_description (xmlNodePtr node, gl_label_set_template (label, template); - gl_template_free (template); + lgl_template_free (template); xmlFree (template_name); gl_debug (DEBUG_XML, "END"); @@ -179,8 +179,8 @@ xml04_parse_object (xmlNodePtr object_node, gl_debug (DEBUG_XML, "START"); - x = gl_xml_get_prop_double (object_node, "x", 0); - y = gl_xml_get_prop_double (object_node, "y", 0); + x = lgl_xml_get_prop_double (object_node, "x", 0); + y = lgl_xml_get_prop_double (object_node, "y", 0); gl_label_object_set_position (object, x, y); @@ -209,18 +209,18 @@ xml04_parse_text_props (xmlNodePtr object_node, gl_debug (DEBUG_XML, "START"); font_family = xmlGetProp (object_node, (xmlChar *)"font_family"); - font_size = gl_xml_get_prop_double (object_node, "font_size", 0); + font_size = lgl_xml_get_prop_double (object_node, "font_size", 0); string = xmlGetProp (object_node, (xmlChar *)"font_weight"); font_weight = gl_util_string_to_weight ((gchar *)string); xmlFree (string); - font_italic_flag = gl_xml_get_prop_boolean (object_node, "font_italic", FALSE); + font_italic_flag = lgl_xml_get_prop_boolean (object_node, "font_italic", FALSE); string = xmlGetProp (object_node, (xmlChar *)"justify"); align = gl_util_string_to_align ((gchar *)string); xmlFree (string); color_node = gl_color_node_new_default (); - color_node->color = gl_xml_get_prop_uint (object_node, "color", 0); + color_node->color = lgl_xml_get_prop_uint (object_node, "color", 0); gl_label_object_set_font_family (GL_LABEL_OBJECT(object), (gchar *)font_family); gl_label_object_set_font_size (GL_LABEL_OBJECT(object), font_size); @@ -317,16 +317,16 @@ xml04_parse_box_props (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - w = gl_xml_get_prop_double (node, "w", 0); - h = gl_xml_get_prop_double (node, "h", 0); + w = lgl_xml_get_prop_double (node, "w", 0); + h = lgl_xml_get_prop_double (node, "h", 0); - line_width = gl_xml_get_prop_double (node, "line_width", 0); + line_width = lgl_xml_get_prop_double (node, "line_width", 0); line_color_node = gl_color_node_new_default (); - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); fill_color_node = gl_color_node_new_default (); - fill_color_node->color = gl_xml_get_prop_uint (node, "fill_color", 0); + fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); @@ -350,13 +350,13 @@ xml04_parse_line_props (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - w = gl_xml_get_prop_double (node, "dx", 0); - h = gl_xml_get_prop_double (node, "dy", 0); + w = lgl_xml_get_prop_double (node, "dx", 0); + h = lgl_xml_get_prop_double (node, "dy", 0); - line_width = gl_xml_get_prop_double (node, "line_width", 0); + line_width = lgl_xml_get_prop_double (node, "line_width", 0); line_color_node = gl_color_node_new_default (); - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); @@ -380,16 +380,16 @@ xml04_parse_ellipse_props (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - w = gl_xml_get_prop_double (node, "w", 0); - h = gl_xml_get_prop_double (node, "h", 0); + w = lgl_xml_get_prop_double (node, "w", 0); + h = lgl_xml_get_prop_double (node, "h", 0); - line_width = gl_xml_get_prop_double (node, "line_width", 0); + line_width = lgl_xml_get_prop_double (node, "line_width", 0); line_color_node = gl_color_node_new_default (); - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); fill_color_node = gl_color_node_new_default (); - fill_color_node->color = gl_xml_get_prop_uint (node, "fill_color", 0); + fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); @@ -419,8 +419,8 @@ xml04_parse_image_props (xmlNodePtr node, gl_label_image_set_filename (object, filename); gl_text_node_free (&filename); - w = gl_xml_get_prop_double (node, "w", 0); - h = gl_xml_get_prop_double (node, "h", 0); + w = lgl_xml_get_prop_double (node, "w", 0); + h = lgl_xml_get_prop_double (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); gl_debug (DEBUG_XML, "END"); @@ -443,12 +443,12 @@ xml04_parse_barcode_props (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); color_node = gl_color_node_new_default (); - color_node->color = gl_xml_get_prop_uint (node, "color", 0); + color_node->color = lgl_xml_get_prop_uint (node, "color", 0); id = xmlGetProp (node, (xmlChar *)"style"); - text_flag = gl_xml_get_prop_boolean (node, "text", FALSE); - scale = gl_xml_get_prop_double (node, "scale", 1.0); + text_flag = lgl_xml_get_prop_boolean (node, "text", FALSE); + scale = lgl_xml_get_prop_double (node, "scale", 1.0); if (scale == 0.0) { scale = 0.5; /* Set to a valid value */ } diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index f4d85d6e..54f8b633 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -264,7 +264,7 @@ xml_doc_to_label (xmlDocPtr doc, return NULL; } - ns = xmlSearchNsByHref (doc, root, (xmlChar *)GL_XML_NAME_SPACE); + ns = xmlSearchNsByHref (doc, root, (xmlChar *)LGL_XML_NAME_SPACE); if (ns != NULL) { label = xml_parse_label (root, status); if (label) @@ -303,15 +303,15 @@ static glLabel * xml_parse_label (xmlNodePtr root, glXMLLabelStatus *status) { - xmlNodePtr child_node; - glLabel *label; - glTemplate *template; + xmlNodePtr child_node; + glLabel *label; + lglTemplate *template; gl_debug (DEBUG_XML, "START"); *status = XML_LABEL_OK; - if (!gl_xml_is_node (root, "Glabels-document")) { + if (!lgl_xml_is_node (root, "Glabels-document")) { g_message (_("Bad root node = \"%s\""), root->name); *status = XML_LABEL_ERROR_OPEN_PARSE; return NULL; @@ -321,7 +321,7 @@ xml_parse_label (xmlNodePtr root, /* Pass 1, extract data nodes to pre-load cache. */ for (child_node = root->xmlChildrenNode; child_node != NULL; child_node = child_node->next) { - if (gl_xml_is_node (child_node, "Data")) { + if (lgl_xml_is_node (child_node, "Data")) { xml_parse_data (child_node, label); } } @@ -331,21 +331,21 @@ xml_parse_label (xmlNodePtr root, child_node != NULL; child_node = child_node->next) { - if (gl_xml_is_node (child_node, "Template")) { - template = gl_xml_template_parse_template_node (child_node); + if (lgl_xml_is_node (child_node, "Template")) { + template = lgl_xml_template_parse_template_node (child_node); if (!template) { g_object_unref (label); *status = XML_LABEL_UNKNOWN_MEDIA; return NULL; } - gl_template_register (template); + lgl_template_register (template); gl_label_set_template (label, template); - gl_template_free (template); - } else if (gl_xml_is_node (child_node, "Objects")) { + lgl_template_free (template); + } else if (lgl_xml_is_node (child_node, "Objects")) { xml_parse_objects (child_node, label); - } else if (gl_xml_is_node (child_node, "Merge")) { + } else if (lgl_xml_is_node (child_node, "Merge")) { xml_parse_merge_fields (child_node, label); - } else if (gl_xml_is_node (child_node, "Data")) { + } else if (lgl_xml_is_node (child_node, "Data")) { /* Handled in pass 1. */ } else { if (!xmlNodeIsText (child_node)) { @@ -375,22 +375,22 @@ xml_parse_objects (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - rotate_flag = gl_xml_get_prop_boolean (node, "rotate", FALSE); + rotate_flag = lgl_xml_get_prop_boolean (node, "rotate", FALSE); gl_label_set_rotate_flag (label, rotate_flag); for (child = node->xmlChildrenNode; child != NULL; child = child->next) { - if (gl_xml_is_node (child, "Object-text")) { + if (lgl_xml_is_node (child, "Object-text")) { xml_parse_object_text (child, label); - } else if (gl_xml_is_node (child, "Object-box")) { + } else if (lgl_xml_is_node (child, "Object-box")) { xml_parse_object_box (child, label); - } else if (gl_xml_is_node (child, "Object-ellipse")) { + } else if (lgl_xml_is_node (child, "Object-ellipse")) { xml_parse_object_ellipse (child, label); - } else if (gl_xml_is_node (child, "Object-line")) { + } else if (lgl_xml_is_node (child, "Object-line")) { xml_parse_object_line (child, label); - } else if (gl_xml_is_node (child, "Object-image")) { + } else if (lgl_xml_is_node (child, "Object-image")) { xml_parse_object_image (child, label); - } else if (gl_xml_is_node (child, "Object-barcode")) { + } else if (lgl_xml_is_node (child, "Object-barcode")) { xml_parse_object_barcode (child, label); } else { if (!xmlNodeIsText (child)) { @@ -423,23 +423,23 @@ xml_parse_object_text (xmlNodePtr node, object = gl_label_text_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* implied size attrs */ - w = gl_xml_get_prop_length (node, "w", 0); - h = gl_xml_get_prop_length (node, "h", 0); + w = lgl_xml_get_prop_length (node, "w", 0); + h = lgl_xml_get_prop_length (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); /* justify attr */ - string = gl_xml_get_prop_string (node, "justify", NULL); + string = lgl_xml_get_prop_string (node, "justify", NULL); align = gl_util_string_to_align (string); g_free (string); gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align); /* auto_shrink attr */ - auto_shrink = gl_xml_get_prop_boolean (node, "auto_shrink", FALSE); + auto_shrink = lgl_xml_get_prop_boolean (node, "auto_shrink", FALSE); gl_label_text_set_auto_shrink (GL_LABEL_TEXT(object), auto_shrink); /* affine attrs */ @@ -450,7 +450,7 @@ xml_parse_object_text (xmlNodePtr node, /* Process children */ for (child = node->xmlChildrenNode; child != NULL; child = child->next) { - if (gl_xml_is_node (child, "Span")) { + if (lgl_xml_is_node (child, "Span")) { xml_parse_toplevel_span (child, GL_LABEL_OBJECT(object)); break; } else { @@ -484,26 +484,26 @@ xml_parse_object_box (xmlNodePtr node, object = gl_label_box_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* size attrs */ - w = gl_xml_get_prop_length (node, "w", 0); - h = gl_xml_get_prop_length (node, "h", 0); + w = lgl_xml_get_prop_length (node, "w", 0); + h = lgl_xml_get_prop_length (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); /* line attrs */ - line_width = gl_xml_get_prop_length (node, "line_width", 1.0); + line_width = lgl_xml_get_prop_length (node, "line_width", 1.0); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); line_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "line_color_field", NULL); + string = lgl_xml_get_prop_string (node, "line_color_field", NULL); if ( string ) { line_color_node->field_flag = TRUE; line_color_node->key = string; } else { - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); } gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node); gl_color_node_free (&line_color_node); @@ -511,12 +511,12 @@ xml_parse_object_box (xmlNodePtr node, /* fill attrs */ fill_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "fill_color_field", NULL); + string = lgl_xml_get_prop_string (node, "fill_color_field", NULL); if ( string ) { fill_color_node->field_flag = TRUE; fill_color_node->key = string; } else { - fill_color_node->color = gl_xml_get_prop_uint (node, "fill_color", 0); + fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0); } gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node); gl_color_node_free (&fill_color_node); @@ -550,26 +550,26 @@ xml_parse_object_ellipse (xmlNodePtr node, object = gl_label_ellipse_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* size attrs */ - w = gl_xml_get_prop_length (node, "w", 0); - h = gl_xml_get_prop_length (node, "h", 0); + w = lgl_xml_get_prop_length (node, "w", 0); + h = lgl_xml_get_prop_length (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); /* line attrs */ - line_width = gl_xml_get_prop_length (node, "line_width", 1.0); + line_width = lgl_xml_get_prop_length (node, "line_width", 1.0); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); line_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "line_color_field", NULL); + string = lgl_xml_get_prop_string (node, "line_color_field", NULL); if ( string ) { line_color_node->field_flag = TRUE; line_color_node->key = string; } else { - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); } gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node); gl_color_node_free (&line_color_node); @@ -577,12 +577,12 @@ xml_parse_object_ellipse (xmlNodePtr node, /* fill attrs */ fill_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "fill_color_field", NULL); + string = lgl_xml_get_prop_string (node, "fill_color_field", NULL); if ( string ) { fill_color_node->field_flag = TRUE; fill_color_node->key = string; } else { - fill_color_node->color = gl_xml_get_prop_uint (node, "fill_color", 0); + fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0); } gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node); gl_color_node_free (&fill_color_node); @@ -615,26 +615,26 @@ xml_parse_object_line (xmlNodePtr node, object = gl_label_line_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* length attrs */ - dx = gl_xml_get_prop_length (node, "dx", 0); - dy = gl_xml_get_prop_length (node, "dy", 0); + dx = lgl_xml_get_prop_length (node, "dx", 0); + dy = lgl_xml_get_prop_length (node, "dy", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), dx, dy); /* line attrs */ - line_width = gl_xml_get_prop_length (node, "line_width", 1.0); + line_width = lgl_xml_get_prop_length (node, "line_width", 1.0); gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width); line_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "line_color_field", NULL); + string = lgl_xml_get_prop_string (node, "line_color_field", NULL); if ( string ) { line_color_node->field_flag = TRUE; line_color_node->key = string; } else { - line_color_node->color = gl_xml_get_prop_uint (node, "line_color", 0); + line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0); } gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node); gl_color_node_free (&line_color_node); @@ -666,12 +666,12 @@ xml_parse_object_image (xmlNodePtr node, object = gl_label_image_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* src or field attr */ - string = gl_xml_get_prop_string (node, "src", NULL); + string = lgl_xml_get_prop_string (node, "src", NULL); if ( string ) { filename = g_new0 (glTextNode, 1); filename->field_flag = FALSE; @@ -680,7 +680,7 @@ xml_parse_object_image (xmlNodePtr node, gl_text_node_free (&filename); xmlFree (string); } else { - string = gl_xml_get_prop_string (node, "field", NULL); + string = lgl_xml_get_prop_string (node, "field", NULL); if ( string ) { filename = g_new0 (glTextNode, 1); filename->field_flag = TRUE; @@ -694,8 +694,8 @@ xml_parse_object_image (xmlNodePtr node, } /* size attrs */ - w = gl_xml_get_prop_length (node, "w", 0); - h = gl_xml_get_prop_length (node, "h", 0); + w = lgl_xml_get_prop_length (node, "w", 0); + h = lgl_xml_get_prop_length (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); /* affine attrs */ @@ -730,37 +730,37 @@ xml_parse_object_barcode (xmlNodePtr node, object = gl_label_barcode_new (label); /* position attrs */ - x = gl_xml_get_prop_length (node, "x", 0.0); - y = gl_xml_get_prop_length (node, "y", 0.0); + x = lgl_xml_get_prop_length (node, "x", 0.0); + y = lgl_xml_get_prop_length (node, "y", 0.0); gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y); /* size attrs */ - w = gl_xml_get_prop_length (node, "w", 0); - h = gl_xml_get_prop_length (node, "h", 0); + w = lgl_xml_get_prop_length (node, "w", 0); + h = lgl_xml_get_prop_length (node, "h", 0); gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h); /* prop attrs */ - id = gl_xml_get_prop_string (node, "style", NULL); - text_flag = gl_xml_get_prop_boolean (node, "text", FALSE); - checksum_flag = gl_xml_get_prop_boolean (node, "checksum", TRUE); - format_digits = gl_xml_get_prop_uint (node, "format", 10); + id = lgl_xml_get_prop_string (node, "style", NULL); + text_flag = lgl_xml_get_prop_boolean (node, "text", FALSE); + checksum_flag = lgl_xml_get_prop_boolean (node, "checksum", TRUE); + format_digits = lgl_xml_get_prop_uint (node, "format", 10); gl_label_barcode_set_props (GL_LABEL_BARCODE(object), (gchar *)id, text_flag, checksum_flag, format_digits); g_free (id); color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "color_field", NULL); + string = lgl_xml_get_prop_string (node, "color_field", NULL); if ( string ) { color_node->field_flag = TRUE; color_node->key = string; } else { - color_node->color = gl_xml_get_prop_uint (node, "color", 0); + color_node->color = lgl_xml_get_prop_uint (node, "color", 0); } gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color_node); gl_color_node_free (&color_node); /* data or field attr */ - string = gl_xml_get_prop_string (node, "data", NULL); + string = lgl_xml_get_prop_string (node, "data", NULL); if ( string ) { text_node = g_new0 (glTextNode, 1); text_node->field_flag = FALSE; @@ -768,7 +768,7 @@ xml_parse_object_barcode (xmlNodePtr node, gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node); gl_text_node_free (&text_node); } else { - string = gl_xml_get_prop_string (node, "field", NULL); + string = lgl_xml_get_prop_string (node, "field", NULL); if ( string ) { text_node = g_new0 (glTextNode, 1); text_node->field_flag = TRUE; @@ -801,11 +801,11 @@ xml_parse_merge_fields (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - string = gl_xml_get_prop_string (node, "type", NULL); + string = lgl_xml_get_prop_string (node, "type", NULL); merge = gl_merge_new (string); g_free (string); - string = gl_xml_get_prop_string (node, "src", NULL); + string = lgl_xml_get_prop_string (node, "src", NULL); gl_merge_set_src (merge, string); g_free (string); @@ -829,7 +829,7 @@ xml_parse_data (xmlNodePtr node, for (child = node->xmlChildrenNode; child != NULL; child = child->next) { - if (gl_xml_is_node (child, "Pixdata")) { + if (lgl_xml_is_node (child, "Pixdata")) { xml_parse_pixdata (child, label); } else { if (!xmlNodeIsText (child)) { @@ -859,8 +859,8 @@ xml_parse_pixdata (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); - name = gl_xml_get_prop_string (node, "name", NULL); - base64 = gl_xml_get_node_content (node); + name = lgl_xml_get_prop_string (node, "name", NULL); + base64 = lgl_xml_get_node_content (node); stream = gl_base64_decode ((gchar *)base64, &stream_length); pixdata = g_new0 (GdkPixdata, 1); @@ -903,39 +903,39 @@ xml_parse_toplevel_span (xmlNodePtr node, gl_debug (DEBUG_XML, "START"); /* Font family attr */ - font_family = gl_xml_get_prop_string (node, "font_family", "Sans"); + font_family = lgl_xml_get_prop_string (node, "font_family", "Sans"); gl_label_object_set_font_family (object, font_family); g_free (font_family); /* Font size attr */ - font_size = gl_xml_get_prop_double (node, "font_size", 0.0); + font_size = lgl_xml_get_prop_double (node, "font_size", 0.0); gl_label_object_set_font_size (object, font_size); /* Font weight attr */ - string = gl_xml_get_prop_string (node, "font_weight", NULL); + string = lgl_xml_get_prop_string (node, "font_weight", NULL); font_weight = gl_util_string_to_weight (string); g_free (string); gl_label_object_set_font_weight (object, font_weight); /* Font italic flag attr */ - font_italic_flag = gl_xml_get_prop_boolean (node, "font_italic", FALSE); + font_italic_flag = lgl_xml_get_prop_boolean (node, "font_italic", FALSE); gl_label_object_set_font_italic_flag (object, font_italic_flag); /* Text color attr */ color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "color_field", NULL); + string = lgl_xml_get_prop_string (node, "color_field", NULL); if ( string ) { color_node->field_flag = TRUE; color_node->key = string; } else { - color_node->color = gl_xml_get_prop_uint (node, "color", 0); + color_node->color = lgl_xml_get_prop_uint (node, "color", 0); } gl_label_object_set_text_color (object, color_node); gl_color_node_free (&color_node); /* Text line spacing attr */ - text_line_spacing = gl_xml_get_prop_double (node, "line_spacing", 1.0); + text_line_spacing = lgl_xml_get_prop_double (node, "line_spacing", 1.0); gl_label_object_set_text_line_spacing (object, text_line_spacing); /* Now descend children, and build lines of text nodes */ @@ -944,7 +944,7 @@ xml_parse_toplevel_span (xmlNodePtr node, for (child = node->xmlChildrenNode; child != NULL; child = child->next) { if (xmlNodeIsText (child)) { - gchar *data = gl_xml_get_node_content (child); + gchar *data = lgl_xml_get_node_content (child); /* Hack: if the first char is LF, it's an xml formatting string */ if (data[0] != '\n') { @@ -956,20 +956,20 @@ xml_parse_toplevel_span (xmlNodePtr node, } g_free (data); - } else if (gl_xml_is_node (child, "Span")) { + } else if (lgl_xml_is_node (child, "Span")) { g_message ("Unexpected rich text (not supported, yet!)"); - } else if (gl_xml_is_node (child, "Field")) { + } else if (lgl_xml_is_node (child, "Field")) { /* Field node */ - string = gl_xml_get_prop_string (child, "name", NULL); + string = lgl_xml_get_prop_string (child, "name", NULL); text_node = g_new0 (glTextNode, 1); text_node->field_flag = TRUE; text_node->data = string; text_nodes = g_list_append (text_nodes, text_node); - } else if (gl_xml_is_node (child, "NL")) { + } else if (lgl_xml_is_node (child, "NL")) { /* Store line. */ lines = g_list_append (lines, text_nodes); @@ -1001,12 +1001,12 @@ xml_parse_affine_attrs (xmlNodePtr node, gdouble a[6]; cairo_matrix_t matrix; - a[0] = gl_xml_get_prop_double (node, "a0", 0.0); - a[1] = gl_xml_get_prop_double (node, "a1", 0.0); - a[2] = gl_xml_get_prop_double (node, "a2", 0.0); - a[3] = gl_xml_get_prop_double (node, "a3", 0.0); - a[4] = gl_xml_get_prop_double (node, "a4", 0.0); - a[5] = gl_xml_get_prop_double (node, "a5", 0.0); + a[0] = lgl_xml_get_prop_double (node, "a0", 0.0); + a[1] = lgl_xml_get_prop_double (node, "a1", 0.0); + a[2] = lgl_xml_get_prop_double (node, "a2", 0.0); + a[3] = lgl_xml_get_prop_double (node, "a3", 0.0); + a[4] = lgl_xml_get_prop_double (node, "a4", 0.0); + a[5] = lgl_xml_get_prop_double (node, "a5", 0.0); cairo_matrix_init (&matrix, a[0], a[1], a[2], a[3], a[4], a[5]); @@ -1027,27 +1027,27 @@ xml_parse_shadow_attrs (xmlNodePtr node, gdouble shadow_opacity; gchar *string; - shadow_state = gl_xml_get_prop_boolean (node, "shadow", FALSE); + shadow_state = lgl_xml_get_prop_boolean (node, "shadow", FALSE); gl_label_object_set_shadow_state (object, shadow_state); if (shadow_state) { - shadow_x = gl_xml_get_prop_length (node, "shadow_x", 0.0); - shadow_y = gl_xml_get_prop_length (node, "shadow_y", 0.0); + shadow_x = lgl_xml_get_prop_length (node, "shadow_x", 0.0); + shadow_y = lgl_xml_get_prop_length (node, "shadow_y", 0.0); gl_label_object_set_shadow_offset (object, shadow_x, shadow_y); shadow_color_node = gl_color_node_new_default (); - string = gl_xml_get_prop_string (node, "shadow_color_field", NULL); + string = lgl_xml_get_prop_string (node, "shadow_color_field", NULL); if ( string ) { shadow_color_node->field_flag = TRUE; shadow_color_node->key = string; } else { - shadow_color_node->color = gl_xml_get_prop_uint (node, "shadow_color", 0); + shadow_color_node->color = lgl_xml_get_prop_uint (node, "shadow_color", 0); } gl_label_object_set_shadow_color (object, shadow_color_node); gl_color_node_free (&shadow_color_node); - shadow_opacity = gl_xml_get_prop_double (node, "shadow_opacity", 1.0); + shadow_opacity = lgl_xml_get_prop_double (node, "shadow_opacity", 1.0); gl_label_object_set_shadow_opacity (object, shadow_opacity); } } @@ -1135,10 +1135,10 @@ xml_label_to_doc (glLabel *label, doc = xmlNewDoc ((xmlChar *)"1.0"); doc->xmlRootNode = xmlNewDocNode (doc, NULL, (xmlChar *)"Glabels-document", NULL); - ns = xmlNewNs (doc->xmlRootNode, (xmlChar *)GL_XML_NAME_SPACE, NULL); + ns = xmlNewNs (doc->xmlRootNode, (xmlChar *)LGL_XML_NAME_SPACE, NULL); xmlSetNs (doc->xmlRootNode, ns); - gl_xml_template_create_template_node (label->template, doc->xmlRootNode, ns); + lgl_xml_template_create_template_node (label->template, doc->xmlRootNode, ns); xml_create_objects (doc->xmlRootNode, ns, label); @@ -1172,8 +1172,8 @@ xml_create_objects (xmlNodePtr root, gl_debug (DEBUG_XML, "START"); node = xmlNewChild (root, ns, (xmlChar *)"Objects", NULL); - gl_xml_set_prop_string (node, "id", "0"); - gl_xml_set_prop_boolean (node, "rotate", label->rotate_flag); + lgl_xml_set_prop_string (node, "id", "0"); + lgl_xml_set_prop_boolean (node, "rotate", label->rotate_flag); for (p = label->objects; p != NULL; p = p->next) { @@ -1220,21 +1220,21 @@ xml_create_object_text (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* size attrs */ gl_label_object_get_raw_size ( object, &w, &h); - gl_xml_set_prop_length (node, "w", w); - gl_xml_set_prop_length (node, "h", h); + lgl_xml_set_prop_length (node, "w", w); + lgl_xml_set_prop_length (node, "h", h); /* justify attr */ align = gl_label_object_get_text_alignment (object); - gl_xml_set_prop_string (node, "justify", gl_util_align_to_string (align)); + lgl_xml_set_prop_string (node, "justify", gl_util_align_to_string (align)); /* auto_shrink attr */ auto_shrink = gl_label_text_get_auto_shrink (GL_LABEL_TEXT (object)); - gl_xml_set_prop_boolean (node, "auto_shrink", auto_shrink); + lgl_xml_set_prop_boolean (node, "auto_shrink", auto_shrink); /* affine attrs */ xml_create_affine_attrs (node, object); @@ -1269,26 +1269,26 @@ xml_create_object_box (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* size attrs */ gl_label_object_get_size (object, &w, &h); - gl_xml_set_prop_length (node, "w", w); - gl_xml_set_prop_length (node, "h", h); + lgl_xml_set_prop_length (node, "w", w); + lgl_xml_set_prop_length (node, "h", h); /* line attrs */ line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); - gl_xml_set_prop_length (node, "line_width", line_width); + lgl_xml_set_prop_length (node, "line_width", line_width); line_color_node = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); if (line_color_node->field_flag) { - gl_xml_set_prop_string (node, "line_color_field", line_color_node->key); + lgl_xml_set_prop_string (node, "line_color_field", line_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); + lgl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); } gl_color_node_free (&line_color_node); @@ -1296,11 +1296,11 @@ xml_create_object_box (xmlNodePtr root, fill_color_node = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); if (fill_color_node->field_flag) { - gl_xml_set_prop_string (node, "fill_color_field", fill_color_node->key); + lgl_xml_set_prop_string (node, "fill_color_field", fill_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "fill_color", fill_color_node->color); + lgl_xml_set_prop_uint_hex (node, "fill_color", fill_color_node->color); } gl_color_node_free (&fill_color_node); @@ -1334,26 +1334,26 @@ xml_create_object_ellipse (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* size attrs */ gl_label_object_get_size (object, &w, &h); - gl_xml_set_prop_length (node, "w", w); - gl_xml_set_prop_length (node, "h", h); + lgl_xml_set_prop_length (node, "w", w); + lgl_xml_set_prop_length (node, "h", h); /* line attrs */ line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); - gl_xml_set_prop_length (node, "line_width", line_width); + lgl_xml_set_prop_length (node, "line_width", line_width); line_color_node = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); if (line_color_node->field_flag) { - gl_xml_set_prop_string (node, "line_color_field", line_color_node->key); + lgl_xml_set_prop_string (node, "line_color_field", line_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); + lgl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); } gl_color_node_free (&line_color_node); @@ -1362,11 +1362,11 @@ xml_create_object_ellipse (xmlNodePtr root, fill_color_node = gl_label_object_get_fill_color (GL_LABEL_OBJECT(object)); if (fill_color_node->field_flag) { - gl_xml_set_prop_string (node, "fill_color_field", fill_color_node->key); + lgl_xml_set_prop_string (node, "fill_color_field", fill_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "fill_color", fill_color_node->color); + lgl_xml_set_prop_uint_hex (node, "fill_color", fill_color_node->color); } gl_color_node_free (&fill_color_node); @@ -1399,26 +1399,26 @@ xml_create_object_line (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* length attrs */ gl_label_object_get_size (object, &dx, &dy); - gl_xml_set_prop_length (node, "dx", dx); - gl_xml_set_prop_length (node, "dy", dy); + lgl_xml_set_prop_length (node, "dx", dx); + lgl_xml_set_prop_length (node, "dy", dy); /* line attrs */ line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object)); - gl_xml_set_prop_length (node, "line_width", line_width); + lgl_xml_set_prop_length (node, "line_width", line_width); line_color_node = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); if (line_color_node->field_flag) { - gl_xml_set_prop_string (node, "line_color_field", line_color_node->key); + lgl_xml_set_prop_string (node, "line_color_field", line_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); + lgl_xml_set_prop_uint_hex (node, "line_color", line_color_node->color); } gl_color_node_free (&line_color_node); @@ -1451,20 +1451,20 @@ xml_create_object_image (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* size attrs */ gl_label_object_get_size (object, &w, &h); - gl_xml_set_prop_length (node, "w", w); - gl_xml_set_prop_length (node, "h", h); + lgl_xml_set_prop_length (node, "w", w); + lgl_xml_set_prop_length (node, "h", h); /* src OR field attr */ filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object)); if (filename->field_flag) { - gl_xml_set_prop_string (node, "field", filename->data); + lgl_xml_set_prop_string (node, "field", filename->data); } else { - gl_xml_set_prop_string (node, "src", filename->data); + lgl_xml_set_prop_string (node, "src", filename->data); } gl_text_node_free (&filename); @@ -1501,31 +1501,31 @@ xml_create_object_barcode (xmlNodePtr root, /* position attrs */ gl_label_object_get_position (object, &x, &y); - gl_xml_set_prop_length (node, "x", x); - gl_xml_set_prop_length (node, "y", y); + lgl_xml_set_prop_length (node, "x", x); + lgl_xml_set_prop_length (node, "y", y); /* size attrs */ gl_label_object_get_raw_size (object, &w, &h); - gl_xml_set_prop_length (node, "w", w); - gl_xml_set_prop_length (node, "h", h); + lgl_xml_set_prop_length (node, "w", w); + lgl_xml_set_prop_length (node, "h", h); /* Barcode properties attrs */ gl_label_barcode_get_props (GL_LABEL_BARCODE(object), &id, &text_flag, &checksum_flag, &format_digits); - gl_xml_set_prop_string (node, "style", id); - gl_xml_set_prop_boolean (node, "text", text_flag); - gl_xml_set_prop_boolean (node, "checksum", checksum_flag); + lgl_xml_set_prop_string (node, "style", id); + lgl_xml_set_prop_boolean (node, "text", text_flag); + lgl_xml_set_prop_boolean (node, "checksum", checksum_flag); g_free (id); color_node = gl_label_object_get_line_color (GL_LABEL_OBJECT(object)); if (color_node->field_flag) { - gl_xml_set_prop_string (node, "color_field", color_node->key); + lgl_xml_set_prop_string (node, "color_field", color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "color", color_node->color); + lgl_xml_set_prop_uint_hex (node, "color", color_node->color); } gl_color_node_free (&color_node); @@ -1533,10 +1533,10 @@ xml_create_object_barcode (xmlNodePtr root, /* data OR field attr */ text_node = gl_label_barcode_get_data (GL_LABEL_BARCODE(object)); if (text_node->field_flag) { - gl_xml_set_prop_string (node, "field", text_node->data); - gl_xml_set_prop_int (node, "format", format_digits); + lgl_xml_set_prop_string (node, "field", text_node->data); + lgl_xml_set_prop_int (node, "format", format_digits); } else { - gl_xml_set_prop_string (node, "data", text_node->data); + lgl_xml_set_prop_string (node, "data", text_node->data); } gl_text_node_free (&text_node); @@ -1568,11 +1568,11 @@ xml_create_merge_fields (xmlNodePtr root, node = xmlNewChild (root, ns, (xmlChar *)"Merge", NULL); string = gl_merge_get_name (merge); - gl_xml_set_prop_string (node, "type", string); + lgl_xml_set_prop_string (node, "type", string); g_free (string); string = gl_merge_get_src (merge); - gl_xml_set_prop_string (node, "src", string); + lgl_xml_set_prop_string (node, "src", string); g_free (string); g_object_unref (G_OBJECT(merge)); @@ -1639,8 +1639,8 @@ xml_create_pixdata (xmlNodePtr root, base64 = gl_base64_encode (stream, stream_length); node = xmlNewChild (root, ns, (xmlChar *)"Pixdata", (xmlChar *)base64); - gl_xml_set_prop_string (node, "name", name); - gl_xml_set_prop_string (node, "encoding", "Base64"); + lgl_xml_set_prop_string (node, "name", name); + lgl_xml_set_prop_string (node, "encoding", "Base64"); gl_pixbuf_cache_remove_pixbuf (pixbuf_cache, name); @@ -1685,21 +1685,21 @@ xml_create_toplevel_span (xmlNodePtr root, color_node = gl_label_object_get_text_color (GL_LABEL_OBJECT(object_text)); if (color_node->field_flag) { - gl_xml_set_prop_string (node, "color_field", color_node->key); + lgl_xml_set_prop_string (node, "color_field", color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "color", color_node->color); + lgl_xml_set_prop_uint_hex (node, "color", color_node->color); } gl_color_node_free (&color_node); align = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object_text)); - gl_xml_set_prop_string (node, "font_family", font_family); - gl_xml_set_prop_double (node, "font_size", font_size); - gl_xml_set_prop_string (node, "font_weight", gl_util_weight_to_string (font_weight)); - gl_xml_set_prop_boolean (node, "font_italic", font_italic_flag); + lgl_xml_set_prop_string (node, "font_family", font_family); + lgl_xml_set_prop_double (node, "font_size", font_size); + lgl_xml_set_prop_string (node, "font_weight", gl_util_weight_to_string (font_weight)); + lgl_xml_set_prop_boolean (node, "font_italic", font_italic_flag); - gl_xml_set_prop_double (node, "line_spacing", text_line_spacing); + lgl_xml_set_prop_double (node, "line_spacing", text_line_spacing); /* Build children. */ lines = gl_label_text_get_lines (GL_LABEL_TEXT(object_text)); @@ -1711,7 +1711,7 @@ xml_create_toplevel_span (xmlNodePtr root, if (text_node->field_flag) { child = xmlNewChild (node, ns, (xmlChar *)"Field", NULL); - gl_xml_set_prop_string (child, "name", text_node->data); + lgl_xml_set_prop_string (child, "name", text_node->data); } else { xmlNodeAddContent (node, (xmlChar *)text_node->data); } @@ -1740,12 +1740,12 @@ xml_create_affine_attrs (xmlNodePtr node, gl_label_object_get_matrix (object, &matrix); - gl_xml_set_prop_double (node, "a0", matrix.xx); - gl_xml_set_prop_double (node, "a1", matrix.yx); - gl_xml_set_prop_double (node, "a2", matrix.xy); - gl_xml_set_prop_double (node, "a3", matrix.yy); - gl_xml_set_prop_double (node, "a4", matrix.x0); - gl_xml_set_prop_double (node, "a5", matrix.y0); + lgl_xml_set_prop_double (node, "a0", matrix.xx); + lgl_xml_set_prop_double (node, "a1", matrix.yx); + lgl_xml_set_prop_double (node, "a2", matrix.xy); + lgl_xml_set_prop_double (node, "a3", matrix.yy); + lgl_xml_set_prop_double (node, "a4", matrix.x0); + lgl_xml_set_prop_double (node, "a5", matrix.y0); } /*--------------------------------------------------------------------------*/ @@ -1765,25 +1765,25 @@ xml_create_shadow_attrs (xmlNodePtr node, if (shadow_state) { - gl_xml_set_prop_boolean (node, "shadow", shadow_state); + lgl_xml_set_prop_boolean (node, "shadow", shadow_state); gl_label_object_get_shadow_offset (object, &shadow_x, &shadow_y); - gl_xml_set_prop_length (node, "shadow_x", shadow_x); - gl_xml_set_prop_length (node, "shadow_y", shadow_y); + lgl_xml_set_prop_length (node, "shadow_x", shadow_x); + lgl_xml_set_prop_length (node, "shadow_y", shadow_y); shadow_color_node = gl_label_object_get_shadow_color (object); if (shadow_color_node->field_flag) { - gl_xml_set_prop_string (node, "shadow_color_field", shadow_color_node->key); + lgl_xml_set_prop_string (node, "shadow_color_field", shadow_color_node->key); } else { - gl_xml_set_prop_uint_hex (node, "shadow_color", shadow_color_node->color); + lgl_xml_set_prop_uint_hex (node, "shadow_color", shadow_color_node->color); } gl_color_node_free (&shadow_color_node); shadow_opacity = gl_label_object_get_shadow_opacity (object); - gl_xml_set_prop_double (node, "shadow_opacity", shadow_opacity); + lgl_xml_set_prop_double (node, "shadow_opacity", shadow_opacity); } }