]> git.sur5r.net Git - glabels/commitdiff
2006-09-12 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Wed, 13 Sep 2006 02:40:30 +0000 (02:40 +0000)
committerJim Evins <evins@snaught.com>
Wed, 13 Sep 2006 02:40:30 +0000 (02:40 +0000)
* data/dtd/glabels-2.0.dtd:
* data/templates/Makefile.am:
* data/templates/avery-iso-templates.xml:
* data/templates/avery-other-templates.xml:
* data/templates/avery-us-templates.xml:
* data/templates/categories.xml:
* data/templates/misc-iso-templates.xml:
* data/templates/misc-other-templates.xml:
* data/templates/zweckform-iso-templates.xml:
* data/glade/Makefile.am:
* data/glade/new-label-dialog.glade:
* data/glade/wdgt-media-select.glade:
* data/glade/wdgt-rotate-label.glade:
* libglabels/Makefile.am:
* libglabels/category.c:
* libglabels/category.h:
* libglabels/libglabels.h:
* libglabels/paper.c:
* libglabels/template.c:
* libglabels/template.h:
* libglabels/xml-category.c:
* libglabels/xml-category.h:
* libglabels/xml-template.c:
Added support for category meta data.
* src/Makefile.am:
* src/file.c:
* src/mini-preview-pixbuf.c:
* src/mini-preview-pixbuf.h:
* src/new-label-dialog.c:
* src/new-label-dialog.h:
* src/wdgt-media-select.c:
* src/wdgt-media-select.h:
* src/wdgt-rotate-label.c:
* src/wdgt-rotate-label.h:
New "new label" dialog.

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

35 files changed:
glabels2/ChangeLog
glabels2/data/dtd/glabels-2.0.dtd
glabels2/data/glade/Makefile.am
glabels2/data/glade/new-label-dialog.glade [new file with mode: 0644]
glabels2/data/glade/wdgt-media-select.glade [new file with mode: 0644]
glabels2/data/glade/wdgt-rotate-label.glade [new file with mode: 0644]
glabels2/data/templates/Makefile.am
glabels2/data/templates/avery-iso-templates.xml
glabels2/data/templates/avery-other-templates.xml
glabels2/data/templates/avery-us-templates.xml
glabels2/data/templates/categories.xml [new file with mode: 0644]
glabels2/data/templates/misc-iso-templates.xml
glabels2/data/templates/misc-other-templates.xml
glabels2/data/templates/zweckform-iso-templates.xml
glabels2/gtk-doc.make
glabels2/libglabels/Makefile.am
glabels2/libglabels/category.c [new file with mode: 0644]
glabels2/libglabels/category.h [new file with mode: 0644]
glabels2/libglabels/libglabels.h
glabels2/libglabels/paper.c
glabels2/libglabels/template.c
glabels2/libglabels/template.h
glabels2/libglabels/xml-category.c [new file with mode: 0644]
glabels2/libglabels/xml-category.h [new file with mode: 0644]
glabels2/libglabels/xml-template.c
glabels2/src/Makefile.am
glabels2/src/file.c
glabels2/src/mini-preview-pixbuf.c [new file with mode: 0644]
glabels2/src/mini-preview-pixbuf.h [new file with mode: 0644]
glabels2/src/new-label-dialog.c [new file with mode: 0644]
glabels2/src/new-label-dialog.h [new file with mode: 0644]
glabels2/src/wdgt-media-select.c
glabels2/src/wdgt-media-select.h
glabels2/src/wdgt-rotate-label.c
glabels2/src/wdgt-rotate-label.h

index 0b628829f1d3a4126e39ea256512ae934e23de8b..e77232523e37f02f8907c26a0b85451c67195c62 100644 (file)
@@ -1,3 +1,41 @@
+2006-09-12  Jim Evins  <evins@snaught.com>
+
+       * data/dtd/glabels-2.0.dtd:
+       * data/templates/Makefile.am:
+       * data/templates/avery-iso-templates.xml:
+       * data/templates/avery-other-templates.xml:
+       * data/templates/avery-us-templates.xml:
+       * data/templates/categories.xml:
+       * data/templates/misc-iso-templates.xml:
+       * data/templates/misc-other-templates.xml:
+       * data/templates/zweckform-iso-templates.xml:
+       * data/glade/Makefile.am:
+       * data/glade/new-label-dialog.glade:
+       * data/glade/wdgt-media-select.glade:
+       * data/glade/wdgt-rotate-label.glade:
+       * libglabels/Makefile.am:
+       * libglabels/category.c:
+       * libglabels/category.h:
+       * libglabels/libglabels.h:
+       * libglabels/paper.c:
+       * libglabels/template.c:
+       * libglabels/template.h:
+       * libglabels/xml-category.c:
+       * libglabels/xml-category.h:
+       * libglabels/xml-template.c:
+               Added support for category meta data.
+       * src/Makefile.am:
+       * src/file.c:
+       * src/mini-preview-pixbuf.c:
+       * src/mini-preview-pixbuf.h:
+       * src/new-label-dialog.c:
+       * src/new-label-dialog.h:
+       * src/wdgt-media-select.c:
+       * src/wdgt-media-select.h:
+       * src/wdgt-rotate-label.c:
+       * src/wdgt-rotate-label.h:
+               New "new label" dialog.
+
 2006-05-27  Jim Evins  <evins@snaught.com>
 
        * NEWS:
index 5d8047a3ea2d541e7e0e90494faeb8d69f2852ce..7bb2067a6e409aa47f31b8949d7a9a96e68b87d7 100644 (file)
                  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                                 -->
                  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">
 
-<!ELEMENT Template ((%label_element;)+, Alias*)>
+<!ELEMENT Template (Meta*, (%label_element;)+, Alias*)>
 <!ATTLIST Template
                  name            %STRING_TYPE;           #REQUIRED
                  size            %STRING_TYPE;           #REQUIRED
                  _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
index 2a64fef8ccee5bf6d62cc0643c9e0506c633c9ff..0e81e6b506575bdea09ef8ee37f84828002d2500 100644 (file)
@@ -7,7 +7,10 @@ glade_DATA = \
        prefs-dialog.glade              \
        template-designer.glade         \
        merge-properties-dialog.glade   \
-       property-bar.glade
+       property-bar.glade              \
+       wdgt-media-select.glade         \
+       wdgt-rotate-label.glade         \
+       new-label-dialog.glade
 
 EXTRA_DIST = $(glade_DATA)
 
diff --git a/glabels2/data/glade/new-label-dialog.glade b/glabels2/data/glade/new-label-dialog.glade
new file mode 100644 (file)
index 0000000..b282a36
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window1">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">window1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="new_label_dialog_vbox">
+      <property name="border_width">12</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">12</property>
+
+      <child>
+       <widget class="GtkFrame" id="frame1">
+         <property name="visible">True</property>
+         <property name="label_xalign">0</property>
+         <property name="label_yalign">0.5</property>
+         <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+         <child>
+           <widget class="GtkAlignment" id="alignment1">
+             <property name="visible">True</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xscale">1</property>
+             <property name="yscale">1</property>
+             <property name="top_padding">0</property>
+             <property name="bottom_padding">0</property>
+             <property name="left_padding">12</property>
+             <property name="right_padding">0</property>
+
+             <child>
+               <widget class="GtkVBox" id="media_select_vbox">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <placeholder/>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label1">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">&lt;b&gt;Media type&lt;/b&gt;</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">True</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="type">label_item</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkFrame" id="frame2">
+         <property name="visible">True</property>
+         <property name="label_xalign">0</property>
+         <property name="label_yalign">0.5</property>
+         <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+         <child>
+           <widget class="GtkAlignment" id="alignment2">
+             <property name="visible">True</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xscale">1</property>
+             <property name="yscale">1</property>
+             <property name="top_padding">0</property>
+             <property name="bottom_padding">0</property>
+             <property name="left_padding">12</property>
+             <property name="right_padding">0</property>
+
+             <child>
+               <widget class="GtkVBox" id="rotate_label_vbox">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <placeholder/>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label2">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">&lt;b&gt;Label orientation&lt;/b&gt;</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">True</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="type">label_item</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
diff --git a/glabels2/data/glade/wdgt-media-select.glade b/glabels2/data/glade/wdgt-media-select.glade
new file mode 100644 (file)
index 0000000..f92d5de
--- /dev/null
@@ -0,0 +1,193 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window1">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">window1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkHBox" id="wdgt_media_select_hbox">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child>
+       <widget class="GtkVBox" id="vbox3">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkHBox" id="hbox6">
+             <property name="border_width">12</property>
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">12</property>
+
+             <child>
+               <widget class="GtkHBox" id="hbox7">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkLabel" id="label12">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Page size:</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">False</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkComboBox" id="page_size_combo">
+                     <property name="visible">True</property>
+                     <property name="add_tearoffs">False</property>
+                     <property name="focus_on_click">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkHBox" id="hbox8">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkLabel" id="label13">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Category:</property>
+                     <property name="use_underline">False</property>
+                     <property name="use_markup">False</property>
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
+                     <property name="wrap">False</property>
+                     <property name="selectable">False</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                     <property name="width_chars">-1</property>
+                     <property name="single_line_mode">False</property>
+                     <property name="angle">0</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkComboBox" id="category_combo">
+                     <property name="visible">True</property>
+                     <property name="add_tearoffs">False</property>
+                     <property name="focus_on_click">True</property>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow1">
+             <property name="border_width">12</property>
+             <property name="width_request">480</property>
+             <property name="height_request">320</property>
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkTreeView" id="template_treeview">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="headers_visible">False</property>
+                 <property name="rules_hint">False</property>
+                 <property name="reorderable">False</property>
+                 <property name="enable_search">True</property>
+                 <property name="fixed_height_mode">False</property>
+                 <property name="hover_selection">False</property>
+                 <property name="hover_expand">False</property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
diff --git a/glabels2/data/glade/wdgt-rotate-label.glade b/glabels2/data/glade/wdgt-rotate-label.glade
new file mode 100644 (file)
index 0000000..89e24a0
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkWindow" id="window1">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">window1</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkHBox" id="rotate_hbox">
+      <property name="border_width">12</property>
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">6</property>
+
+      <child>
+       <widget class="GtkCheckButton" id="rotate_check">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
+         <property name="label" translatable="yes">Rotate</property>
+         <property name="use_underline">True</property>
+         <property name="relief">GTK_RELIEF_NORMAL</property>
+         <property name="focus_on_click">True</property>
+         <property name="active">False</property>
+         <property name="inconsistent">False</property>
+         <property name="draw_indicator">True</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkDrawingArea" id="rotate_drawingarea">
+         <property name="visible">True</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
index fc0039fcef8e07a6fc3dc4bc22130909ea5811bd..6339454039975f2c4793695a6cf8b47359b3186a 100644 (file)
@@ -4,6 +4,7 @@ templatesdir = $(datadir)/glabels/templates
 
 templates_DATA = \
        paper-sizes.xml \
+       categories.xml \
        avery-us-templates.xml \
        avery-iso-templates.xml \
        avery-other-templates.xml \
index aa9ad16bebdd1bac8545f237077d2da8d9fa0ad3..c7e9410e2e463d3e63b8e1163b67b930f3ff02e9 100644 (file)
@@ -10,6 +10,7 @@
   <!-- Avery 7160 family: Mailing labels, 63.5 x 38.1 mm, 21 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   7160" size="A4" _description="Mailing labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="181.4" height="108.0" round="5">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="7" x0="21.2" y0="43.9" dx="187.2" dy="108.0"/>
@@ -25,6 +26,7 @@
   <!-- Avery 7161 family: Mailing labels, 63.5 x 46.6 mm, 18 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   7161" size="A4" _description="Mailing labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="180.2" height="132.6" round="7">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="6" x0="21" y0="23" dx="186.9" dy="132.5"/>
@@ -37,6 +39,7 @@
   <!-- Avery 7162 family: Mailing labels, 99.1 x 33.9 mm, 16 per sheet    -->  
   <!-- ================================================================== -->  
   <Template name="Avery   7162" size="A4" _description="Mailing labels">  
+    <Meta category="label"/>
     <Label-rectangle id="0" width="280.9" height="96.1" round="5">  
       <Markup-margin size="5"/>
       <Layout nx="2" ny="8" x0="11.3" y0="36.8" dx="290.5" dy="96.1"/>  
@@ -48,6 +51,7 @@
   <!-- Avery 7163 family: Mailing labels, 99.1 x 38.1 mm, 14 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   7163" size="A4" _description="Mailing labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="280.9" height="108" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="7" x0="9.5" y0="43" dx="292" dy="108"/>
@@ -59,6 +63,7 @@
   <!-- Avery 7164 family: Address labels, 63.50 x 71.98 mm, 12 per sheet   -->
   <!-- =================================================================== -->
   <Template name="Avery   7164" size="A4" _description="Address labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="180" height="204.038" round="8.5">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="4" x0="20.84" y0="10" dx="187.08" dy="204.038"/>
@@ -72,6 +77,7 @@
   <!-- Avery 7165 family: Address labels                                   -->
   <!-- =================================================================== -->
   <Template name="Avery  7165" size="A4" description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="280.8pt" height="191.991pt" round="0pt" waste="0pt">
       <Markup-margin size="5.66929pt"/>
       <Layout nx="2" ny="4" x0="13.2378pt" y0="36.9638pt" dx="288.113pt" dy="191.991pt"/>
@@ -84,6 +90,7 @@
   <!-- Avery 7169 family: shipping labels, 99.1 x 139.0 mm, 4 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Avery   7169" size="A4" _description="Shipping labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="280.9" height="394.0" round="6">
       <Markup-margin size="6"/>
       <Layout nx="2" ny="2" x0="14.2" y0="20.0" dx="287.7" dy="394.0"/>
   <!-- Avery 7414 family: Business Cards, 52mm x 90mm, 10 per sheet        -->
   <!-- =================================================================== -->
   <Template name="Avery   7414" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="255.1" height="147.4" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="42.51" y0="52.44" dx="255.1" dy="147.4"/>
   <!-- Avery 7664 family: Diskette Labels, 70mm x 71.9 mm, 8 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   7664" size="A4" description="Diskette Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="70mm" height="71.9mm" round="2.5mm">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="4" x0="17mm" y0="5mm" dx="104.5mm" dy="72mm"/> 
   <!-- Avery 8414 family: Business Cards, 50.8 x 87.0 mm, 10 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   8414" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="246.6" height="144" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="42" y0="57.890" dx="264" dy="144"/>
   <!-- Avery J8435: CD Inlets Booklet part                         -->
   <!-- =============================================================== -->
   <Template name="Avery   8435A" size="A4" _description="CD Booklet">
+    <Meta category="cd"/>
     <Label-rectangle id="0" width="155mm" height="125mm" round="0">
       <Markup-margin size="2mm"/>
       <Markup-line x1="32mm" y1="0mm" x2="32mm" y2="125mm"/>
   <!-- Avery J8435: CD Inlets Inlet part                           -->
   <!-- =============================================================== -->
   <Template name="Avery   8435B" size="A4" _description="CD Inlet">
+    <Meta category="cd"/>
     <Label-rectangle id="0" width="155mm" height="122mm" round="0">
       <Markup-margin size="2mm"/>
       <Markup-line x1="8.5mm" y1="0mm" x2="8.5mm" y2="122mm"/>
   <!-- Avery 8651 family: Mailing labels, 38.1 x 21.2 mm, 65 per sheet     -->
   <!-- =================================================================== -->
   <Template name="Avery   8651" size="A4" _description="Mini Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="108" height="60.09" round="5">
       <Markup-margin size="5"/>
       <Layout nx="5" ny="13" x0="13.32" y0="30.90" dx="115.09" dy="60.09"/>
   <!-- Avery 8666 family: Diskette labels (face only), 70 x 52 mm, 10 per  -->
   <!-- =================================================================== -->
   <Template name="Avery   8666" size="A4" _description="Diskette labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198.4" height="147.4" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="66" y0="53" dx="264" dy="147"/>
   <!-- Avery J8676A: CD/DVD Labels 2 per sheet                         -->
   <!-- =============================================================== -->
   <Template name="Avery   8676" size="A4" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5" hole="17" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="130" y0="59.5" dx="0" dy="388"/>        
   <!-- Avery 18036 Mailing Labels, 70mm x 32mm, 27 per sheet           -->
   <!-- =============================================================== -->
   <Template name="Avery  18036" size="A4" _description="Mailing Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198" height="91" round="0">
       <Markup-margin size="10"/>
       <Layout nx="3" ny="9" x0="0" y0="13" dx="198" dy="91"/>
   <!-- Avery 32015: Business Cards                                  -->
   <!-- ============================================================ -->
   <Template name="Avery 32015" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="85mm" height="54mm" round="0mm">
       <Markup-margin size="5mm"/>
       <Layout nx="2" ny="4" x0="17mm" y0="31.5mm" dx="91mm" dy="60mm"/>
index 1640790d4b0557f1403e6867a3ac5d9c9344370d..542e0eeb06fdabd895b2a8a74d4fffcc9fefaff2 100644 (file)
@@ -11,6 +11,7 @@
   <!-- =================================================================== -->
   <Template name="Avery 06141" size="Other" width="207pt" height="351pt"
             description="File Folder Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198pt" height="45pt" round="4.5pt" waste="0pt">
       <Markup-margin size="4.5pt"/>
       <Layout nx="1" ny="7" x0="4.5pt" y0="4.5pt" dx="198pt" dy="49.5pt"/>
index 53f1bd34bfc82351ddf10f2ef35615417947f727..cabea04327533b958af9945312f0eede1b5471a7 100644 (file)
@@ -14,6 +14,7 @@
   <!-- Avery 5160 family: Address Labels, 1'' x 2_5/8'', 30 per sheet    x -->
   <!-- =================================================================== -->
   <Template name="Avery  5160" size="US-Letter" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="2.625in" height="1in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="3" ny="10" x0="0.1875in" y0="0.5in" dx="2.75in" dy="1in"/>
@@ -56,6 +57,7 @@
   <!-- Avery 5161 family: Address Labels, 1'' x 4'', 20 per sheet        x -->
   <!-- =================================================================== -->
   <Template name="Avery  5161" size="US-Letter" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="4in" height="1in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="10" x0="0.15625in" y0="0.5in" dx="4.1875in" dy="1in"/>
@@ -71,6 +73,7 @@
   <!-- Avery 5162 family: Address Labels, 1_1/3'' x 4'', 14 per sheet    x -->
   <!-- =================================================================== -->
   <Template name="Avery  5162" size="US-Letter" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="4in" height="1.333333333in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="7"
@@ -96,6 +99,7 @@
   <!-- Avery 6879 family: Address Labels, 1_1/4'' x 3_3/4'', 12 per sheetx -->
   <!-- =================================================================== -->
   <Template name="Avery  6879" size="US-Letter" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="3.75in" height="1.25in" round="0.0625in" waste="5pt">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="6" x0="0.375in" y0="1.125in" dx="4in" dy="1.5in"/>
   <!-- Avery 5159 family: Address Labels, 1_1/2'' x 4'', 14 per sheet      -->
   <!-- =================================================================== -->
   <Template name="Avery  5159" size="US-Letter" description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="4in" height="1.5in" round="0.0625in" waste="0in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="7" x0="0.15625in" y0="0.25in" dx="4.1875in" dy="1.5in"/>
   <!-- Avery 5163 family: Shipping Labels, 4'' x 2'', 10 per sheet       x -->
   <!-- =================================================================== -->
   <Template name="Avery  5163" size="US-Letter" _description="Shipping Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="4in" height="2in" round="0.125in">
       <Markup-margin size="0.125in"/>
       <Layout nx="2" ny="5" x0="0.1625in" y0="0.5in" dx="4.1875in" dy="2in"/>
   <!-- Avery 5164 family: Shipping Labels. 4'' x 3_1/3'', 6 per sheet    x -->
   <!-- =================================================================== -->
   <Template name="Avery  5164" size="US-Letter" _description="Shipping Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="4in" height="3.333333333in" round="0.125in">
       <Markup-margin size="0.125in"/>
       <Layout nx="2" ny="3" x0="0.15625in" y0="0.5in" dx="4.1875in" dy="3.333333333in"/>
   <!-- Avery 5168 family:  Shipping Labels 5'' x 3_1/2'', 4 per sheet      -->
   <!-- =================================================================== -->
   <Template name="Avery  5168" size="US-Letter" description="Shipping Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="3.5in" height="5in" round="0.0625in" waste="0in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="2" x0="0.5in" y0="0.5in" dx="4in" dy="5in"/>
   <!-- Avery 5167 family: Address Labels, 1_3/4'' x 1/2'', 80 per sheet  x -->
   <!-- =================================================================== -->
   <Template name="Avery  5167" size="US-Letter" _description="Return Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="1.75in" height="0.5in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="4" ny="20" x0="0.28125in" y0="0.5in" dx="2.0625in" dy="0.5in"/>
   <!-- Avery 5196 family: Diskette Labels, 2_3/4'' x 2_3/4'', 9 per sheetx -->
   <!-- =================================================================== -->
   <Template name="Avery  5196" size="US-Letter" _description="Diskette Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="2.75in" height="2.75in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="3" ny="3" x0="0.125in" y0="0.5in" dx="2.75in" dy="3in"/>
   <!-- Avery 5294 family: Round Labels, 12 per sheet.                      -->
   <!-- =================================================================== -->
   <Template name="Avery  5294" size="US-Letter" description="Round Labels">
+    <Meta category="label"/>
     <Label-round id="0" radius="90pt" waste="0pt">
       <Markup-margin size="7.2pt"/>
       <Layout nx="3" ny="4" x0="15.12pt" y0="30.6pt" dx="198pt" dy="181.08pt"/>
   <!-- Avery 6490 family: Diskette Labels, 2_11/16'' x 2'', 15 per sheet x -->
   <!-- =================================================================== -->
   <Template name="Avery  6490" size="US-Letter" _description="Diskette Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="2.6875in" height="2in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="3" ny="5" x0="0.125in" y0="0.5in" dx="2.78125in" dy="2in"/>
   <!-- Avery 5366 family: Filing Labels, 2/3'' x 3_7/16'', 30 per sheet  x -->
   <!-- =================================================================== -->
   <Template name="Avery  5366" size="US-Letter" _description="Filing Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="3.4375in" height="0.666666667in" round="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="15" x0="0.53125in" y0="0.5in" dx="4in" dy="0.666666667in"/>
   <!-- Avery 5371 family: Business Cards, 2'' x 3_1/2'', 10 per sheet    x -->
   <!-- =================================================================== -->
   <Template name="Avery  5371" size="US-Letter" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="3.5in" height="2in" round="0">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="5" x0="0.75in" y0="0.5in" dx="3.5in" dy="2in"/>
   <!-- Avery 5388 family: Index Cards, 5'' x 3'', 3 per sheet              -->
   <!-- =================================================================== -->
   <Template name="Avery  5388" size="US-Letter" description="Index Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="5in" height="3in" round="0pt" waste="0pt">
-      <Layout nx="1" ny="3" x0="1.75in" y0="1in" dx="5in" dy="3in"/>
       <Markup-margin size="0.125in"/>
+      <Layout nx="1" ny="3" x0="1.75in" y0="1in" dx="5in" dy="3in"/>
     </Label-rectangle>
     <Alias name="Avery  5386"/>
     <Alias name="Avery  8388"/>
   <!-- Avery 5389 family: Post Cards, 6'' x 4'', 2 per sheet               -->
   <!-- =================================================================== -->
   <Template name="Avery  5389" size="US-Letter" description="Post cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="6in" height="4in" round="0pt" waste="0pt">
-      <Layout nx="1" ny="2" x0="1.25in" y0="1.25in" dx="6in" dy="4.5in"/>
       <Markup-margin size="0.125in"/>
