-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * print.c: Print module
+ * print.c
+ * Copyright (C) 2001-2009 Jim Evins <evins@snaught.com>.
*
- * Copyright (C) 2001-2007 Jim Evins <evins@snaught.com>.
+ * This file is part of gLabels.
*
- * This program is free software; you can redistribute it and/or modify
+ * gLabels 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
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels 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
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <config.h>
#include "print.h"
#include <time.h>
#include <ctype.h>
+#include <libglabels/libglabels.h>
#include "label.h"
-#include <libglabels/template.h>
#include "cairo-label-path.h"
#include "debug.h"
+
/*===========================================*/
/* Private macros and constants. */
/*===========================================*/
#define TICK_OFFSET 2.25
#define TICK_LENGTH 18.0
+
/*=========================================================================*/
/* Private types. */
/*=========================================================================*/
glLabel *label);
-\f
/*****************************************************************************/
/* Print simple sheet (no merge data) command. */
/*****************************************************************************/
pi = print_info_new (cr, label);
- frame = lgl_template_get_first_frame (pi->template);
+ frame = (lglTemplateFrame *)pi->template->frames->data;
origins = lgl_template_frame_get_origins (frame);
if (crop_marks_flag) {
gl_debug (DEBUG_PRINT, "END");
}
+
/*****************************************************************************/
/* Print collated merge sheet command */
/*****************************************************************************/
record_list = gl_merge_get_record_list (merge);
pi = print_info_new (cr, label);
- frame = lgl_template_get_first_frame (pi->template);
+ frame = (lglTemplateFrame *)pi->template->frames->data;
n_labels_per_page = lgl_template_frame_get_n_labels (frame);
origins = lgl_template_frame_get_origins (frame);
gl_debug (DEBUG_PRINT, "END");
}
+
/*****************************************************************************/
/* Print uncollated merge sheet command */
/*****************************************************************************/
record_list = gl_merge_get_record_list (merge);
pi = print_info_new (cr, label);
- frame = lgl_template_get_first_frame (pi->template);
+ frame = (lglTemplateFrame *)pi->template->frames->data;
n_labels_per_page = lgl_template_frame_get_n_labels (frame);
origins = lgl_template_frame_get_origins (frame);
gl_debug (DEBUG_PRINT, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. new print info structure */
/*---------------------------------------------------------------------------*/
g_return_val_if_fail (label && GL_IS_LABEL (label), NULL);
g_return_val_if_fail (label->template, NULL);
- g_return_val_if_fail (label->template->page_size, NULL);
+ g_return_val_if_fail (label->template->paper_id, NULL);
g_return_val_if_fail (label->template->page_width > 0, NULL);
g_return_val_if_fail (label->template->page_height > 0, NULL);
pi->cr = cr;
gl_debug (DEBUG_PRINT,
- "setting page size = \"%s\"", label->template->page_size);
+ "setting page size = \"%s\"", label->template->paper_id);
pi->page_width = label->template->page_width;
pi->page_height = label->template->page_height;
return pi;
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. free print info structure */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_PRINT, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Print crop tick marks. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_PRINT, "START");
- frame = lgl_template_get_first_frame (pi->template);
+ frame = (lglTemplateFrame *)pi->template->frames->data;
lgl_template_frame_get_size (frame, &w, &h);
gl_debug (DEBUG_PRINT, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Print i'th label. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_PRINT, "START");
- frame = lgl_template_get_first_frame (pi->template);
+ frame = (lglTemplateFrame *)pi->template->frames->data;
gl_label_get_size (label, &width, &height);
/* Transform coordinate system to be relative to upper corner */
/* of the current label */
cairo_translate (pi->cr, x, y);
+
+ clip_to_outline (pi, label);
+
+ cairo_save (pi->cr);
+
+ /* Special transformations. */
if (label->rotate_flag) {
gl_debug (DEBUG_PRINT, "Rotate flag set");
cairo_rotate (pi->cr, -M_PI/2.0);
cairo_scale (pi->cr, -1.0, 1.0);
}
- clip_to_outline (pi, label);
gl_label_draw (label, pi->cr, FALSE, record);
+
+ cairo_restore (pi->cr); /* From special transformations. */
+
if (outline_flag) {
draw_outline (pi, label);
}
- cairo_restore (pi->cr);
+ cairo_restore (pi->cr); /* From translation. */
gl_debug (DEBUG_PRINT, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Draw outline. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_PRINT, "END");
}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Clip to outline. */
/*---------------------------------------------------------------------------*/
gl_debug (DEBUG_PRINT, "END");
}
+
+
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */