<Sheet name="Avery 5196" size="US-Letter" description="Diskette labels">
<Label id="0" style="rectangle" width="198" height="198" round="5">
<Markup type="margin" size="5"/>
- <Layout nx="3" ny="3" x0="9" y0="126" dx="198" dy="216"/>
+ <Layout nx="3" ny="3" x0="9" y0="36" dx="198" dy="216"/>
</Label>
<Alias name="Avery 5096"/>
<Alias name="Avery 5896"/>
description="VCR Face Labels">
<Label id="0" style="rectangle" width="220" height="133" round="5">
<Markup type="margin" size="5"/>
- <Layout nx="2" ny="5" x0="80" y0="66.5" dx="236" dy="133"/>
+ <Layout nx="2" ny="5" x0="80" y0="60.5" dx="236" dy="133"/>
</Label>
<Alias name="Avery 5199 - VCR Face"/>
</Sheet>
<Sheet name="Avery 8414" size="A4" description="Business Cards">
<Label id="0" style="rectangle" width="246.6" height="144" round="0">
<Markup type="margin" size="5"/>
- <Layout nx="2" ny="5" x0="42" y0="64" dx="264" dy="144"/>
+ <Layout nx="2" ny="5" x0="42" y0="57.890" dx="264" dy="144"/>
</Label>
<Alias name="Avery J8414"/>
</Sheet>
<Sheet name="Zweckform 3654" size="A4" description="CD/DVD Labels">
<Label id="0" style="cd" radius="165.78" hole="58.09">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="2" x0="131.78" y0="63.56" dx="0" dy="387.97"/>
+ <Layout nx="1" ny="2" x0="131.78" y0="58.7998" dx="0" dy="387.97"/>
</Label>
</Sheet>
<Sheet name="Zweckform 4780" size="A4" description="Allround Labels">
<Label id="0" style="rectangle" width="137.48" height="72" round="0">
<Markup type="margin" size="5"/>
- <Layout nx="4" ny="10" x0="23" y0="68" dx="137.48" dy="72"/>
+ <Layout nx="4" ny="10" x0="23" y0="53.8898" dx="137.48" dy="72"/>
</Label>
</Sheet>
description="CD/DVD Labels (2 Pass)">
<Label id="0" style="cd" radius="166.5" hole="58.5">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="1" x0="40.5" y0="414" dx="0" dy="0"/>
+ <Layout nx="1" ny="1" x0="40.5" y0="45" dx="0" dy="0"/>
</Label>
</Sheet>
description="PRO CD Labels 2-up (face only, 2 Pass)">
<Label id="0" style="cd" radius="166.5" hole="58.5">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="1" x0="34" y0="416" dx="0" dy="0"/>
+ <Layout nx="1" ny="1" x0="34" y0="43" dx="0" dy="0"/>
</Label>
</Sheet>
description="PRO CD Labels 2-up (Face only, 2 Pass)">
<Label id="0" style="rectangle" width="168" height="142" round="0">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="2" x0="407" y0="440" dx="0" dy="142"/>
+ <Layout nx="1" ny="2" x0="407" y0="68" dx="0" dy="142"/>
</Label>
</Sheet>
description="PRO CD Labels 2-up (CD spine only)">
<Label id="0" style="rectangle" width="288" height="20" round="0">
<Markup type="margin" size="2"/>
- <Layout nx="2" ny="1" x0="18" y0="387" dx="288" dy="0"/>
+ <Layout nx="2" ny="1" x0="18" y0="385" dx="288" dy="0"/>
</Label>
</Sheet>
description="Mini-CD Labels, outer 4">
<Label id="0" style="cd" radius="110.5" hole="57.5">
<Markup type="margin" size="5"/>
- <Layout nx="2" ny="2" x0="48.4" y0="41.9" dx="299.5" dy="481.5"/>
+ <Layout nx="2" ny="2" x0="48.4" y0="47.6" dx="299.5" dy="481.5"/>
</Label>
</Sheet>
<!-- y0=47 is probably about right, but changing it isn't helping! -->
description="Mini-CD Labels, center 1">
<Label id="0" style="cd" radius="110.5" hole="57.5">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="1" x0="197.3" y0="281.5" dx="0" dy="0"/>
+ <Layout nx="1" ny="1" x0="197.3" y0="289.5" dx="0" dy="0"/>
</Label>
</Sheet>
description="Slimline CD Case (rightside up)">
<Label id="0" style="rectangle" width="394.5" height="342.5" round="0">
<Markup type="margin" size="7.5"/>
- <Layout nx="1" ny="2" x0="130" y0="44.6" dx="0" dy="363"/>
+ <Layout nx="1" ny="2" x0="130" y0="41.9" dx="0" dy="363"/>
</Label>
</Sheet>
<Sheet name="Neato Slimline CD Case, spine" size="US-Letter"
description="Slimline CD Case (upside down)">
<Label id="0" style="rectangle" width="394.5" height="342.5" round="0">
<Markup type="margin" size="7.5"/>
- <Layout nx="1" ny="2" x0="96.5" y0="44.6" dx="0" dy="363"/>
+ <Layout nx="1" ny="2" x0="96.5" y0="41.9" dx="0" dy="363"/>
</Label>
</Sheet>
<Sheet name="Neato A4 CD" size="A4" description="CD/DVD Labels (face only)">
<Label id="0" style="cd" radius="166.5" hole="58.5">
<Markup type="margin" size="5"/>
- <Layout nx="1" ny="2" x0="125" y0="80" dx="0" dy="360"/>
+ <Layout nx="1" ny="2" x0="125" y0="68.890" dx="0" dy="360"/>
</Label>
</Sheet>
- <!-- =================================================================== -->
- <!-- EPSON Photo Stickers, 17 x 24 mm, 16 per sheet (Actually A6) -->
- <!-- =================================================================== -->
- <Sheet name="Epson S041144" size="A4" description="EPSON Photo Stickers 16">
- <Label id="0" style="rectangle" width="48" height="68" round="7">
- <Markup type="margin" size="5"/>
- <Layout nx="4" ny="4" x0="33" y0="59" dx="59.5" dy="79.5"/>
- </Label>
- </Sheet>
-
<!-- =================================================================== -->
<!-- DATA BECKER: Business Cards, 50 x 90 mm, 10 per sheet -->
<!-- =================================================================== -->
<Sheet name="DataBecker" size="A4" description="Business Cards">
<Label id="0" style="rectangle" width="255" height="142" round="0">
<Markup type="margin" size="5"/>
- <Layout nx="2" ny="5" x0="36" y0="62" dx="255" dy="142"/>
+ <Layout nx="2" ny="5" x0="36" y0="69.890" dx="255" dy="142"/>
</Label>
</Sheet>
<Sheet name="Hema Etiketten" size="A4" description="Rectangular Labels">
<Label id="0" style="rectangle" width="178" height="108" round="5">
<Markup type="margin" size="5"/>
- <Layout nx="3" ny="7" x0="20" y0="42" dx="187" dy="107"/>
+ <Layout nx="3" ny="7" x0="20" y0="49.890" dx="187" dy="107"/>
</Label>
</Sheet>
<Sheet name="APLI 1999" size="A4" description="Mailing Labels">
<Label id="0" style="rectangle" width="281" height="193" round="5">
<Markup type="margin" size="5"/>
- <Layout nx="2" ny="4" x0="13" y0="45" dx="289" dy="194"/>
+ <Layout nx="2" ny="4" x0="13" y0="21.890" dx="289" dy="194"/>
</Label>
</Sheet>
<Sheet name="Herma 4607" size="A4" description="Allround Labels --64">
<Label id="0" style="rectangle" width="136.913" height="47.9055" round="0">
<Markup type="margin" size="5"/>
- <Layout nx="4" ny="16" x0="24.0945" y0="35.7165" dx="136.913" dy="47.9055"/>
+ <Layout nx="4" ny="16" x0="24.0945" y0="39.6853" dx="136.913" dy="47.9055"/>
</Label>
<Alias name="Herma 4271"/>
</Sheet>
<Alias name="DataBecker 0368"/>
</Sheet>
+
+ <!-- ******************************************************************** -->
+ <!-- Misc. A6 products. -->
+ <!-- ******************************************************************** -->
+
+ <!-- =================================================================== -->
+ <!-- EPSON Photo Stickers, 17 x 24 mm, 16 per sheet -->
+ <!-- =================================================================== -->
+ <Sheet name="Epson S041144" size="A6" description="EPSON Photo Stickers 16">
+ <Label id="0" style="rectangle" width="48" height="68" round="7">
+ <Markup type="margin" size="5"/>
+ <Layout nx="4" ny="4" x0="33" y0="59" dx="59.5" dy="79.5"/>
+ </Label>
+ </Sheet>
+
</GLabels-templates>
#define GL_PRINT_DEFAULT_PAPER "US Letter"
-/*===========================================*/
-/* Private types. */
-/*===========================================*/
+/*=========================================================================*/
+/* Private types. */
+/*=========================================================================*/
+
typedef struct _PrintInfo {
/* gnome print context */
GnomePrintContext *pc;
glTemplate *template;
gboolean label_rotate_flag;
+ /* page size */
+ gdouble page_width;
+ gdouble page_height;
+
+ /* page counter */
+ gint sheet;
} PrintInfo;
-/*===========================================*/
-/* Private function prototypes. */
-/*===========================================*/
-static PrintInfo *print_info_new (GnomePrintMaster * master, glLabel * label);
-static void print_info_free (PrintInfo ** pi);
-
-static void print_label (PrintInfo * pi, glLabel * label, gdouble x, gdouble y,
- glMergeRecord * record, gboolean outline_flag,
- gboolean reverse_flag);
-
-static void draw_label (PrintInfo * pi, glLabel * label,
- glMergeRecord * record);
-
-static void draw_text_object (PrintInfo * pi, glLabelText * object,
- glMergeRecord * record);
-static void draw_box_object (PrintInfo * pi, glLabelBox * object);
-static void draw_line_object (PrintInfo * pi, glLabelLine * object);
-static void draw_ellipse_object (PrintInfo * pi, glLabelEllipse * object);
-static void draw_image_object (PrintInfo * pi, glLabelImage * object);
-static void draw_barcode_object (PrintInfo * pi, glLabelBarcode * object,
- glMergeRecord * record);
-
-static void draw_outline (PrintInfo * pi, glLabel * label);
-static void clip_to_outline (PrintInfo * pi, glLabel * label);
-
-static void create_rectangle_path (GnomePrintContext * pc,
- gdouble x0, gdouble y0,
- gdouble w, gdouble h);
-static void create_ellipse_path (GnomePrintContext * pc,
- gdouble x0, gdouble y0,
- gdouble rx, gdouble ry);
-static void create_rounded_rectangle_path (GnomePrintContext * pc,
- gdouble x0, gdouble y0,
- gdouble w, gdouble h, gdouble r);
+
+/*=========================================================================*/
+/* Private function prototypes. */
+/*=========================================================================*/
+static PrintInfo *print_info_new (GnomePrintMaster *master,
+ glLabel *label);
+
+static void print_info_free (PrintInfo **pi);
+
+
+static void print_page_begin (PrintInfo *pi);
+
+static void print_page_end (PrintInfo *pi);
+
+static void print_label (PrintInfo *pi,
+ glLabel *label,
+ gdouble x,
+ gdouble y,
+ glMergeRecord *record,
+ gboolean outline_flag,
+ gboolean reverse_flag);
+
+
+static void draw_label (PrintInfo *pi,
+ glLabel *label,
+ glMergeRecord *record);
+
+
+static void draw_text_object (PrintInfo *pi,
+ glLabelText *object,
+ glMergeRecord *record);
+
+static void draw_box_object (PrintInfo *pi,
+ glLabelBox *object);
+
+static void draw_line_object (PrintInfo *pi,
+ glLabelLine *object);
+
+static void draw_ellipse_object (PrintInfo *pi,
+ glLabelEllipse *object);
+
+static void draw_image_object (PrintInfo *pi,
+ glLabelImage *object);
+
+static void draw_barcode_object (PrintInfo *pi,
+ glLabelBarcode *object,
+ glMergeRecord *record);
+
+
+static void draw_outline (PrintInfo *pi,
+ glLabel *label);
+
+static void clip_to_outline (PrintInfo *pi,
+ glLabel *label);
+
+
+static void create_rectangle_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble w,
+ gdouble h);
+
+static void create_ellipse_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble rx,
+ gdouble ry);
+
+static void create_rounded_rectangle_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble w,
+ gdouble h,
+ gdouble r);
\f
/*****************************************************************************/
/* Simple (no merge data) print command. */
/*****************************************************************************/
void
-gl_print_simple (GnomePrintMaster * master,
- glLabel * label,
- gint n_sheets,
- gint first,
- gint last,
- gboolean outline_flag,
- gboolean reverse_flag)
+gl_print_simple (GnomePrintMaster *master,
+ glLabel *label,
+ gint n_sheets,
+ gint first,
+ gint last,
+ gboolean outline_flag,
+ gboolean reverse_flag)
{
PrintInfo *pi;
gint i_sheet, i_label;
- gchar *page_str = NULL;
glTemplateOrigin *origins;
gl_debug (DEBUG_PRINT, "START");
for (i_sheet = 0; i_sheet < n_sheets; i_sheet++) {
- page_str = g_strdup_printf ("sheet %d", i_sheet + 1);
- gnome_print_beginpage (pi->pc, page_str);
- g_free (page_str);
+ print_page_begin (pi);
for (i_label = first - 1; i_label < last; i_label++) {
}
- gnome_print_showpage (pi->pc);
+ print_page_end (pi);
}
g_free (origins);
/* Merge print command (collated copies) */
/*****************************************************************************/
void
-gl_print_merge_collated (GnomePrintMaster * master,
- glLabel * label,
- GList * record_list,
- gint n_copies,
- gint first,
- gboolean outline_flag,
- gboolean reverse_flag)
+gl_print_merge_collated (GnomePrintMaster *master,
+ glLabel *label,
+ GList *record_list,
+ gint n_copies,
+ gint first,
+ gboolean outline_flag,
+ gboolean reverse_flag)
{
PrintInfo *pi;
gint i_sheet, i_label, n_labels_per_page, i_copy;
- gchar *str = NULL;
glMergeRecord *record;
GList *p;
glTemplateOrigin *origins;
for (i_copy = 0; i_copy < n_copies; i_copy++) {
if ((i_label == 0) || (i_sheet == 0)) {
- str = g_strdup_printf ("sheet %d",
- ++i_sheet);
- gnome_print_beginpage (pi->pc, str);
- g_free (str);
+ print_page_begin (pi);
}
print_label (pi, label,
i_label = (i_label + 1) % n_labels_per_page;
if (i_label == 0) {
- gnome_print_showpage (pi->pc);
+ print_page_end (pi);
}
}
}
}
if (i_label != 0) {
- gnome_print_showpage (pi->pc);
+ print_page_end (pi);
}
g_free (origins);
/* Merge print command (uncollated copies) */
/*****************************************************************************/
void
-gl_print_merge_uncollated (GnomePrintMaster * master,
- glLabel * label,
- GList * record_list,
- gint n_copies,
- gint first,
- gboolean outline_flag,
- gboolean reverse_flag)
+gl_print_merge_uncollated (GnomePrintMaster *master,
+ glLabel *label,
+ GList *record_list,
+ gint n_copies,
+ gint first,
+ gboolean outline_flag,
+ gboolean reverse_flag)
{
PrintInfo *pi;
gint i_sheet, i_label, n_labels_per_page, i_copy;
- gchar *str = NULL;
glMergeRecord *record;
GList *p;
glTemplateOrigin *origins;
if ((i_label == 0) || (i_sheet == 0)) {
- str = g_strdup_printf ("sheet %d",
- ++i_sheet);
- gnome_print_beginpage (pi->pc, str);
- g_free (str);
+ print_page_begin (pi);
}
print_label (pi, label,
i_label = (i_label + 1) % n_labels_per_page;
if (i_label == 0) {
- gnome_print_showpage (pi->pc);
+ print_page_end (pi);
}
}
}
}
if (i_label != 0) {
- gnome_print_showpage (pi->pc);
+ print_page_end (pi);
}
g_free (origins);
/* Batch print. Call appropriate function above. */
/*****************************************************************************/
void
-gl_print_batch (GnomePrintMaster * master, glLabel * label,
- gint n_sheets, gint n_copies,
- gboolean outline_flag, gboolean reverse_flag)
+gl_print_batch (GnomePrintMaster *master,
+ glLabel *label,
+ gint n_sheets,
+ gint n_copies,
+ gboolean outline_flag,
+ gboolean reverse_flag)
{
gint n_per_page;
GList *record_list = NULL;
/* PRIVATE. new print info structure */
/*---------------------------------------------------------------------------*/
static PrintInfo *
-print_info_new (GnomePrintMaster * master,
- glLabel * label)
+print_info_new (GnomePrintMaster *master,
+ glLabel *label)
{
PrintInfo *pi = g_new0 (PrintInfo, 1);
glTemplate *template;
+ const GnomePrintPaper *paper = NULL;
gl_debug (DEBUG_PRINT, "START");
pi->config = gnome_print_master_get_config (master);
if ((template != NULL) && (template->page_size != NULL)) {
- const GnomePrintPaper *paper = NULL;
gl_debug (DEBUG_PRINT,
"setting page size = \"%s\"", template->page_size);
paper->height,
GNOME_PRINT_PS_UNIT);
} else {
+ g_warning ("Cannot determine correct page size.");
+ paper = gnome_print_paper_get_by_name (GL_PRINT_DEFAULT_PAPER);
gnome_print_config_set (pi->config,
GNOME_PRINT_KEY_PAPER_SIZE,
GL_PRINT_DEFAULT_PAPER);
}
+ pi->page_width = paper->width;
+ pi->page_height = paper->height;
pi->template = template;
pi->label_rotate_flag = gl_label_get_rotate_flag (label);
+ pi->sheet = 0;
+
gl_debug (DEBUG_PRINT, "END");
return pi;
/* PRIVATE. free print info structure */
/*---------------------------------------------------------------------------*/
static void
-print_info_free (PrintInfo ** pi)
+print_info_free (PrintInfo **pi)
{
gl_debug (DEBUG_PRINT, "START");
gl_debug (DEBUG_PRINT, "END");
}
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. Begin a new page. */
+/*---------------------------------------------------------------------------*/
+static void
+print_page_begin (PrintInfo *pi)
+{
+ gchar *str;
+
+ pi->sheet++;
+
+ str = g_strdup_printf ("sheet%02d", pi->sheet);
+ gnome_print_beginpage (pi->pc, str);
+ g_free (str);
+
+ /* Translate and scale, so that our origin is at the upper left. */
+ gnome_print_translate (pi->pc, 0.0, pi->page_height);
+ gnome_print_scale (pi->pc, 1.0, -1.0);
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. End a page. */
+/*---------------------------------------------------------------------------*/
+static void
+print_page_end (PrintInfo *pi)
+{
+ gnome_print_showpage (pi->pc);
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Print i'th label. */
/*---------------------------------------------------------------------------*/
gboolean outline_flag,
gboolean reverse_flag)
{
- gdouble a[6];
gdouble width, height;
glTemplate *template;
if (gl_label_get_rotate_flag (label)) {
gl_debug (DEBUG_PRINT, "Rotate flag set");
gnome_print_rotate (pi->pc, 90.0);
- gnome_print_scale (pi->pc, 1.0, -1.0);
- } else {
- gl_debug (DEBUG_PRINT, "Rotate flag NOT set");
- art_affine_scale (a, 1.0, -1.0);
- a[5] = height;
- gnome_print_concat (pi->pc, a);
}
if ( reverse_flag ) {
gnome_print_translate (pi->pc, width, 0.0);
- art_affine_scale (a, -1.0, 1.0);
- gnome_print_concat (pi->pc, a);
+ gnome_print_scale (pi->pc, -1.0, 1.0);
}
if (outline_flag) {
draw_outline (pi, label);
/* PRIVATE. Draw label. */
/*---------------------------------------------------------------------------*/
static void
-draw_label (PrintInfo * pi,
- glLabel * label,
- glMergeRecord * record)
+draw_label (PrintInfo *pi,
+ glLabel *label,
+ glMergeRecord *record)
{
GList *p_obj;
glLabelObject *object;
/* PRIVATE. Draw text object. */
/*---------------------------------------------------------------------------*/
static void
-draw_text_object (PrintInfo * pi,
- glLabelText * object,
- glMergeRecord * record)
+draw_text_object (PrintInfo *pi,
+ glLabelText *object,
+ glMergeRecord *record)
{
GnomeFont *font;
gchar **line;
/* PRIVATE. Draw box object. */
/*---------------------------------------------------------------------------*/
static void
-draw_box_object (PrintInfo * pi,
- glLabelBox * object)
+draw_box_object (PrintInfo *pi,
+ glLabelBox *object)
{
gdouble x, y, w, h;
gdouble line_width;
/* PRIVATE. Draw line object. */
/*---------------------------------------------------------------------------*/
static void
-draw_line_object (PrintInfo * pi,
- glLabelLine * object)
+draw_line_object (PrintInfo *pi,
+ glLabelLine *object)
{
gdouble x, y, w, h;
gdouble line_width;
/* PRIVATE. Draw ellipse object. */
/*---------------------------------------------------------------------------*/
static void
-draw_ellipse_object (PrintInfo * pi,
- glLabelEllipse * object)
+draw_ellipse_object (PrintInfo *pi,
+ glLabelEllipse *object)
{
gdouble x, y, x0, y0, rx, ry, w, h;
gdouble line_width;
/* PRIVATE. Draw image object. */
/*---------------------------------------------------------------------------*/
static void
-draw_image_object (PrintInfo * pi,
- glLabelImage * object)
+draw_image_object (PrintInfo *pi,
+ glLabelImage *object)
{
gdouble x, y, w, h;
const GdkPixbuf *pixbuf;
/* PRIVATE. Draw box object. */
/*---------------------------------------------------------------------------*/
static void
-draw_barcode_object (PrintInfo * pi,
- glLabelBarcode * object,
- glMergeRecord * record)
+draw_barcode_object (PrintInfo *pi,
+ glLabelBarcode *object,
+ glMergeRecord *record)
{
glBarcode *gbc;
glBarcodeLine *line;
/* PRIVATE. Draw outline. */
/*---------------------------------------------------------------------------*/
static void
-draw_outline (PrintInfo * pi,
- glLabel * label)
+draw_outline (PrintInfo *pi,
+ glLabel *label)
{
gdouble w, h, r;
gdouble r1, r2;
/* PRIVATE. Clip to outline. */
/*---------------------------------------------------------------------------*/
static void
-clip_to_outline (PrintInfo * pi,
- glLabel * label)
+clip_to_outline (PrintInfo *pi,
+ glLabel *label)
{
gdouble w, h, r;
gdouble r1;
/* PRIVATE. Path creation utilities. */
/*---------------------------------------------------------------------------*/
static void
-create_rectangle_path (GnomePrintContext * pc,
- gdouble x0,
- gdouble y0,
- gdouble w,
- gdouble h)
+create_rectangle_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble w,
+ gdouble h)
{
gl_debug (DEBUG_PRINT, "START");
}
static void
-create_ellipse_path (GnomePrintContext * pc,
- gdouble x0,
- gdouble y0,
- gdouble rx,
- gdouble ry)
+create_ellipse_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble rx,
+ gdouble ry)
{
gdouble x, y;
gint i_theta;
}
static void
-create_rounded_rectangle_path (GnomePrintContext * pc,
- gdouble x0,
- gdouble y0,
- gdouble w,
- gdouble h,
- gdouble r)
+create_rounded_rectangle_path (GnomePrintContext *pc,
+ gdouble x0,
+ gdouble y0,
+ gdouble w,
+ gdouble h,
+ gdouble r)
{
gdouble x, y;
gint i_theta;