+      <Layout nx="1" ny="2" x0="1.25in" y0="1.25in" dx="6in" dy="4.5in"/>
     </Label-rectangle>
   </Template>
 
   <!-- Avery 8373 family: Business Cards, 2'' x 3_1/2'', 8 per sheet     x -->
   <!-- =================================================================== -->
   <Template name="Avery  8373" size="US-Letter" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="3.5in" height="2in" round="0" waste="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="4" x0="0.5in" y0="0.75in" dx="4in" dy="2.5in"/>
   <!-- Avery 5395 family: Name Badge Labels, 2_1/3'' x 3_3/8'', 8 per sheetx -->
   <!-- =================================================================== -->
   <Template name="Avery  5395" size="US-Letter" _description="Name Badge Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="3.375in" height="2.333333333in" round="0.1875in" waste="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="2" ny="4" x0="0.6875in" y0="0.583333333in" dx="3.75in" dy="2.5in"/>
   <!-- =================================================================== -->
   <!-- Avery 5824 family: CD/DVD Labels (face only), 2 per sheet         * -->
   <!-- =================================================================== -->
-  <Template name="Avery  5824" size="US-Letter" description="CD/DVD Labels">
+  <Template name="Avery  5824" size="US-Letter" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5pt" hole="58.5pt" waste="9pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="2" x0="144pt" y0="36pt" dx="351pt" dy="396pt"/>
   <!-- =================================================================== -->
   <Template name="Avery  5931-Disc" size="US-Letter"
          _description="CD/DVD Labels (Disc Labels)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="2.3125in" hole="0.8125in" waste="0.0625in">
       <Markup-margin size="0.0625in"/>
       <Markup-line x1="0" y1="2.3125in" x2="1.5in" y2="2.3125in"/>
   <!-- =================================================================== -->
   <Template name="Avery 5931-Spine" size="US-Letter" 
          _description="CD/DVD Labels (Spine Labels)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-rectangle id="0" width="0.21875in" height="4.6875in" round="0.0625in" waste="0.0625in">
       <Layout nx="2" ny="2" x0="0.5in" y0="0.734375in" dx="0.46875in" dy="4.84375in"/>
     </Label-rectangle>
   <!-- =================================================================== -->
   <Template name="Avery  5997-Face" size="US-Letter"
          _description="Video Tape Face Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="220" height="133" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="80" y0="60.5" dx="236" dy="133"/>
   <!-- =================================================================== -->
   <Template name="Avery  5997-Spine" size="US-Letter"
         _description="Video Tape Spine Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="414" height="48" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="15" x0="99" y0="36" dx="0" dy="48"/>
   <!-- Avery 8165 family: Full-page label, 8_1/2'' x 11'', 1 per sheet   x -->
   <!-- =================================================================== -->
   <Template name="Avery  8165" size="US-Letter" _description="Full Sheet Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="8.5in" height="11.in" round="0">
       <Markup-margin size="0.0625in"/>
       <Layout nx="1" ny="1" x0="0" y0="0" dx="0" dy="0"/>
   <!-- Avery 3274.1 family: Square stickers, 2_1/2'' x 2_1/2, 9 per sheetx  -->
   <!-- =================================================================== -->
   <Template name="Avery  3274.1" size="US-Letter" _description="Square Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="2.5in" height="2.5in" round="0">
       <Markup-margin size="0.0625in"/>
       <Layout nx="3" ny="3" x0="0.3125in" y0="1.25in" dx="2.6875in" dy="3in"/>
   <!-- Avery 3274.2 family: Small round stickers, 1_1/2'', 20 per sheet  x -->
   <!-- =================================================================== -->
   <Template name="Avery  3274.2" size="US-Letter" _description="Small Round Labels">
+    <Meta category="label"/>
     <Label-round id="0" radius="0.75in">
       <Markup-margin size="0.0625in"/>
       <Layout nx="4" ny="5" x0="0.5in" y0="0.75in" dx="2in" dy="2in"/>
   <!-- Avery 3274.3 family: Large round stickers, 2_1/2'', 9 per sheet   x -->
   <!-- =================================================================== -->
   <Template name="Avery  3274.3" size="US-Letter" _description="Large Round Labels">
+    <Meta category="label"/>
     <Label-round id="0" radius="1.25in">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="3" x0="0.3125in" y0="1.25in" dx="2.6875in" dy="3in"/>
   <!-- http://www.avery.com/help/tech_bulletin.jsp?tech_bull_code=152       -->
   <!-- ******************************************************************** -->
   <Template name="Avery LSK-8" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="1.13in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="20" x0="0.5in" y0="0.5in" dx="2.13in" dy="0.5in"/>
   </Template>
   <!-- the LSK labels can be torn in half down the center -->
   <Template name="Avery LSK-8.5" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="1" width="1.13in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="20" x0="0.5in" y0="0.5in" dx="2.13in" dy="0.5in"/>
     </Label-rectangle>
   </Template>
   <Template name="Avery LSK-5" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="2" width="1.75in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="20" x0="0.5in" y0="0.3in" dx="2.05in" dy="0.5in"/>
   </Template>
   <!-- the LSK labels can be torn in half down the center -->
   <Template name="Avery LSK-5.5" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="3" width="1.75in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="20" x0="0.5in" y0="0.3in" dx="2.05in" dy="0.5in"/>
     </Label-rectangle>
   </Template>
   <Template name="Avery LSK-3" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="4" width="3.13in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="20" x0="0.5in" y0="0.5in" dx="4.38in" dy="0.5in"/>
   </Template>
   <!-- the LSK labels can be torn in half down the center -->
   <Template name="Avery LSK-3.5" size="US-Letter" description="Divider Labels">
+    <Meta category="label"/>
     <Label-rectangle id="5" width="3.13in" height="0.5in" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="20" x0="0.5in" y0="0.5in" dx="4.38in" dy="0.5in"/>
diff --git a/glabels2/data/templates/categories.xml b/glabels2/data/templates/categories.xml
new file mode 100644 (file)
index 0000000..4703e86
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<Glabels-categories>
+
+  <Category id="label"    _name="Label"/>
+  <Category id="card"     _name="Card"/>
+  <Category id="cd"       _name="CD/DVD label/insert"/>
+
+</Glabels-categories>
index 8163df5e887bc29ce1c0e09dab386af0a0abae67..ff81602f2c5380cb91ef82420c14b7254dd549f3 100644 (file)
@@ -10,6 +10,7 @@
   <!-- Sigel LP 800/LP 801/LP 802: Business Cards, 55.0 x 85.0 mm, 10 per sheet   -->
   <!-- =================================================================== -->
   <Template name="Sigel LP 800" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="85.0mm" height="55.0mm" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="15.0mm" y0="10.0mm" dx="95.0mm" dy="55.0mm"/>
@@ -22,6 +23,7 @@
   <!-- Sigel DP 830/DP 930: Business Cards, 55.0 x 85.0 mm, 10 per sheet   -->
   <!-- =================================================================== -->
   <Template name="Sigel DP 830/DP 930" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="240.9" height="155.9" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="40" y0="31" dx="269" dy="156"/>
@@ -32,6 +34,7 @@
   <!-- Ascom A4/24/MKII: Rectangular Labels, 24 per sheet                  -->
   <!-- =================================================================== -->
   <Template name="Ascom A4/24/MKII" size="A4" _description="Rectangular Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="181" height="96" round="10">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="8" x0="19" y0="36" dx="187" dy="96"/>
@@ -43,6 +46,7 @@
   <!-- =================================================================== -->
   <Template name="Agipa 119488" size="A4"
         _description="Agipa 119488: Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="255" height="142" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="43" y0="67" dx="255" dy="142"/>
@@ -53,6 +57,7 @@
   <!-- Ednet BC: Business Cards, 51 x 89 mm, 10 per sheet                  -->
   <!-- =================================================================== -->
   <Template name="Ednet BC" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="253" height="145" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="40" y0="59" dx="253" dy="145"/>
@@ -62,7 +67,8 @@
   <!-- =================================================================== -->
   <!-- Ednet 45021: Inkjet/Laser Labels 70x37mm                            -->
   <!-- =================================================================== -->
-  <Template name="Ednet 45021" size="A4" description="Inkjet &amp; Laser Labels 70x37mm">
+  <Template name="Ednet 45021" size="A4" description="Inkjet/Laser Labels 70x37mm">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198.425pt" height="104.882pt" round="0pt" x_waste="0pt" y_waste="0pt">
       <Markup-margin size="0pt"/>
       <Layout nx="3" ny="8" x0="0pt" y0="0pt" dx="198.425pt" dy="104.882pt"/>
@@ -73,6 +79,7 @@
   <!-- Herma 4620: Mailing Labels - 2 columns, 107 x 37 mm, 16 per sheet   -->
   <!-- =================================================================== -->
   <Template name="Herma 4620" size="A4" _description="Mailing Labels-2 columns">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="298" height="105" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="8" x0="0" y0="0" dx="298" dy="105"/>
@@ -83,6 +90,7 @@
   <!-- Herma 4464: Mailing Labels - 3 columns, 70 x 37.125 mm, 24 per sheet-->
   <!-- =================================================================== -->
   <Template name="Herma 4464" size="A4" _description="Mailing Labels-3 columns">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="199" height="105" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="8" x0="0" y0="0" dx="199" dy="105"/>
   <!-- Herma 5079: CD/DVD Labels, 2 per sheet                              -->
   <!-- =================================================================== -->
   <Template name="Herma 5079" size="A4" description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="164.409pt" hole="58.1102pt" waste="9pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="2" x0="133.228pt" y0="46.7717pt" dx="346.819pt" dy="419.528pt"/>
   <!-- Neato brand CD/DVD Labels (face only), 2 per sheet                 -->
   <!-- ===================================================================-->
   <Template name="Neato A4 CD" size="A4" _description="CD/DVD Labels (face only)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="125" y0="68.890" dx="0" dy="360"/>        
   <!-- DATA BECKER: Business Cards, 50 x 90 mm, 10 per sheet               -->
   <!-- =================================================================== -->
   <Template name="DataBecker" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="255" height="142" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="36" y0="69.890" dx="255" dy="142"/>
   <!-- DATA BECKER 0491 Business Cards, 50 x 90 mm, 10 per sheet           -->
   <!-- =================================================================== -->
   <Template name="DataBecker 0491" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="90mm" height="50mm" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="12.5mm" y0="15mm" dx="94.55mm" dy="54mm"/>
   <!-- Dataline 57125: Business Cards, 54.0 x 86.0 mm, 10 per sheet        -->
   <!-- =================================================================== -->
   <Template name="Dataline 57125" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="86.00mm" height="54.00mm" round="0">
       <Markup-margin size="0mm"/>
       <Layout nx="2" ny="5" x0="16mm" y0="11mm" dx="91mm" dy="55.625mm"/>
   <!-- Hema Etiketten: 65 x 38 mm, 21 per sheet                            -->
   <!-- =================================================================== -->
   <Template name="Hema Etiketten" size="A4" _description="Rectangular Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="178" height="108" round="5">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="7" x0="20" y0="49.890" dx="187" dy="107"/>
   <!-- Alpi 02793: Business Cards, 50,8 x 90 mm, 10 per sheet -->
   <!-- ====================================================== -->
   <Template name="Alpi 02793" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="255.118" height="144" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="42.5197" y0="62.3622" dx="255.118" dy="144"/>
   <!-- APLI 1999:  Mailing Labels, 9,9cm x 6,8cm, 8 per sheet              -->
   <!-- =================================================================== -->
   <Template name="APLI 1999" size="A4" _description="Mailing Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="281" height="193" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="4" x0="13" y0="21.890" dx="289" dy="194"/>
   <!-- Data Becker Etiketten Paket: Ordnerrucken, 192 x 61,5 mm, 4 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Herma 4284" size="A4" _description="Arch File Labels (large)">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.252" height="174.331" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="4" x0="25.5118" y0="38.2677" dx="544.252" dy="197.008"/>
   <!-- Data Becker Etiketten Paket: Ordnerrucken, 192 x 39 mm, 6 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Herma 4283" size="A4" _description="Arch File Labels (small)">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.252" height="110.551" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="6" x0="25.5118" y0="32.5984" dx="544.252" dy="133.228"/>
   <!-- Data Becker Etiketten Paket: Video Etiketten, 78,7 x 46,5 mm, 12 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Herma 4828" size="A4" _description="Video Labels (face only)">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="223.086" height="131.811" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="6" x0="38.5512" y0="24.9449" dx="295.086" dy="131.811"/>
   <!-- Data Becker Etiketten Paket: Disketten Etiketten, 70 x 50,8 mm, 10 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Herma 8803" size="A4" _description="Diskette Labels (face only)">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198.425" height="144" round="5">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="60.9448" y0="60.9448" dx="270.425" dy="144"/>
   </Template>
   
   <!-- =================================================================== -->
-  <!-- Otto Versand: Allzweck Etiketten, 38 x 21,2 mm, 65 per sheet    -->
+  <!-- Otto Versand: Allzweck Etiketten, 38 x 21,2 mm, 65 per sheet        -->
   <!-- =================================================================== -->
-  <Template name="Herma 4606" size="A4" _description="Allround Labels --65">
+  <Template name="Herma 4606" size="A4" _description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="107.716" height="60.0945" round="0">
       <Markup-margin size="5"/>
       <Layout nx="5" ny="13" x0="26.9291" y0="29.7638" dx="107.716" dy="60.0945"/>
   </Template>
   
   <!-- =================================================================== -->
-  <!-- Herma Musteretiketten: Allzweck Etiketten, 48,3 x 16,9 mm, 64 per sheet    -->
+  <!-- Herma Musteretiketten: Allzweck Etiketten, 48,3 x 16,9 mm           -->
   <!-- =================================================================== -->
-  <Template name="Herma 4607" size="A4" _description="Allround Labels --64">
+  <Template name="Herma 4607" size="A4" _description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="136.913" height="47.9055" round="0">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="16" x0="24.0945" y0="39.6853" dx="136.913" dy="47.9055"/>
   <!-- =================================================================== -->
   <!-- Herma Musteretiketten: Allzweck Etiketten, 48,3 x 25,4 mm, 44 per sheet    -->
   <!-- =================================================================== -->
-  <Template name="Herma 4608" size="A4" _description="Allround Labels --44">
+  <Template name="Herma 4608" size="A4" _description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="136.913" height="72" round="0">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="11" x0="24.0945" y0="24.0945" dx="136.913" dy="72"/>
   <!-- =================================================================== -->
   <!-- Herma Musteretiketten: Allzweck Etiketten, 66 x 33,8 mm, 24 per sheet    -->
   <!-- =================================================================== -->
-  <Template name="Herma 4614" size="A4" _description="Allround Labels --24">
+  <Template name="Herma 4614" size="A4" _description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="187.086" height="95.811" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="8" x0="16.1575" y0="36.8504" dx="187.086" dy="95.811"/>
   <!-- =================================================================== -->
   <!-- Herma Musteretiketten: Adress Etiketten, 105 x 42,3 mm, 24 per sheet    -->
   <!-- =================================================================== -->
-  <Template name="Herma 4625" size="A4" _description="Mailing Labels --14">
+  <Template name="Herma 4625" size="A4" _description="Mailing Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="297.638" height="119.905" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="7" x0="0" y0="0" dx="297.638" dy="119.905"/>
   <!-- Herma Musteretiketten: Ordnerrucken, 192 x 38 mm, 7 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Herma 4293" size="A4" _description="Arch File Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.252" height="107.716" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="7" x0="25.5118" y0="42.5197" dx="544.252" dy="107.716"/>
   <!-- Data Becker CD/DVD Labels (face only), 2 per sheet                 -->
   <!-- ===================================================================-->
   <Template name="DataBecker 0335" size="A4" _description="CD/DVD Labels Standard Format (face only)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="164.409" hole="58.1102" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="133.228" y0="46.7716" dx="0" dy="419.527"/>
   <!-- LeLabel 2001.018 CD/DVD Labels, 1 per sheet                        -->
   <!-- ===================================================================-->
   <Template name="LeLabel 2001.018" size="A4" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="168.08" hole="54.69" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="1" x0="128.556" y0="42.52" dx="0" dy="0"/>
   <!-- Viking 02204 Etiketten, 21 per sheet                               -->
   <!-- ===================================================================-->
   <Template name="Viking 02204" size="A4" _description="Etiketten">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198" height="120" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="7" x0="0" y0="0" dx="198" dy="120"/>
   <!-- Media Line CD/DVD Labels (face only), 2 per sheet                  -->
   <!-- ===================================================================-->
   <Template name="MediaLine 760-50475 A4 CD" size="A4" description="CD/DVD Labels (face only)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5" hole="58.5" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="133" y0="45" dx="0" dy="422"/>
   <!-- Encre.com Business Cards, 10 per sheet                             -->
   <!-- ===================================================================-->
   <Template name="Encre.com BCV10" size="A4" description="Business Cards">  
+    <Meta category="card"/>
     <Label-rectangle id="0" width="243.78" height="153.07">  
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="48.19" y0="42.50" dx="255.12" dy="157.32"/>  
   <!-- Celcast IJ37: Fridge magnet (stickers), 52 x 90 mm, 10 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Celcast IJ37" size="A4" _description="Fridge Magnet Stickers">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="255" height="147.5" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="43" y0="52.7" dx="255" dy="147.5"/>
   <!-- =================================================================== -->
   <Template name="Stomper PRO A4" size="A4"
          _description="PRO CD Labels 2-up (face only)">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5" hole="58" waste="10">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="1" x0="34.5" y0="47" dx="0" dy="0"/>
   <!-- Pressit CD Labels/                                                  -->
   <!-- =================================================================== -->
   <Template name="Pressit  50blank" size="A4" _description="CD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5pt" hole="58.5pt" waste="9pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="1" x0="30.096pt" y0="70.416pt" dx="351pt" dy="351pt"/>
   <!-- Ryman Standard CD/DVD Labels.                                       -->
   <!-- =================================================================== -->
   <Template name="Ryman Standard CD/DVD" size="A4" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="165.827pt" hole="58.1102pt" waste="9pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="2" x0="131.811pt" y0="60.6614pt" dx="245.622pt" dy="388.346pt"/>
   <!-- Fellows 04715 CD/DVD Labels (Face only).                            -->
   <!-- =================================================================== -->
   <Template name="Fellows 04715" size="A4" description="CD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="166.5pt" hole="58.5pt" waste="9pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="2" x0="133.2pt" y0="50.4pt" dx="244.276pt" dy="363.6pt"/>
   <!-- EPSON Photo Stickers, 17 x 24 mm, 16 per sheet                      -->
   <!-- =================================================================== -->
   <Template name="Epson S041144" size="A6" _description="EPSON Photo Stickers 16">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="48" height="68" round="7">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="4" x0="33" y0="59" dx="59.5" dy="79.5"/>
   <!-- ******************************************************************** -->
   
   <Template name="Russian A3 5x9" size="A3" description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="90mm" height="50mm" round="0">
       <Layout nx="3" ny="8" x0="14mm" y0="10mm" dx="90mm" dy="50mm"/>
       <Markup-margin size="5pt"/>
   </Template>
 
   <Template name="Russian A4 5x9" size="A4" description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="50mm" height="90mm" round="0">
       <Layout nx="4" ny="3" x0="5mm" y0="13mm" dx="50mm" dy="90mm"/>
       <Markup-margin size="5pt"/>
index 6f2e2ffee781fbf02f371e83ef655e9394049032..440b6604fbdbce0d5f0e11467ea485d2cdbb74c9 100644 (file)
@@ -11,6 +11,7 @@
   <!-- =================================================================== -->
   <Template name="OfficeMax 86112" size="Other" width="297pt" height="450pt"
             description="Multi-Purpose Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="288pt" height="144pt" round="9pt" waste="0pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="3" x0="4.5pt" y0="3.6pt" dx="288pt" dy="148.5pt"/>
index d2c664141382624a22a5eb8ec9b22de23e860f3c..a96e7d94317b0b91f39372edc52ee9e9452b5c73 100644 (file)
@@ -10,6 +10,7 @@
   <!-- Zweckform 4761: Lever Arch File Labels, 192 x 61 mm, 4 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Zweckform  4761" size="A4" _description="Lever Arch File Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.25" height="172.9" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="4" x0="25" y0="75" dx="544.25" dy="172.9"/>
@@ -20,6 +21,7 @@
   <!-- Zweckform 3651: Rectangular Labels, 52 x 29.5 mm, 40 per sheet      -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3651" size="A4" _description="Rectangular Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="147.4016" height="83.6220" round="0">  
       <Markup-margin size="5"/>
       <Layout nx="4" ny="10" x0="2.834" y0="2.834" dx="147.4016" dy="83.6220"/>
@@ -30,6 +32,8 @@
   <!-- Zweckform 3654: CD Labels  2 per Template                              -->
   <!-- ====================================================================-->
   <Template name="Zweckform  3654" size="A4" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
     <Label-cd id="0" radius="165.78" hole="58.09" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="131.78" y0="58.7998" dx="0" dy="387.97"/>
@@ -40,6 +44,7 @@
   <!-- Zweckform 3659: Rectangular Labels, 97 x 42.125 mm, 12 per sheet    -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3659" size="A4" _description="Mailing Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="274" height="120.5" round="0">  
       <Markup-margin size="5"/>
       <Layout nx="2" ny="6" x0="22.68" y0="60" dx="274" dy="120.5"/>
@@ -50,6 +55,7 @@
   <!-- Zweckform 3669:  Rectangular Labels, 70 x 50.8mm, 15 per sheet      -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3669" size="A4" _description="QSL-Karten Etiketten 70mm x 50,8mm">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198.425" height="144" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="5" x0="0" y0="61" dx="198.425" dy="144"/>
@@ -60,6 +66,7 @@
   <!-- Zweckform 3688: Ordnerruecken Labels                                -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3688" size="A4" description="File Back Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.252pt" height="172.913pt" round="0pt" waste="0pt">
       <Markup-margin size="9.07087pt"/>
       <Layout nx="1" ny="4" x0="28.3465pt" y0="76.5354pt" dx="544.252pt" dy="172.913pt"/>
@@ -70,6 +77,7 @@
   <!-- Zweckform 4732: Multi-purpose Stick+Lift labels                     -->
   <!-- =================================================================== -->
   <Template name="Zweckform  4732" size="A4" description="Multi-purpose Stick+Lift Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="102.047pt" height="48.189pt" round="5.66929pt" waste="0pt">
       <Markup-margin size="5.66929pt"/>
       <Layout nx="5" ny="16" x0="31.1811pt" y0="36.8504pt" dx="107.717pt" dy="48.189pt"/>
@@ -80,6 +88,7 @@
   <!-- Zweckform 4746: Video Labels, 147,32 x 20 mm, 13 per sheet          -->
   <!-- =================================================================== -->
   <Template name="Zweckform  4746" size="A4" _description="Video Labels (back)">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="416.6" height="56.6929" round="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="13" x0="88.8377" y0="52.2425" dx="416.6" dy="56.6929"/>
@@ -90,6 +99,7 @@
   <!-- Zweckform 4780: Allround Labels, 48,5 x 25,4 mm, 40 per sheet       -->
   <!-- =================================================================== -->
   <Template name="Zweckform  4780" size="A4" _description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="137.48" height="72" round="0">
       <Markup-margin size="5"/>
       <Layout nx="4" ny="10" x0="23" y0="53.8898" dx="137.48" dy="72"/>
   <!-- Zweckform 3474: Address Labels, 70 x 37 mm, 24 per sheet            -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3474" size="A4" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="70mm" height="37mm" round="0">
       <Markup-margin size="0"/>
       <Layout nx="3" ny="8" x0="0" y0="0" dx="70mm" dy="37mm"/>
   <!-- Zweckform 3475: Address Labels, 70 x 30 mm, 24 per sheet            -->
   <!-- =================================================================== -->
   <Template name="Zweckform  3475" size="A4" _description="Address Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="198.570" height="102.121" round="0">
       <Markup-margin size="0"/>
       <Layout nx="3" ny="8" x0="0" y0="12.566" dx="198.570" dy="102.121"/>
   <!-- Zweckform 3490: Rectangular Labels, 70 x 36 mm, 24 per sheet        -->
   <!-- =================================================================== -->
    <Template name="Zweckform  3490" size="A4" _description="Rectangular Copier Labels">
+     <Meta category="label"/>
      <Label-rectangle id="0" width="198.425" height="102.047" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="8" x0="" y0="12.557" dx="198.425" dy="102.047"/>
   <!-- Zweckform 4781: Rectangular Labels, 97 x 42.3 mm, 12 per sheet      -->
   <!-- =================================================================== -->
    <Template name="Zweckform  4781" size="A4" _description="Rectangular Copier Labels">
