+2007-10-20 Jim Evins <evins@snaught.com>
+
+ * data/dtd/Makefile.am:
+ * data/dtd/glabels-2.0.dtd:
+ * data/dtd/glabels-2.2.dtd:
+ Rename glabels-2.0.dtd to glabels-2.2.dtd. Added brand and part attributes to
+ template node.
+ * libglabels/template.c:
+ * libglabels/template.h:
+ * libglabels/xml-template.c:
+ * libglabels/xml.h:
+ Added brand and part attributes to template and alias structures and nodes.
+ * src/file.c:
+ * src/label.c:
+ * src/mini-preview-pixbuf-cache.c:
+ * src/template-designer.c:
+ * src/wdgt-media-select.c:
+ Use modified libglabels API.
+ * docs/libglabels/libglabels-decl-list.txt:
+ * docs/libglabels/libglabels-sections.txt:
+ * docs/libglabels/libglabels-undocumented.txt:
+ * docs/libglabels/tmpl/template-construction.sgml:
+ * docs/libglabels/tmpl/template-db.sgml:
+ * docs/libglabels/tmpl/template-struct.sgml:
+ Update libglabels documentation to reflect above modifications.
+
2007-10-14 Jim Evins <evins@snaught.com>
* docs/libglabels/libglabels-decl-list.txt:
dtddir = $(datadir)/glabels/dtd
dtd_DATA = \
- glabels-2.0.dtd
+ glabels-2.2.dtd
EXTRA_DIST = $(dtd_DATA)
+++ /dev/null
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- ENTITIES: primitive types used in element attributes -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-
-<!-- primitives -->
-<!ENTITY % BOOLEAN_TYPE "(False | True | 0 | 1)">
-<!ENTITY % STRING_TYPE "CDATA">
-<!ENTITY % LENGTH_TYPE "CDATA"> <!-- %g (pt|in|mm|cm|pc) -->
-<!ENTITY % INT_TYPE "CDATA"> <!-- %d | 0x%x | 0%o -->
-<!ENTITY % UINT_TYPE "CDATA"> <!-- %u | 0x%x | 0%o -->
-<!ENTITY % FLOAT_TYPE "CDATA"> <!-- %g -->
-
-<!-- Text related enumerations/types -->
-<!ENTITY % JUSTIFY_TYPE "(Left | Right | Center)">
-<!ENTITY % FONT_WEIGHT_TYPE "(Regular | Bold)">
-
-<!-- Barcode related enumerations/types -->
-<!ENTITY % BC_STYLE_TYPE "CDATA">
- <!-- one of:
- "(POSTNET |
- POSTNET-5 |
- POSTNET-9 |
- POSTNET-11 |
- EAN |
- EAN-8 |
- EAN-8+2 |
- EAN-8+5 |
- EAN-13 |
- EAN-13+2 |
- EAN-13+5 |
- UPC |
- UPC-A |
- UPC-A+2 |
- UPC-A+5 |
- UPC-E |
- UPC-E+2 |
- UPC-E+5 |
- ISBN |
- ISBN+5 |
- Code39 |
- Code128 |
- Code128C |
- Code128B |
- I25 |
- CBR |
- MSI |
- PLS)"
- -->
-
-<!-- Data encoding method -->
-<!ENTITY % DATA_ENCODING_TYPE "(None | Base64)">
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Top-level glabels paper data base -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Glabels-paper-sizes (Paper-size*)>
-<!ATTLIST Glabels-paper-sizes
- xmlns %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Top-level glabels categories data base -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Glabels-categories (Category*)>
-<!ATTLIST Glabels-categories
- xmlns %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Top-level glabels template data base -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Glabels-templates (Template*)>
-<!ATTLIST Glabels-templates
- xmlns %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Top-level glabels document -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Glabels-document (Template, Objects+, Merge?, Data*)>
-<!ATTLIST Glabels-document
- xmlns %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Paper size -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Paper-size EMPTY>
-<!ATTLIST Paper-size
- id %STRING_TYPE; #REQUIRED
- name %STRING_TYPE; #IMPLIED
- _name %STRING_TYPE; #IMPLIED
- width %LENGTH_TYPE; #REQUIRED
- height %LENGTH_TYPE; #REQUIRED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Category -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Category EMPTY>
-<!ATTLIST Category
- id %STRING_TYPE; #REQUIRED
- name %STRING_TYPE; #IMPLIED
- _name %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Template Section -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ENTITY % label_element "Label-rectangle | Label-round | Label-cd">
-<!ENTITY % markup_element "Markup-margin | Markup-line | Markup-circle | Markup-rect">
-
-<!ELEMENT Template (Meta*, (%label_element;)+, Alias*)>
-<!ATTLIST Template
- name %STRING_TYPE; #REQUIRED
- size %STRING_TYPE; #REQUIRED
- width %LENGTH_TYPE; #IMPLIED
- height %LENGTH_TYPE; #IMPLIED
- description %STRING_TYPE; #IMPLIED
- _description %STRING_TYPE; #IMPLIED
->
-
-<!ELEMENT Meta EMPTY>
-<!ATTLIST Meta
- category %STRING_TYPE; #REQUIRED
->
-
-<!ELEMENT Label-rectangle ((%markup_element;)*, Layout+)>
-<!ATTLIST Label-rectangle
- id %STRING_TYPE; #REQUIRED
- width %LENGTH_TYPE; #REQUIRED
- height %LENGTH_TYPE; #REQUIRED
- round %LENGTH_TYPE; "0 pt"
- waste %LENGTH_TYPE; #IMPLIED
- x_waste %LENGTH_TYPE; #IMPLIED
- y_waste %LENGTH_TYPE; #IMPLIED
->
-
-<!ELEMENT Label-round ((%markup_element;)*, Layout+)>
-<!ATTLIST Label-round
- id %STRING_TYPE; #REQUIRED
- radius %LENGTH_TYPE; #REQUIRED
- waste %LENGTH_TYPE; #IMPLIED
->
-
-<!ELEMENT Label-cd ((%markup_element;)*, Layout+)>
-<!ATTLIST Label-cd
- id %STRING_TYPE; #REQUIRED
- radius %LENGTH_TYPE; #REQUIRED
- hole %LENGTH_TYPE; #REQUIRED
- width %LENGTH_TYPE; #IMPLIED
- height %LENGTH_TYPE; #IMPLIED
- waste %LENGTH_TYPE; #IMPLIED
->
-
-<!ELEMENT Markup-margin EMPTY>
-<!ATTLIST Markup-margin
- size %LENGTH_TYPE; #REQUIRED
->
-
-<!ELEMENT Markup-line EMPTY>
-<!ATTLIST Markup-line
- x1 %LENGTH_TYPE; #REQUIRED
- y1 %LENGTH_TYPE; #REQUIRED
- x2 %LENGTH_TYPE; #REQUIRED
- y2 %LENGTH_TYPE; #REQUIRED
->
-
-<!ELEMENT Markup-circle EMPTY>
-<!ATTLIST Markup-circle
- x0 %LENGTH_TYPE; #REQUIRED
- y0 %LENGTH_TYPE; #REQUIRED
- radius %LENGTH_TYPE; #REQUIRED
->
-
-<!ELEMENT Markup-rect EMPTY>
-<!ATTLIST Markup-rect
- x1 %LENGTH_TYPE; #REQUIRED
- y1 %LENGTH_TYPE; #REQUIRED
- w %LENGTH_TYPE; #REQUIRED
- h %LENGTH_TYPE; #REQUIRED
- r %LENGTH_TYPE; #REQUIRED
->
-
-<!ELEMENT Layout EMPTY>
-<!ATTLIST Layout
- nx %UINT_TYPE; #REQUIRED
- ny %UINT_TYPE; #REQUIRED
- x0 %LENGTH_TYPE; "0 pt"
- y0 %LENGTH_TYPE; "0 pt"
- dx %LENGTH_TYPE; "0 pt"
- dy %LENGTH_TYPE; "0 pt"
->
-
-<!ELEMENT Alias EMPTY>
-<!ATTLIST Alias
- name %STRING_TYPE; #REQUIRED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Objects Section -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ENTITY % object_class_element "Object-text |
- Object-box |
- Object-line |
- Object-ellipse |
- Object-image |
- Object-barcode"
->
-
-<!ELEMENT Objects ((%object_class_element;)*)>
-<!ATTLIST Objects
- id %STRING_TYPE; #REQUIRED
- rotate %BOOLEAN_TYPE; #REQUIRED
->
-
-<!ENTITY % position_attrs
- "x %LENGTH_TYPE; #REQUIRED
- y %LENGTH_TYPE; #REQUIRED"
->
-
-<!ENTITY % size_attrs
- "w %LENGTH_TYPE; #REQUIRED
- h %LENGTH_TYPE; #REQUIRED"
->
-
-<!ENTITY % line_attrs
- "line_width %LENGTH_TYPE; #IMPLIED
- line_color %UINT_TYPE; #IMPLIED
- line_color_field %STRING_TYPE; #IMPLIED"
->
-
-<!ENTITY % fill_attrs
- "fill_color %UINT_TYPE; #IMPLIED
- fill_color_field %STRING_TYPE; #IMPLIED"
->
-
-<!ENTITY % affine_attrs
- "a0 %FLOAT_TYPE; #IMPLIED
- a1 %FLOAT_TYPE; #IMPLIED
- a2 %FLOAT_TYPE; #IMPLIED
- a3 %FLOAT_TYPE; #IMPLIED
- a4 %FLOAT_TYPE; #IMPLIED
- a5 %FLOAT_TYPE; #IMPLIED"
->
-
-<!ENTITY % shadow_attrs
- ""
->
-
-<!ELEMENT Object-text (Span)>
-<!ATTLIST Object-text
- %position_attrs;
- %size_attrs;
- justify %JUSTIFY_TYPE; #REQUIRED
- auto_shrink %BOOLEAN_TYPE; #IMPLIED
- %affine_attrs;
- %shadow_attrs;
->
-
-<!ELEMENT Object-box EMPTY>
-<!ATTLIST Object-box
- %position_attrs;
- %size_attrs;
- %line_attrs;
- %fill_attrs;
- %affine_attrs;
- %shadow_attrs;
->
-
-<!ELEMENT Object-ellipse EMPTY>
-<!ATTLIST Object-ellipse
- %position_attrs;
- %size_attrs;
- %line_attrs;
- %fill_attrs;
- %affine_attrs;
- %shadow_attrs;
->
-
-<!ELEMENT Object-line EMPTY>
-<!ATTLIST Object-line
- %position_attrs;
- dx %LENGTH_TYPE; #REQUIRED
- dy %LENGTH_TYPE; #REQUIRED
- %line_attrs;
- %affine_attrs;
- %shadow_attrs;
->
-
-<!ELEMENT Object-image EMPTY>
-<!ATTLIST Object-image
- %position_attrs;
- %size_attrs;
- src %STRING_TYPE; #IMPLIED
- field %STRING_TYPE; #IMPLIED
- embed %BOOLEAN_TYPE; #IMPLIED
- %affine_attrs;
- %shadow_attrs;
->
-
-<!ELEMENT Object-barcode EMPTY>
-<!ATTLIST Object-barcode
- %position_attrs;
- %size_attrs;
- style %BC_STYLE_TYPE; #REQUIRED
- text %BOOLEAN_TYPE; #REQUIRED
- checksum %BOOLEAN_TYPE; #REQUIRED
- color %UINT_TYPE; #IMPLIED
- color_field %STRING_TYPE; #IMPLIED
- data %STRING_TYPE; #IMPLIED
- field %STRING_TYPE; #IMPLIED
- format %UINT_TYPE; #IMPLIED
- %affine_attrs;
- %shadow_attrs;
->
-
-
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Merge Section -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ELEMENT Merge EMPTY>
-<!ATTLIST Merge
- type %STRING_TYPE; #REQUIRED
- src %STRING_TYPE; #IMPLIED
->
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Data Section -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ENTITY % data_element "Pixdata">
-
-<!ELEMENT Data (%data_element;)*>
-
-<!-- Inline Pixdata -->
-<!ELEMENT Pixdata (#PCDATA)>
-<!ATTLIST Pixdata
- name %STRING_TYPE; #REQUIRED
- encoding %DATA_ENCODING_TYPE; "Base64"
->
-
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- Text elements -->
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!ENTITY % text_element "#PCDATA | Span | Field | NL">
-
-<!ELEMENT Span (%text_element;)*>
-<!ATTLIST Span
- font_family %STRING_TYPE; #IMPLIED
- font_size %LENGTH_TYPE; #IMPLIED
- font_weight %FONT_WEIGHT_TYPE; #IMPLIED
- font_italic %BOOLEAN_TYPE; #IMPLIED
- color %UINT_TYPE; #IMPLIED
- color_field %STRING_TYPE; #IMPLIED
- line_spacing %LENGTH_TYPE; #IMPLIED
->
-
-<!ELEMENT Field EMPTY>
-<!ATTLIST Field
- name %STRING_TYPE; #REQUIRED
->
-
-<!ELEMENT NL EMPTY>
--- /dev/null
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- ENTITIES: primitive types used in element attributes -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+
+<!-- primitives -->
+<!ENTITY % BOOLEAN_TYPE "(False | True | 0 | 1)">
+<!ENTITY % STRING_TYPE "CDATA">
+<!ENTITY % LENGTH_TYPE "CDATA"> <!-- %g (pt|in|mm|cm|pc) -->
+<!ENTITY % INT_TYPE "CDATA"> <!-- %d | 0x%x | 0%o -->
+<!ENTITY % UINT_TYPE "CDATA"> <!-- %u | 0x%x | 0%o -->
+<!ENTITY % FLOAT_TYPE "CDATA"> <!-- %g -->
+
+<!-- Text related enumerations/types -->
+<!ENTITY % JUSTIFY_TYPE "(Left | Right | Center)">
+<!ENTITY % FONT_WEIGHT_TYPE "(Regular | Bold)">
+
+<!-- Barcode related enumerations/types -->
+<!ENTITY % BC_STYLE_TYPE "CDATA">
+ <!-- one of:
+ "(POSTNET |
+ POSTNET-5 |
+ POSTNET-9 |
+ POSTNET-11 |
+ CEPNET |
+ EAN |
+ EAN-8 |
+ EAN-8+2 |
+ EAN-8+5 |
+ EAN-13 |
+ EAN-13+2 |
+ EAN-13+5 |
+ UPC |
+ UPC-A |
+ UPC-A+2 |
+ UPC-A+5 |
+ UPC-E |
+ UPC-E+2 |
+ UPC-E+5 |
+ ISBN |
+ ISBN+5 |
+ Code39 |
+ Code128 |
+ Code128C |
+ Code128B |
+ I25 |
+ CBR |
+ MSI |
+ PLS |
+ IEC16022)"
+ -->
+
+<!-- Data encoding method -->
+<!ENTITY % DATA_ENCODING_TYPE "(None | Base64)">
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Top-level glabels paper data base -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Glabels-paper-sizes (Paper-size*)>
+<!ATTLIST Glabels-paper-sizes
+ xmlns %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Top-level glabels categories data base -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Glabels-categories (Category*)>
+<!ATTLIST Glabels-categories
+ xmlns %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Top-level glabels template data base -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Glabels-templates (Template*)>
+<!ATTLIST Glabels-templates
+ xmlns %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Top-level glabels document -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Glabels-document (Template, Objects+, Merge?, Data*)>
+<!ATTLIST Glabels-document
+ xmlns %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Paper size -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Paper-size EMPTY>
+<!ATTLIST Paper-size
+ id %STRING_TYPE; #REQUIRED
+ name %STRING_TYPE; #IMPLIED
+ _name %STRING_TYPE; #IMPLIED
+ width %LENGTH_TYPE; #REQUIRED
+ height %LENGTH_TYPE; #REQUIRED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Category -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Category EMPTY>
+<!ATTLIST Category
+ id %STRING_TYPE; #REQUIRED
+ name %STRING_TYPE; #IMPLIED
+ _name %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Template Section -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ENTITY % label_element "Label-rectangle | Label-round | Label-cd">
+<!ENTITY % markup_element "Markup-margin | Markup-line | Markup-circle | Markup-rect">
+
+<!ELEMENT Template (Meta*, (%label_element;)+, Alias*)>
+<!ATTLIST Template
+ brand %STRING_TYPE; #REQUIRED
+ part %STRING_TYPE; #REQUIRED
+ name %STRING_TYPE; #IMPLIED
+ size %STRING_TYPE; #REQUIRED
+ width %LENGTH_TYPE; #IMPLIED
+ height %LENGTH_TYPE; #IMPLIED
+ description %STRING_TYPE; #IMPLIED
+ _description %STRING_TYPE; #IMPLIED
+>
+
+<!ELEMENT Meta EMPTY>
+<!ATTLIST Meta
+ category %STRING_TYPE; #REQUIRED
+>
+
+<!ELEMENT Label-rectangle ((%markup_element;)*, Layout+)>
+<!ATTLIST Label-rectangle
+ id %STRING_TYPE; #REQUIRED
+ width %LENGTH_TYPE; #REQUIRED
+ height %LENGTH_TYPE; #REQUIRED
+ round %LENGTH_TYPE; "0 pt"
+ waste %LENGTH_TYPE; #IMPLIED
+ x_waste %LENGTH_TYPE; #IMPLIED
+ y_waste %LENGTH_TYPE; #IMPLIED
+>
+
+<!ELEMENT Label-round ((%markup_element;)*, Layout+)>
+<!ATTLIST Label-round
+ id %STRING_TYPE; #REQUIRED
+ radius %LENGTH_TYPE; #REQUIRED
+ waste %LENGTH_TYPE; #IMPLIED
+>
+
+<!ELEMENT Label-cd ((%markup_element;)*, Layout+)>
+<!ATTLIST Label-cd
+ id %STRING_TYPE; #REQUIRED
+ radius %LENGTH_TYPE; #REQUIRED
+ hole %LENGTH_TYPE; #REQUIRED
+ width %LENGTH_TYPE; #IMPLIED
+ height %LENGTH_TYPE; #IMPLIED
+ waste %LENGTH_TYPE; #IMPLIED
+>
+
+<!ELEMENT Markup-margin EMPTY>
+<!ATTLIST Markup-margin
+ size %LENGTH_TYPE; #REQUIRED
+>
+
+<!ELEMENT Markup-line EMPTY>
+<!ATTLIST Markup-line
+ x1 %LENGTH_TYPE; #REQUIRED
+ y1 %LENGTH_TYPE; #REQUIRED
+ x2 %LENGTH_TYPE; #REQUIRED
+ y2 %LENGTH_TYPE; #REQUIRED
+>
+
+<!ELEMENT Markup-circle EMPTY>
+<!ATTLIST Markup-circle
+ x0 %LENGTH_TYPE; #REQUIRED
+ y0 %LENGTH_TYPE; #REQUIRED
+ radius %LENGTH_TYPE; #REQUIRED
+>
+
+<!ELEMENT Markup-rect EMPTY>
+<!ATTLIST Markup-rect
+ x1 %LENGTH_TYPE; #REQUIRED
+ y1 %LENGTH_TYPE; #REQUIRED
+ w %LENGTH_TYPE; #REQUIRED
+ h %LENGTH_TYPE; #REQUIRED
+ r %LENGTH_TYPE; #REQUIRED
+>
+
+<!ELEMENT Layout EMPTY>
+<!ATTLIST Layout
+ nx %UINT_TYPE; #REQUIRED
+ ny %UINT_TYPE; #REQUIRED
+ x0 %LENGTH_TYPE; "0 pt"
+ y0 %LENGTH_TYPE; "0 pt"
+ dx %LENGTH_TYPE; "0 pt"
+ dy %LENGTH_TYPE; "0 pt"
+>
+
+<!ELEMENT Alias EMPTY>
+<!ATTLIST Alias
+ name %STRING_TYPE; #REQUIRED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Objects Section -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ENTITY % object_class_element "Object-text |
+ Object-box |
+ Object-line |
+ Object-ellipse |
+ Object-image |
+ Object-barcode"
+>
+
+<!ELEMENT Objects ((%object_class_element;)*)>
+<!ATTLIST Objects
+ id %STRING_TYPE; #REQUIRED
+ rotate %BOOLEAN_TYPE; #REQUIRED
+>
+
+<!ENTITY % position_attrs
+ "x %LENGTH_TYPE; #REQUIRED
+ y %LENGTH_TYPE; #REQUIRED"
+>
+
+<!ENTITY % size_attrs
+ "w %LENGTH_TYPE; #REQUIRED
+ h %LENGTH_TYPE; #REQUIRED"
+>
+
+<!ENTITY % line_attrs
+ "line_width %LENGTH_TYPE; #IMPLIED
+ line_color %UINT_TYPE; #IMPLIED
+ line_color_field %STRING_TYPE; #IMPLIED"
+>
+
+<!ENTITY % fill_attrs
+ "fill_color %UINT_TYPE; #IMPLIED
+ fill_color_field %STRING_TYPE; #IMPLIED"
+>
+
+<!ENTITY % affine_attrs
+ "a0 %FLOAT_TYPE; #IMPLIED
+ a1 %FLOAT_TYPE; #IMPLIED
+ a2 %FLOAT_TYPE; #IMPLIED
+ a3 %FLOAT_TYPE; #IMPLIED
+ a4 %FLOAT_TYPE; #IMPLIED
+ a5 %FLOAT_TYPE; #IMPLIED"
+>
+
+<!ENTITY % shadow_attrs
+ ""
+>
+
+<!ELEMENT Object-text (Span)>
+<!ATTLIST Object-text
+ %position_attrs;
+ %size_attrs;
+ justify %JUSTIFY_TYPE; #REQUIRED
+ auto_shrink %BOOLEAN_TYPE; #IMPLIED
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+<!ELEMENT Object-box EMPTY>
+<!ATTLIST Object-box
+ %position_attrs;
+ %size_attrs;
+ %line_attrs;
+ %fill_attrs;
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+<!ELEMENT Object-ellipse EMPTY>
+<!ATTLIST Object-ellipse
+ %position_attrs;
+ %size_attrs;
+ %line_attrs;
+ %fill_attrs;
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+<!ELEMENT Object-line EMPTY>
+<!ATTLIST Object-line
+ %position_attrs;
+ dx %LENGTH_TYPE; #REQUIRED
+ dy %LENGTH_TYPE; #REQUIRED
+ %line_attrs;
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+<!ELEMENT Object-image EMPTY>
+<!ATTLIST Object-image
+ %position_attrs;
+ %size_attrs;
+ src %STRING_TYPE; #IMPLIED
+ field %STRING_TYPE; #IMPLIED
+ embed %BOOLEAN_TYPE; #IMPLIED
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+<!ELEMENT Object-barcode EMPTY>
+<!ATTLIST Object-barcode
+ %position_attrs;
+ %size_attrs;
+ style %BC_STYLE_TYPE; #REQUIRED
+ text %BOOLEAN_TYPE; #REQUIRED
+ checksum %BOOLEAN_TYPE; #REQUIRED
+ color %UINT_TYPE; #IMPLIED
+ color_field %STRING_TYPE; #IMPLIED
+ data %STRING_TYPE; #IMPLIED
+ field %STRING_TYPE; #IMPLIED
+ format %UINT_TYPE; #IMPLIED
+ %affine_attrs;
+ %shadow_attrs;
+>
+
+
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Merge Section -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ELEMENT Merge EMPTY>
+<!ATTLIST Merge
+ type %STRING_TYPE; #REQUIRED
+ src %STRING_TYPE; #IMPLIED
+>
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Data Section -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ENTITY % data_element "Pixdata">
+
+<!ELEMENT Data (%data_element;)*>
+
+<!-- Inline Pixdata -->
+<!ELEMENT Pixdata (#PCDATA)>
+<!ATTLIST Pixdata
+ name %STRING_TYPE; #REQUIRED
+ encoding %DATA_ENCODING_TYPE; "Base64"
+>
+
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- Text elements -->
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!ENTITY % text_element "#PCDATA | Span | Field | NL">
+
+<!ELEMENT Span (%text_element;)*>
+<!ATTLIST Span
+ font_family %STRING_TYPE; #IMPLIED
+ font_size %LENGTH_TYPE; #IMPLIED
+ font_weight %FONT_WEIGHT_TYPE; #IMPLIED
+ font_italic %BOOLEAN_TYPE; #IMPLIED
+ color %UINT_TYPE; #IMPLIED
+ color_field %STRING_TYPE; #IMPLIED
+ line_spacing %LENGTH_TYPE; #IMPLIED
+>
+
+<!ELEMENT Field EMPTY>
+<!ATTLIST Field
+ name %STRING_TYPE; #REQUIRED
+>
+
+<!ELEMENT NL EMPTY>
<SECTION>
<FILE>template</FILE>
lglTemplate
+lglTemplateAlias
lglTemplateFrameAll
lglTemplateFrameRect
lglTemplateFrameRound
lglTemplateMarkupType
lglTemplateMarkup
lgl_template_register
+lgl_template_get_brand_list
+lgl_template_free_brand_list
lgl_template_get_name_list_unique
lgl_template_get_name_list_all
lgl_template_free_name_list
lgl_template_from_name
+lgl_template_get_name
+lgl_template_do_templates_match
+lgl_template_does_brand_match
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_alias
lgl_template_add_category
lgl_template_add_frame
-lgl_template_add_alias
lgl_template_frame_rect_new
+lgl_template_alias_new
lgl_template_frame_round_new
lgl_template_frame_cd_new
lgl_template_frame_add_layout
lgl_template_markup_rect_new
lgl_template_dup
lgl_template_free
+lgl_template_alias_dup
+lgl_template_alias_free
lgl_template_frame_dup
lgl_template_frame_free
lgl_template_layout_dup
<FILE>template-struct</FILE>
<INCLUDE>libglabels/template.h</INCLUDE>
lglTemplate
+<SUBSECTION Alias Structure>
+lglTemplateAlias
<SUBSECTION Frame Structure>
lglTemplateFrameShape
lglTemplateFrame
<SUBSECTION Origin Structure>
lglTemplateOrigin
<SUBSECTION Template Query Functions>
+lgl_template_get_name
+lgl_template_do_templates_match
+lgl_template_does_brand_match
lgl_template_does_page_size_match
lgl_template_does_category_match
<SUBSECTION Frame Frame Query Functions>
lgl_template_get_name_list_unique
lgl_template_get_name_list_all
lgl_template_free_name_list
+lgl_template_get_brand_list
+lgl_template_free_brand_list
<SUBSECTION Locate Template Functions>
lgl_template_from_name
<SUBSECTION Template Registration Functions>
lgl_template_add_category
lgl_template_add_frame
lgl_template_add_alias
+<SUBSECTION Alias Functions>
+lgl_template_alias_new
+lgl_template_alias_dup
+lgl_template_alias_free
<SUBSECTION Frame Functions>
lgl_template_frame_rect_new
lgl_template_frame_round_new
99% symbol docs coverage.
-130 symbols documented.
+139 symbols documented.
0 symbols incomplete.
1 not documented.
</para>
-@name:
+@brand:
+@part:
@description:
@page_size:
@page_width:
@alias:
+<!-- ##### FUNCTION lgl_template_alias_new ##### -->
+<para>
+
+</para>
+
+@brand:
+@part:
+@Returns:
+
+
+<!-- ##### FUNCTION lgl_template_alias_dup ##### -->
+<para>
+
+</para>
+
+@orig_alias:
+@Returns:
+
+
+<!-- ##### FUNCTION lgl_template_alias_free ##### -->
+<para>
+
+</para>
+
+@alias:
+
+
<!-- ##### FUNCTION lgl_template_frame_rect_new ##### -->
<para>
</para>
+@brand:
@page_size:
@category:
@Returns:
</para>
+@brand:
@page_size:
@category:
@Returns:
@names:
+<!-- ##### FUNCTION lgl_template_get_brand_list ##### -->
+<para>
+
+</para>
+
+@page_size:
+@category:
+@Returns:
+
+
+<!-- ##### FUNCTION lgl_template_free_brand_list ##### -->
+<para>
+
+</para>
+
+@brands:
+
+
<!-- ##### FUNCTION lgl_template_from_name ##### -->
<para>
of peel-off labels or cards.
</para>
-@name: The primary name of the template. Usually a manufacturer followed by a part number.
+@brand: Brand name of label or card. E.g. "Avery."
+@part: Part name or number of label or card. E.g. "8160."
@description: A description of the template. E.g. "Mailing labels."
@page_size: A page size ID. E.g. "US-Letter" or "A4."
@page_width: Page width in points. Used only if page_size is "Other."
@page_height: Page height in points. Used only if page_size is "Other."
+@aliases: A list of alternate names for this template. Often a single template can be used for
+multiple products.
@categories: A list of category IDs associated with this template.
@frames: A list of (#lglTemplateFrame *) structures. GLabels currently only supports one frame
per template -- future versions may support multiple frames per template.
-@aliases: A list of alternate names for this template. Often a single template can be used for
-multiple products.
+
+<!-- ##### STRUCT lglTemplateAlias ##### -->
+<para>
+This structure defines an alias for the parent template structure. An alias is used for
+different products that can use the same template.
+</para>
+
+@brand: Brand name of label or card. E.g. "Avery."
+@part: Part name or number of label or card. E.g. "8160."
<!-- ##### ENUM lglTemplateFrameShape ##### -->
<para>
@x: Distance in points from top edge of page.
@y: Distance in points from left edge of page.
+<!-- ##### FUNCTION lgl_template_get_name ##### -->
+<para>
+
+</para>
+
+@template:
+@Returns:
+
+
+<!-- ##### FUNCTION lgl_template_do_templates_match ##### -->
+<para>
+
+</para>
+
+@template1:
+@template2:
+@Returns:
+
+
+<!-- ##### FUNCTION lgl_template_does_brand_match ##### -->
+<para>
+
+</para>
+
+@template:
+@brand:
+@Returns:
+
+
<!-- ##### FUNCTION lgl_template_does_page_size_match ##### -->
<para>
#include "xml-template.h"
#include "paper.h"
-#define FULL_PAGE "Full-page"
+#define EQUAL(s1,s2) (!g_utf8_collate (s1, s2))
/*===========================================*/
/* Private types */
void
lgl_template_register (const lglTemplate *template)
{
- GList *p_tmplt, *pa1;
- lglTemplate *template1;
+ GList *p_tmplt1, *p_a1;
+ lglTemplate *template1;
+ lglTemplateAlias *alias1;
if (!templates) {
lgl_template_init ();
}
- for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) {
- template1 = (lglTemplate *) p_tmplt->data;
+ for (p_tmplt1 = templates; p_tmplt1 != NULL; p_tmplt1 = p_tmplt1->next) {
+ template1 = (lglTemplate *) p_tmplt1->data;
- for (pa1=template1->aliases; pa1!=NULL; pa1=pa1->next) {
-
- if (g_utf8_collate (template->name, pa1->data) == 0) {
+ for (p_a1=template1->aliases; p_a1!=NULL; p_a1=p_a1->next) {
+ alias1 = (lglTemplateAlias *) p_a1->data;
+
+ if ( EQUAL (template->brand, alias1->brand) &&
+ EQUAL (template->part, alias1->part) )
+ {
/* FIXME: make sure templates are really identical */
/* if not, apply hash to name to make unique. */
/* FIXME: make sure filename is unique */
dir = LGL_USER_DATA_DIR;
mkdir (dir, 0775); /* Try to make sure directory exists. */
- filename = g_strconcat (template->name, ".template", NULL);
+ filename = g_strdup_printf ("%s_%s.template", template->brand, template->part);
abs_filename = g_build_filename (dir, filename, NULL);
lgl_xml_template_write_template_to_file (template, abs_filename);
g_free (dir);
}
+/**
+ * lgl_template_get_brand_list:
+ * @page_size: If non NULL, limit results to given page size.
+ * @category: If non NULL, limit results to given template category.
+ *
+ * Get a list of all valid brands of templates in the template database.
+ * Results can be filtered by page size and/or template category. A list of valid page
+ * sizes can be obtained using lgl_paper_get_id_list(). A list of valid template
+ * categories can be obtained using lgl_category_get_id_list().
+ *
+ * Returns: a list of brands
+ */
+GList *
+lgl_template_get_brand_list (const gchar *page_size,
+ const gchar *category)
+{
+ GList *p_tmplt, *p_alias;
+ lglTemplate *template;
+ lglTemplateAlias *alias;
+ GList *brands = NULL;
+
+ if (!templates)
+ {
+ lgl_template_init ();
+ }
+
+ for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next)
+ {
+ 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)
+ {
+ alias = (lglTemplateAlias *)p_alias->data;
+
+ if ( !g_list_find_custom (brands, alias->brand,
+ (GCompareFunc)g_utf8_collate) )
+ {
+ brands = g_list_insert_sorted (brands,
+ g_strdup (alias->brand),
+ (GCompareFunc)g_utf8_collate);
+ }
+ }
+ }
+ }
+
+ return brands;
+}
+
+/**
+ * lgl_template_free_brand_list:
+ * @brands: List of template brand strings to be freed.
+ *
+ * Free up all storage associated with a list of template names obtained with
+ * lgl_template_get_brand_list().
+ *
+ */
+void
+lgl_template_free_brand_list (GList *brands)
+{
+ GList *p_brand;
+
+ for (p_brand = brands; p_brand != NULL; p_brand = p_brand->next)
+ {
+ g_free (p_brand->data);
+ p_brand->data = NULL;
+ }
+
+ g_list_free (brands);
+}
+
+
/**
* lgl_template_get_name_list_unique:
+ * @brand: If non NULL, limit results to given brand
* @page_size: If non NULL, limit results to given page size.
* @category: If non NULL, limit results to given template category.
*
* Returns: a list of template names.
*/
GList *
-lgl_template_get_name_list_unique (const gchar *page_size,
+lgl_template_get_name_list_unique (const gchar *brand,
+ const gchar *page_size,
const gchar *category)
{
GList *p_tmplt;
lglTemplate *template;
+ gchar *name;
GList *names = NULL;
if (!templates)
for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next)
{
template = (lglTemplate *) p_tmplt->data;
- if (lgl_template_does_page_size_match (template, page_size) &&
+
+ if (lgl_template_does_brand_match (template, brand) &&
+ 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),
+ name = g_strdup_printf ("%s %s", template->brand, template->part);
+ names = g_list_insert_sorted (names, name,
(GCompareFunc)g_utf8_collate);
- }
+ }
}
return names;
/**
* lgl_template_get_name_list_all:
+ * @brand: If non NULL, limit results to given brand
* @page_size: If non NULL, limit results to given page size.
* @category: If non NULL, limit results to given template category.
*
* Returns: a list of template names and aliases.
*/
GList *
-lgl_template_get_name_list_all (const gchar *page_size,
+lgl_template_get_name_list_all (const gchar *brand,
+ const gchar *page_size,
const gchar *category)
{
- GList *p_tmplt, *p_alias;
- lglTemplate *template;
- gchar *str;
- GList *names = NULL;
+ GList *p_tmplt, *p_alias;
+ lglTemplate *template;
+ lglTemplateAlias *alias;
+ gchar *name;
+ GList *names = NULL;
if (!templates)
{
for (p_alias = template->aliases; p_alias != NULL;
p_alias = p_alias->next)
{
- str = g_strdup ((gchar *) p_alias->data);
- names = g_list_insert_sorted (names, str,
- (GCompareFunc)g_utf8_collate);
+ alias = (lglTemplateAlias *)p_alias->data;
+
+ if ( !brand || EQUAL( alias->brand, brand) )
+ {
+ name = g_strdup_printf ("%s %s", alias->brand, alias->part);
+ names = g_list_insert_sorted (names, name,
+ (GCompareFunc)g_utf8_collate);
+ }
}
}
}
return names;
}
+
/**
* lgl_template_free_name_list:
* @names: List of template name strings to be freed.
{
GList *p_name;
- for (p_name = names; p_name != NULL; p_name = p_name->next) {
+ for (p_name = names; p_name != NULL; p_name = p_name->next)
+ {
g_free (p_name->data);
p_name->data = NULL;
}
lglTemplate *
lgl_template_from_name (const gchar *name)
{
- GList *p_tmplt, *p_alias;
- lglTemplate *template;
+ GList *p_tmplt, *p_alias;
+ lglTemplate *template;
+ lglTemplateAlias *alias;
+ gchar *candidate_name;
- if (!templates) {
+ if (!templates)
+ {
lgl_template_init ();
}
- if (name == NULL) {
+ if (name == NULL)
+ {
/* If no name, return first template as a default */
return lgl_template_dup ((lglTemplate *) templates->data);
}
- for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next) {
+ for (p_tmplt = templates; p_tmplt != NULL; p_tmplt = p_tmplt->next)
+ {
template = (lglTemplate *) p_tmplt->data;
- for (p_alias = template->aliases; p_alias != NULL;
- p_alias = p_alias->next) {
- if (g_utf8_collate (p_alias->data, name) == 0) {
+ for (p_alias = template->aliases; p_alias != NULL; p_alias = p_alias->next)
+ {
+ alias = (lglTemplateAlias *)p_alias->data;
+ candidate_name = g_strdup_printf ("%s %s", alias->brand, alias->part);
+ if ( EQUAL (candidate_name, name) ) {
+ g_free (candidate_name);
return lgl_template_dup (template);
}
+ g_free (candidate_name);
}
}
/**
* lgl_template_new:
- * @name: Template name
+ * @brand: Template brand
+ * @part: Template part name/number
* @description: Template descriptions
* @page_size: Page size id
* @page_width: Page width in points, set to zero unless page_size="Other"
*
*/
lglTemplate *
-lgl_template_new (const gchar *name,
+lgl_template_new (const gchar *brand,
+ const gchar *part,
const gchar *description,
const gchar *page_size,
gdouble page_width,
gdouble page_height)
{
- lglTemplate *template;
+ lglTemplate *template;
+ lglTemplateAlias *alias;
template = g_new0 (lglTemplate,1);
- template->name = g_strdup (name);
+ template->brand = g_strdup (brand);
+ template->part = g_strdup (part);
template->description = g_strdup (description);
template->page_size = g_strdup (page_size);
template->page_width = page_width;
/* Always include primary name in alias list. */
template->aliases = NULL;
- template->aliases = g_list_append (template->aliases, g_strdup (name));
+ alias = lgl_template_alias_new (brand, part);
+ lgl_template_add_alias (template, alias);
return template;
}
+/**
+ * lgl_template_get_name:
+ * @template: Pointer to template structure to test
+ *
+ * This function returns the name of the given template. The name is the concetenation
+ * of the brand and part name/number.
+ *
+ * Returns: A pointer to a newly allocated name string. Should be freed with g_free().
+ *
+ */
+gchar *
+lgl_template_get_name (const lglTemplate *template)
+{
+ g_return_val_if_fail (template, NULL);
+
+ return g_strdup_printf ("%s %s", template->brand, template->part);
+}
+
+/**
+ * lgl_template_do_templates_match:
+ * @template1: Pointer to 1st template structure to test
+ * @template2: Pointer to 2nd template structure to test
+ *
+ * This function tests if the given templates match. This is a simple test that only tests
+ * the brand and part name/number. It does not test if they are actually identical.
+ *
+ * Returns: TRUE if the two template matche.
+ *
+ */
+gboolean
+lgl_template_do_templates_match (const lglTemplate *template1,
+ const lglTemplate *template2)
+{
+ g_return_val_if_fail (template1, FALSE);
+ g_return_val_if_fail (template2, FALSE);
+
+ return (EQUAL (template1->brand, template2->brand) &&
+ EQUAL (template1->part, template2->part));
+}
+
+/**
+ * lgl_template_does_brand_match:
+ * @template: Pointer to template structure to test
+ * @brand: Brand string
+ *
+ * This function tests if the brand of the template matches the given brand.
+ *
+ * Returns: TRUE if the template matches the given brand.
+ *
+ */
+gboolean
+lgl_template_does_brand_match (const lglTemplate *template,
+ const gchar *brand)
+{
+ g_return_val_if_fail (template, FALSE);
+
+ /* NULL matches everything. */
+ if (brand == NULL)
+ {
+ return TRUE;
+ }
+
+ return EQUAL (template->brand, brand);
+}
+
/**
* lgl_template_does_page_size_match:
* @template: Pointer to template structure to test
return FALSE;
}
+/**
+ * lgl_template_alias_new:
+ * @brand: Alias brand
+ * @part: Alias part name/number
+ *
+ * Create a new template alias structure, with the given brand and part number.
+ *
+ * Returns: pointer to a newly allocated #lglTemplateAlias structure.
+ *
+ */
+lglTemplateAlias *
+lgl_template_alias_new (const gchar *brand,
+ const gchar *part)
+{
+ lglTemplateAlias *alias;
+
+ alias = g_new0 (lglTemplateAlias,1);
+
+ alias->brand = g_strdup (brand);
+ alias->part = g_strdup (part);
+
+ return alias;
+}
+
+/**
+ * lgl_template_add_alias:
+ * @template: Pointer to template structure
+ * @alias: Alias string
+ *
+ * This function adds the given alias to a templates list of aliases.
+ *
+ */
+void
+lgl_template_add_alias (lglTemplate *template,
+ lglTemplateAlias *alias)
+{
+ g_return_if_fail (template);
+ g_return_if_fail (alias);
+
+ template->aliases = g_list_append (template->aliases, alias);
+}
+
/**
* lgl_template_add_frame:
* @template: Pointer to template structure
g_strdup (category));
}
-/**
- * lgl_template_add_alias:
- * @template: Pointer to template structure
- * @alias: Alias string
- *
- * This function adds the given alias to a templates list of aliases.
- *
- */
-void
-lgl_template_add_alias (lglTemplate *template,
- const gchar *alias)
-{
- g_return_if_fail (template);
- g_return_if_fail (alias);
-
- template->aliases = g_list_append (template->aliases,
- g_strdup (alias));
-}
-
/**
* lgl_template_frame_rect_new:
* @id: ID of frame. (This should currently always be "0").
lgl_template_dup (const lglTemplate *orig_template)
{
lglTemplate *template;
+ lglTemplateAlias *alias;
GList *p;
lglTemplateFrame *frame;
g_return_val_if_fail (orig_template, NULL);
- template = lgl_template_new (orig_template->name,
+ template = lgl_template_new (orig_template->brand,
+ orig_template->part,
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 ) {
+ for ( p=orig_template->aliases; p != NULL; p=p->next )
+ {
+ alias = (lglTemplateAlias *)p->data;
- lgl_template_add_category (template, p->data);
+ if ( !(EQUAL (template->brand, alias->brand) &&
+ EQUAL (template->part, alias->part)) )
+ {
+ lgl_template_add_alias (template, lgl_template_alias_dup (alias));
+ }
}
- for ( p=orig_template->frames; p != NULL; p=p->next ) {
+ for ( p=orig_template->categories; p != NULL; p=p->next )
+ {
+ lgl_template_add_category (template, p->data);
+ }
+ for ( p=orig_template->frames; p != NULL; p=p->next )
+ {
frame = (lglTemplateFrame *)p->data;
lgl_template_add_frame (template, lgl_template_frame_dup (frame));
}
- for ( p=orig_template->aliases; p != NULL; p=p->next ) {
-
- if (g_utf8_collate (template->name, p->data) != 0) {
- lgl_template_add_alias (template, p->data);
- }
-
- }
-
return template;
}
if ( template != NULL ) {
- g_free (template->name);
- template->name = NULL;
+ g_free (template->brand);
+ template->brand = NULL;
+
+ g_free (template->part);
+ template->part = NULL;
g_free (template->description);
template->description = NULL;
g_free (template->page_size);
template->page_size = NULL;
+ for ( p=template->aliases; p != NULL; p=p->next ) {
+
+ lgl_template_alias_free (p->data);
+ p->data = NULL;
+
+ }
+ g_list_free (template->aliases);
+ template->aliases = NULL;
+
for ( p=template->categories; p != NULL; p=p->next ) {
g_free (p->data);
g_list_free (template->frames);
template->frames = NULL;
- for ( p=template->aliases; p != NULL; p=p->next ) {
+ g_free (template);
- g_free (p->data);
- p->data = NULL;
+ }
- }
- g_list_free (template->aliases);
- template->aliases = NULL;
+}
- g_free (template);
+/**
+ * lgl_template_alias_dup:
+ * @orig_alias: Alias to duplicate.
+ *
+ * This function duplicates a template alias structure.
+ *
+ * Returns: a newly allocated #lglTemplateAlias structure.
+ *
+ */
+lglTemplateAlias *
+lgl_template_alias_dup (const lglTemplateAlias *orig_alias)
+{
+ g_return_val_if_fail (orig_alias, NULL);
- }
+ return lgl_template_alias_new (orig_alias->brand, orig_alias->part);
+}
+
+/**
+ * lgl_template_alias_free:
+ * @alias: Alias to free.
+ *
+ * This function frees all memory associated with given template alias structure.
+ *
+ */
+void
+lgl_template_alias_free (lglTemplateAlias *alias)
+{
+
+ if ( alias != NULL )
+ {
+ g_free (alias->brand);
+ alias->brand = NULL;
+
+ g_free (alias->part);
+ alias->part = NULL;
+ g_free (alias);
+ }
}
/**
lglPaper *paper = NULL;
lglTemplate *template = NULL;
lglTemplateFrame *frame = NULL;
- gchar *name;
+ gchar *part;
+ gchar *desc;
g_return_val_if_fail (page_size, NULL);
return NULL;
}
- name = g_strdup_printf (_("Generic %s full page"), page_size);
+ part = g_strdup_printf ("%s-Full-Page", paper->id);
+ desc = g_strdup_printf (_("Generic %s full page template"), paper->name);
- template = lgl_template_new (name,
- FULL_PAGE,
- page_size,
- paper->width,
- paper->height);
+ template = lgl_template_new ("Generic", part, desc,
+ page_size, paper->width, paper->height);
frame = lgl_template_frame_rect_new ("0",
lgl_template_frame_add_markup (frame, lgl_template_markup_margin_new (9.0));
- g_free (name);
- name = NULL;
+ g_free (desc);
+ desc = NULL;
lgl_paper_free (paper);
paper = NULL;
lglTemplate *template;
g_print ("%s():\n", __FUNCTION__);
- for (p=templates; p!=NULL; p=p->next) {
+ for (p=templates; p!=NULL; p=p->next)
+ {
template = (lglTemplate *)p->data;
- g_print("TEMPLATE name=\"%s\", description=\"%s\"\n",
- template->name, template->description);
+ g_print("TEMPLATE brand=\"%s\", part=\"%s\", description=\"%s\"\n",
+ template->brand, template->part, template->description);
}
g_print ("\n");
void
lgl_template_print_aliases (const lglTemplate *template)
{
- GList *p;
+ GList *p;
+ lglTemplateAlias *alias;
g_print ("%s():\n", __FUNCTION__);
- for (p=template->aliases; p!=NULL; p=p->next) {
+ for (p=template->aliases; p!=NULL; p=p->next)
+ {
+ alias = (lglTemplateAlias *)p->data;
- g_print("Alias = \"%s\"\n", (gchar *)p->data);
+ g_print("Alias: brand=\"%s\", part=\"%s\"\n", alias->brand, alias->part);
}
g_print ("\n");
typedef struct _lglTemplate lglTemplate;
+typedef struct _lglTemplateAlias lglTemplateAlias;
+
typedef union _lglTemplateFrame lglTemplateFrame;
typedef struct _lglTemplateFrameAll lglTemplateFrameAll;
typedef struct _lglTemplateFrameRect lglTemplateFrameRect;
*/
struct _lglTemplate {
- gchar *name;
+ gchar *brand;
+ gchar *part;
gchar *description;
gchar *page_size;
gdouble page_width;
gdouble page_height;
+ /* List of (lglTemplateAlias *) aliase structures. */
+ GList *aliases;
+
/* List of (gchar *) category ids. */
GList *categories;
* template. */
GList *frames;
- /* List of (gchar *) aliases. */
- GList *aliases;
-
};
+/*
+ * Top-level Template Structure
+ */
+struct _lglTemplateAlias {
+
+ gchar *brand;
+ gchar *part;
+
+};
+
/*
* Possible Frame Shapes
*/
/*
* Known templates query functions
*/
-GList *lgl_template_get_name_list_unique (const gchar *page_size,
+GList *lgl_template_get_brand_list (const gchar *page_size,
const gchar *category);
-GList *lgl_template_get_name_list_all (const gchar *page_size,
+void lgl_template_free_brand_list (GList *brands);
+
+GList *lgl_template_get_name_list_unique (const gchar *brand,
+ const gchar *page_size,
+ const gchar *category);
+
+GList *lgl_template_get_name_list_all (const gchar *brand,
+ const gchar *page_size,
const gchar *category);
void lgl_template_free_name_list (GList *names);
/*
* Template query functions
*/
+gchar *lgl_template_get_name (const lglTemplate *template);
+
+gboolean lgl_template_do_templates_match (const lglTemplate *template1,
+ const lglTemplate *template2);
+
+gboolean lgl_template_does_brand_match (const lglTemplate *template,
+ const gchar *brand);
+
gboolean lgl_template_does_page_size_match (const lglTemplate *template,
const gchar *page_size);
/*
* Template Construction
*/
-lglTemplate *lgl_template_new (const gchar *name,
+lglTemplate *lgl_template_new (const gchar *brand,
+ const gchar *part,
const gchar *description,
const gchar *page_size,
gdouble page_width,
gdouble page_height);
+void lgl_template_add_alias (lglTemplate *template,
+ lglTemplateAlias *alias);
+
void lgl_template_add_category (lglTemplate *template,
const gchar *category);
void lgl_template_add_frame (lglTemplate *template,
lglTemplateFrame *frame);
-void lgl_template_add_alias (lglTemplate *template,
- const gchar *alias);
-
lglTemplateFrame *lgl_template_frame_rect_new (const gchar *id,
gdouble w,
gdouble h,
gdouble x_waste,
gdouble y_waste);
+lglTemplateAlias *lgl_template_alias_new (const gchar *brand,
+ const gchar *part);
+
lglTemplateFrame *lgl_template_frame_round_new (const gchar *id,
gdouble r,
gdouble waste);
void lgl_template_free (lglTemplate *template);
+lglTemplateAlias *lgl_template_alias_dup (const lglTemplateAlias *orig_alias);
+void lgl_template_alias_free (lglTemplateAlias *alias);
+
lglTemplateFrame *lgl_template_frame_dup (const lglTemplateFrame *orig_frame);
void lgl_template_frame_free (lglTemplateFrame *frame);
static void xml_create_markup_rect_node (const lglTemplateMarkup *circle,
xmlNodePtr root,
const xmlNsPtr ns);
-static void xml_create_alias_node (const gchar *name,
+static void xml_create_alias_node (const lglTemplateAlias *alias,
xmlNodePtr root,
const xmlNsPtr ns);
lglTemplate *
lgl_xml_template_parse_template_node (const xmlNodePtr template_node)
{
+ gchar *brand;
+ gchar *part;
gchar *name;
gchar *description;
gchar *page_size;
lglPaper *paper = NULL;
lglTemplate *template;
xmlNodePtr node;
+ gchar **v;
+
+ brand = lgl_xml_get_prop_string (template_node, "brand", NULL);
+ part = lgl_xml_get_prop_string (template_node, "part", NULL);
+ if (!brand || !part)
+ {
+ name = lgl_xml_get_prop_string (template_node, "name", NULL);
+ if (name)
+ {
+ g_message (_("Missing required \"brand\" or \"part\" attribute, trying deprecated name."));
+ v = g_strsplit (name, " ", 2);
+ brand = g_strdup (v[0]);
+ part = g_strdup (v[1]);
+ g_free (name);
+ g_strfreev (v);
+
+ }
+ else
+ {
+ g_message (_("Name attribute also missing."));
+ }
+ }
- 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);
paper = NULL;
}
- template = lgl_template_new (name,
- description,
- page_size,
- page_width, page_height);
+ template = lgl_template_new (brand, part, description,
+ page_size, page_width, page_height);
for (node = template_node->xmlChildrenNode; node != NULL;
node = node->next) {
}
}
- g_free (name);
+ g_free (brand);
+ g_free (part);
g_free (description);
g_free (page_size);
xml_parse_alias_node (xmlNodePtr alias_node,
lglTemplate *template)
{
- gchar *name;
-
- name = lgl_xml_get_prop_string (alias_node, "name", NULL);
-
- lgl_template_add_alias (template, (gchar *)name);
-
- g_free (name);
+ gchar *brand;
+ gchar *part;
+ gchar *name;
+ gchar **v;
+ lglTemplateAlias *alias;
+
+ brand = lgl_xml_get_prop_string (alias_node, "brand", NULL);
+ part = lgl_xml_get_prop_string (alias_node, "part", NULL);
+ if (!brand || !part)
+ {
+ name = lgl_xml_get_prop_string (alias_node, "name", NULL);
+ if (name)
+ {
+ g_message (_("Missing required \"brand\" or \"part\" attribute, trying deprecated name."));
+ v = g_strsplit (name, " ", 2);
+ brand = g_strdup (v[0]);
+ part = g_strdup (v[1]);
+ g_free (name);
+ g_strfreev (v);
+
+ }
+ else
+ {
+ g_message (_("Name attribute also missing."));
+ }
+ }
+
+ lgl_template_add_alias (template, lgl_template_alias_new (brand, part));
+
+ g_free (brand);
+ g_free (part);
}
/**
{
xmlNodePtr node;
GList *p;
+ lglTemplateAlias *alias;
lglTemplateFrame *frame;
node = xmlNewChild (root, ns, (xmlChar *)"Template", NULL);
- lgl_xml_set_prop_string (node, "name", template->name);
+ lgl_xml_set_prop_string (node, "brand", template->part);
+ lgl_xml_set_prop_string (node, "part", template->part);
lgl_xml_set_prop_string (node, "size", template->page_size);
- if (xmlStrEqual ((xmlChar *)template->page_size, (xmlChar *)"Other")) {
+ if (xmlStrEqual ((xmlChar *)template->page_size, (xmlChar *)"Other"))
+ {
lgl_xml_set_prop_length (node, "width", template->page_width);
lgl_xml_set_prop_length (node, "height", template->page_height);
lgl_xml_set_prop_string (node, "description", template->description);
- for ( p=template->categories; p != NULL; p=p->next ) {
+ for ( p=template->aliases; p != NULL; p=p->next ) {
+ alias = (lglTemplateAlias *)p->data;
+ if ( !(xmlStrEqual ((xmlChar *)template->brand, (xmlChar *)alias->brand) &&
+ xmlStrEqual ((xmlChar *)template->part, (xmlChar *)alias->part)) )
+ {
+ xml_create_alias_node ( alias, 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 ) {
+ 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 ) {
- if (!xmlStrEqual ((xmlChar *)template->name, (xmlChar *)p->data)) {
- xml_create_alias_node ( p->data, node, ns );
- }
- }
-
}
/*--------------------------------------------------------------------------*/
/* PRIVATE. Add XML Template->Alias Node. */
/*--------------------------------------------------------------------------*/
static void
-xml_create_alias_node (const gchar *name,
- xmlNodePtr root,
- const xmlNsPtr ns)
+xml_create_alias_node (const lglTemplateAlias *alias,
+ xmlNodePtr root,
+ const xmlNsPtr ns)
{
xmlNodePtr node;
node = xmlNewChild (root, ns, (xmlChar *)"Alias", NULL);
- lgl_xml_set_prop_string (node, "name", name);
+
+ lgl_xml_set_prop_string (node, "brand", alias->brand);
+ lgl_xml_set_prop_string (node, "part", alias->part);
}
#include "enums.h"
-#define LGL_XML_NAME_SPACE "http://snaught.com/glabels/2.0/"
+#define LGL_XML_NAME_SPACE "http://snaught.com/glabels/2.2/"
G_BEGIN_DECLS
glWindow *window)
{
GtkWidget *dialog;
+ gchar *name;
gl_debug (DEBUG_FILE, "START");
label->template->page_size,
NULL);
}
- if (label->template->name != NULL) {
- gl_new_label_dialog_set_template_name (GL_NEW_LABEL_DIALOG (dialog),
- label->template->name);
+ name = lgl_template_get_name (label->template);
+ if (name != NULL) {
+ gl_new_label_dialog_set_template_name (GL_NEW_LABEL_DIALOG (dialog), name);
}
+ g_free (name);
+
gl_new_label_dialog_set_rotate_state (GL_NEW_LABEL_DIALOG (dialog),
label->rotate_flag);
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (label && GL_IS_LABEL (label));
+ g_return_if_fail (template);
if ((label->template == NULL) ||
- (g_strcasecmp (template->name, label->template->name) != 0)) {
+ !lgl_template_do_templates_match (template, label->template)) {
lgl_template_free (label->template);
label->template = lgl_template_dup (template);
mini_preview_pixbuf_cache = g_hash_table_new (g_str_hash, g_str_equal);
- names = lgl_template_get_name_list_unique (NULL, NULL);
+ names = lgl_template_get_name_list_unique (NULL, NULL, NULL);
for ( p=names; p != NULL; p=p->next )
{
+ gl_debug (DEBUG_PIXBUF_CACHE, "name = \"%s\"", p->data);
gl_mini_preview_pixbuf_cache_add_by_name ((gchar *)p->data);
}
lgl_template_free_name_list (names);
apply_cb (glTemplateDesigner *dialog)
{
lglTemplate *template;
+ gchar *name;
template = build_template (dialog);
lgl_template_register (template);
- gl_mini_preview_pixbuf_cache_add_by_name (template->name);
+ name = lgl_template_get_name (template);
+ gl_mini_preview_pixbuf_cache_add_by_name (name);
+ g_free (name);
}
/*--------------------------------------------------------------------------*/
build_template (glTemplateDesigner *dialog)
{
gdouble upp;
- gchar *brand, *part_num, *name, *desc;
+ gchar *brand, *part_num, *desc;
gchar *page_size_name;
lglPaper *paper;
lglTemplateFrameShape shape;
brand = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->brand_entry), 0, -1);
part_num = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->part_num_entry), 0, -1);
- name = g_strdup_printf ("%s %s", brand, part_num);
desc = gtk_editable_get_chars (GTK_EDITABLE(dialog->priv->description_entry), 0, -1);
page_size_name =
dy_2 = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->layout2_dy_spin));
- template = lgl_template_new (name, desc, paper->id, paper->width, paper->height);
+ template = lgl_template_new (brand, part_num, desc, paper->id, paper->width, paper->height);
switch (shape) {
case LGL_TEMPLATE_FRAME_SHAPE_RECT:
g_free (brand);
g_free (part_num);
- g_free (name);
g_free (desc);
g_free (page_size_name);
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 = lgl_template_get_name_list_all (page_size_id, NULL);
+ template_names = lgl_template_get_name_list_all (NULL, page_size_id, NULL);
load_list (media_select->priv->template_store, selection, template_names);
lgl_template_free_name_list (template_names);
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 = lgl_template_get_name_list_all (page_size_id, category_id);
+ template_names = lgl_template_get_name_list_all (NULL, 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);
lgl_template_free_name_list (template_names);
gchar *size;
gchar *layout;
gchar *description;
+ gchar *name;
gl_debug (DEBUG_MEDIA_SELECT, "START");
gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
template = lgl_template_from_name (p->data);
-
- pixbuf = gl_mini_preview_pixbuf_cache_get_pixbuf (template->name);
+
+ name = lgl_template_get_name (template);
+ pixbuf = gl_mini_preview_pixbuf_cache_get_pixbuf (name);
+ g_free (name);
size = get_label_size_desc (template);
layout = get_layout_desc (template);