]> git.sur5r.net Git - glabels/commitdiff
2007-10-20 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sat, 20 Oct 2007 22:02:40 +0000 (22:02 +0000)
committerJim Evins <evins@snaught.com>
Sat, 20 Oct 2007 22:02:40 +0000 (22:02 +0000)
* 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.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@681 f5e0f49d-192f-0410-a22d-a8d8700d0965

19 files changed:
glabels2/ChangeLog
glabels2/data/dtd/Makefile.am
glabels2/data/dtd/glabels-2.0.dtd [deleted file]
glabels2/data/dtd/glabels-2.2.dtd [new file with mode: 0644]
glabels2/docs/libglabels/libglabels-decl-list.txt
glabels2/docs/libglabels/libglabels-sections.txt
glabels2/docs/libglabels/libglabels-undocumented.txt
glabels2/docs/libglabels/tmpl/template-construction.sgml
glabels2/docs/libglabels/tmpl/template-db.sgml
glabels2/docs/libglabels/tmpl/template-struct.sgml
glabels2/libglabels/template.c
glabels2/libglabels/template.h
glabels2/libglabels/xml-template.c
glabels2/libglabels/xml.h
glabels2/src/file.c
glabels2/src/label.c
glabels2/src/mini-preview-pixbuf-cache.c
glabels2/src/template-designer.c
glabels2/src/wdgt-media-select.c

index 463a49126e6b8144270083e11ed64babe94d310e..31e0ba5f2c3695394b6a39ce829136544b492124 100644 (file)
@@ -1,3 +1,29 @@
+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:
index d74bc6c3694689eb689b3f7c22218c2d7f40e5d4..0dce23d6f17519bf41dd099c37039a760c697fb1 100644 (file)
@@ -3,7 +3,7 @@
 dtddir = $(datadir)/glabels/dtd
 
 dtd_DATA = \
-       glabels-2.0.dtd
+       glabels-2.2.dtd
 
 EXTRA_DIST = $(dtd_DATA)
 
diff --git a/glabels2/data/dtd/glabels-2.0.dtd b/glabels2/data/dtd/glabels-2.0.dtd
deleted file mode 100644 (file)
index ad2f50a..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-
-<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
-<!-- 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>
diff --git a/glabels2/data/dtd/glabels-2.2.dtd b/glabels2/data/dtd/glabels-2.2.dtd
new file mode 100644 (file)
index 0000000..4565d81
--- /dev/null
@@ -0,0 +1,378 @@
+
+<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
+<!-- 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>
index 1cbc870116387ca6beda40a94ccb1d97e54a6332..6a9fd9562356cbb32443cfdd212a514ce679a302 100644 (file)
@@ -41,6 +41,7 @@ lglUnitsType
 <SECTION>
 <FILE>template</FILE>
 lglTemplate
+lglTemplateAlias
 lglTemplateFrameAll
 lglTemplateFrameRect
 lglTemplateFrameRound
@@ -56,20 +57,26 @@ lglTemplateFrame
 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
@@ -81,6 +88,8 @@ lgl_template_markup_circle_new
 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
index d29ec3d62dde48985b6a5bbd399d8bec81a50a23..bed478157cac66bf935a89138f41050a5f29d677 100644 (file)
@@ -57,6 +57,8 @@ lgl_category_lookup_name_from_id
 <FILE>template-struct</FILE>
 <INCLUDE>libglabels/template.h</INCLUDE>
 lglTemplate
+<SUBSECTION Alias Structure>
+lglTemplateAlias
 <SUBSECTION Frame Structure>
 lglTemplateFrameShape
 lglTemplateFrame
@@ -76,6 +78,9 @@ lglTemplateMarkupRect
 <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>
@@ -90,6 +95,8 @@ lgl_template_frame_get_origins
 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>
@@ -105,6 +112,10 @@ lgl_template_free
 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