+     <Meta category="label"/>
      <Label-rectangle id="0" width="274.960" height="119.905" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="6" x0="22.677" y0="61.030" dx="274.960" dy="119.905"/>
   <!-- Zweckform 6091: Correction and Cover, 64.6 x 33.8 mm, 24 per sheet  -->
   <!-- =================================================================== -->
    <Template name="Zweckform  6091" size="A4" _description="Correction and Cover-up Labels">
+     <Meta category="label"/>
      <Label-rectangle id="0" width="183.118" height="95.811" round="0">
       <Markup-margin size="5"/>
       <Layout nx="3" ny="8" x0="22.961" y0="37.502" dx="183.118" dy="95.881"/>
   <!-- Zweckform 6015: CD Labels, 2 per Template                           -->
   <!-- =================================================================== -->
    <Template name="Zweckform  6015" size="A4" _description="CD/DVD Labels">
+    <Meta category="label"/>
+    <Meta category="cd"/>
      <Label-cd id="0" radius="165.827" hole="58.110" waste="5">
       <Markup-margin size="5"/>
       <Layout nx="1" ny="2" x0="131.811" y0="60.746" dx="0" dy="388.346"/>
   <!-- Zweckform 6021: Allround Labels                                     -->
   <!-- =================================================================== -->
   <Template name="Zweckform  6021" size="A4" description="Allround Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="130.392pt" height="47.9055pt" round="0pt" waste="0pt">
       <Markup-margin size="5pt"/>
       <Layout nx="4" ny="16" x0="24.0945pt" y0="39.6853pt" dx="136.913pt" dy="47.9055pt"/>
   <!-- Zweckform 32010: Business Cards, 54.0 x 85.0 mm, 10 per sheet       -->
   <!-- =================================================================== -->
   <Template name="Zweckform 32010" size="A4" _description="Business Cards">
+    <Meta category="card"/>
     <Label-rectangle id="0" width="240.94" height="153.07" round="0">
       <Markup-margin size="5"/>
       <Layout nx="2" ny="5" x0="40" y0="40" dx="269" dy="153"/>
   <!-- Zweckform 4760: File Labels, 192 x 38 mm, 7 per sheet               -->
   <!-- =================================================================== -->
   <Template name="Zweckform  4760" size="A4" description="File Back Labels">
+    <Meta category="label"/>
     <Label-rectangle id="0" width="544.252pt" height="107.717pt" round="5.66929pt" waste="0pt">
       <Markup-margin size="9pt"/>
       <Layout nx="1" ny="7" x0="25.5118pt" y0="43.7386pt" dx="544.252pt" dy="107.717pt"/>
index 445c6e85ccc680f31933f98fe8413e8a764d39d4..d50629a1b9e4f908a291e47c1146e9023888428a 100644 (file)
@@ -25,7 +25,6 @@ EXTRA_DIST =                          \
        $(content_files)                \
        $(HTML_IMAGES)                  \
        $(DOC_MAIN_SGML_FILE)           \
-       $(DOC_MODULE).types             \
        $(DOC_MODULE)-sections.txt      \
        $(DOC_MODULE)-overrides.txt
 
@@ -47,9 +46,9 @@ all-local: html-build.stamp
 #### scan ####
 
 scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
-       @echo '*** Scanning header files ***'
+       @echo 'gtk-doc: Scanning header files'
        @-chmod -R u+w $(srcdir)
-       if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
+       if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
            CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
        else \
            cd $(srcdir) ; \
@@ -67,9 +66,9 @@ $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp
 #### templates ####
 
 tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
-       @echo '*** Rebuilding template files ***'
+       @echo 'gtk-doc: Rebuilding template files'
        @-chmod -R u+w $(srcdir)
-       cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
+       cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS)
        touch tmpl-build.stamp
 
 tmpl.stamp: tmpl-build.stamp
@@ -77,11 +76,11 @@ tmpl.stamp: tmpl-build.stamp
 
 #### xml ####
 
-sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml
-       @echo '*** Building XML ***'
+sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml $(expand_content_files)
+       @echo 'gtk-doc: Building XML'
        @-chmod -R u+w $(srcdir)
        cd $(srcdir) && \
-       gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml $(MKDB_OPTIONS)
+       gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS)
        touch sgml-build.stamp
 
 sgml.stamp: sgml-build.stamp
@@ -90,13 +89,13 @@ sgml.stamp: sgml-build.stamp
 #### html ####
 
 html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
-       @echo '*** Building HTML ***'
+       @echo 'gtk-doc: Building HTML'
        @-chmod -R u+w $(srcdir)
        rm -rf $(srcdir)/html 
        mkdir $(srcdir)/html
        cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
        test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
-       @echo '-- Fixing Crossreferences' 
+       @echo 'gtk-doc: Fixing cross-references' 
        cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
        touch html-build.stamp
 else
@@ -147,5 +146,8 @@ dist-hook: dist-check-gtkdoc dist-hook-local
        -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
        -cp $(srcdir)/xml/*.xml $(distdir)/xml
        -cp $(srcdir)/html/* $(distdir)/html
+       if test -f $(srcdir)/$(DOC_MODULE).types; then \
+         cp $(srcdir)/$(DOC_MODULE).types $(distdir)/$(DOC_MODULE).types; \
+       fi
 
 .PHONY : dist-hook-local
index 36e6c3016ab0990ae59309f30334bbb849d69f1c..85139b5bc5402b4900b710016348a5220a7cb091 100644 (file)
@@ -20,10 +20,14 @@ libglabels_la_SOURCES =             \
        enums.h                 \
        paper.h                 \
        paper.c                 \
+       category.h              \
+       category.c              \
        template.h              \
        template.c              \
        xml-paper.h             \
        xml-paper.c             \
+       xml-category.h          \
+       xml-category.c          \
        xml-template.h          \
        xml-template.c          \
        xml.h                   \
@@ -33,8 +37,10 @@ libglabelsinclude_HEADERS =  \
        libglabels.h            \
        enums.h                 \
        paper.h                 \
+       category.h              \
        template.h              \
        xml-paper.h             \
+       xml-category.h          \
        xml-template.h          \
        xml.h                   
 
diff --git a/glabels2/libglabels/category.c b/glabels2/libglabels/category.c
new file mode 100644 (file)
index 0000000..4bd94d4
--- /dev/null
@@ -0,0 +1,416 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (LIBGLABELS) Template library for GLABELS
+ *
+ *  category.c:  template category module
+ *
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of the LIBGLABELS library.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ *  MA 02111-1307, USA
+ */
+#include <config.h>
+
+#include "category.h"
+
+#include <glib/gi18n.h>
+#include <glib/gmem.h>
+#include <glib/gstrfuncs.h>
+#include <glib/gmessages.h>
+#include <glib/gdir.h>
+#include <string.h>
+
+#include "libglabels-private.h"
+
+#include "xml-category.h"
+
+/*===========================================*/
+/* Private types                             */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+static GList *categories = NULL;
+
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static GList *read_categories (void);
+
+static GList *read_category_files_from_dir (GList       *categories,
+                                            const gchar *dirname);
+
+
+/**
+ * gl_category_init:
+ *
+ * Initialize libglabels category module by reading all category definition
+ * files located in system and user template directories.
+ */
+void
+gl_category_init (void)
+{
+       glCategory *other;
+
+       if (categories) {
+               return; /* Already initialized. */
+       }
+
+       categories = read_categories ();
+}
+
+
+/**
+ * gl_category_new:
+ * @id:     Id of category definition. (E.g. label, card, etc.)  Should be
+ *          unique.
+ * @name:   Localized name of category.
+ *
+ * Allocates and constructs a new #glCategory structure.
+ *
+ * Returns: a pointer to a newly allocated #glCategory structure.
+ *
+ */
+glCategory *
+gl_category_new (gchar             *id,
+                 gchar             *name)
+{
+       glCategory *category;
+
+       category         = g_new0 (glCategory,1);
+       category->id     = g_strdup (id);
+       category->name   = g_strdup (name);
+
+       return category;
+}
+
+
+/**
+ * gl_category_dup:
+ * @orig:  #glCategory structure to be duplicated.
+ *
+ * Duplicates an existing #glCategory structure.
+ *
+ * Returns: a pointer to a newly allocated #glCategory structure.
+ *
+ */
+glCategory *gl_category_dup (const glCategory *orig)
+{
+       glCategory       *category;
+
+       g_return_val_if_fail (orig, NULL);
+
+       category = g_new0 (glCategory,1);
+
+       category->id     = g_strdup (orig->id);
+       category->name   = g_strdup (orig->name);
+
+       return category;
+}
+
+
+/**
+ * gl_category_free:
+ * @category:  pointer to #glCategory structure to be freed.
+ *
+ * Free all memory associated with an existing #glCategory structure.
+ *
+ */
+void gl_category_free (glCategory *category)
+{
+
+       if ( category != NULL ) {
+
+               g_free (category->id);
+               category->id = NULL;
+
+               g_free (category->name);
+               category->name = NULL;
+
+               g_free (category);
+       }
+
+}
+
+
+/**
+ * gl_category_get_name_list:
+ *
+ * Get a list of all localized category names known to libglabels.
+ *
+ * Returns: a list of localized category names.
+ *
+ */
+GList *
+gl_category_get_name_list (void)
+{
+       GList           *names = NULL;
+       GList           *p;
+       glCategory      *category;
+
+       if (!categories) {
+               gl_category_init ();
+       }
+
+       for ( p=categories; p != NULL; p=p->next ) {
+               category = (glCategory *)p->data;
+               names = g_list_append (names, g_strdup (category->name));
+       }
+
+       return names;
+}
+
+
+/**
+ * gl_category_free_name_list:
+ * @names: List of localized category name strings to be freed.
+ *
+ * Free up all storage associated with a name list obtained with
+ * gl_category_get_name_list().
+ *
+ */
+void
+gl_category_free_name_list (GList *names)
+{
+       GList *p;
+
+       for (p = names; p != NULL; p = p->next) {
+               g_free (p->data);
+               p->data = NULL;
+       }
+
+       g_list_free (names);
+}
+
+
+/**
+ * gl_category_from_id:
+ * @id: category id string
+ *
+ * Lookup category definition from id string.
+ *
+ * Returns: pointer to a newly allocated #glCategory structure.
+ *
+ */
+glCategory *
+gl_category_from_id (const gchar *id)
+{
+       GList       *p;
+       glCategory  *category;
+
+       if (!categories) {
+               gl_category_init ();
+       }
+
+       if (id == NULL) {
+               /* If no id, return first category as a default */
+               return gl_category_dup ((glCategory *) categories->data);
+       }
+
+       for (p = categories; p != NULL; p = p->next) {
+               category = (glCategory *) p->data;
+               if (g_strcasecmp (category->id, id) == 0) {
+                       return gl_category_dup (category);
+               }
+       }
+
+       return NULL;
+}
+
+
+/**
+ * gl_category_from_name:
+ * @name: localized category name string
+ *
+ * Lookup category definition from localized category name string.
+ *
+ * Returns: pointer to a newly allocated #glCategory structure.
+ *
+ */
+glCategory *
+gl_category_from_name (const gchar *name)
+{
+       GList       *p;
+       glCategory  *category;
+
+       if (!categories) {
+               gl_category_init ();
+       }
+
+       if (name == NULL) {
+               /* If no name, return first category as a default */
+               return gl_category_dup ((glCategory *) categories->data);
+       }
+
+       for (p = categories; p != NULL; p = p->next) {
+               category = (glCategory *) p->data;
+               if (g_strcasecmp (category->name, name) == 0) {
+                       return gl_category_dup (category);
+               }
+       }
+
+       return NULL;
+}
+
+
+/**
+ * gl_category_lookup_id_from_name:
+ * @name: localized category name stringp
+ *
+ * Lookup category name string from localized category name string.
+ *
+ * Returns: pointer to a newly allocated id string.
+ *
+ */
+gchar *
+gl_category_lookup_id_from_name (const gchar       *name)
+{
+       glCategory *category = NULL;
+       gchar      *id = NULL;
+
+        if (name != NULL)
+        {
+                category = gl_category_from_name (name);
+                if ( category != NULL )
+                {
+                        id = g_strdup (category->id);
+                        gl_category_free (category);
+                        category = NULL;
+                }
+        }
+
+       return id;
+}
+
+/**
+ * gl_category_lookup_name_from_id:
+ * @id: category id string
+ *
+ * Lookup localized category name string from category id string.
+ *
+ * Returns: pointer to a newly allocated localized category name string.
+ *
+ */
+gchar *
+gl_category_lookup_name_from_id (const gchar       *id)
+{
+       glCategory *category = NULL;
+       gchar      *name = NULL;
+
+        if (id != NULL)
+        {
+                category = gl_category_from_id (id);
+                if ( category != NULL )
+                {
+                        name = g_strdup (category->name);
+                        gl_category_free (category);
+                        category = NULL;
+                }
+        }
+
+       return name;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Read categories from various files.                            */
+/*--------------------------------------------------------------------------*/
+static GList *
+read_categories (void)
+{
+       gchar *data_dir;
+       GList *categories = NULL;
+
+       data_dir = GL_SYSTEM_DATA_DIR;
+       categories = read_category_files_from_dir (categories, data_dir);
+       g_free (data_dir);
+
+       data_dir = GL_USER_DATA_DIR;
+       categories = read_category_files_from_dir (categories, data_dir);
+       g_free (data_dir);
+
+       if (categories == NULL) {
+               g_critical (_("Unable to locate category definitions.  Libglabels may not be installed correctly!"));
+       }
+
+       return categories;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Read all category files from given directory.  Append to list.    */
+/*--------------------------------------------------------------------------*/
+static GList *
+read_category_files_from_dir (GList       *categories,
+                              const gchar *dirname)
+{
+       GDir        *dp;
+       const gchar *filename, *extension;
+       gchar       *full_filename = NULL;
+       GError      *gerror = NULL;
+       GList       *new_categories = NULL;
+
+       if (dirname == NULL) {
+               return categories;
+       }
+
+       if (!g_file_test (dirname, G_FILE_TEST_EXISTS)) {
+               return categories;
+       }
+
+       dp = g_dir_open (dirname, 0, &gerror);
+       if (gerror != NULL) {
+               g_message ("cannot open data directory: %s", gerror->message );
+               return categories;
+       }
+
+       while ((filename = g_dir_read_name (dp)) != NULL) {
+
+               extension = strrchr (filename, '.');
+
+               if (extension != NULL) {
+
+                       if ( (g_strcasecmp (extension, ".categories") == 0)
+                            || (g_strcasecmp (filename, "categories.xml") == 0) ) {
+
+                               full_filename =
+                                   g_build_filename (dirname, filename, NULL);
+                               new_categories =
+                                   gl_xml_category_read_categories_from_file (full_filename);
+                               g_free (full_filename);
+
+                               categories = g_list_concat (categories, new_categories);
+                               new_categories = NULL;
+
+                       }
+
+               }
+
+       }
+
+       g_dir_close (dp);
+
+       return categories;
+}
+
+
+
+
diff --git a/glabels2/libglabels/category.h b/glabels2/libglabels/category.h
new file mode 100644 (file)
index 0000000..0d46a66
--- /dev/null
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (LIBGLABELS) Template library for GLABELS
+ *
+ *  category.h:  template category module header file
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of the LIBGLABELS library.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ *  MA 02111-1307, USA
+ */
+
+#ifndef __CATEGORY_H__
+#define __CATEGORY_H__
+
+#include <glib/gtypes.h>
+#include <glib/glist.h>
+
+G_BEGIN_DECLS
+
+/*
+ *   Template class
+ */
+typedef struct _glCategory glCategory;
+
+struct _glCategory {
+       gchar               *id;     /* Unique ID of paper definition */
+       gchar               *name;   /* Localized name of paper */
+};
+
+
+/*
+ * Module initialization
+ */
+void              gl_category_init                (void);
+
+
+/*
+ * Category construction
+ */
+glCategory       *gl_category_new                 (gchar            *id,
+                                                   gchar            *name);
+
+glCategory       *gl_category_dup                 (const glCategory *orig);
+void              gl_category_free                (glCategory       *category);
+
+
+/*
+ * Known category name lists
+ */
+GList            *gl_category_get_name_list       (void);
+void              gl_category_free_name_list      (GList            *names);
+
+
+/*
+ * Query functions
+ */
+glCategory       *gl_category_from_name           (const gchar      *name);
+glCategory       *gl_category_from_id             (const gchar      *id);
+gchar            *gl_category_lookup_id_from_name (const gchar      *name);
+gchar            *gl_category_lookup_name_from_id (const gchar      *id);
+
+G_END_DECLS
+
+#endif
index 0ec151fcd7e80fa48e7703d66c9291ab120ad072..bb99d1b892d04e89e95be623225229a05c63eaf1 100644 (file)
 
 #include <libglabels/enums.h>
 #include <libglabels/paper.h>
+#include <libglabels/category.h>
 #include <libglabels/template.h>
 #include <libglabels/xml-paper.h>
+#include <libglabels/xml-category.h>
 #include <libglabels/xml-template.h>
 #include <libglabels/xml.h>
 
index e81432ac0d3cffe3374baa1886a0bfd6aa013960..c19c943345d94290eee4b911ffc4e5171335478a 100644 (file)
@@ -397,13 +397,15 @@ gl_paper_lookup_id_from_name (const gchar       *name)
        glPaper *paper = NULL;
        gchar   *id = NULL;
 
-       g_return_val_if_fail (name, NULL);
-
-       paper = gl_paper_from_name (name);
-       if ( paper != NULL ) {
-               id = g_strdup (paper->id);
-               gl_paper_free (paper);
-               paper = NULL;
+       if (name != NULL)
+       {
+               paper = gl_paper_from_name (name);
+               if ( paper != NULL )
+               {
+                       id = g_strdup (paper->id);
+                       gl_paper_free (paper);
+                       paper = NULL;
+               }
        }
 
        return id;
@@ -424,13 +426,15 @@ gl_paper_lookup_name_from_id (const gchar       *id)
        glPaper *paper = NULL;
        gchar   *name = NULL;
 
-       g_return_val_if_fail (id, NULL);
-
-       paper = gl_paper_from_id (id);
-       if ( paper != NULL ) {
-               name = g_strdup (paper->name);
-               gl_paper_free (paper);
-               paper = NULL;
+       if (id != NULL)
+       {
+               paper = gl_paper_from_id (id);
+               if ( paper != NULL )
+               {
+                       name = g_strdup (paper->name);
+                       gl_paper_free (paper);
+                       paper = NULL;
+               }
        }
 
        return name;
index 7d584f09723452b8640868fb3951b2b3e5af962d..fd8f8a52406408f511822db14270361da85614ec 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (LIBGLABELS) Template library for GLABELS
  *
  *  template.c:  template module
  *
- *  Copyright (C) 2001-2004  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This file is part of the LIBGLABELS library.
  *
@@ -143,22 +145,28 @@ gl_template_register (const glTemplate  *template)
 /* Get a list of valid template names for given page size                    */
 /*****************************************************************************/
 GList *
-gl_template_get_name_list (const gchar *page_size)
+gl_template_get_name_list (const gchar *page_size,
+                           const gchar *category)
 {
        GList      *p_tmplt, *p_alias;
        glTemplate *template;
        gchar      *str;
        GList      *names = NULL;
 
-       if (!templates) {
+       if (!templates)
+        {
                gl_template_init ();
        }
 
-       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 = (glTemplate *) p_tmplt->data;
-               if (g_strcasecmp (page_size, template->page_size) == 0) {
+               if (gl_template_does_page_size_match (template, page_size) &&
+                    gl_template_does_category_match (template, category))
+                {
                        for (p_alias = template->aliases; p_alias != NULL;
-                            p_alias = p_alias->next) {
+                            p_alias = p_alias->next)
+                        {
                                str = g_strdup_printf("%s: %s",
                                                      (gchar *) p_alias->data,
                                                      template->description);
@@ -376,6 +384,66 @@ gl_template_new (const gchar         *name,
        return template;
 }
 
+/*****************************************************************************/
+/* Does page size match given id?                                            */
+/*****************************************************************************/
+gboolean
+gl_template_does_page_size_match (const glTemplate   *template,
+                                  const gchar        *page_size)
+{
+       g_return_if_fail (template);
+
+        /* NULL matches everything. */
+        if (page_size == NULL)
+        {
+                return TRUE;
+        }
+
+        return g_strcasecmp(page_size, template->page_size) == 0;
+}
+
+/*****************************************************************************/
+/* Does category match given id?                                             */
+/*****************************************************************************/
+gboolean
+gl_template_does_category_match  (const glTemplate   *template,
+                                  const gchar        *category)
+{
+        GList *p;
+
+       g_return_if_fail (template);
+
+        /* NULL matches everything. */
+        if (category == NULL)
+        {
+                return TRUE;
+        }
+
+        for ( p=template->categories; p != NULL; p=p->next )
+        {
+                if (g_strcasecmp(category, p->data) == 0)
+                {
+                        return TRUE;
+                }
+        }
+
+        return FALSE;
+}
+
+/*****************************************************************************/
+/* Add category to category list of template.                                */
+/*****************************************************************************/
+void
+gl_template_add_category (glTemplate          *template,
+                          const gchar         *category)
+{
+       g_return_if_fail (template);
+       g_return_if_fail (category);
+
+       template->categories = g_list_append (template->categories,
+                                              g_strdup (category));
+}
 /*****************************************************************************/
 /* Add label type structure to label type list of template.                  */
 /*****************************************************************************/
@@ -430,7 +498,7 @@ gl_template_rect_label_type_new  (const gchar         *id,
 
        return label_type;
 }
-                                                                               
+
 /*****************************************************************************/
 /* Create a new label type structure for a round label.                      */
 /*****************************************************************************/
@@ -609,6 +677,12 @@ gl_template_dup (const glTemplate *orig_template)
                                    orig_template->page_width,
                                    orig_template->page_height);
 
+       for ( p=orig_template->categories; p != NULL; p=p->next ) {
+
+                gl_template_add_category (template, p->data);
+
+       }
+
        for ( p=orig_template->label_types; p != NULL; p=p->next ) {
 
                label_type = (glTemplateLabelType *)p->data;
@@ -648,6 +722,15 @@ gl_template_free (glTemplate *template)
                g_free (template->page_size);
                template->page_size = NULL;
 
+               for ( p=template->categories; p != NULL; p=p->next ) {
+
+                       g_free (p->data);
+                       p->data = NULL;
+
+               }
+               g_list_free (template->categories);
+               template->categories = NULL;
+
                for ( p=template->label_types; p != NULL; p=p->next ) {
 
                        label_type = (glTemplateLabelType *)p->data;
index ce633b71dcdb983d0ade6f0446134606a337e990..2dc1308bc7828c7dfe079d6ca3cb05d08834f103 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (LIBGLABELS) Template library for GLABELS
  *
  *  template.h:  template module header file
  *
- *  Copyright (C) 2001-2004  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This file is part of the LIBGLABELS library.
  *
@@ -37,7 +39,6 @@ typedef struct _glTemplateLayout    glTemplateLayout;
 typedef struct _glTemplateMarkup    glTemplateMarkup;
 typedef struct _glTemplateOrigin    glTemplateOrigin;
 
-
 /*
  *   Top-level Template Structure
  */
@@ -49,6 +50,9 @@ struct _glTemplate {
        gdouble              page_width;
        gdouble              page_height;
 
+        /* List of (gchar *) category ids. */
+       GList               *categories;
+
        /* List of (glTemplateLabelType *) label type structures.
         * Currently glabels only supports a single label type per
         * template. */
@@ -187,7 +191,8 @@ void                 gl_template_register             (const glTemplate    *temp
 /*
  * Known templates query functions
  */
-GList               *gl_template_get_name_list        (const gchar         *page_size);
+GList               *gl_template_get_name_list        (const gchar         *page_size,
+                                                       const gchar         *category);
 
 void                 gl_template_free_name_list       (GList               *names);
 
@@ -201,6 +206,12 @@ gchar                     *gl_template_get_name_with_desc   (const glTemplate
 
 const glTemplateLabelType *gl_template_get_first_label_type (const glTemplate   *template);
 
+gboolean                   gl_template_does_page_size_match (const glTemplate   *template,
+                                                             const gchar        *page_size);
+
+gboolean                   gl_template_does_category_match  (const glTemplate   *template,
+                                                             const gchar        *category);
+
 
 /*
  * Label Type query functions
@@ -223,6 +234,9 @@ glTemplate          *gl_template_new                  (const gchar         *name
                                                       gdouble              page_width,
                                                       gdouble              page_height);
 
+void                 gl_template_add_category         (glTemplate          *template,
+                                                      const gchar         *category);
+
 void                 gl_template_add_label_type       (glTemplate          *template,
                                                       glTemplateLabelType *label_type);
 
diff --git a/glabels2/libglabels/xml-category.c b/glabels2/libglabels/xml-category.c
new file mode 100644 (file)
index 0000000..e161a83
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ *  (LIBGLABELS) Template library for GLABELS
+ *
+ *  xml-category.c:  category xml module
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of the LIBGLABELS library.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ *  MA 02111-1307, USA
+ */
+#include <config.h>
+
+#include "xml-category.h"
+
+#include <glib/gi18n.h>
+#include <glib/gmessages.h>
+#include <string.h>
+#include <libintl.h>
+
+#include "libglabels-private.h"
+
+#include "xml.h"
+
+/*===========================================*/
+/* Private types                             */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+
+/**
+ * gl_xml_category_read_categories_from_file:
+ * @utf8_filename:       Filename of categories file (name encoded as UTF-8)
+ *
+ * Read category definitions from a file.
+ *
+ * Returns: a list of #glCategory structures.
+ *
+ */
+GList *
+gl_xml_category_read_categories_from_file (gchar *utf8_filename)
+{
+       gchar      *filename;
+       GList      *categories;
+       xmlDocPtr   categories_doc;
+
+       LIBXML_TEST_VERSION;
+
+       filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
+       if (!filename) {
+               g_message ("Utf8 filename conversion error");
+               return NULL;
+       }
+
+       categories_doc = xmlParseFile (filename);
+       if (!categories_doc) {
+               g_message ("\"%s\" is not a glabels category file (not XML)",
+                          filename);
+               return NULL;
+       }
+
+       categories = gl_xml_category_parse_categories_doc (categories_doc);
+
+       g_free (filename);
+       xmlFreeDoc (categories_doc);
+
+       return categories;
+}
+
+
+/**
+ * gl_xml_category_parse_categories_doc:
+ * @categories_doc:  libxml #xmlDocPtr tree, representing a categories
+ * definition file.
+ *
+ * Read category definitions from a libxml #xmlDocPtr tree.
+ *
+ * Returns: a list of #glCategory structures.
+ *
+ */
+GList *
+gl_xml_category_parse_categories_doc (xmlDocPtr  categories_doc)
+{
+       GList      *categories = NULL;
+       xmlNodePtr  root, node;
+       glCategory *category;
+
+       LIBXML_TEST_VERSION;
+
+       root = xmlDocGetRootElement (categories_doc);
+       if (!root || !root->name) {
+               g_message ("\"%s\" is not a glabels category file (no root node)",
+                          categories_doc->name);
+               xmlFreeDoc (categories_doc);
+               return categories;
+       }
+       if (!gl_xml_is_node (root, "Glabels-categories")) {
+               g_message ("\"%s\" is not a glabels category file (wrong root node)",
+                          categories_doc->name);
+               xmlFreeDoc (categories_doc);
+               return categories;
+       }
+
+       for (node = root->xmlChildrenNode; node != NULL; node = node->next) {
+
+               if (gl_xml_is_node (node, "Category")) {
+                       category = gl_xml_category_parse_category_node (node);
+                       categories = g_list_append (categories, category);
+               } else {
+                       if ( !xmlNodeIsText(node) ) {
+                               if (!gl_xml_is_node (node, "comment")) {
+                                       g_message ("bad node =  \"%s\"",node->name);
+                               }
+                       }
+               }
+       }
+
+       return categories;
+}
+
+
+/**
+ * gl_xml_category_parse_category_node:
+ * @category_node:  libxml #xmlNodePtr category node from a #xmlDocPtr tree.
+ *
+ * Read a single category definition from a libxml #xmlNodePtr node.
+ *
+ * Returns: a pointer to a newly created #glCategory structure.
+ *
+ */
+glCategory *
+gl_xml_category_parse_category_node (xmlNodePtr category_node)
+{
+       glCategory            *category;
+       gchar                 *id, *name;
+
+       LIBXML_TEST_VERSION;
+
+       id   = gl_xml_get_prop_string (category_node, "id", NULL);
+       name = gl_xml_get_prop_i18n_string (category_node, "name", NULL);
+
+       category = gl_category_new (id, name);
+
+       g_free (id);
+       g_free (name);
+
+       return category;
+}
+
diff --git a/glabels2/libglabels/xml-category.h b/glabels2/libglabels/xml-category.h
new file mode 100644 (file)
index 0000000..de82a49
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ *  (LIBGLABELS) Template library for GLABELS
+ *
+ *  xml-category.h:  category xml module header file
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This file is part of the LIBGLABELS library.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ *  MA 02111-1307, USA
+ */
+
+#ifndef __XML_CATEGORY_H__
+#define __XML_CATEGORY_H__
+
+#include <glib/gtypes.h>
+#include <glib/glist.h>
+#include <libxml/tree.h>
+
+#include "category.h"
+
+G_BEGIN_DECLS
+
+GList       *gl_xml_category_read_categories_from_file (gchar        *utf8_filename);
+
+GList       *gl_xml_category_parse_categories_doc      (xmlDocPtr     categories_doc);
+
+glCategory  *gl_xml_category_parse_category_node       (xmlNodePtr    category_node);
+
+
+G_END_DECLS
+
+#endif /* __XML_CATEGORY_H__ */
index 64fc2da5c0d14c07acd091b3b5ab419e7c4b9ade..eca5c80bf797ce34875affc83f663b3165ac9553 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (LIBGLABELS) Template library for GLABELS
  *
  *  xml-template.c:  template xml module
  *
- *  Copyright (C) 2001-2004  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This file is part of the LIBGLABELS library.
  *
@@ -47,6 +49,8 @@
 /*===========================================*/
 /* Local function prototypes                 */
 /*===========================================*/
+static void  xml_parse_meta_node            (xmlNodePtr              label_node,
+                                            glTemplate             *template);
 static void  xml_parse_label_rectangle_node (xmlNodePtr              label_node,
                                             glTemplate             *template);
 static void  xml_parse_label_round_node     (xmlNodePtr              label_node,
@@ -64,6 +68,9 @@ static void  xml_parse_markup_circle_node   (xmlNodePtr              markup_node
 static void  xml_parse_alias_node           (xmlNodePtr              alias_node,
                                             glTemplate             *template);
 
+static void  xml_create_meta_node           (const gchar                  *category,
+                                            xmlNodePtr                    root,
+                                            const xmlNsPtr                ns);
 static void  xml_create_label_node          (const glTemplateLabelType    *label_type,
                                             xmlNodePtr                    root,
                                             const xmlNsPtr                ns);
@@ -231,7 +238,9 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node)
 
        for (node = template_node->xmlChildrenNode; node != NULL;
             node = node->next) {
-               if (gl_xml_is_node (node, "Label-rectangle")) {
+               if (gl_xml_is_node (node, "Meta")) {
+                       xml_parse_meta_node (node, template);
+               } else if (gl_xml_is_node (node, "Label-rectangle")) {
                        xml_parse_label_rectangle_node (node, template);
                } else if (gl_xml_is_node (node, "Label-round")) {
                        xml_parse_label_round_node (node, template);
@@ -255,6 +264,24 @@ gl_xml_template_parse_template_node (const xmlNodePtr template_node)
        return template;
 }
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Parse XML Template->Meta Node.                                 */
+/*--------------------------------------------------------------------------*/
+static void
+xml_parse_meta_node (xmlNodePtr  meta_node,
+                    glTemplate *template)
+{
+       gchar               *category;
+
+       category = gl_xml_get_prop_string (meta_node, "category", NULL);
+
+       if (category != NULL)
+       {
+               gl_template_add_category (template, category);
+               g_free (category);
+       }
+}
+
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Parse XML Template->Label-rectangle Node.                      */
 /*--------------------------------------------------------------------------*/
@@ -638,6 +665,21 @@ gl_xml_template_create_template_node (const glTemplate *template,
 
 }
 
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Add XML Template->Meta Node.                                   */
+/*--------------------------------------------------------------------------*/
+static void
+xml_create_meta_node (const gchar      *category,
+                     xmlNodePtr        root,
+                     const xmlNsPtr    ns)
+{
+       xmlNodePtr node;
+
+       node = xmlNewChild (root, ns, (xmlChar *)"Meta", NULL);
+       gl_xml_set_prop_string (node, "category", category);
+
+}
+
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  Add XML Template->Label Node.                                  */
 /*--------------------------------------------------------------------------*/
index 33fd13cea218d4a44d5315dcd3183c5bd5668e41..2b730810800e8f6cd6e5100c5fac5c3ebad87dd5 100644 (file)
@@ -62,6 +62,8 @@ glabels_SOURCES =                     \
        ui-sidebar.c                    \
        file.h                          \
        file.c                          \
+       new-label-dialog.h              \
+       new-label-dialog.c              \
        recent.h                        \
        recent.c                        \
        prefs.c                         \
@@ -156,6 +158,8 @@ glabels_SOURCES =                   \
        merge-vcard.h                   \
        text-node.c                     \
        text-node.h                     \
+       mini-preview-pixbuf.c           \
+       mini-preview-pixbuf.h           \
        wdgt-print-copies.c             \
        wdgt-print-copies.h             \
        wdgt-print-merge.c              \
index a8c71fbf54ab59bbcc8352b88f5d6542e2c23227..8bff5918879f3af214ee4cb30db9ff56b744666b 100644 (file)
 
 #include "xml-label.h"
 #include "recent.h"
-#include "hig.h"
 #include "util.h"
-#include "wdgt-media-select.h"
-#include "wdgt-rotate-label.h"
+#include "window.h"
+#include "new-label-dialog.h"
 #include "debug.h"
 
 /*===========================================*/
@@ -47,6 +46,7 @@
 
 /* Saved state for new dialog */
 static gchar   *page_size   = NULL;
+static gchar   *category    = NULL;
 static gchar   *sheet_name  = NULL;
 static gboolean rotate_flag = FALSE;
 
@@ -57,18 +57,11 @@ static gchar *save_path = NULL;
 /*===========================================*/
 /* Local function prototypes.                */
 /*===========================================*/
-static void create_new_dialog_widgets        (GtkDialog         *dlg);
-static void new_template_changed             (glWdgtMediaSelect *select,
-                                             gpointer           data);
-static void new_response                     (GtkDialog         *dlg,
+static void new_response                     (GtkDialog         *dialog,
                                              gint               response,
                                              gpointer           user_data);
 
-static void create_properties_dialog_widgets (GtkDialog         *dlg,
-                                             glLabel           *label);
-static void properties_template_changed      (glWdgtMediaSelect *select,
-                                             gpointer           data);
-static void properties_response              (GtkDialog         *dlg,
+static void properties_response              (GtkDialog         *dialog,
                                              gint               response,
                                              gpointer           user_data);
 
@@ -86,104 +79,33 @@ static void save_as_response                 (GtkDialog         *chooser,
 void
 gl_file_new (glWindow  *window)
 {
-       GtkWidget    *dlg;
+       GtkWidget    *dialog;
 
        gl_debug (DEBUG_FILE, "START");
 
-       g_return_if_fail (window != NULL);
-
-       dlg = gtk_dialog_new_with_buttons (_("New Label or Card"),
-                                          GTK_WINDOW (window),
-                                          GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
-                                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                          GTK_STOCK_OK, GTK_RESPONSE_OK,
-                                          NULL);
-
-       gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
-       gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2);
-
-       create_new_dialog_widgets (GTK_DIALOG (dlg));
-
-       g_object_set_data (G_OBJECT (dlg), "parent_window", window);
-
-       g_signal_connect (G_OBJECT(dlg), "response",
-                         G_CALLBACK (new_response), dlg);
-
-        gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
-       gtk_widget_show_all (GTK_WIDGET (dlg));
-
-       gl_debug (DEBUG_FILE, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE.  Create widgets.                                                 */
-/*---------------------------------------------------------------------------*/
-static void
-create_new_dialog_widgets (GtkDialog *dlg)
-{
-       GtkWidget *wvbox, *wframe, *template_entry, *rotate_sel;
-
-       gl_debug (DEBUG_FILE, "START");
-
-       wvbox = gtk_vbox_new (FALSE, GL_HIG_PAD2);
-       gtk_box_pack_start (GTK_BOX(dlg->vbox), wvbox, FALSE, FALSE, 0);
-
-       wframe = gl_hig_category_new (_("Media Type"));
-       gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0);
-
-       template_entry = gl_wdgt_media_select_new ();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), template_entry);
-
-       wframe = gl_hig_category_new (_("Label orientation"));
-       gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0);
+       g_return_if_fail (window && GTK_IS_WINDOW (window));
 
-       rotate_sel = gl_wdgt_rotate_label_new ();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), rotate_sel);
+       dialog = gl_new_label_dialog_new (GTK_WINDOW (window));
+       gtk_window_set_title (GTK_WINDOW (dialog), _("New Label or Card"));
 
-       g_object_set_data (G_OBJECT (dlg), "template_entry", template_entry);
-       g_object_set_data (G_OBJECT (dlg), "rotate_sel", rotate_sel);
+       g_object_set_data (G_OBJECT (dialog), "parent_window", window);
 
-       g_signal_connect (G_OBJECT (template_entry), "changed",
-                         G_CALLBACK (new_template_changed), rotate_sel);
+       g_signal_connect (G_OBJECT(dialog), "response",
+                         G_CALLBACK (new_response), dialog);
 
        if (page_size != NULL) {
-               gl_wdgt_media_select_set_page_size (GL_WDGT_MEDIA_SELECT (template_entry),
-                                              page_size);
+               gl_new_label_dialog_set_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                           page_size,
+                                                           category);
        }
        if (sheet_name != NULL) {
-               gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (template_entry),
+               gl_new_label_dialog_set_template_name (GL_NEW_LABEL_DIALOG (dialog),
                                          sheet_name);
-               gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL
-                                                   (rotate_sel), sheet_name);
-       } else {
-               sheet_name =
-                   gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry));
-               gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL
-                                                   (rotate_sel), sheet_name);
        }
-       gl_wdgt_rotate_label_set_state (GL_WDGT_ROTATE_LABEL (rotate_sel), rotate_flag);
-
-       gl_debug (DEBUG_FILE, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE.  New template changed callback.                                  */
-/*---------------------------------------------------------------------------*/
-static void
-new_template_changed (glWdgtMediaSelect *select,
-                     gpointer           data)
-{
-       glWdgtRotateLabel *rotate_sel = GL_WDGT_ROTATE_LABEL (data);
-       gchar             *name;
-
-       gl_debug (DEBUG_FILE, "START");
-
-       name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select));
-
-       gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (rotate_sel),
-                                               name);
+       gl_new_label_dialog_set_rotate_state (GL_NEW_LABEL_DIALOG (dialog), rotate_flag);
 
-       g_free (name);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+       gtk_widget_show_all (GTK_WIDGET (dialog));
 
        gl_debug (DEBUG_FILE, "END");
 }
@@ -192,38 +114,32 @@ new_template_changed (glWdgtMediaSelect *select,
 /* PRIVATE.  New "ok" button callback.                                       */
 /*---------------------------------------------------------------------------*/
 static void
-new_response (GtkDialog *dlg,
+new_response (GtkDialog *dialog,
              gint       response,
              gpointer   user_data)
 {
-       GtkWidget  *template_entry, *rotate_sel, *new_window;
        glTemplate *template;
        glLabel    *label;
-       gint        ret;
        glWindow   *window;
+       GtkWidget  *new_window;
 
        gl_debug (DEBUG_FILE, "START");
 
        switch (response) {
+
        case GTK_RESPONSE_OK:
-               template_entry =
-                       GTK_WIDGET (g_object_get_data (G_OBJECT (dlg),
-                                                      "template_entry"));
-               rotate_sel = GTK_WIDGET (g_object_get_data (G_OBJECT (dlg),
-                                                           "rotate_sel"));
 
-               if (page_size != NULL)
-                       g_free (page_size);
-               page_size =
-                       gl_wdgt_media_select_get_page_size (GL_WDGT_MEDIA_SELECT (template_entry));
+               gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                           &page_size,
+                                                           &category);
 
                if (sheet_name != NULL)
                        g_free (sheet_name);
                sheet_name =
-                       gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry));
+                       gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
 
                rotate_flag =
-                       gl_wdgt_rotate_label_get_state (GL_WDGT_ROTATE_LABEL (rotate_sel));
+                       gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
 
                template = gl_template_from_name (sheet_name);
 
@@ -234,7 +150,7 @@ new_response (GtkDialog *dlg,
                gl_template_free (template);
 
                window =
-                       GL_WINDOW (g_object_get_data (G_OBJECT (dlg),
+                       GL_WINDOW (g_object_get_data (G_OBJECT (dialog),
                                                      "parent_window"));
                if ( gl_window_is_empty (window) ) {
                        gl_window_set_label (window, label);
@@ -243,16 +159,17 @@ new_response (GtkDialog *dlg,
                        gtk_widget_show_all (new_window);
                }
                
+               break;
 
+       default:
                break;
        }
 
-       gtk_widget_destroy (GTK_WIDGET (dlg));
+       gtk_widget_destroy (GTK_WIDGET (dialog));
 
        gl_debug (DEBUG_FILE, "END");
 }
 
-\f
 /*****************************************************************************/
 /* "Properties" menu callback.                                               */
 /*****************************************************************************/
@@ -260,115 +177,43 @@ void
 gl_file_properties (glLabel   *label,
                    glWindow  *window)
 {
-       GtkWidget    *dlg;
+       GtkWidget    *dialog;
+        glTemplate   *template;
+        gboolean      rotate_flag;
 
        gl_debug (DEBUG_FILE, "START");
 
-       g_return_if_fail (label && GL_IS_LABEL (label));
+        g_return_if_fail (label && GL_IS_LABEL (label));
        g_return_if_fail (window && GTK_IS_WINDOW (window));
 
-       dlg = gtk_dialog_new_with_buttons (_("Label properties"),
-                                          GTK_WINDOW (window),
-                                          GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
-                                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                          GTK_STOCK_OK, GTK_RESPONSE_OK,
-                                          NULL);
-       gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2);
+       dialog = gl_new_label_dialog_new (GTK_WINDOW (window));
+       gtk_window_set_title (GTK_WINDOW (dialog), _("Label properties"));
 
-       gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_OK);
+       g_object_set_data (G_OBJECT (dialog), "label", label);
 
-       create_properties_dialog_widgets (GTK_DIALOG (dlg), label);
+       g_signal_connect (G_OBJECT(dialog), "response",
+                         G_CALLBACK (properties_response), dialog);
 
-       g_object_set_data (G_OBJECT (dlg), "label", label);
+        template = gl_label_get_template (label);
+        rotate_flag = gl_label_get_rotate_flag (label);
 
-       g_signal_connect (G_OBJECT(dlg), "response",
-                         G_CALLBACK (properties_response), dlg);
+        if (template->page_size != NULL) {
+                gl_new_label_dialog_set_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                            template->page_size,                                                            NULL);
+        }
+        if (template->name != NULL) {
+                gchar *template_name = gl_template_get_name_with_desc (template);
+                gl_new_label_dialog_set_template_name (GL_NEW_LABEL_DIALOG (dialog),
+                                               template_name);
+                gl_new_label_dialog_set_template_name (GL_NEW_LABEL_DIALOG (dialog),
+                                                      template_name);
+                g_free (template_name);
+        }
+        gl_new_label_dialog_set_rotate_state (GL_NEW_LABEL_DIALOG (dialog),
+                                             rotate_flag);
 
-        gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
-       gtk_widget_show_all (GTK_WIDGET (dlg));
-
-       gl_debug (DEBUG_FILE, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE.  Create widgets.                                                 */
-/*---------------------------------------------------------------------------*/
-static void
-create_properties_dialog_widgets (GtkDialog   *dlg,
-                                 glLabel     *label)
-{
-       GtkWidget  *wvbox, *wframe, *template_entry, *rotate_sel;
-       glTemplate *template;
-       gboolean    rotate_flag;
-
-       gl_debug (DEBUG_FILE, "START");
-
-       wvbox = gtk_vbox_new (FALSE, GL_HIG_PAD2);
-       gtk_box_pack_start (GTK_BOX(dlg->vbox), wvbox, FALSE, FALSE, 0);
-
-       wframe = gl_hig_category_new (_("Media Type"));
-       gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0);
-
-       template_entry = gl_wdgt_media_select_new ();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), template_entry);
-
-       wframe = gl_hig_category_new (_("Label orientation"));
-       gtk_box_pack_start (GTK_BOX (wvbox), wframe, FALSE, FALSE, 0);
-
-       rotate_sel = gl_wdgt_rotate_label_new ();
-       gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), rotate_sel);
-
-       g_object_set_data (G_OBJECT (dlg), "template_entry", template_entry);
-       g_object_set_data (G_OBJECT (dlg), "rotate_sel", rotate_sel);
-
-       g_signal_connect (G_OBJECT (template_entry), "changed",
-                         G_CALLBACK (properties_template_changed), rotate_sel);
-
-       template = gl_label_get_template (label);
-       rotate_flag = gl_label_get_rotate_flag (label);
-
-       gl_debug (DEBUG_FILE, "%s, %s", template->page_size, template->name);
-
-       if (template->page_size != NULL) {
-               gl_wdgt_media_select_set_page_size (GL_WDGT_MEDIA_SELECT (template_entry),
-                                                   template->page_size);
-       }
-       if (template->name != NULL) {
-               gchar *template_name = gl_template_get_name_with_desc (template);
-               gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (template_entry),
-                                              template_name);
-               gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL
-                                                       (rotate_sel), template_name);
-               g_free (template_name);
-       } else {
-               sheet_name =
-                   gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry));
-               gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL
-                                                       (rotate_sel), sheet_name);
-       }
-       gl_wdgt_rotate_label_set_state (GL_WDGT_ROTATE_LABEL (rotate_sel), rotate_flag);
-
-       gl_debug (DEBUG_FILE, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE.  Properties template changed callback.                           */
-/*---------------------------------------------------------------------------*/
-static void
-properties_template_changed (glWdgtMediaSelect *select,
-                            gpointer           data)
-{
-       glWdgtRotateLabel *rotate_sel = GL_WDGT_ROTATE_LABEL (data);
-       gchar             *name;
-
-       gl_debug (DEBUG_FILE, "START");
-
-       name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select));
-
-       gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (rotate_sel),
-                                               name);
-
-       g_free (name);
+        gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+       gtk_widget_show_all (GTK_WIDGET (dialog));
 
        gl_debug (DEBUG_FILE, "END");
 }