index 2b02c59e68ca7a081bace59fac4ac0589f534cdb..e487606c96f1ea7637886fe7d1b64191a4bc3d52 100644 (file)
@@ -1,5 +1,5 @@
 99% symbol docs coverage.
-130 symbols documented.
+139 symbols documented.
 0 symbols incomplete.
 1 not documented.
 
index 55da76bb5a083bc44f661eacb84fa6e37cd12196..f486869a7b76fb876b2b76dcae6ff69e957c9e46 100644 (file)
@@ -22,7 +22,8 @@ This section describes a set of functions for constructing new template structur
 
 </para>
 
-@name: 
+@brand: 
+@part: 
 @description: 
 @page_size: 
 @page_width: 
@@ -74,6 +75,33 @@ This section describes a set of functions for constructing new template structur
 @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>
 
index 3241c832a75b2f7b0c72c265783993b5249cc0c3..81aa69418e170b874ad86ab7b03428862701b10f 100644 (file)
@@ -23,6 +23,7 @@ to the LibGlabels template database.
 
 </para>
 
+@brand: 
 @page_size: 
 @category: 
 @Returns: 
@@ -33,6 +34,7 @@ to the LibGlabels template database.
 
 </para>
 
+@brand: 
 @page_size: 
 @category: 
 @Returns: 
@@ -46,6 +48,24 @@ to the LibGlabels template database.
 @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>
 
index 7aa46193c4a0e90f132d1dea67585017f95cfd47..5357607e4fbec011ee6971a897f3c31cf1b16b0a 100644 (file)
@@ -24,16 +24,26 @@ This is the main structure of a libglabels template.  A template represents a si
 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>
@@ -191,6 +201,35 @@ relative to the upper left corner of the page.
 @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>
 
index 784fae9df5411fa8f9b63a2972830e9340886396..6de739a575100a84aa4d155b42227e2ddd9c14c8 100644 (file)
@@ -42,7 +42,7 @@
 #include "xml-template.h"
 #include "paper.h"
 
-#define FULL_PAGE "Full-page"
+#define EQUAL(s1,s2) (!g_utf8_collate (s1, s2))
 
 /*===========================================*/
 /* Private types                             */
@@ -107,19 +107,23 @@ lgl_template_init (void)
 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. */
@@ -140,7 +144,7 @@ lgl_template_register (const lglTemplate  *template)
                /* 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);
@@ -153,8 +157,83 @@ lgl_template_register (const lglTemplate  *template)
 
 }
 
+/**
+ * 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.
  *
@@ -169,11 +248,13 @@ lgl_template_register (const lglTemplate  *template)
  * 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)
@@ -184,12 +265,15 @@ lgl_template_get_name_list_unique (const gchar *page_size,
        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;
@@ -197,6 +281,7 @@ lgl_template_get_name_list_unique (const gchar *page_size,
 
 /**
  * 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.
  *
@@ -211,13 +296,15 @@ lgl_template_get_name_list_unique (const gchar *page_size,
  * 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)
         {
@@ -233,9 +320,14 @@ lgl_template_get_name_list_all (const gchar *page_size,
                        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);
+                                }
                        }
                }
        }
@@ -243,6 +335,7 @@ lgl_template_get_name_list_all (const gchar *page_size,
        return names;
 }
 
+
 /**
  * lgl_template_free_name_list:
  * @names: List of template name strings to be freed.
@@ -256,7 +349,8 @@ lgl_template_free_name_list (GList *names)
 {
        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;
        }
@@ -276,26 +370,35 @@ lgl_template_free_name_list (GList *names)
 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);
                }
        }
 
@@ -419,7 +522,8 @@ lgl_template_frame_get_origins (const lglTemplateFrame *frame)
 
 /**
  * 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"
@@ -434,17 +538,20 @@ lgl_template_frame_get_origins (const lglTemplateFrame *frame)
  *
  */
 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;