@@ -377,49 +222,46 @@ properties_template_changed (glWdgtMediaSelect *select,
 /* PRIVATE.  Properties "ok" button callback.                                */
 /*---------------------------------------------------------------------------*/
 static void
-properties_response (GtkDialog *dlg,
-                    gint       response,
-                    gpointer   user_data)
+properties_response (GtkDialog *dialog,
+             gint       response,
+             gpointer   user_data)
 {
-       GtkWidget  *template_entry, *rotate_sel;
        glTemplate *template;
        glLabel    *label;
-       gint        ret;
        glWindow   *window;
+       GtkWidget  *new_window;
 
        gl_debug (DEBUG_FILE, "START");
 
        switch (response) {
+
        case GTK_RESPONSE_OK:
-               template_entry =
-                       GTK_WIDGET (g_object_get_data (G_OBJECT (dlg),
-                                                      "template_entry"));
-               rotate_sel = GTK_WIDGET (g_object_get_data (G_OBJECT (dlg),
-                                                           "rotate_sel"));
 
-               if (page_size != NULL)
-                       g_free (page_size);
-               page_size =
-                       gl_wdgt_media_select_get_page_size (GL_WDGT_MEDIA_SELECT (template_entry));
+               gl_new_label_dialog_get_filter_parameters (GL_NEW_LABEL_DIALOG (dialog),
+                                                           &page_size,
+                                                           &category);
 
                if (sheet_name != NULL)
                        g_free (sheet_name);
                sheet_name =
-                       gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (template_entry));
+                       gl_new_label_dialog_get_template_name (GL_NEW_LABEL_DIALOG (dialog));
 
                rotate_flag =
-                       gl_wdgt_rotate_label_get_state (GL_WDGT_ROTATE_LABEL (rotate_sel));
+                       gl_new_label_dialog_get_rotate_state (GL_NEW_LABEL_DIALOG (dialog));
 
                template = gl_template_from_name (sheet_name);
 
-               label = GL_LABEL(g_object_get_data (G_OBJECT (dlg), "label"));
-               gl_label_set_template (label, template);
-               gl_label_set_rotate_flag (label, rotate_flag);
+                label = GL_LABEL(g_object_get_data (G_OBJECT (dialog), "label"));
+                gl_label_set_template (label, template);
+                gl_label_set_rotate_flag (label, rotate_flag);
 
                break;
+
+       default:
+               break;
        }
 
-       gtk_widget_destroy (GTK_WIDGET (dlg));
+       gtk_widget_destroy (GTK_WIDGET (dialog));
 
        gl_debug (DEBUG_FILE, "END");
 }
@@ -481,7 +323,7 @@ open_response (GtkDialog     *chooser,
 {
        gchar            *raw_filename;
        gchar            *filename;
-       GtkWidget        *dlg;
+       GtkWidget        *dialog;
        gint              ret;
        EggRecentModel   *recent;
 
@@ -501,33 +343,33 @@ open_response (GtkDialog     *chooser,
                    !filename || 
                    g_file_test (raw_filename, G_FILE_TEST_IS_DIR)) {
 
-                       dlg = gtk_message_dialog_new (GTK_WINDOW(chooser),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW(chooser),
                                                      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                      GTK_MESSAGE_WARNING,
                                                      GTK_BUTTONS_CLOSE,
                                                      _("Empty file name selection"));
                        gtk_message_dialog_format_secondary_text (
-                               GTK_MESSAGE_DIALOG (dlg),
+                               GTK_MESSAGE_DIALOG (dialog),
                                _("Please select a file or supply a valid file name"));
 
-                       gtk_dialog_run (GTK_DIALOG (dlg));
-                       gtk_widget_destroy (dlg);
+                       gtk_dialog_run (GTK_DIALOG (dialog));
+                       gtk_widget_destroy (dialog);
 
                } else {
 
                        if (!g_file_test (raw_filename, G_FILE_TEST_IS_REGULAR)) {
 
-                               dlg = gtk_message_dialog_new (GTK_WINDOW(chooser),
+                               dialog = gtk_message_dialog_new (GTK_WINDOW(chooser),
                                                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                              GTK_MESSAGE_WARNING,
                                                              GTK_BUTTONS_CLOSE,
                                                              _("File does not exist"));
                                gtk_message_dialog_format_secondary_text (
-                                       GTK_MESSAGE_DIALOG (dlg),
+                                       GTK_MESSAGE_DIALOG (dialog),
                                        _("Please select a file or supply a valid file name"));
 
-                               gtk_dialog_run (GTK_DIALOG (dlg));
-                               gtk_widget_destroy (dlg);
+                               gtk_dialog_run (GTK_DIALOG (dialog));
+                               gtk_widget_destroy (dialog);
 
 
                        } else {
@@ -589,21 +431,21 @@ gl_file_open_real (const gchar     *filename,
        abs_filename = gl_util_make_absolute (filename);
        label = gl_xml_label_open (abs_filename, &status);
        if (!label) {
-               GtkWidget *dlg;
+               GtkWidget *dialog;
 
                gl_debug (DEBUG_FILE, "couldn't open file");
 
-               dlg = gtk_message_dialog_new (GTK_WINDOW (window),
+               dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                              GTK_DIALOG_DESTROY_WITH_PARENT,
                                              GTK_MESSAGE_ERROR,
                                              GTK_BUTTONS_CLOSE,
                                              _("Could not open file \"%s\""),
                                              filename);
-               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg),
+               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                                          _("Not a supported file format"));
 
-               gtk_dialog_run (GTK_DIALOG (dlg));
-               gtk_widget_destroy (dlg);
+               gtk_dialog_run (GTK_DIALOG (dialog));
+               gtk_widget_destroy (dialog);
 
                g_free (abs_filename);
 
@@ -671,22 +513,22 @@ gl_file_save (glLabel   *label,
 
        if (status != XML_LABEL_OK)
        {
-               GtkWidget *dlg;
+               GtkWidget *dialog;
 
                gl_debug (DEBUG_FILE, "FAILED");
 
-               dlg = gtk_message_dialog_new (GTK_WINDOW (window),
+               dialog = gtk_message_dialog_new (GTK_WINDOW (window),
                                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                              GTK_MESSAGE_ERROR,
                                              GTK_BUTTONS_CLOSE,
                                              _("Could not save file \"%s\""),
                                              filename);
                gtk_message_dialog_format_secondary_text (
-                       GTK_MESSAGE_DIALOG (dlg),
+                       GTK_MESSAGE_DIALOG (dialog),
                        _("Error encountered during save.  The file is still not saved."));
 
-               gtk_dialog_run (GTK_DIALOG (dlg));
-               gtk_widget_destroy (dlg);
+               gtk_dialog_run (GTK_DIALOG (dialog));
+               gtk_widget_destroy (dialog);
 
                g_free (filename);
 
@@ -781,7 +623,7 @@ save_as_response (GtkDialog     *chooser,
                  glLabel       *label)
 {
        gchar            *raw_filename, *filename, *full_filename;
-       GtkWidget        *dlg;
+       GtkWidget        *dialog;
        glXMLLabelStatus  status;
        EggRecentModel   *recent;
        gboolean         *saved_flag;
@@ -803,17 +645,17 @@ save_as_response (GtkDialog     *chooser,
 
                if (!raw_filename || g_file_test (raw_filename, G_FILE_TEST_IS_DIR)) {
 
-                       dlg = gtk_message_dialog_new (GTK_WINDOW(chooser),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW(chooser),
                                                      GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                      GTK_MESSAGE_WARNING,
                                                      GTK_BUTTONS_CLOSE,
                                                      _("Empty file name selection"));
                        gtk_message_dialog_format_secondary_text (
-                               GTK_MESSAGE_DIALOG (dlg),
+                               GTK_MESSAGE_DIALOG (dialog),
                                _("Please supply a valid file name"));
 
-                       gtk_dialog_run (GTK_DIALOG (dlg));
-                       gtk_widget_destroy (dlg);
+                       gtk_dialog_run (GTK_DIALOG (dialog));
+                       gtk_widget_destroy (dialog);
 
                } else {
 
@@ -827,21 +669,21 @@ save_as_response (GtkDialog     *chooser,
                        if (g_file_test (full_filename, G_FILE_TEST_IS_REGULAR)) {
                                gint ret;
 
-                               dlg = gtk_message_dialog_new (GTK_WINDOW(chooser),
+                               dialog = gtk_message_dialog_new (GTK_WINDOW(chooser),
                                                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                              GTK_MESSAGE_QUESTION,
                                                              GTK_BUTTONS_YES_NO,
                                                              _("Overwrite file \"%s\"?"),
                                                               filename);
                                gtk_message_dialog_format_secondary_text (
-                                       GTK_MESSAGE_DIALOG (dlg),
+                                       GTK_MESSAGE_DIALOG (dialog),
                                        _("File already exists."));
 
-                               ret = gtk_dialog_run (GTK_DIALOG (dlg));
+                               ret = gtk_dialog_run (GTK_DIALOG (dialog));
                                if ( ret == GTK_RESPONSE_NO ) {
                                        cancel_flag = TRUE;
                                }
-                               gtk_widget_destroy (dlg);
+                               gtk_widget_destroy (dialog);
                        }
 
                        if (!cancel_flag) {
@@ -852,7 +694,7 @@ save_as_response (GtkDialog     *chooser,
 
                                if ( status != XML_LABEL_OK ) {
 
-                                       dlg = gtk_message_dialog_new (
+                                       dialog = gtk_message_dialog_new (
                                                GTK_WINDOW(chooser),
                                                GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                GTK_MESSAGE_ERROR,
@@ -860,11 +702,11 @@ save_as_response (GtkDialog     *chooser,
                                                _("Could not save file \"%s\""),
                                                filename);
                                        gtk_message_dialog_format_secondary_text (
-                                               GTK_MESSAGE_DIALOG (dlg),
+                                               GTK_MESSAGE_DIALOG (dialog),
                                                _("Error encountered during save.  The file is still not saved."));
 
-                                       gtk_dialog_run (GTK_DIALOG (dlg));
-                                       gtk_widget_destroy (dlg);
+                                       gtk_dialog_run (GTK_DIALOG (dialog));
+                                       gtk_widget_destroy (dialog);
 
                                } else {
 
@@ -921,40 +763,40 @@ gl_file_close (glWindow *window)
                label = view->label;
 
                if (gl_label_is_modified (label))       {
-                       GtkWidget *dlg, *w;
+                       GtkWidget *dialog, *w;
                        gchar *fname = NULL;
                        gint ret;
                        gboolean exiting;
 
                        fname = gl_label_get_short_name (label);
                        
-                       dlg = gtk_message_dialog_new (GTK_WINDOW(window),
+                       dialog = gtk_message_dialog_new (GTK_WINDOW(window),
                                                         GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                         GTK_MESSAGE_WARNING,
                                                         GTK_BUTTONS_NONE,
                                                         _("Save changes to document \"%s\" before closing?"),
                                                         fname);
                        gtk_message_dialog_format_secondary_text (
-                               GTK_MESSAGE_DIALOG (dlg),
+                               GTK_MESSAGE_DIALOG (dialog),
                                _("Your changes will be lost if you don't save them."));
 
-                       gtk_dialog_add_button (GTK_DIALOG (dlg),
+                       gtk_dialog_add_button (GTK_DIALOG (dialog),
                                               _("Close without saving"),
                                               GTK_RESPONSE_NO);
 
-                       gtk_dialog_add_button (GTK_DIALOG (dlg),
+                       gtk_dialog_add_button (GTK_DIALOG (dialog),
                                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
 
-                       gtk_dialog_add_button (GTK_DIALOG (dlg),
+                       gtk_dialog_add_button (GTK_DIALOG (dialog),
                                               GTK_STOCK_SAVE, GTK_RESPONSE_YES);
 
-                       gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_YES);
+                       gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
 
-                       gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+                       gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 
-                       ret = gtk_dialog_run (GTK_DIALOG (dlg));
+                       ret = gtk_dialog_run (GTK_DIALOG (dialog));
                
-                       gtk_widget_destroy (dlg);
+                       gtk_widget_destroy (dialog);
 
                        g_free (fname);
                
diff --git a/glabels2/src/mini-preview-pixbuf.c b/glabels2/src/mini-preview-pixbuf.c
new file mode 100644 (file)
index 0000000..6d2a6fc
--- /dev/null
@@ -0,0 +1,355 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  mini-preview-pixbuf.c:  mini preview pixbuf module
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#include <config.h>
+
+#include "mini-preview-pixbuf.h"
+
+#include <cairo.h>
+#include <math.h>
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private types                             */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void draw_paper                (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            scale);
+
+static void draw_label_outlines       (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            scale);
+
+static void draw_label_outline        (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            x0,
+                                      gdouble            y0);
+
+static void draw_rect_label_outline   (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            x0,
+                                      gdouble            y0);
+
+static void draw_round_label_outline  (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            x0,
+                                      gdouble            y0);
+
+static void draw_cd_label_outline     (cairo_t           *cr,
+                                      const glTemplate  *template,
+                                      gdouble            x0,
+                                      gdouble            y0);
+
+
+
+\f
+/****************************************************************************/
+/* Create new pixbuf with mini preview of template                          */
+/****************************************************************************/
+GdkPixbuf *
+gl_mini_preview_pixbuf_new (glTemplate *template,
+                           gint        width,
+                           gint        height)
+{
+       cairo_surface_t   *surface;
+       cairo_t           *cr;
+       GdkPixbuf         *pixbuf;
+       gdouble            scale;
+       gdouble            w, h;
+       gdouble            offset_x, offset_y;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       /* Create pixbuf and cairo context. */
+       pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
+       surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (pixbuf),
+                                                      CAIRO_FORMAT_RGB24,
+                                                      gdk_pixbuf_get_width (pixbuf),
+                                                      gdk_pixbuf_get_height (pixbuf),
+                                                      gdk_pixbuf_get_rowstride (pixbuf));
+
+       cr = cairo_create (surface);
+       cairo_surface_destroy (surface);
+
+       /* Clear pixbuf */
+       cairo_save (cr);
+        cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
+        cairo_paint (cr);
+       cairo_restore (cr);
+
+       cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
+
+       /* Set scale and offset */
+       w = width - 1;
+       h = height - 1;
+       if ( (w/template->page_width) > (h/template->page_height) ) {
+               scale = h / template->page_height;
+       } else {
+               scale = w / template->page_width;
+       }
+       offset_x = (width/scale - template->page_width) / 2.0;
+       offset_y = (height/scale - template->page_height) / 2.0;
+       cairo_identity_matrix (cr);
+        cairo_scale (cr, scale, scale);
+       cairo_translate (cr, offset_x, offset_y);
+
+       /* Draw paper and label outlines */
+       draw_paper (cr, template, scale);
+       draw_label_outlines (cr, template, scale);
+
+       /* Cleanup */
+       cairo_destroy (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+
+       return pixbuf;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw paper and paper outline.                                  */
+/*--------------------------------------------------------------------------*/
+static void
+draw_paper (cairo_t           *cr,
+           const glTemplate  *template,
+           gdouble            scale)
+{
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+       cairo_rectangle (cr, 0.0, 0.0, template->page_width, template->page_height);
+       cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+       cairo_fill_preserve (cr);
+       cairo_set_line_width (cr, 1/scale);
+       cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+       cairo_stroke (cr);
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw label outlines.                                           */
+/*--------------------------------------------------------------------------*/
+static void
+draw_label_outlines (cairo_t           *cr,
+                    const glTemplate  *template,
+                    gdouble            scale)
+{
+       const glTemplateLabelType *label_type;
+       gint                       i, n_labels;
+       glTemplateOrigin          *origins;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       cairo_set_line_width (cr, 1.0/scale);
+       cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
+
+       label_type = gl_template_get_first_label_type (template);
+
+       n_labels = gl_template_get_n_labels (label_type);
+       origins  = gl_template_get_origins (label_type);
+
+       for ( i=0; i < n_labels; i++ ) {
+
+               draw_label_outline(cr, template, origins[i].x, origins[i].y);
+
+       }
+
+       g_free (origins);
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw label outline.                                            */
+/*--------------------------------------------------------------------------*/
+static void
+draw_label_outline (cairo_t           *cr,
+                   const glTemplate  *template,
+                   gdouble            x0,
+                   gdouble            y0)
+{
+       const glTemplateLabelType *label_type;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+
+       switch (label_type->shape) {
+
+       case GL_TEMPLATE_SHAPE_RECT:
+               draw_rect_label_outline (cr, template, x0, y0);
+               break;
+
+       case GL_TEMPLATE_SHAPE_ROUND:
+               draw_round_label_outline (cr, template, x0, y0);
+               break;
+
+       case GL_TEMPLATE_SHAPE_CD:
+               draw_cd_label_outline (cr, template, x0, y0);
+               break;
+
+       default:
+               g_message ("Unknown label style");
+               break;
+       }
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw rectangular label outline.                                */
+/*--------------------------------------------------------------------------*/
+static void
+draw_rect_label_outline (cairo_t           *cr,
+                        const glTemplate  *template,
+                        gdouble            x0,
+                        gdouble            y0)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       cairo_rectangle (cr, x0, y0, w, h);
+       cairo_stroke (cr);
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw round label outline.                                      */
+/*--------------------------------------------------------------------------*/
+static void
+draw_round_label_outline (cairo_t           *cr,
+                         const glTemplate  *template,
+                         gdouble            x0,
+                         gdouble            y0)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       cairo_arc (cr, x0+w/2, y0+h/2, w/2, 0.0, 2*M_PI);
+       cairo_stroke (cr);
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw cd label outline.                                         */
+/*--------------------------------------------------------------------------*/
+static void
+draw_cd_label_outline (cairo_t           *cr,
+                      const glTemplate  *template,
+                      gdouble            x0,
+                      gdouble            y0)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+       gdouble                    xc, yc;
+       gdouble                    r1, r2;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       xc = x0 + w/2.0;
+       yc = y0 + h/2.0;
+
+       r1 = label_type->size.cd.r1;
+       r2 = label_type->size.cd.r2;
+
+       if ( w == h )
+       {
+               /* Simple CD */
+               cairo_arc (cr, xc, yc, r1, 0.0, 2*M_PI);
+               cairo_stroke (cr);
+       }
+       else
+       {
+               /* Credit Card CD (One or both dimensions trucated) */
+               gdouble theta1, theta2;
+
+               theta1 = acos (w / (2.0*r1));
+               theta2 = asin (h / (2.0*r1));
+
+               cairo_new_path (cr);
+               cairo_arc (cr, xc, yc, r1, theta1, theta2);
+               cairo_arc (cr, xc, yc, r1, M_PI-theta2, M_PI-theta1);
+               cairo_arc (cr, xc, yc, r1, M_PI+theta1, M_PI+theta2);
+               cairo_arc (cr, xc, yc, r1, 2*M_PI-theta2, 2*M_PI-theta1);
+               cairo_close_path (cr);
+               cairo_stroke (cr);
+       }
+
+       /* Hole */
+       cairo_arc (cr, xc, yc, r2, 0.0, 2*M_PI);
+       cairo_stroke (cr);
+       
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+
+
diff --git a/glabels2/src/mini-preview-pixbuf.h b/glabels2/src/mini-preview-pixbuf.h
new file mode 100644 (file)
index 0000000..84ecd24
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  mini-preview-pixbuf.h:  mini-preview pixbuf module header file
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#ifndef __MINI_PREVIEW_PIXBUF_H__
+#define __MINI_PREVIEW_PIXBUF_H__
+
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <libglabels/template.h>
+
+G_BEGIN_DECLS
+
+GdkPixbuf *gl_mini_preview_pixbuf_new (glTemplate *template,
+                                      gint        width,
+                                      gint        height);
+
+G_END_DECLS
+
+#endif
diff --git a/glabels2/src/new-label-dialog.c b/glabels2/src/new-label-dialog.c
new file mode 100644 (file)
index 0000000..0864c8a
--- /dev/null
@@ -0,0 +1,327 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  new-label-dialog.c:  New label dialog module
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+#include <config.h>
+
+#include "new-label-dialog.h"
+
+#include <glib/gi18n.h>
+#include <glade/glade-xml.h>
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkstock.h>
+
+#include "hig.h"
+#include "wdgt-media-select.h"
+#include "wdgt-rotate-label.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private data types                        */
+/*===========================================*/
+
+struct _glNewLabelDialogPrivate {
+
+        GladeXML     *gui;
+
+       GtkWidget *media_select;
+       GtkWidget *rotate_label;
+
+};
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+static GtkDialogClass* parent_class = NULL;
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void       gl_new_label_dialog_class_init      (glNewLabelDialogClass *klass);
+static void       gl_new_label_dialog_init            (glNewLabelDialog      *dlg);
+static void       gl_new_label_dialog_finalize        (GObject               *object);
+
+static void       gl_new_label_dialog_construct       (glNewLabelDialog      *dialog,
+                                                      GtkWindow             *win);
+
+static void       template_changed_cb                 (glWdgtMediaSelect     *select,
+                                                      gpointer               data);
+
+
+\f
+/*****************************************************************************/
+/* Boilerplate object stuff.                                                 */
+/*****************************************************************************/
+GType
+gl_new_label_dialog_get_type (void)
+{
+       static GType type = 0;
+
+       if (!type)
+       {
+               static const GTypeInfo info =
+               {
+                       sizeof (glNewLabelDialogClass),
+                       NULL,           /* base_init */
+                       NULL,           /* base_finalize */
+                       (GClassInitFunc) gl_new_label_dialog_class_init,
+                       NULL,           /* class_finalize */
+                       NULL,           /* class_data */
+                       sizeof (glNewLabelDialog),
+                       0,              /* n_preallocs */
+                       (GInstanceInitFunc) gl_new_label_dialog_init,
+                       NULL
+               };
+
+               type = g_type_register_static (GTK_TYPE_DIALOG,
+                                              "glNewLabelDialog", &info, 0);
+       }
+
+       return type;
+}
+
+static void
+gl_new_label_dialog_class_init (glNewLabelDialogClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       gl_debug (DEBUG_FILE, "");
+       
+       parent_class = g_type_class_peek_parent (klass);
+
+       object_class->finalize = gl_new_label_dialog_finalize;          
+}
+
+static void
+gl_new_label_dialog_init (glNewLabelDialog *dialog)
+{
+       GtkWidget *pp_button;
+
+       gl_debug (DEBUG_FILE, "START");
+
+       g_return_if_fail (GL_IS_NEW_LABEL_DIALOG (dialog));
+
+       dialog->priv = g_new0 (glNewLabelDialogPrivate, 1);
+
+       gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD2);
+
+       gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
+       gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                               NULL);
+       gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
+       gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+        dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "new-label-dialog.glade",
+                                           "new_label_dialog_vbox",
+                                           NULL);
+
+        if (!dialog->priv->gui) {
+                g_critical ("Could not open new-label-dialog.glade. gLabels may not be installed correctly!");
+                return;
+        }
+
+       gl_debug (DEBUG_FILE, "END");
+}
+
+static void 
+gl_new_label_dialog_finalize (GObject *object)
+{
+       glNewLabelDialog* dialog;
+       
+       gl_debug (DEBUG_FILE, "START");
+
+       g_return_if_fail (object != NULL);
+       
+       dialog = GL_NEW_LABEL_DIALOG (object);
+
+       g_return_if_fail (GL_IS_NEW_LABEL_DIALOG (dialog));
+       g_return_if_fail (dialog->priv != NULL);
+
+       g_free (dialog->priv);
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+
+       gl_debug (DEBUG_FILE, "END");
+
+}
+
+/*****************************************************************************/
+/* NEW object properties dialog.                                             */
+/*****************************************************************************/
+GtkWidget *
+gl_new_label_dialog_new (GtkWindow    *win)
+{
+       GtkWidget *dialog;
+
+       gl_debug (DEBUG_FILE, "");
+
+       dialog = GTK_WIDGET (g_object_new (GL_TYPE_NEW_LABEL_DIALOG, NULL));
+
+       gl_new_label_dialog_construct (GL_NEW_LABEL_DIALOG(dialog), win);
+
+       return dialog;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Construct dialog.                                              */
+/*--------------------------------------------------------------------------*/
+static void
+gl_new_label_dialog_construct (glNewLabelDialog   *dialog,
+                              GtkWindow          *win)
+{
+       GtkWidget *vbox, *media_select_vbox, *rotate_label_vbox;
+       gchar     *name;
+
+       gl_debug (DEBUG_FILE, "START");
+
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), win);
+
+        vbox = glade_xml_get_widget (dialog->priv->gui,
+                                     "new_label_dialog_vbox");
+       gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0);
+
+        media_select_vbox =
+                glade_xml_get_widget (dialog->priv->gui, "media_select_vbox");
+        rotate_label_vbox =
+                glade_xml_get_widget (dialog->priv->gui, "rotate_label_vbox");
+
+       dialog->priv->media_select = gl_wdgt_media_select_new ();
+       gtk_box_pack_start (GTK_BOX (media_select_vbox),
+                           dialog->priv->media_select, FALSE, FALSE, 0);
+
+       dialog->priv->rotate_label = gl_wdgt_rotate_label_new ();
+       gtk_box_pack_start (GTK_BOX (rotate_label_vbox),
+                           dialog->priv->rotate_label, FALSE, FALSE, 0);
+
+       /* Sync template name from media select with rotate widget. */
+       name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select));
+       gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label),
+                                               name);
+
+       g_signal_connect (G_OBJECT (dialog->priv->media_select), "changed",
+                         G_CALLBACK (template_changed_cb), dialog);
+
+       gl_debug (DEBUG_FILE, "END");
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE.  New template changed callback.                                  */
+/*---------------------------------------------------------------------------*/
+static void
+template_changed_cb (glWdgtMediaSelect *select,
+                    gpointer           data)
+{
+       glNewLabelDialog  *dialog = GL_NEW_LABEL_DIALOG (data);
+       gchar             *name;
+
+       gl_debug (DEBUG_FILE, "START");
+
+       name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (select));
+
+       gl_wdgt_rotate_label_set_template_name (GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label),
+                                               name);
+
+       gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+                                          GTK_RESPONSE_OK,
+                                          (name != NULL));
+
+       g_free (name);
+
+       gl_debug (DEBUG_FILE, "END");
+}
+
+/*****************************************************************************/
+/* Get template name.                                                        */
+/*****************************************************************************/
+gchar *
+gl_new_label_dialog_get_template_name (glNewLabelDialog *dialog)
+{
+       gchar *name;
+
+       name = gl_wdgt_media_select_get_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select));
+
+       return name;
+}
+
+/*****************************************************************************/
+/* Set template name.                                                        */
+/*****************************************************************************/
+void
+gl_new_label_dialog_set_template_name (glNewLabelDialog *dialog,
+                                      gchar            *name)
+{
+       gl_wdgt_media_select_set_name (GL_WDGT_MEDIA_SELECT (dialog->priv->media_select), name);
+}
+
+/*****************************************************************************/
+/* Get current filter parameters.                                            */
+/*****************************************************************************/
+void
+gl_new_label_dialog_get_filter_parameters (glNewLabelDialog *dialog,
+                                          gchar           **page_size_id,
+                                          gchar           **category_id)
+{
+       gl_wdgt_media_select_get_filter_parameters (
+               GL_WDGT_MEDIA_SELECT (dialog->priv->media_select),
+               page_size_id, category_id);
+}
+
+/*****************************************************************************/
+/* Set current filter parameters.                                            */
+/*****************************************************************************/
+void
+gl_new_label_dialog_set_filter_parameters (glNewLabelDialog *dialog,
+                                          const gchar      *page_size_id,
+                                          const gchar      *category_id)
+{
+       gl_wdgt_media_select_set_filter_parameters (
+               GL_WDGT_MEDIA_SELECT (dialog->priv->media_select),
+               page_size_id, category_id);
+}
+
+/*****************************************************************************/
+/* Get rotate state.                                                         */
+/*****************************************************************************/
+gboolean
+gl_new_label_dialog_get_rotate_state (glNewLabelDialog *dialog)
+{
+       return gl_wdgt_rotate_label_get_state (
+               GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label));
+}
+
+/*****************************************************************************/
+/* Set rotate state.                                                         */
+/*****************************************************************************/
+void
+gl_new_label_dialog_set_rotate_state (glNewLabelDialog *dialog,
+                                     gboolean          state)
+{
+       gl_wdgt_rotate_label_set_state (
+               GL_WDGT_ROTATE_LABEL (dialog->priv->rotate_label), state);
+}
+
diff --git a/glabels2/src/new-label-dialog.h b/glabels2/src/new-label-dialog.h
new file mode 100644 (file)
index 0000000..291c397
--- /dev/null
@@ -0,0 +1,84 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  new-label-dialog.h:  New label dialog module header file
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+#ifndef __NEW_LABEL_DIALOG_H__
+#define __NEW_LABEL_DIALOG_H__
+
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkdialog.h>
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_NEW_LABEL_DIALOG            (gl_new_label_dialog_get_type ())
+#define GL_NEW_LABEL_DIALOG(obj)            (GTK_CHECK_CAST ((obj), GL_TYPE_NEW_LABEL_DIALOG, glNewLabelDialog))
+#define GL_NEW_LABEL_DIALOG_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_NEW_LABEL_DIALOG, glNewLabelDialogClass))
+#define GL_IS_NEW_LABEL_DIALOG(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_NEW_LABEL_DIALOG))
+#define GL_IS_NEW_LABEL_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_NEW_LABEL_DIALOG))
+#define GL_NEW_LABEL_DIALOG_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_NEW_LABEL_DIALOG, glNewLabelDialogClass))
+
+
+typedef struct _glNewLabelDialog         glNewLabelDialog;
+typedef struct _glNewLabelDialogClass    glNewLabelDialogClass;
+
+typedef struct _glNewLabelDialogPrivate  glNewLabelDialogPrivate;
+
+struct _glNewLabelDialog
+{
+       GtkDialog                parent_instance;
+
+       glNewLabelDialogPrivate *priv;
+
+};
+
+struct  _glNewLabelDialogClass
+{
+       GtkDialogClass           parent_class;
+};
+
+
+GType      gl_new_label_dialog_get_type              (void) G_GNUC_CONST;
+
+GtkWidget *gl_new_label_dialog_new                   (GtkWindow     *win);
+
+gchar     *gl_new_label_dialog_get_template_name     (glNewLabelDialog *dialog);
+
+void       gl_new_label_dialog_set_template_name     (glNewLabelDialog *dialog,
+                                                     gchar            *name);
+
+void       gl_new_label_dialog_get_filter_parameters (glNewLabelDialog *dialog,
+                                                     gchar           **page_size_id,
+                                                     gchar           **category_id);
+
+void       gl_new_label_dialog_set_filter_parameters (glNewLabelDialog *dialog,
+                                                     const gchar      *page_size_id,
+                                                     const gchar      *category_id);
+
+gboolean   gl_new_label_dialog_get_rotate_state      (glNewLabelDialog *dialog);
+
+void       gl_new_label_dialog_set_rotate_state      (glNewLabelDialog *dialog,
+                                                     gboolean          state);
+
+
+G_END_DECLS
+
+#endif
index 323fc672b4d5a6508090dfe0dffc58f18141430a..1419767d3a529a41f77ca36e0f38d1ec1aadbf02 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  wdgt_media_select.c:  media selection widget module
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include "wdgt-media-select.h"
 
 #include <glib/gi18n.h>
-#include <gtk/gtklabel.h>
+#include <glade/glade-xml.h>
 #include <gtk/gtkcombobox.h>
-#include <gtk/gtksizegroup.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtkstock.h>
 #include <string.h>
 
-#include "hig.h"
-#include "wdgt-mini-preview.h"
+#include "mini-preview-pixbuf.h"
 #include "prefs.h"
 #include "util.h"
+#include "color.h"
 #include "marshal.h"
 #include <libglabels/paper.h>
+#include <libglabels/category.h>
 #include <libglabels/template.h>
 
 #include "debug.h"
 
-#define WDGT_MINI_PREVIEW_WIDTH  160
-#define WDGT_MINI_PREVIEW_HEIGHT 200
-
 /*===========================================*/
 /* Private types                             */
 /*===========================================*/
 
 enum {
-       CHANGED,
-       LAST_SIGNAL
+       NAME_COLUMN,
+       PREVIEW_COLUMN,
+       PREVIEW_COLUMN_STOCK,
+       PREVIEW_COLUMN_STOCK_SIZE,
+       DESCRIPTION_COLUMN,
+       N_COLUMNS
+};
+
+struct _glWdgtMediaSelectPrivate {
+
+        GladeXML     *gui;
+
+        GtkWidget    *page_size_combo;
+        GtkWidget    *category_combo;
+
+        GtkWidget    *template_treeview;
+        GtkListStore *template_store;
+};
+
+enum {
+        CHANGED,
+        LAST_SIGNAL
 };
 
 typedef void (*glWdgtMediaSelectSignal) (GObject * object, gpointer data);
@@ -72,18 +97,19 @@ static void gl_wdgt_media_select_finalize      (GObject                *object);
 
 static void gl_wdgt_media_select_construct     (glWdgtMediaSelect      *media_select);
 
-static void page_size_combo_changed_cb         (GtkComboBox            *combo,
-                                               gpointer                user_data);
-static void template_combo_changed_cb          (GtkComboBox            *combo,
-                                               gpointer                user_data);
-static void prefs_changed_cb                   (glPrefsModel           *gl_prefs,
-                                               gpointer                user_data);
+static void filter_changed_cb                  (GtkComboBox            *combo,
+                                                gpointer                user_data);
+static void template_selection_changed_cb      (GtkTreeSelection       *selection,
+                                                gpointer                user_data);
 
 static void details_update                     (glWdgtMediaSelect      *media_select,
-                                               gchar                  *name);
+                                                gchar                  *name);
 
 static gchar *get_layout_desc                  (const glTemplate       *template);
 static gchar *get_label_size_desc              (const glTemplate       *template);
+static void   load_list                        (GtkListStore           *store,
+                                                GtkTreeSelection       *selection,
+                                                GList                  *list);
 \f
 /****************************************************************************/
 /* Boilerplate Object stuff.                                                */
@@ -91,107 +117,107 @@ static gchar *get_label_size_desc              (const glTemplate       *template
 GType
 gl_wdgt_media_select_get_type (void)
 {
-       static GType type = 0;
-
-       if (!type) {
-               static const GTypeInfo info = {
-                       sizeof (glWdgtMediaSelectClass),
-                       NULL,
-                       NULL,
-                       (GClassInitFunc) gl_wdgt_media_select_class_init,
-                       NULL,
-                       NULL,
-                       sizeof (glWdgtMediaSelect),
-                       0,
-                       (GInstanceInitFunc) gl_wdgt_media_select_instance_init,
-                       NULL
-               };
-
-               type = g_type_register_static (GL_TYPE_HIG_VBOX,
-                                              "glWdgtMediaSelect", &info, 0);
-       }
-
-       return type;
+        static GType type = 0;
+
+        if (!type) {
+                static const GTypeInfo info = {
+                        sizeof (glWdgtMediaSelectClass),
+                        NULL,
+                        NULL,
+                        (GClassInitFunc) gl_wdgt_media_select_class_init,
+                        NULL,
+                        NULL,
+                        sizeof (glWdgtMediaSelect),
+                        0,
+                        (GInstanceInitFunc) gl_wdgt_media_select_instance_init,
+                        NULL
+                };
+
+                type = g_type_register_static (GTK_TYPE_VBOX,
+                                               "glWdgtMediaSelect", &info, 0);
+        }
+
+        return type;
 }
 
 static void
 gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class)
 {
-       GObjectClass *object_class;
+        GObjectClass *object_class;
 
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       object_class = (GObjectClass *) class;
+        object_class = (GObjectClass *) class;
 
-       parent_class = g_type_class_peek_parent (class);
+        parent_class = g_type_class_peek_parent (class);
 
-       object_class->finalize = gl_wdgt_media_select_finalize;
+        object_class->finalize = gl_wdgt_media_select_finalize;
 
-       wdgt_media_select_signals[CHANGED] =
-           g_signal_new ("changed",
-                         G_OBJECT_CLASS_TYPE(object_class),
-                         G_SIGNAL_RUN_LAST,
-                         G_STRUCT_OFFSET (glWdgtMediaSelectClass, changed),
-                         NULL, NULL,
-                         gl_marshal_VOID__VOID,
-                         G_TYPE_NONE, 0);
+        wdgt_media_select_signals[CHANGED] =
+            g_signal_new ("changed",
+                          G_OBJECT_CLASS_TYPE(object_class),
+                          G_SIGNAL_RUN_LAST,
+                          G_STRUCT_OFFSET (glWdgtMediaSelectClass, changed),
+                          NULL, NULL,
+                          gl_marshal_VOID__VOID,
+                          G_TYPE_NONE, 0);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 static void
 gl_wdgt_media_select_instance_init (glWdgtMediaSelect *media_select)
 {
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       media_select->page_size_combo = NULL;
-       media_select->template_combo = NULL;
+        media_select->priv = g_new0 (glWdgtMediaSelectPrivate, 1);
 
-       media_select->mini_preview = NULL;
+        media_select->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-media-select.glade",
+                                           "wdgt_media_select_hbox",
+                                           NULL);
 
-       media_select->desc_label = NULL;
-       media_select->sheet_size_label = NULL;
-       media_select->number_label = NULL;
-       media_select->label_size_label = NULL;
+        if (!media_select->priv->gui) {
+                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
+                return;
+        }
 
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 static void
 gl_wdgt_media_select_finalize (GObject *object)
 {
-       glWdgtMediaSelect *media_select;
-       glWdgtMediaSelectClass *class;
+        glWdgtMediaSelect *media_select;
+        glWdgtMediaSelectClass *class;
 
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       g_return_if_fail (object != NULL);
-       g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object));
+        g_return_if_fail (object != NULL);
+        g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object));
 
-       media_select = GL_WDGT_MEDIA_SELECT (object);
+        media_select = GL_WDGT_MEDIA_SELECT (object);
 
-       g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs),
-                                             prefs_changed_cb, media_select);
+        G_OBJECT_CLASS (parent_class)->finalize (object);
 
-       G_OBJECT_CLASS (parent_class)->finalize (object);
+        g_free (media_select->priv);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 GtkWidget *
 gl_wdgt_media_select_new (void)
 {
-       glWdgtMediaSelect *media_select;
+        glWdgtMediaSelect *media_select;
 
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       media_select = g_object_new (gl_wdgt_media_select_get_type (), NULL);
+        media_select = g_object_new (gl_wdgt_media_select_get_type (), NULL);
 
-       gl_wdgt_media_select_construct (media_select);
+        gl_wdgt_media_select_construct (media_select);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 
-       return GTK_WIDGET (media_select);
+        return GTK_WIDGET (media_select);
 }
 
 /*--------------------------------------------------------------------------*/
@@ -200,266 +226,163 @@ gl_wdgt_media_select_new (void)
 static void
 gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
 {
-       GtkWidget    *whbox, *wvbox, *wcombo, *wvbox1, *whbox1, *wlabel;
-       GtkSizeGroup *label_size_group;
-       gchar        *name;
-       GList        *template_names, *page_sizes = NULL;
-       const gchar  *page_size_id;
-       gchar        *page_size_name;
-
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
-
-       page_size_id = gl_prefs_get_page_size ();
-       page_size_name = gl_paper_lookup_name_from_id (page_size_id);
-
-       wvbox = GTK_WIDGET (media_select);
-
-       whbox = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
-       /* Page size selection control */
-       gl_debug (DEBUG_MEDIA_SELECT, "Creating page size combo...");
-       wcombo = gtk_combo_box_new_text ();
-       media_select->page_size_combo = wcombo;
-       page_sizes = gl_paper_get_name_list ();
-       gl_util_combo_box_set_strings (GTK_COMBO_BOX (wcombo), page_sizes);
-       gl_paper_free_name_list (page_sizes);
-       gtk_widget_set_size_request (media_select->page_size_combo, 100, -1);
-       gl_util_combo_box_set_active_text (GTK_COMBO_BOX (wcombo),
-                                          page_size_name);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo);
-
-       /* Actual selection control */
-       gl_debug (DEBUG_MEDIA_SELECT, "Creating template combo...");
-       gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = %s", page_size_name);
-       template_names = gl_template_get_name_list (page_size_id);
-       media_select->template_combo = gtk_combo_box_new_text ();
-       gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->template_combo),
-                                      template_names);
-       gtk_widget_set_size_request (media_select->template_combo, 400, -1);
-       gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->template_combo),
-                           template_names->data);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox),
-                               media_select->template_combo);
-       gl_template_free_name_list (template_names);
-
-       whbox = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
-       /* mini_preview canvas */
-       gl_debug (DEBUG_MEDIA_SELECT, "Creating mini preview...");
-       media_select->mini_preview = gl_wdgt_mini_preview_new ( WDGT_MINI_PREVIEW_HEIGHT,
-                                                          WDGT_MINI_PREVIEW_WIDTH);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox),
-                               media_select->mini_preview);
-
-       /* ---- Information area ---- */
-       wvbox1 = gl_hig_vbox_new (GL_HIG_VBOX_INNER);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wvbox1);
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-       /* blank line */
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), gtk_label_new (""));
-
-       /* Description line */
-       whbox1 = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1);
-       wlabel = gtk_label_new (_("Description:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel);
-       media_select->desc_label = gtk_label_new ("");
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), media_select->desc_label);
-
-       /* Page size line */
-       whbox1 = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1);
-       wlabel = gtk_label_new (_("Page size:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel);
-       media_select->sheet_size_label = gtk_label_new ("");
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1),
-                               media_select->sheet_size_label);
-
-       /* Label size line */
-       whbox1 = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1);
-       wlabel = gtk_label_new (_("Label size:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel);
-       media_select->label_size_label = gtk_label_new ("");
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1),
-                               media_select->label_size_label);
-
-       /* Layout line */
-       whbox1 = gl_hig_hbox_new ();
-       gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox1), whbox1);
-       wlabel = gtk_label_new (_("Layout:"));
-       gtk_size_group_add_widget (label_size_group, wlabel);
-       gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), wlabel);
-       media_select->number_label = gtk_label_new ("");
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1),
-                               media_select->number_label);
-
-       /* Update mini_preview and details from default template */
-       
-       gl_debug (DEBUG_MEDIA_SELECT, "template_combo = %p",
-                 media_select->template_combo);
-       name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->template_combo));
-       gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
-       gl_wdgt_mini_preview_set_label_by_name (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
-                                               name);
-       details_update (media_select, name);
-       g_free (name);
-
-       /* Connect signals to controls */
-       g_signal_connect (G_OBJECT (media_select->page_size_combo), "changed",
-                         G_CALLBACK (page_size_combo_changed_cb),
-                         media_select);
-       g_signal_connect (G_OBJECT (media_select->template_combo), "changed",
-                         G_CALLBACK (template_combo_changed_cb),
-                         media_select);
-       g_signal_connect (G_OBJECT (gl_prefs), "changed",
-                         G_CALLBACK (prefs_changed_cb),
-                         media_select);
-
-       g_free (page_size_name);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        GtkWidget         *hbox;
+        GtkWidget         *preview_vbox;
+        GList             *page_sizes = NULL;
+        GList             *categories = NULL;
+        GList             *template_names = NULL;
+        const gchar       *page_size_id;
+        gchar             *page_size_name;
+        gchar             *name;
+        GtkCellRenderer   *renderer;
+        GtkTreeViewColumn *column;
+        GtkTreeSelection  *selection;
+        GtkTreeIter        iter;
+        GtkTreeModel      *model;        
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (media_select));
+        g_return_if_fail (media_select->priv != NULL);
+
+        hbox = glade_xml_get_widget (media_select->priv->gui,
+                                     "wdgt_media_select_hbox");
+        gtk_container_add (GTK_CONTAINER (media_select), hbox);
+
+        media_select->priv->page_size_combo =
+                glade_xml_get_widget (media_select->priv->gui, "page_size_combo");
+        media_select->priv->category_combo =
+                glade_xml_get_widget (media_select->priv->gui, "category_combo");
+        media_select->priv->template_treeview =
+                glade_xml_get_widget (media_select->priv->gui, "template_treeview");
+
+        page_size_id = gl_prefs_get_page_size ();
+        page_size_name = gl_paper_lookup_name_from_id (page_size_id);
+
+        /* Page size selection control */
+        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (media_select->priv->page_size_combo));
+        page_sizes = gl_paper_get_name_list ();
+        page_sizes = g_list_prepend (page_sizes, g_strdup (_("Any")));
+        gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->priv->page_size_combo), page_sizes);
+        gl_paper_free_name_list (page_sizes);
+        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo),
+                                           page_size_name);
+
+        /* Category selection control */
+        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (media_select->priv->category_combo));
+        categories = gl_category_get_name_list ();
+        categories = g_list_prepend (categories, g_strdup (_("Any")));
+        gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->priv->category_combo), categories);
+        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->category_combo),
+                                           _("Any"));
+        gl_category_free_name_list (categories);
+
+        /* Actual selection control */
+        media_select->priv->template_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+        gtk_tree_view_set_model (GTK_TREE_VIEW (media_select->priv->template_treeview),
+                                 GTK_TREE_MODEL (media_select->priv->template_store));
+        renderer = gtk_cell_renderer_pixbuf_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "pixbuf", PREVIEW_COLUMN,
+                                                           "stock-id", PREVIEW_COLUMN_STOCK,
+                                                           "stock-size", PREVIEW_COLUMN_STOCK_SIZE,
+                                                           NULL);
+        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);
+        renderer = gtk_cell_renderer_text_new ();
+        column = gtk_tree_view_column_new_with_attributes ("", renderer,
+                                                           "markup", DESCRIPTION_COLUMN,
+                                                           NULL);
+        gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+        gtk_tree_view_append_column (GTK_TREE_VIEW (media_select->priv->template_treeview), column);
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview));
+        template_names = gl_template_get_name_list (page_size_id, NULL);
+        load_list (media_select->priv->template_store, selection, template_names);
+        gl_template_free_name_list (template_names);
+
+        /* Connect signals to controls */
+        g_signal_connect (G_OBJECT (media_select->priv->page_size_combo), "changed",
+                          G_CALLBACK (filter_changed_cb),
+                          media_select);
+        g_signal_connect (G_OBJECT (media_select->priv->category_combo), "changed",
+                          G_CALLBACK (filter_changed_cb),
+                          media_select);
+        g_signal_connect (G_OBJECT (selection), "changed",
+                          G_CALLBACK (template_selection_changed_cb),
+                          media_select);
+
+        g_free (page_size_name);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  modify widget due to change in selection                       */
 /*--------------------------------------------------------------------------*/
 static void
-page_size_combo_changed_cb (GtkComboBox *combo,
-                           gpointer     user_data)
+filter_changed_cb (GtkComboBox *combo,
+                   gpointer     user_data)
 {
-       glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
-       gchar             *page_size_name, *page_size_id;
-       GList             *template_names;
-
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
-
-
-       /* Update template selections for new page size */
-       page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
-       if ( strlen(page_size_name) ) {
-               gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = \"%s\"", page_size_name);
-               page_size_id = gl_paper_lookup_id_from_name (page_size_name);
-               template_names = gl_template_get_name_list (page_size_id);
-               if (template_names == NULL) {
-                       template_names = g_list_append (template_names, g_strdup(""));
-               }
-               gl_util_combo_box_set_strings (GTK_COMBO_BOX (media_select->template_combo),
-                                              template_names);
-               gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->template_combo),
-                                                  template_names->data);
-               gl_template_free_name_list (template_names);
-               g_free (page_size_id);
-       }
-       g_free (page_size_name);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
+        gchar             *page_size_name, *page_size_id;
+        gchar             *category_name, *category_id;
+        GList             *template_names;
+        GtkTreeSelection  *selection;
+        GtkTreeIter        iter;
+        GtkTreeModel      *model;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+
+        /* Update template selections for new page size */
+        page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo));
+        category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo));
+        if ( page_size_name && strlen(page_size_name) &&
+             category_name && strlen(category_name) )
+        {
+                gl_debug (DEBUG_MEDIA_SELECT, "page_size_name = \"%s\"", page_size_name);
+                gl_debug (DEBUG_MEDIA_SELECT, "category_name = \"%s\"", category_name);
+                page_size_id = gl_paper_lookup_id_from_name (page_size_name);
+                category_id = gl_category_lookup_id_from_name (category_name);
+                gl_debug (DEBUG_MEDIA_SELECT, "page_size_id = \"%s\"", page_size_id);
+                gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id);
+                template_names = gl_template_get_name_list (page_size_id, category_id);
+                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview));
+                g_signal_handlers_block_by_func (G_OBJECT (selection),
+                                                 template_selection_changed_cb,
+                                                 media_select);
+                load_list (media_select->priv->template_store, selection, template_names);
+                g_signal_handlers_unblock_by_func (G_OBJECT (selection),
+                                                   template_selection_changed_cb,
+                                                   media_select);
+                gl_template_free_name_list (template_names);
+                g_free (page_size_id);
+
+                /* Emit our "changed" signal */
+                g_signal_emit (G_OBJECT (user_data),
+                               wdgt_media_select_signals[CHANGED], 0);
+        }
+        g_free (page_size_name);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 /*--------------------------------------------------------------------------*/
 /* PRIVATE.  modify widget due to change in selection                       */
 /*--------------------------------------------------------------------------*/
 static void