@@ -452,11 +559,77 @@ lgl_template_new (const gchar         *name,
 
        /* 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
@@ -517,6 +690,48 @@ lgl_template_does_category_match  (const lglTemplate  *template,
         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
@@ -558,25 +773,6 @@ lgl_template_add_category (lglTemplate         *template,
                                               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").
@@ -883,38 +1079,43 @@ lglTemplate *
 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;
 }
 
@@ -933,8 +1134,11 @@ lgl_template_free (lglTemplate *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;
@@ -942,6 +1146,15 @@ lgl_template_free (lglTemplate *template)
                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);
@@ -961,19 +1174,50 @@ lgl_template_free (lglTemplate *template)
                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);
+       }
 }
 
 /**
@@ -1173,7 +1417,8 @@ template_full_page (const gchar *page_size)
        lglPaper              *paper = NULL;
        lglTemplate           *template = NULL;
        lglTemplateFrame      *frame = NULL;
-       gchar                 *name;
+        gchar                 *part;
+        gchar                 *desc;
 
        g_return_val_if_fail (page_size, NULL);
 
@@ -1182,13 +1427,11 @@ template_full_page (const gchar *page_size)
                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",
@@ -1203,8 +1446,8 @@ template_full_page (const gchar *page_size)
 
        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;
 
@@ -1323,11 +1566,12 @@ lgl_template_print_known_templates (void)
        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");
@@ -1344,12 +1588,15 @@ lgl_template_print_known_templates (void)
 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");
index 72767002ad9e40329dce807c3237d88c97be6820..ebc44af65efea1353a7cfa156d02f2d7cd443fc8 100644 (file)
@@ -35,6 +35,8 @@ G_BEGIN_DECLS
 
 typedef struct _lglTemplate                lglTemplate;
 
+typedef struct _lglTemplateAlias           lglTemplateAlias;
+
 typedef union  _lglTemplateFrame           lglTemplateFrame;
 typedef struct _lglTemplateFrameAll        lglTemplateFrameAll;
 typedef struct _lglTemplateFrameRect       lglTemplateFrameRect;
@@ -56,12 +58,16 @@ typedef struct _lglTemplateOrigin          lglTemplateOrigin;
  */
 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;
 
@@ -70,12 +76,19 @@ struct _lglTemplate {
         * template. */
        GList               *frames;
 
-       /* List of (gchar *) aliases. */
-       GList               *aliases;
-
 };
 
 
+/*
+ *   Top-level Template Structure
+ */
+struct _lglTemplateAlias {
+
+       gchar               *brand;
+        gchar               *part;
+
+};
+
 /*
  *   Possible Frame Shapes
  */
@@ -253,10 +266,17 @@ void                 lgl_template_register              (const lglTemplate    *t
 /*
  * 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);
@@ -267,6 +287,14 @@ lglTemplate         *lgl_template_from_name            (const gchar         *nam
 /* 
  * 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);
 
@@ -289,21 +317,22 @@ lglTemplateOrigin   *lgl_template_frame_get_origins    (const lglTemplateFrame
 /*
  * 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,
@@ -311,6 +340,9 @@ lglTemplateFrame    *lgl_template_frame_rect_new       (const gchar          *id
                                                         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);
@@ -356,6 +388,9 @@ lglTemplate         *lgl_template_dup                  (const lglTemplate    *or
 
 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);
 
index 3ce412229f051be6d37f29764a82b58d35ef373d..bcb0ffe9bacc688d019237d92b6ea2e438783c23 100644 (file)
@@ -91,7 +91,7 @@ static void  xml_create_markup_circle_node  (const lglTemplateMarkup      *circl
 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);
 
@@ -197,6 +197,8 @@ lgl_xml_template_parse_templates_doc (const xmlDocPtr templates_doc)
 lglTemplate *
 lgl_xml_template_parse_template_node (const xmlNodePtr template_node)
 {
+       gchar                 *brand;
+        gchar                 *part;
        gchar                 *name;
        gchar                 *description;
        gchar                 *page_size;
@@ -204,8 +206,29 @@ lgl_xml_template_parse_template_node (const xmlNodePtr template_node)
        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);
 
@@ -236,10 +259,8 @@ lgl_xml_template_parse_template_node (const xmlNodePtr template_node)
                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) {
@@ -262,7 +283,8 @@ lgl_xml_template_parse_template_node (const xmlNodePtr template_node)
                }
        }
 
-       g_free (name);
+       g_free (brand);
+       g_free (part);
        g_free (description);
        g_free (page_size);
 
@@ -577,13 +599,37 @@ static void
 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);
 }
 
 /**
@@ -672,14 +718,17 @@ lgl_xml_template_create_template_node (const lglTemplate *template,
 {
        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);
@@ -688,20 +737,24 @@ lgl_xml_template_create_template_node (const lglTemplate *template,
 
        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 );
-               }
-       }
-
 }
 
 /*--------------------------------------------------------------------------*/
@@ -897,14 +950,16 @@ xml_create_markup_rect_node (const lglTemplateMarkup *markup,
 /* 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);
 
 }
 
index 3bfd01a4712d747708c5ff87f9ee9febd06204d6..3ef2e495f41f92b61319cc73134c3c124a8d4d37 100644 (file)
@@ -31,7 +31,7 @@
 
 #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
 
index 65adec7dbf08601b2db9d9cb6480164d5c9133df..d1f20243435b44cd868b1b9732e5a5480b3fb0a4 100644 (file)
@@ -179,6 +179,7 @@ gl_file_properties (glLabel   *label,
                    glWindow  *window)
 {
        GtkWidget    *dialog;
+        gchar        *name;
 
        gl_debug (DEBUG_FILE, "START");
 
@@ -198,10 +199,12 @@ gl_file_properties (glLabel   *label,
                                                            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);
 
index 555268e0e08a48fe613a640164a47ef8381ac35b..a68bb43c4111f6b1a05e65c050990af7e8b18c33 100644 (file)
@@ -380,9 +380,10 @@ gl_label_set_template (glLabel     *label,
        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);
index a260e3d8db513446b5e8aa75a70131e293be0c47..cdcca3bac2449667a77d9bb09d34f482df8ffd21 100644 (file)
@@ -59,9 +59,10 @@ gl_mini_preview_pixbuf_cache_init (void)
 
        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);
index a4b3bb046223fc5cc702db0279426a9acdafb333..26d25439a4a4cbf34fd3ce3cbacd32db7384c836 100644 (file)
@@ -1112,10 +1112,13 @@ static void
 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);
 }
                          
 /*--------------------------------------------------------------------------*/
@@ -1599,7 +1602,7 @@ static lglTemplate *
 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;
@@ -1614,7 +1617,6 @@ build_template (glTemplateDesigner      *dialog)
 
        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 =
@@ -1671,7 +1673,7 @@ build_template (glTemplateDesigner      *dialog)
        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:
@@ -1711,7 +1713,6 @@ build_template (glTemplateDesigner      *dialog)
 
        g_free (brand);
        g_free (part_num);
-       g_free (name);
        g_free (desc);
 
        g_free (page_size_name);
index dd5c47b9e2005ea535b6a9caa4c2d74ff0d8bbbb..d453de9ccedb7395037b99d47ef7ec4320de07a6 100644 (file)
@@ -260,7 +260,7 @@ 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 = 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);
 
@@ -310,7 +310,7 @@ filter_changed_cb (GtkComboBox *combo,
                 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);
@@ -587,6 +587,7 @@ load_list (GtkListStore           *store,
         gchar       *size;
         gchar       *layout;
         gchar       *description;
+        gchar       *name;
 
         gl_debug (DEBUG_MEDIA_SELECT, "START");
 
@@ -601,8 +602,10 @@ load_list (GtkListStore           *store,
                         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);