-template_combo_changed_cb (GtkComboBox *combo,
-                          gpointer     user_data)
-{
-       glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
-       gchar *name;
-
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
-
-       /* Update mini_preview canvas & details with template */
-       gl_debug (DEBUG_MEDIA_SELECT, "template_combo = %p", combo);
-       name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
-       if ( strlen(name) ) {
-               gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
-               gl_wdgt_mini_preview_set_label_by_name (GL_WDGT_MINI_PREVIEW (media_select->mini_preview),
-                                                       name);
-               gl_debug (DEBUG_MEDIA_SELECT, "m1");
-               details_update (media_select, name);
-               gl_debug (DEBUG_MEDIA_SELECT, "m2");
-
-               /* Emit our "changed" signal */
-               g_signal_emit (G_OBJECT (user_data),
-                              wdgt_media_select_signals[CHANGED], 0);
-       }
-       g_free (name);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  modify widget due to change in prefs                           */
-/*--------------------------------------------------------------------------*/
-static void
-prefs_changed_cb (glPrefsModel *gl_prefs,
-                 gpointer      user_data)
-{
-       glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
-       gchar *name;
-
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
-
-       /* Update mini_preview canvas & details with template */
-       name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->template_combo));
-       if ( strlen(name) ) {
-               gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
-               details_update (media_select, name);
-       }
-       g_free (name);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. update "details" widgets from new template.               */
-/*--------------------------------------------------------------------------*/
-static void
-details_update (glWdgtMediaSelect *media_select,
-               gchar             *name)
+template_selection_changed_cb (GtkTreeSelection       *selection,
+                               gpointer                user_data)
 {
-       glTemplate *template;
-       gchar *text;
-       glUnitsType units;
-       const gchar *units_string;
-       gdouble units_per_point;
+        glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       units = gl_prefs_get_units ();
-       units_string = gl_prefs_get_units_string ();
-       units_per_point = gl_prefs_get_units_per_point ();
+        /* Emit our "changed" signal */
+        g_signal_emit (G_OBJECT (user_data),
+                       wdgt_media_select_signals[CHANGED], 0);
 
-       /* Fetch template */
-       template = gl_template_from_name (name);
-
-       gtk_label_set_text (GTK_LABEL (media_select->desc_label),
-                           template->description);
-
-       gtk_label_set_text (GTK_LABEL (media_select->sheet_size_label),
-                           template->page_size);
-
-       text = get_layout_desc (template);
-       gtk_label_set_text (GTK_LABEL (media_select->number_label), text);
-       g_free (text);
-
-       text = get_label_size_desc (template);
-       gtk_label_set_text (GTK_LABEL (media_select->label_size_label), text);
-       g_free (text);
-
-       gl_template_free (template);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 /****************************************************************************/
@@ -468,8 +391,25 @@ details_update (glWdgtMediaSelect *media_select,
 gchar *
 gl_wdgt_media_select_get_name (glWdgtMediaSelect *media_select)
 {
-       gl_debug (DEBUG_MEDIA_SELECT, "");
-       return gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->template_combo));
+        GtkTreeSelection  *selection;
+        GtkTreeIter        iter;
+        GtkTreeModel      *model;        
+        gchar             *name;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview));
+        if (gtk_tree_selection_get_mode (selection) == GTK_SELECTION_NONE)
+        {
+                name = NULL;
+        }
+        else
+        {
+                gtk_tree_selection_get_selected (selection, &model, &iter);
+                gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1);
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
+        return name;
 }
 
 /****************************************************************************/
@@ -477,57 +417,106 @@ gl_wdgt_media_select_get_name (glWdgtMediaSelect *media_select)
 /****************************************************************************/
 void
 gl_wdgt_media_select_set_name (glWdgtMediaSelect *media_select,
-                              gchar             *name)
+                               gchar             *name)
 {
-       gint pos;
-
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
-
-       gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->template_combo),
-                                          name);
-
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        GtkTreeSelection  *selection;
+        GtkTreeModel      *model;
+        GtkTreeIter        iter;
+        GtkTreePath       *path;
+        gchar             *name_i;
+        gboolean           flag;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview));
+        g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+
+        model = GTK_TREE_MODEL (media_select->priv->template_store);
+
+        for ( flag = gtk_tree_model_get_iter_first (model, &iter);
+              flag;
+              flag = gtk_tree_model_iter_next(model, &iter) )
+        {
+                gtk_tree_model_get (model, &iter, NAME_COLUMN, &name_i, -1); 
+                if (strcasecmp(name, name_i) == 0)
+                {
+                        gtk_tree_selection_select_iter (selection, &iter);
+                        path = gtk_tree_model_get_path (model, &iter);
+                        gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (media_select->priv->template_treeview),
+                                                      path,
+                                                      NULL,
+                                                      TRUE, 0.5, 0.0);
+                        gtk_tree_path_free (path);
+                        break;
+                }
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 /****************************************************************************/
-/* query selected label template page size.                                 */
+/* query current filter parameters.                                         */
 /****************************************************************************/
-gchar *
-gl_wdgt_media_select_get_page_size (glWdgtMediaSelect *media_select)
+void
+gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select,
+                                            gchar            **page_size_id,
+                                            gchar            **category_id)
 {
-       gchar *page_size_name, *page_size_id;
+        gchar *page_size_name, *category_name;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "");
+
+        g_free (*page_size_id);
+        g_free (*category_id);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "");
+        page_size_name =
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo));
 
-       page_size_name =
-               gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->page_size_combo));
+        *page_size_id = gl_paper_lookup_id_from_name (page_size_name);
 
-       page_size_id = gl_paper_lookup_id_from_name (page_size_name);
+        category_name =
+                gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo));
 
-       g_free (page_size_name);
+        *category_id = gl_category_lookup_id_from_name (category_name);
 
-       return page_size_id;
+        g_free (page_size_name);
+        g_free (category_name);
 }
 
 /****************************************************************************/
-/* set selected label template page size.                                   */
+/* set filter parameters.                                                   */
 /****************************************************************************/
 void
-gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select,
-                                   gchar             *page_size_id)
+gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select,
+                                            const gchar       *page_size_id,
+                                            const gchar       *category_id)
 {
-       gint   pos;
-       gchar *page_size_name;
+        gchar *page_size_name;
+        gchar *category_name;
 
-       gl_debug (DEBUG_MEDIA_SELECT, "START");
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
 
-       page_size_name = gl_paper_lookup_name_from_id (page_size_id);
+        page_size_name = gl_paper_lookup_name_from_id (page_size_id);
+        if (page_size_name == NULL)
+        {
+                page_size_name = g_strdup (_("Any"));
+        }
 
-       gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->page_size_combo),
-                                          page_size_name);
-       g_free (page_size_name);
+        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo),
+                                           page_size_name);
 
-       gl_debug (DEBUG_MEDIA_SELECT, "END");
+        category_name = gl_category_lookup_name_from_id (category_id);
+        if (category_name == NULL)
+        {
+                category_name = g_strdup (_("Any"));
+        }
+
+        gl_util_combo_box_set_active_text (GTK_COMBO_BOX (media_select->priv->category_combo),
+                                           category_name);
+        g_free (page_size_name);
+        g_free (category_name);
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
 /*--------------------------------------------------------------------------*/
@@ -536,26 +525,18 @@ gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select,
 static gchar *
 get_layout_desc (const glTemplate *template)
 {
-       const glTemplateLabelType *label_type;
-       gint                       n_labels;
-       glTemplateLayout          *layout;
-       gchar                     *string;
-
-       label_type = gl_template_get_first_label_type (template);
-
-       n_labels = gl_template_get_n_labels (label_type);
-
-       if ( label_type->layouts->next == NULL ) {
-               layout = (glTemplateLayout *)label_type->layouts->data;
-               string = g_strdup_printf (_("%d x %d  (%d per sheet)"),
-                                         layout->nx, layout->ny,
-                                         n_labels);
-       } else {
-               string = g_strdup_printf (_("%d per sheet"),
-                                         n_labels);
-       }
-
-       return string;
+        const glTemplateLabelType *label_type;
+        gint                       n_labels;
+        glTemplateLayout          *layout;
+        gchar                     *string;
+
+        label_type = gl_template_get_first_label_type (template);
+
+        n_labels = gl_template_get_n_labels (label_type);
+
+        string = g_strdup_printf (_("%d per sheet"), n_labels);
+
+        return string;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -564,68 +545,148 @@ get_layout_desc (const glTemplate *template)
 static gchar *
 get_label_size_desc (const glTemplate *template)
 {
-       glUnitsType                units;
-       const gchar               *units_string;
-       gdouble                    units_per_point;
-       const glTemplateLabelType *label_type;
-       gchar                     *string = NULL;
-
-       units           = gl_prefs_get_units ();
-       units_string    = gl_prefs_get_units_string ();
-       units_per_point = gl_prefs_get_units_per_point ();
-
-       label_type = gl_template_get_first_label_type (template);
-
-       switch (label_type->shape) {
-       case GL_TEMPLATE_SHAPE_RECT:
-               if ( units == GL_UNITS_INCH ) {
-                       gchar *xstr, *ystr;
-
-                       xstr = gl_util_fraction (label_type->size.rect.w*units_per_point);
-                       ystr = gl_util_fraction (label_type->size.rect.h*units_per_point);
-                       string = g_strdup_printf (_("%s x %s %s"),
-                                                 xstr, ystr, units_string);
-                       g_free (xstr);
-                       g_free (ystr);
-               } else {
-                       string = g_strdup_printf (_("%.5g x %.5g %s"),
-                                                 label_type->size.rect.w*units_per_point,
-                                                 label_type->size.rect.h*units_per_point,
-                                                 units_string);
-               }
-               break;
-       case GL_TEMPLATE_SHAPE_ROUND:
-               if ( units == GL_UNITS_INCH ) {
-                       gchar *dstr;
-
-                       dstr = gl_util_fraction (2.0*label_type->size.round.r*units_per_point);
-                       string = g_strdup_printf (_("%s %s diameter"),
-                                                 dstr, units_string);
-                       g_free (dstr);
-               } else {
-                       string = g_strdup_printf (_("%.5g %s diameter"),
-                                                 2.0*label_type->size.round.r*units_per_point,
-                                                 units_string);
-               }
-               break;
-       case GL_TEMPLATE_SHAPE_CD:
-               if ( units == GL_UNITS_INCH ) {
-                       gchar *dstr;
-
-                       dstr = gl_util_fraction (2.0*label_type->size.cd.r1*units_per_point);
-                       string = g_strdup_printf (_("%s %s diameter"),
-                                                 dstr, units_string);
-                       g_free (dstr);
-               } else {
-                       string = g_strdup_printf (_("%.5g %s diameter"),
-                                                 2.0*label_type->size.cd.r1*units_per_point,
-                                                 units_string);
-               }
-               break;
-       default:
-               break;
-       }
-
-       return string;
+        glUnitsType                units;
+        const gchar               *units_string;
+        gdouble                    units_per_point;
+        const glTemplateLabelType *label_type;
+        gchar                     *string = NULL;
+
+        units           = gl_prefs_get_units ();
+        units_string    = gl_prefs_get_units_string ();
+        units_per_point = gl_prefs_get_units_per_point ();
+
+        label_type = gl_template_get_first_label_type (template);
+
+        switch (label_type->shape) {
+        case GL_TEMPLATE_SHAPE_RECT:
+                if ( units == GL_UNITS_INCH ) {
+                        gchar *xstr, *ystr;
+
+                        xstr = gl_util_fraction (label_type->size.rect.w*units_per_point);
+                        ystr = gl_util_fraction (label_type->size.rect.h*units_per_point);
+                        string = g_strdup_printf (_("%s x %s %s"),
+                                                  xstr, ystr, units_string);
+                        g_free (xstr);
+                        g_free (ystr);
+                } else {
+                        string = g_strdup_printf (_("%.5g x %.5g %s"),
+                                                  label_type->size.rect.w*units_per_point,
+                                                  label_type->size.rect.h*units_per_point,
+                                                  units_string);
+                }
+                break;
+        case GL_TEMPLATE_SHAPE_ROUND:
+                if ( units == GL_UNITS_INCH ) {
+                        gchar *dstr;
+
+                        dstr = gl_util_fraction (2.0*label_type->size.round.r*units_per_point);
+                        string = g_strdup_printf (_("%s %s diameter"),
+                                                  dstr, units_string);
+                        g_free (dstr);
+                } else {
+                        string = g_strdup_printf (_("%.5g %s diameter"),
+                                                  2.0*label_type->size.round.r*units_per_point,
+                                                  units_string);
+                }
+                break;
+        case GL_TEMPLATE_SHAPE_CD:
+                if ( units == GL_UNITS_INCH ) {
+                        gchar *dstr;
+
+                        dstr = gl_util_fraction (2.0*label_type->size.cd.r1*units_per_point);
+                        string = g_strdup_printf (_("%s %s diameter"),
+                                                  dstr, units_string);
+                        g_free (dstr);
+                } else {
+                        string = g_strdup_printf (_("%.5g %s diameter"),
+                                                  2.0*label_type->size.cd.r1*units_per_point,
+                                                  units_string);
+                }
+                break;
+        default:
+                break;
+        }
+
+        return string;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Load list store from template name list.                       */
+/*--------------------------------------------------------------------------*/
+static void
+load_list (GtkListStore           *store,
+           GtkTreeSelection       *selection,
+           GList                  *list)
+{
+        GList       *p;
+        GtkTreeIter  iter;
+        glTemplate  *template;
+        GdkPixbuf   *pixbuf;
+        gchar       *size;
+        gchar       *layout;
+        gchar       *description;
+
+        gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+        gtk_list_store_clear (store);
+
+        if (list)
+        {
+
+                for ( p=list; p!=NULL; p=p->next )
+                {
+
+                        gl_debug (DEBUG_MEDIA_SELECT, "p->data = \"%s\"", p->data);
+
+                        template = gl_template_from_name (p->data);
+
+                        pixbuf = gl_mini_preview_pixbuf_new (template, 64, 64);
+
+                        size = get_label_size_desc (template);
+                        layout = get_layout_desc (template);
+                        description = g_strdup_printf ("<b>%s</b>\n%s\n%s",
+                                                       p->data,
+                                                       size,
+                                                       layout);
+                        g_free (size);
+                        g_free (layout);
+
+                        gl_template_free (template);
+
+                        gtk_list_store_append (store, &iter);
+                        gtk_list_store_set (store, &iter,
+                                            NAME_COLUMN, p->data,
+                                            PREVIEW_COLUMN, pixbuf,
+                                            DESCRIPTION_COLUMN, description,
+                                            -1);
+
+                        g_object_unref (G_OBJECT (pixbuf));
+                        g_free (description);
+                }
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+                gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
+                gtk_tree_selection_select_iter (selection, &iter);
+
+        }
+        else
+        {
+                gchar *text = g_strdup_printf ("<span weight=\"bold\" size=\"larger\">%s</span>\n%s",
+                                               _("No match."),
+                                               _("Try selecting a different page size or category."));
+                gtk_list_store_append (store, &iter);
+                gtk_list_store_set (store, &iter,
+                                    NAME_COLUMN, "empty",
+                                    PREVIEW_COLUMN_STOCK, GTK_STOCK_DIALOG_WARNING,
+                                    PREVIEW_COLUMN_STOCK_SIZE, GTK_ICON_SIZE_DIALOG,
+                                    DESCRIPTION_COLUMN, text,
+                                    -1);
+                g_free (text);
+
+                gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
+
+        }
+
+        gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
index feee1d0cf26b3289e2a8a123ff8ce9eef260e07a..c8e95fce283df1096ac63efea1ca1cf6fc14d376 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  wdgt_media_select.h:  media selection widget module header file
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -23,7 +25,7 @@
 #ifndef __WDGT_MEDIA_SELECT_H__
 #define __WDGT_MEDIA_SELECT_H__
 
-#include "hig.h"
+#include <gtk/gtkvbox.h>
 
 G_BEGIN_DECLS
 
@@ -37,27 +39,21 @@ G_BEGIN_DECLS
 #define GL_IS_WDGT_MEDIA_SELECT_CLASS(klass) \
         (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_MEDIA_SELECT))
 
-typedef struct _glWdgtMediaSelect      glWdgtMediaSelect;
-typedef struct _glWdgtMediaSelectClass glWdgtMediaSelectClass;
-
-struct _glWdgtMediaSelect {
-       glHigVBox  parent_widget;
+typedef struct _glWdgtMediaSelect         glWdgtMediaSelect;
+typedef struct _glWdgtMediaSelectClass    glWdgtMediaSelectClass;
 
-       GtkWidget *page_size_combo;
-       GtkWidget *template_combo;
+typedef struct _glWdgtMediaSelectPrivate  glWdgtMediaSelectPrivate;
 
-       GtkWidget *mini_preview;
+struct _glWdgtMediaSelect {
+        GtkVBox                    parent_widget;
 
-       GtkWidget *desc_label;
-       GtkWidget *sheet_size_label;
-       GtkWidget *number_label;
-       GtkWidget *label_size_label;
+        glWdgtMediaSelectPrivate  *priv;
 };
 
 struct _glWdgtMediaSelectClass {
-       glHigVBoxClass parent_class;
+        GtkVBoxClass               parent_class;
 
-       void (*changed) (glWdgtMediaSelect * media_select, gpointer user_data);
+        void (*changed) (glWdgtMediaSelect * media_select, gpointer user_data);
 };
 
 GType      gl_wdgt_media_select_get_type      (void) G_GNUC_CONST;
@@ -67,12 +63,15 @@ GtkWidget *gl_wdgt_media_select_new           (void);
 gchar     *gl_wdgt_media_select_get_name      (glWdgtMediaSelect *media_select);
 
 void       gl_wdgt_media_select_set_name      (glWdgtMediaSelect *media_select,
-                                              gchar             *name);
+                                               gchar             *name);
 
-gchar     *gl_wdgt_media_select_get_page_size (glWdgtMediaSelect *media_select);
+void       gl_wdgt_media_select_get_filter_parameters (glWdgtMediaSelect *media_select,
+                                                       gchar            **page_size_id,
+                                                       gchar            **category_id);
 
-void       gl_wdgt_media_select_set_page_size (glWdgtMediaSelect *media_select,
-                                              gchar             *page_size_id);
+void       gl_wdgt_media_select_set_filter_parameters (glWdgtMediaSelect *media_select,
+                                                       const gchar       *page_size_id,
+                                                       const gchar       *category_id);
 
 G_END_DECLS
 
index 58a663b5a93b1237c39cb051fca83fa892522bbb..afd0027b4a33d7b4b90b2c4662bc606f80c23f75 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  wdgt_rotate_label.c:  label rotate selection widget module
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include "wdgt-rotate-label.h"
 
 #include <glib/gi18n.h>
+#include <glade/glade-xml.h>
 #include <gtk/gtktogglebutton.h>
 #include <gtk/gtkcheckbutton.h>
-#include <libgnomecanvas/gnome-canvas-util.h>
+#include <gtk/gtkdrawingarea.h>
 #include <math.h>
 
-#include "hig.h"
 #include "marshal.h"
 #include "color.h"
 #include <libglabels/template.h>
 
 #define LINE_COLOR             GL_COLOR(0,0,0)
 #define FILL_COLOR             GL_COLOR(255,255,255)
-#define UNSENSITIVE_LINE_COLOR GL_COLOR(0x66,0x66,0x66)
-#define UNSENSITIVE_FILL_COLOR GL_COLOR(0xCC,0xCC,0xCC)
-
-#define RES 5 /* Resolution in degrees for Business Card CD outlines */
 
 /*===========================================*/
 /* Private types                             */
 /*===========================================*/
 
+struct _glWdgtRotateLabelPrivate {
+
+        GladeXML     *gui;
+
+        GtkWidget    *rotate_check;
+        GtkWidget    *rotate_drawingarea;
+
+       glTemplate   *template;
+};
+
 enum {
        CHANGED,
        LAST_SIGNAL
@@ -74,27 +82,38 @@ static gint wdgt_rotate_label_signals[LAST_SIGNAL] = { 0 };
 /*===========================================*/
 
 static void gl_wdgt_rotate_label_class_init    (glWdgtRotateLabelClass *class);
-static void gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel      *rotate_select);
+static void gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel      *rotate_label);
 static void gl_wdgt_rotate_label_finalize      (GObject                *object);
 
-static void gl_wdgt_rotate_label_construct     (glWdgtRotateLabel      *rotate_select);
+static void gl_wdgt_rotate_label_construct     (glWdgtRotateLabel      *rotate_label);
+
+static void entry_changed_cb                   (GtkToggleButton        *toggle,
+                                               gpointer                user_data);
 
-static void entry_changed_cb                   (GtkToggleButton *toggle,
-                                               gpointer         user_data);
+static void drawingarea_update                 (GtkDrawingArea         *drawing_area,
+                                               glTemplate             *template,
+                                               gboolean                rotate_flag);
 
-static GtkWidget *mini_preview_canvas_new      (void);
+static void draw_rect_label_outline            (cairo_t                *cr,
+                                               const glTemplate       *template,
+                                               guint                   line_color,
+                                               guint                   fill_color);
 
-static void mini_preview_canvas_update         (GnomeCanvas      *canvas,
-                                               glTemplate       *template,
-                                               gboolean          rotate_flag);
+static void draw_round_label_outline           (cairo_t                *cr,
+                                               const glTemplate       *template,
+                                               guint                   line_color,
+                                               guint                   fill_color);
+
+
+static void draw_cd_label_outline              (cairo_t                *cr,
+                                               const glTemplate       *template,
+                                               guint                   line_color,
+                                               guint                   fill_color);
+
+static gboolean expose_cb                      (GtkWidget              *drawingarea,
+                                               GdkEventExpose         *event,
+                                               gpointer                user_data);
 
-static GnomeCanvasItem *cdbc_item              (GnomeCanvasGroup *group,
-                                               gdouble           w,
-                                               gdouble           h,
-                                               gdouble           r,
-                                               guint             line_width,
-                                               guint             line_color,
-                                               guint             fill_color);
 
 /****************************************************************************/
 /* Boilerplate Object stuff.                                                */
@@ -118,7 +137,7 @@ gl_wdgt_rotate_label_get_type (void)
                        NULL
                };
 
-               type = g_type_register_static (GL_TYPE_HIG_HBOX,
+               type = g_type_register_static (GTK_TYPE_VBOX,
                                               "glWdgtRotateLabel", &info, 0);
        }
 
@@ -148,69 +167,83 @@ gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass *class)
 }
 
 static void
-gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel *rotate_select)
+gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel *rotate_label)
 {
-       rotate_select->rotate_check = NULL;
+        rotate_label->priv = g_new0 (glWdgtRotateLabelPrivate, 1);
 
-       rotate_select->canvas = NULL;
+        rotate_label->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-rotate-label.glade",
+                                           "rotate_hbox",
+                                           NULL);
 
-       rotate_select->template = NULL;
+        if (!rotate_label->priv->gui) {
+                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
+                return;
+        }
 }
 
 static void
 gl_wdgt_rotate_label_finalize (GObject *object)
 {
-       glWdgtRotateLabel      *rotate_select;
+       glWdgtRotateLabel      *rotate_label;
        glWdgtRotateLabelClass *class;
 
        g_return_if_fail (object != NULL);
        g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object));
 
-       rotate_select = GL_WDGT_ROTATE_LABEL (object);
+       rotate_label = GL_WDGT_ROTATE_LABEL (object);
 
-       if (rotate_select->template) {
-               gl_template_free (rotate_select->template);
-               rotate_select->template = NULL;
+       if (rotate_label->priv->template) {
+               gl_template_free (rotate_label->priv->template);
+               rotate_label->priv->template = NULL;
        }
 
+       g_free (rotate_label->priv);
+
        G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 GtkWidget *
 gl_wdgt_rotate_label_new (void)
 {
-       glWdgtRotateLabel *rotate_select;
+       glWdgtRotateLabel *rotate_label;
 
-       rotate_select = g_object_new (gl_wdgt_rotate_label_get_type (), NULL);
+       rotate_label = g_object_new (gl_wdgt_rotate_label_get_type (), NULL);
 
-       gl_wdgt_rotate_label_construct (rotate_select);
+       gl_wdgt_rotate_label_construct (rotate_label);
 
-       return GTK_WIDGET (rotate_select);
+       return GTK_WIDGET (rotate_label);
 }
 
 /*--------------------------------------------------------------------------*/
 /* Construct composite widget.                                              */
 /*--------------------------------------------------------------------------*/
 static void
-gl_wdgt_rotate_label_construct (glWdgtRotateLabel *rotate_select)
+gl_wdgt_rotate_label_construct (glWdgtRotateLabel *rotate_label)
 {
-       GtkWidget *whbox;
+       GtkWidget *hbox;
 
-       whbox = GTK_WIDGET (rotate_select);
+        g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (rotate_label));
+        g_return_if_fail (rotate_label->priv != NULL);
 
-       /* Actual selection control */
-       rotate_select->rotate_check =
-           gtk_check_button_new_with_label (_("Rotate"));
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox),
-                               rotate_select->rotate_check);
+        hbox = glade_xml_get_widget (rotate_label->priv->gui, "rotate_hbox");
+        gtk_container_add (GTK_CONTAINER (rotate_label), hbox);
 
-       /* mini_preview canvas */
-       rotate_select->canvas = mini_preview_canvas_new ();
-       gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), rotate_select->canvas);
+        rotate_label->priv->rotate_check =
+                glade_xml_get_widget (rotate_label->priv->gui, "rotate_check");
+        rotate_label->priv->rotate_drawingarea =
+                glade_xml_get_widget (rotate_label->priv->gui, "rotate_drawingarea");
+
+       gtk_widget_set_size_request (rotate_label->priv->rotate_drawingarea,
+                                     MINI_PREVIEW_CANVAS_PIXELS,
+                                     MINI_PREVIEW_CANVAS_PIXELS);
 
        /* Connect signals to controls */
-       g_signal_connect (G_OBJECT (rotate_select->rotate_check), "toggled",
-                         G_CALLBACK (entry_changed_cb), rotate_select);
+       g_signal_connect (G_OBJECT (rotate_label->priv->rotate_check),
+                         "toggled",
+                         G_CALLBACK (entry_changed_cb), rotate_label);
+       g_signal_connect (G_OBJECT (rotate_label->priv->rotate_drawingarea),
+                         "expose_event",
+                         G_CALLBACK (expose_cb), rotate_label);
 }
 
 /*--------------------------------------------------------------------------*/
@@ -220,15 +253,13 @@ static void
 entry_changed_cb (GtkToggleButton *toggle,
                  gpointer         user_data)
 {
-       glWdgtRotateLabel *rotate_select = GL_WDGT_ROTATE_LABEL (user_data);
+       glWdgtRotateLabel *rotate_label = GL_WDGT_ROTATE_LABEL (user_data);
 
-       if (rotate_select->template != NULL) {
+       if (rotate_label->priv->template != NULL) {
                /* Update mini_preview canvas & details with template */
-               mini_preview_canvas_update (GNOME_CANVAS
-                                           (rotate_select->canvas),
-                                           rotate_select->template,
-                                           gtk_toggle_button_get_active
-                                           (toggle));
+               drawingarea_update (GTK_DRAWING_AREA (rotate_label->priv->rotate_drawingarea),
+                                   rotate_label->priv->template,
+                                   gtk_toggle_button_get_active (toggle));
        }
 
        /* Emit our "changed" signal */
@@ -238,270 +269,299 @@ entry_changed_cb (GtkToggleButton *toggle,
 }
 
 /*--------------------------------------------------------------------------*/
-/* PRIVATE.  Draw a mini-preview canvas.                                    */
-/*--------------------------------------------------------------------------*/
-static GtkWidget *
-mini_preview_canvas_new (void)
-{
-       GtkWidget *wcanvas = NULL;
-
-       /* Create a canvas */
-       gtk_widget_push_colormap (gdk_rgb_get_colormap ());
-       wcanvas = gnome_canvas_new_aa ();
-       gtk_widget_pop_colormap ();
-
-       gtk_widget_set_size_request (GTK_WIDGET (wcanvas),
-                                    MINI_PREVIEW_CANVAS_PIXELS,
-                                    MINI_PREVIEW_CANVAS_PIXELS);
-
-       gtk_object_set_data (GTK_OBJECT (wcanvas), "label_item", NULL);
-
-       return wcanvas;
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  Update mini-preview canvas from new template.                  */
+/* PRIVATE.  Update mini-preview from template           .                  */
 /*--------------------------------------------------------------------------*/
 static void
-mini_preview_canvas_update (GnomeCanvas *canvas,
-                           glTemplate  *template,
-                           gboolean     rotate_flag)
+drawingarea_update (GtkDrawingArea *drawing_area,
+                   glTemplate     *template,
+                   gboolean        rotate_flag)
 {
        const glTemplateLabelType *label_type;
-       gdouble                    canvas_scale;
-       GnomeCanvasGroup          *group = NULL;
-       GnomeCanvasItem           *label_item = NULL;
-       gdouble                    m, m_canvas, w, h;
+       gdouble                    m, m_canvas, w, h, scale;
+       GtkStyle                  *style;
        guint                      line_color, fill_color;
+       cairo_t                   *cr;
 
-       /* Fetch our data from canvas */
-       label_item = g_object_get_data (G_OBJECT (canvas), "label_item");
+       if (!GTK_WIDGET_DRAWABLE (GTK_WIDGET (drawing_area)))
+       {
+               return;
+       }
+
+        /* Clear surface */
+       gdk_window_clear (GTK_WIDGET (drawing_area)->window);
+
+       if (template == NULL)
+       {
+               return;
+       }
 
        label_type = gl_template_get_first_label_type (template);
 
        gl_template_get_label_size (label_type, &w, &h);
        m = MAX (w, h);
-       canvas_scale = MINI_PREVIEW_MAX_PIXELS / m;
-       m_canvas = MINI_PREVIEW_CANVAS_PIXELS / canvas_scale;
-
-       /* scale and size canvas */
-       gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (canvas), canvas_scale);
-       group = gnome_canvas_root (GNOME_CANVAS (canvas));
-       gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas),
-                                       -m_canvas / 2.0, -m_canvas / 2.0,
-                                       +m_canvas / 2.0, +m_canvas / 2.0);
-
-       /* remove old label outline */
-       if (label_item != NULL) {
-               gtk_object_destroy (GTK_OBJECT (label_item));
-       }
+       scale = MINI_PREVIEW_MAX_PIXELS / m;
+       m_canvas = MINI_PREVIEW_CANVAS_PIXELS / scale;
 
        /* Adjust sensitivity (should the canvas be grayed?) */
        if (w != h) {
                line_color = LINE_COLOR;
                fill_color = FILL_COLOR;
        } else {
-               line_color = UNSENSITIVE_LINE_COLOR;
-               fill_color = UNSENSITIVE_FILL_COLOR;
+               style = gtk_widget_get_style (GTK_WIDGET (drawing_area));
+               line_color = gl_color_from_gdk_color (&style->text[GTK_STATE_INSENSITIVE]);
+               fill_color = gl_color_from_gdk_color (&style->base[GTK_STATE_INSENSITIVE]);
        }
 
-       /* draw mini label outline */
+       cr = gdk_cairo_create (GTK_WIDGET (drawing_area)->window);
+  
+       cairo_identity_matrix (cr);
+       cairo_translate (cr, MINI_PREVIEW_CANVAS_PIXELS/2, MINI_PREVIEW_CANVAS_PIXELS/2);
+        cairo_scale (cr, scale, scale);
+       if (rotate_flag)
+       {
+               cairo_rotate (cr, M_PI/2.0);
+       }
+
+       cairo_set_line_width (cr, 1.0/scale);
+
        switch (label_type->shape) {
+
        case GL_TEMPLATE_SHAPE_RECT:
-               label_item = gnome_canvas_item_new (group,
-                                                   gnome_canvas_rect_get_type(),
-                                                   "x1", -w / 2.0,
-                                                   "y1", -h / 2.0,
-                                                   "x2", +w / 2.0,
-                                                   "y2", +h / 2.0,
-                                                   "width_pixels", 1,
-                                                   "outline_color_rgba", line_color,
-                                                   "fill_color_rgba", fill_color,
-                                                   NULL);
+               draw_rect_label_outline (cr, template, line_color, fill_color);
                break;
+
        case GL_TEMPLATE_SHAPE_ROUND:
-               label_item = gnome_canvas_item_new (group,
-                                                   gnome_canvas_ellipse_get_type(),
-                                                   "x1", -w / 2.0,
-                                                   "y1", -h / 2.0,
-                                                   "x2", +w / 2.0,
-                                                   "y2", +h / 2.0,
-                                                   "width_pixels", 1,
-                                                   "outline_color_rgba", line_color,
-                                                   "fill_color_rgba", fill_color,
-                                                   NULL);
+               draw_round_label_outline (cr, template, line_color, fill_color);
                break;
+
        case GL_TEMPLATE_SHAPE_CD:
-               if ( w == h ) {
-                       label_item = gnome_canvas_item_new (group,
-                                                           gnome_canvas_ellipse_get_type(),
-                                                           "x1", -w / 2.0,
-                                                           "y1", -h / 2.0,
-                                                           "x2", +w / 2.0,
-                                                           "y2", +h / 2.0,
-                                                           "width_pixels", 1,
-                                                           "outline_color_rgba", line_color,
-                                                           "fill_color_rgba", fill_color,
-                                                           NULL);
-               } else {
-                       label_item = cdbc_item (group,
-                                               w, h, label_type->size.cd.r1,
-                                               1, line_color, fill_color);
-               }
+               draw_cd_label_outline (cr, template, line_color, fill_color);
                break;
+
        default:
                g_message ("Unknown label style");
                break;
        }
 
-       if (rotate_flag) {
-               gdouble affine[6];
+       cairo_destroy (cr);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw rectangular label outline.                                */
+/*--------------------------------------------------------------------------*/
+static void
+draw_rect_label_outline (cairo_t           *cr,
+                        const glTemplate  *template,
+                        guint              line_color,
+                        guint              fill_color)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       cairo_rectangle (cr, -w/2.0, -h/2.0, w, h);
+
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(fill_color),
+                             GL_COLOR_F_GREEN(fill_color),
+                             GL_COLOR_F_BLUE(fill_color));
+       cairo_fill_preserve (cr);
+
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(line_color),
+                             GL_COLOR_F_GREEN(line_color),
+                             GL_COLOR_F_BLUE(line_color));
+       cairo_stroke (cr);
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw round label outline.                                      */
+/*--------------------------------------------------------------------------*/
+static void
+draw_round_label_outline (cairo_t           *cr,
+                         const glTemplate  *template,
+                         guint              line_color,
+                         guint              fill_color)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
 
-               art_affine_rotate (affine, 90);
-               gnome_canvas_item_affine_absolute (label_item, affine);
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       cairo_arc (cr, 0.0, 0.0, w/2, 0.0, 2*M_PI);
+
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(fill_color),
+                             GL_COLOR_F_GREEN(fill_color),
+                             GL_COLOR_F_BLUE(fill_color));
+       cairo_fill_preserve (cr);
+
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(line_color),
+                             GL_COLOR_F_GREEN(line_color),
+                             GL_COLOR_F_BLUE(line_color));
+       cairo_stroke (cr);
+
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw cd label outline.                                         */
+/*--------------------------------------------------------------------------*/
+static void
+draw_cd_label_outline (cairo_t           *cr,
+                      const glTemplate  *template,
+                      guint              line_color,
+                      guint              fill_color)
+{
+       const glTemplateLabelType *label_type;
+       gdouble                    w, h;
+       gdouble                    r1, r2;
+
+       gl_debug (DEBUG_MINI_PREVIEW, "START");
+
+       cairo_save (cr);
+
+       label_type = gl_template_get_first_label_type (template);
+       gl_template_get_label_size (label_type, &w, &h);
+
+       r1 = label_type->size.cd.r1;
+       r2 = label_type->size.cd.r2;
+
+       if ( w == h )
+       {
+               /* Simple CD */
+               cairo_arc (cr, 0.0, 0.0, r1, 0.0, 2*M_PI);
+       }
+       else
+       {
+               /* Credit Card CD (One or both dimensions trucated) */
+               gdouble theta1, theta2;
+
+               theta1 = acos (w / (2.0*r1));
+               theta2 = asin (h / (2.0*r1));
+
+               cairo_new_path (cr);
+               cairo_arc (cr, 0.0, 0.0, r1, theta1, theta2);
+               cairo_arc (cr, 0.0, 0.0, r1, M_PI-theta2, M_PI-theta1);
+               cairo_arc (cr, 0.0, 0.0, r1, M_PI+theta1, M_PI+theta2);
+               cairo_arc (cr, 0.0, 0.0, r1, 2*M_PI-theta2, 2*M_PI-theta1);
+               cairo_close_path (cr);
        }
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(fill_color),
+                             GL_COLOR_F_GREEN(fill_color),
+                             GL_COLOR_F_BLUE(fill_color));
+       cairo_fill_preserve (cr);
+
+       cairo_set_source_rgb (cr,
+                             GL_COLOR_F_RED(line_color),
+                             GL_COLOR_F_GREEN(line_color),
+                             GL_COLOR_F_BLUE(line_color));
+       cairo_stroke (cr);
+
+       /* Hole */
+       cairo_arc (cr, 0.0, 0.0, r2, 0.0, 2*M_PI);
+       cairo_stroke (cr);
+       
+       cairo_restore (cr);
+
+       gl_debug (DEBUG_MINI_PREVIEW, "END");
+}
 
-       gtk_object_set_data (GTK_OBJECT (canvas), "label_item", label_item);
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Draw cd label outline.                                         */
+/*--------------------------------------------------------------------------*/
+static gboolean
+expose_cb (GtkWidget *drawingarea, GdkEventExpose *event, gpointer user_data)
+{
+       glWdgtRotateLabel *rotate_label = GL_WDGT_ROTATE_LABEL (user_data);
 
+       drawingarea_update (GTK_DRAWING_AREA (drawingarea),
+                           rotate_label->priv->template,
+                           gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rotate_label->priv->rotate_check)));
+
+       return FALSE;
 }
 
 /****************************************************************************/
 /* query state of widget.                                                   */
 /****************************************************************************/
 gboolean
-gl_wdgt_rotate_label_get_state (glWdgtRotateLabel *rotate_select)
+gl_wdgt_rotate_label_get_state (glWdgtRotateLabel *rotate_label)
 {
        return
            gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-                                         (rotate_select->rotate_check));
+                                         (rotate_label->priv->rotate_check));
 }
 
 /****************************************************************************/
 /* set state of widget.                                                     */
 /****************************************************************************/
 void
-gl_wdgt_rotate_label_set_state (glWdgtRotateLabel *rotate_select,
+gl_wdgt_rotate_label_set_state (glWdgtRotateLabel *rotate_label,
                                gboolean state)
 {
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                     (rotate_select->rotate_check), state);
+                                     (rotate_label->priv->rotate_check), state);
 }
 
 /****************************************************************************/
 /* set template for widget.                                                 */
 /****************************************************************************/
 void
-gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_select,
+gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label,
                                        gchar             *name)
 {
        glTemplate                *template;
        const glTemplateLabelType *label_type;
        gdouble                    raw_w, raw_h;
 
-       template   = gl_template_from_name (name);
-       label_type = gl_template_get_first_label_type (template);
-
-       rotate_select->template = template;
-       gl_template_get_label_size (label_type, &raw_w, &raw_h);
+       if (name == NULL)
+       {
+               rotate_label->priv->template = NULL;
 
-       gtk_widget_set_sensitive (rotate_select->rotate_check,
-                                 (raw_w != raw_h));
+               gtk_widget_set_sensitive (rotate_label->priv->rotate_check,
+                                         FALSE);
 
-       mini_preview_canvas_update (GNOME_CANVAS (rotate_select->canvas),
-                                   template, FALSE);
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-                                     (rotate_select->rotate_check), FALSE);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  Draw CD business card item (cut-off in w and/or h).            */
-/*--------------------------------------------------------------------------*/
-static GnomeCanvasItem *
-cdbc_item (GnomeCanvasGroup *group,
-          gdouble           w,
-          gdouble           h,
-          gdouble           r,
-          guint             line_width,
-          guint             line_color,
-          guint             fill_color)
-{
-       GnomeCanvasPoints         *points;
-       gint                       i_coords, i_theta;
-       gdouble                    theta1, theta2;
-       GnomeCanvasItem           *item;
-
-       theta1 = (180.0/G_PI) * acos (w / (2.0*r));
-       theta2 = (180.0/G_PI) * asin (h / (2.0*r));
-
-       points = gnome_canvas_points_new (360/RES + 1);
-       i_coords = 0;
-
-       points->coords[i_coords++] = r * cos (theta1 * G_PI / 180.0);
-       points->coords[i_coords++] = r * sin (theta1 * G_PI / 180.0);
-
-       for ( i_theta = theta1 + RES; i_theta < theta2; i_theta +=RES ) {
-               points->coords[i_coords++] = r * cos (i_theta * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin (i_theta * G_PI / 180.0);
-       }
-
-       points->coords[i_coords++] = r * cos (theta2 * G_PI / 180.0);
-       points->coords[i_coords++] = r * sin (theta2 * G_PI / 180.0);
-
-
-       if ( fabs (theta2 - 90.0) > GNOME_CANVAS_EPSILON ) {
-               points->coords[i_coords++] = r * cos ((180-theta2) * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin ((180-theta2) * G_PI / 180.0);
-       }
-
-       for ( i_theta = 180-theta2+RES; i_theta < (180-theta1); i_theta +=RES ) {
-               points->coords[i_coords++] = r * cos (i_theta * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin (i_theta * G_PI / 180.0);
-       }
-
-       points->coords[i_coords++] = r * cos ((180-theta1) * G_PI / 180.0);
-       points->coords[i_coords++] = r * sin ((180-theta1) * G_PI / 180.0);
-
-       if ( fabs (theta1) > GNOME_CANVAS_EPSILON ) {
-               points->coords[i_coords++] = r * cos ((180+theta1) * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin ((180+theta1) * G_PI / 180.0);
+               drawingarea_update (GTK_DRAWING_AREA (rotate_label->priv->rotate_drawingarea),
+                                   NULL,
+                                   FALSE);
        }
+       else
+       {
+               template   = gl_template_from_name (name);
+               label_type = gl_template_get_first_label_type (template);
 
-       for ( i_theta = 180+theta1+RES; i_theta < (180+theta2); i_theta +=RES ) {
-               points->coords[i_coords++] = r * cos (i_theta * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin (i_theta * G_PI / 180.0);
-       }
-
-       points->coords[i_coords++] = r * cos ((180+theta2) * G_PI / 180.0);
-       points->coords[i_coords++] = r * sin ((180+theta2) * G_PI / 180.0);
+               rotate_label->priv->template = template;
+               gl_template_get_label_size (label_type, &raw_w, &raw_h);
 
-       if ( fabs (theta2 - 90.0) > GNOME_CANVAS_EPSILON ) {
-               points->coords[i_coords++] = r * cos ((360-theta2) * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin ((360-theta2) * G_PI / 180.0);
-       }
+               gtk_widget_set_sensitive (rotate_label->priv->rotate_check,
+                                         (raw_w != raw_h));
 
-       for ( i_theta = 360-theta2+RES; i_theta < (360-theta1); i_theta +=RES ) {
-               points->coords[i_coords++] = r * cos (i_theta * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin (i_theta * G_PI / 180.0);
+               drawingarea_update (GTK_DRAWING_AREA (rotate_label->priv->rotate_drawingarea),
+                                   rotate_label->priv->template,
+                                   FALSE);
        }
-
-       if ( fabs (theta1) > GNOME_CANVAS_EPSILON ) {
-               points->coords[i_coords++] = r * cos ((360-theta1) * G_PI / 180.0);
-               points->coords[i_coords++] = r * sin ((360-theta1) * G_PI / 180.0);
-       }
-
-       points->num_points = i_coords / 2;
-
-
-       item = gnome_canvas_item_new (group,
-                                     gnome_canvas_polygon_get_type (),
-                                     "points", points,
-                                     "width_pixels", line_width,
-                                     "outline_color_rgba", line_color,
-                                     "fill_color_rgba", fill_color,
-                                     NULL);
-
-       gnome_canvas_points_free (points);
-
-       return item;
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+                                     (rotate_label->priv->rotate_check), FALSE);
 }
 
index d6d2604a1da1252d3c814ed96c3124f5e1bec4d9..3d8b412edba4514f956452686ab6195f781b5d2e 100644 (file)
@@ -1,9 +1,11 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
 /*
  *  (GLABELS) Label and Business Card Creation program for GNOME
  *
  *  wdgt_rotate_label.h:  label rotate selection widget module header file
  *
- *  Copyright (C) 2001-2002  Jim Evins <evins@snaught.com>.
+ *  Copyright (C) 2001-2006  Jim Evins <evins@snaught.com>.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -23,8 +25,7 @@
 #ifndef __WDGT_ROTATE_LABEL_H__
 #define __WDGT_ROTATE_LABEL_H__
 
-#include "hig.h"
-#include <libglabels/template.h>
+#include <gtk/gtkvbox.h>
 
 G_BEGIN_DECLS
 
@@ -38,37 +39,35 @@ G_BEGIN_DECLS
 #define GL_IS_WDGT_ROTATE_LABEL_CLASS(klass) \
         (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_ROTATE_LABEL))
 
-typedef struct _glWdgtRotateLabel      glWdgtRotateLabel;
-typedef struct _glWdgtRotateLabelClass glWdgtRotateLabelClass;
-
-struct _glWdgtRotateLabel {
-       glHigHBox   parent_widget;
+typedef struct _glWdgtRotateLabel         glWdgtRotateLabel;
+typedef struct _glWdgtRotateLabelClass    glWdgtRotateLabelClass;
 
-       GtkWidget  *rotate_check;
+typedef struct _glWdgtRotateLabelPrivate  glWdgtRotateLabelPrivate;
 
-       GtkWidget  *canvas;
+struct _glWdgtRotateLabel {
+       GtkVBox                    parent_widget;
 
-       glTemplate *template;
+       glWdgtRotateLabelPrivate  *priv;
 };
 
 struct _glWdgtRotateLabelClass {
-       glHigHBoxClass parent_class;
+       GtkVBoxClass parent_class;
 
-       void (*changed) (glWdgtRotateLabel wdgt_rotate_label,
-                        gpointer user_data);
+       void (*changed) (glWdgtRotateLabel  *wdgt_rotate_label,
+                        gpointer            user_data);
 };
 
-GType     gl_wdgt_rotate_label_get_type  (void) G_GNUC_CONST;
+GType      gl_wdgt_rotate_label_get_type          (void) G_GNUC_CONST;
 
-GtkWidget *gl_wdgt_rotate_label_new      (void);
+GtkWidget *gl_wdgt_rotate_label_new               (void);
 
-gboolean  gl_wdgt_rotate_label_get_state (glWdgtRotateLabel *wdgt_rotate_label);
+gboolean   gl_wdgt_rotate_label_get_state         (glWdgtRotateLabel *rotate_label);
 
-void      gl_wdgt_rotate_label_set_state (glWdgtRotateLabel *wdgt_rotate_label,
-                                         gboolean           state);
+void       gl_wdgt_rotate_label_set_state         (glWdgtRotateLabel *rotate_label,
+                                                  gboolean           state);
 
-void      gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *wdgt_rotate_label,
-                                                 gchar             *name);
+void       gl_wdgt_rotate_label_set_template_name (glWdgtRotateLabel *rotate_label,
+                                                  gchar             *name);
 
 G_END_DECLS