]> git.sur5r.net Git - glabels/commitdiff
2007-01-16 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Wed, 17 Jan 2007 04:14:38 +0000 (04:14 +0000)
committerJim Evins <evins@snaught.com>
Wed, 17 Jan 2007 04:14:38 +0000 (04:14 +0000)
* src/Makefile.am:
* src/print-dialog.c:
* src/print-dialog.h:
* src/print-op.c:
* src/print-op.h:
* src/template-designer.c: (print_test_cb):
* src/ui-commands.c: (gl_ui_cmd_file_print):
* src/print.c:
Renamed PrintDialog to PrintOp.  Added constructor for batch
printing.
* src/glabels-batch.c: (main):
Converted to use new PrintOp object for printing.

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

glabels2/ChangeLog
glabels2/src/Makefile.am
glabels2/src/glabels-batch.c
glabels2/src/print-dialog.c [deleted file]
glabels2/src/print-dialog.h [deleted file]
glabels2/src/print-op.c [new file with mode: 0644]
glabels2/src/print-op.h [new file with mode: 0644]
glabels2/src/print.c
glabels2/src/template-designer.c
glabels2/src/ui-commands.c

index eba7352995606376dd73bee9f9bb645da2075042..2b94897eef33be9386ec47c01bc8fd0081512a7e 100644 (file)
@@ -1,3 +1,18 @@
+2007-01-16  Jim Evins  <evins@snaught.com>
+
+       * src/Makefile.am:
+       * src/print-dialog.c:
+       * src/print-dialog.h:
+       * src/print-op.c:
+       * src/print-op.h:
+       * src/template-designer.c: (print_test_cb):
+       * src/ui-commands.c: (gl_ui_cmd_file_print):
+       * src/print.c:
+               Renamed PrintDialog to PrintOp.  Added constructor for batch
+               printing.
+       * src/glabels-batch.c: (main):
+               Converted to use new PrintOp object for printing.
+
 2007-01-15  Jim Evins  <evins@snaught.com>
 
        * data/glade/Makefile.am:
index 7f0b19537ad3e5eedb762271e4de6c1178e6a2ad..f4ffa687f5c89ad0a56207e33b1e8523126acb5a 100644 (file)
@@ -113,8 +113,8 @@ glabels_SOURCES =                   \
        object-editor-shadow-page.c     \
        print.c                         \
        print.h                         \
-       print-dialog.c                  \
-       print-dialog.h                  \
+       print-op.c                      \
+       print-op.h                      \
        template-designer.c             \
        template-designer.h             \
        bc.c                            \
@@ -191,6 +191,8 @@ glabels_batch_SOURCES =             \
        glabels-batch.c                 \
        print.c                         \
        print.h                         \
+       print-op.c                      \
+       print-op.h                      \
        bc.c                            \
        bc.h                            \
        bc-gnubarcode.c                 \
@@ -247,6 +249,14 @@ glabels_batch_SOURCES =            \
        color.h                         \
        debug.c                         \
        debug.h                         \
+       wdgt-print-copies.c             \
+       wdgt-print-copies.h             \
+       wdgt-print-merge.c              \
+       wdgt-print-merge.h              \
+       wdgt-mini-preview.c             \
+       wdgt-mini-preview.h             \
+       hig.c                           \
+       hig.h                           \
        $(BUILT_SOURCES)
 
 marshal.h: marshal.list $(GLIB_GENMARSHAL)
index 39426bde9127bb716587713798d2485837a6fd20..64588deb8e4f438d9c03cb18a899b4bedf1fe36f 100644 (file)
 
 #include <glib/gi18n.h>
 #include <libgnome/libgnome.h>
-#include <libgnomeprint/gnome-print-job.h>
 
 #include "merge-init.h"
 #include "xml-label.h"
 #include "print.h"
+#include "print-op.h"
 #include <libglabels/paper.h>
 #include <libglabels/template.h>
 #include "util.h"
@@ -41,7 +41,7 @@
 /*============================================*/
 static gboolean help_flag    = FALSE;
 static gboolean version_flag = FALSE;
-static gchar    *output      = "output.ps";
+static gchar    *output      = "output.pdf";
 static gint     n_copies     = 1;
 static gint     n_sheets     = 1;
 static gint     first        = 1;
@@ -56,7 +56,7 @@ static struct poptOption options[] = {
         {"version", 'v', POPT_ARG_NONE, &version_flag, 0,
          N_("print the version of glabels-batch being used"), NULL},
         {"output", 'o', POPT_ARG_STRING, &output, 0,
-         N_("set output filename (default=\"output.ps\")"), N_("filename")},
+         N_("set output filename (default=\"output.pdf\")"), N_("filename")},
         {"sheets", 's', POPT_ARG_INT, &n_sheets, 0,
          N_("number of sheets (default=1)"), N_("sheets")},
         {"copies", 'c', POPT_ARG_INT, &n_copies, 0,
@@ -88,13 +88,11 @@ main (int argc, char **argv)
         gint               rc;
         GSList            *p, *file_list = NULL;
         gint               n_files;
-        GnomePrintJob     *job = NULL;
         gchar             *abs_fn;
-        GnomePrintConfig  *config = NULL;
         glLabel           *label = NULL;
         glMerge           *merge = NULL;
         glXMLLabelStatus   status;
-        glPrintFlags       flags;
+        glPrintOp         *print_op;
 
         bindtextdomain (GETTEXT_PACKAGE, GLABELS_LOCALEDIR);
         textdomain (GETTEXT_PACKAGE);
@@ -133,10 +131,6 @@ main (int argc, char **argv)
         }
         poptFreeContext (pctx);
 
-        flags.outline = outline_flag;
-        flags.reverse = reverse_flag;
-        flags.crop_marks = crop_marks_flag;
-
         /* initialize components */
         gl_debug_init ();
         gl_merge_init ();
@@ -162,23 +156,21 @@ main (int argc, char **argv)
                                                   (char *)p->data );
                                 }
                         }
-                        if ( job == NULL ) {
-                                job = gnome_print_job_new (NULL);
-                                abs_fn = gl_util_make_absolute ( output );
-                                config = gnome_print_job_get_config (job);
-                                gnome_print_config_set (config,
-                                                        (guchar*)"Printer",
-                                                        (guchar*)"GENERIC");
-                                gnome_print_config_set (config,
-                                                        (guchar*)"Settings.Transport.Backend",
-                                                        (guchar*)"file");
-                                gnome_print_config_set (config,
-                                                        (guchar*)GNOME_PRINT_KEY_OUTPUT_FILENAME,
-                                                        (guchar*)abs_fn);
-                                g_free( abs_fn );
-                        }
+                        abs_fn = gl_util_make_absolute ( output );
+                        print_op = gl_print_op_new_batch (label,
+                                                          abs_fn,
+                                                          n_sheets,
+                                                          n_copies,
+                                                          first,
+                                                          outline_flag,
+                                                          reverse_flag,
+                                                          crop_marks_flag);
+
+                        gtk_print_operation_run (GTK_PRINT_OPERATION (print_op),
+                                                 GTK_PRINT_OPERATION_ACTION_EXPORT,
+                                                 NULL,
+                                                 NULL);
 
-                        gl_print_batch (job, label, n_sheets, n_copies, first, &flags);
                         g_object_unref (label);
                 }
                 else {
@@ -186,13 +178,6 @@ main (int argc, char **argv)
                                   (char *)p->data );
                 }
         }
-        if ( job != NULL ) {
-
-                gnome_print_job_close (job);
-                gnome_print_job_print (job);
-
-                g_object_unref (job);
-        }
 
         g_slist_free (file_list);
 
diff --git a/glabels2/src/print-dialog.c b/glabels2/src/print-dialog.c
deleted file mode 100644 (file)
index 5051da2..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- *  (GLABELS) Label and Business Card Creation program for GNOME
- *
- *  print-dialog.c:  Print dialog module
- *
- *  Copyright (C) 2001-2007  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 "print-dialog.h"
-
-#include <glib/gi18n.h>
-#include <glade/glade-xml.h>
-#include <math.h>
-#include <time.h>
-#include <ctype.h>
-#include <gtk/gtktogglebutton.h>
-
-#include "print.h"
-#include "label.h"
-
-#include "wdgt-print-copies.h"
-#include "wdgt-print-merge.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private data types                        */
-/*===========================================*/
-
-struct _glPrintDialogPrivate {
-
-       glLabel   *label;
-
-       GladeXML  *gui;
-
-       GtkWidget *simple_frame;
-       GtkWidget *copies_vbox;
-       GtkWidget *copies;
-
-       GtkWidget *merge_frame;
-       GtkWidget *prmerge_vbox;
-       GtkWidget *prmerge;
-
-       GtkWidget *outline_check;
-       GtkWidget *reverse_check;
-       GtkWidget *crop_marks_check;
-
-        gboolean   force_outline_flag;
-
-       gboolean   outline_flag;
-        gboolean   reverse_flag;
-        gboolean   crop_marks_flag;
-        gboolean   merge_flag;
-        gboolean   collate_flag;
-
-       gint       first;
-        gint       last;
-        gint       n_sheets;
-        gint       n_copies;
-
-        glPrintState state;
-};
-
-
-/*===========================================*/
-/* Private globals                           */
-/*===========================================*/
-
-static GtkPrintOperationClass* parent_class = NULL;
-
-/*===========================================*/
-/* Local function prototypes                 */
-/*===========================================*/
-
-static void     gl_print_dialog_class_init    (glPrintDialogClass *klass);
-static void     gl_print_dialog_init          (glPrintDialog      *dialog);
-static void     gl_print_dialog_finalize      (GObject            *object);
-
-static void     gl_print_dialog_construct     (glPrintDialog      *dialog,
-                                               glLabel            *label);
-
-
-static GObject *create_custom_widget_cb       (GtkPrintOperation *operation,
-                                               gpointer           user_data);
-
-static void     custom_widget_apply_cb        (GtkPrintOperation *operation,
-                                               GtkWidget         *widget,
-                                               gpointer           user_data);
-
-static void     begin_print_cb                (GtkPrintOperation *operation,
-                                               GtkPrintContext   *context,
-                                               gpointer           user_data);
-
-static void     draw_page_cb                  (GtkPrintOperation *operation,
-                                               GtkPrintContext   *context,
-                                               int                page_nr,
-                                               gpointer           user_data);
-
-
-
-\f
-/*****************************************************************************/
-/* Boilerplate object stuff.                                                 */
-/*****************************************************************************/
-GType
-gl_print_dialog_get_type (void)
-{
-       static GType type = 0;
-
-       if (!type)
-       {
-               static const GTypeInfo info =
-               {
-                       sizeof (glPrintDialogClass),
-                       NULL,           /* base_init */
-                       NULL,           /* base_finalize */
-                       (GClassInitFunc) gl_print_dialog_class_init,
-                       NULL,           /* class_finalize */
-                       NULL,           /* class_data */
-                       sizeof (glPrintDialog),
-                       0,              /* n_preallocs */
-                       (GInstanceInitFunc) gl_print_dialog_init,
-                       NULL
-               };
-
-               type = g_type_register_static (GTK_TYPE_PRINT_OPERATION,
-                                              "glPrintDialog", &info, 0);
-       }
-
-       return type;
-}
-
-static void
-gl_print_dialog_class_init (glPrintDialogClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       GtkPrintOperationClass *print_class = GTK_PRINT_OPERATION_CLASS (klass);
-
-       gl_debug (DEBUG_PRINT, "");
-       
-       parent_class = g_type_class_peek_parent (klass);
-
-       object_class->finalize = gl_print_dialog_finalize;
-}
-
-static void
-gl_print_dialog_init (glPrintDialog *dialog)
-{
-       GtkWidget *pp_button;
-
-       gl_debug (DEBUG_PRINT, "");
-
-       gtk_print_operation_set_use_full_page (GTK_PRINT_OPERATION (dialog),
-                                              TRUE);
-
-        gtk_print_operation_set_unit (GTK_PRINT_OPERATION (dialog),
-                                      GTK_UNIT_POINTS);
-
-       dialog->priv = g_new0 (glPrintDialogPrivate, 1);
-
-}
-
-static void 
-gl_print_dialog_finalize (GObject *object)
-{
-       glPrintDialog* dialog;
-       
-       gl_debug (DEBUG_PRINT, "");
-
-       g_return_if_fail (object != NULL);
-       
-       dialog = GL_PRINT_DIALOG (object);
-
-       g_return_if_fail (GL_IS_PRINT_DIALOG (dialog));
-       g_return_if_fail (dialog->priv != NULL);
-
-       if (dialog->priv->label) {
-               g_object_unref (G_OBJECT(dialog->priv->label));
-       }
-       g_free (dialog->priv);
-
-       G_OBJECT_CLASS (parent_class)->finalize (object);
-
-       g_free (dialog->priv);
-}
-
-/*****************************************************************************/
-/* NEW print dialog.                                                         */
-/*****************************************************************************/
-glPrintDialog *
-gl_print_dialog_new (glLabel      *label)
-{
-       glPrintDialog *dialog;
-
-       gl_debug (DEBUG_PRINT, "");
-
-       dialog = GL_PRINT_DIALOG (g_object_new (GL_TYPE_PRINT_DIALOG, NULL));
-
-       gl_print_dialog_construct (GL_PRINT_DIALOG(dialog), label);
-
-       return dialog;
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  Construct dialog.                                              */
-/*--------------------------------------------------------------------------*/
-static void
-gl_print_dialog_construct (glPrintDialog      *dialog,
-                          glLabel            *label)
-{
-       dialog->priv->label              = label;
-       dialog->priv->force_outline_flag = FALSE;
-
-       gtk_print_operation_set_custom_tab_label ( GTK_PRINT_OPERATION (dialog),
-                                                  _("Labels"));
-
-       g_signal_connect (G_OBJECT (dialog), "create-custom-widget",
-                         G_CALLBACK (create_custom_widget_cb), label);
-
-       g_signal_connect (G_OBJECT (dialog), "custom-widget-apply",
-                         G_CALLBACK (custom_widget_apply_cb), label);
-
-       g_signal_connect (G_OBJECT (dialog), "begin-print",
-                         G_CALLBACK (begin_print_cb), label);
-
-       g_signal_connect (G_OBJECT (dialog), "draw-page",
-                         G_CALLBACK (draw_page_cb), label);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  "Create custom widget" callback                                */
-/*--------------------------------------------------------------------------*/
-static GObject *
-create_custom_widget_cb (GtkPrintOperation *operation,
-                        gpointer           user_data)
-{
-       glPrintDialog *dialog = GL_PRINT_DIALOG (operation);
-       glLabel       *label  = GL_LABEL (user_data);
-
-       GtkWidget     *vbox;
-
-        glMerge       *merge = NULL;
-
-       dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "print-custom-widget.glade",
-                                          "print_custom_widget_vbox",
-                                          NULL);
-
-       if (!dialog->priv->gui) {
-               g_warning ("Could not open print-dialog.glade, reinstall glabels!");
-               return;
-       }
-
-       vbox = glade_xml_get_widget (dialog->priv->gui, "print_custom_widget_vbox");
-
-       /* ----- Simple print control ----- */
-       dialog->priv->simple_frame = glade_xml_get_widget (dialog->priv->gui,
-                                                          "simple_frame");
-       dialog->priv->copies_vbox  = glade_xml_get_widget (dialog->priv->gui,
-                                                          "copies_vbox");
-       dialog->priv->copies = gl_wdgt_print_copies_new (label);
-       gtk_box_pack_start (GTK_BOX(dialog->priv->copies_vbox),
-                           dialog->priv->copies, FALSE, FALSE, 0);
-
-       /* ----- Merge print control ----- */
-       dialog->priv->merge_frame  = glade_xml_get_widget (dialog->priv->gui,
-                                                          "merge_frame");
-       dialog->priv->prmerge_vbox = glade_xml_get_widget (dialog->priv->gui,
-                                                          "prmerge_vbox");
-       dialog->priv->prmerge = gl_wdgt_print_merge_new (label);
-       gtk_box_pack_start (GTK_BOX(dialog->priv->prmerge_vbox),
-                           dialog->priv->prmerge, FALSE, FALSE, 0);
-
-       /* ----- Options ----------------- */
-       dialog->priv->outline_check    = glade_xml_get_widget (dialog->priv->gui,
-                                                              "outline_check");
-       dialog->priv->reverse_check    = glade_xml_get_widget (dialog->priv->gui,
-                                                              "reverse_check");
-       dialog->priv->crop_marks_check = glade_xml_get_widget (dialog->priv->gui,
-                                                              "crop_marks_check");
-
-        /* ---- Activate either simple or merge print control widgets. ---- */
-        merge = gl_label_get_merge (dialog->priv->label);
-       if (merge == NULL) {
-
-               gtk_widget_show_all (dialog->priv->simple_frame);
-               gtk_widget_hide_all (dialog->priv->merge_frame);
-
-       } else {
-
-               gint n_records = gl_merge_get_record_count( merge );
-               gl_wdgt_print_merge_set_copies (GL_WDGT_PRINT_MERGE(dialog->priv->prmerge),
-                                               1, 1, n_records, FALSE);
-               g_object_unref (G_OBJECT(merge));
-
-               gtk_widget_hide_all (dialog->priv->simple_frame);
-               gtk_widget_show_all (dialog->priv->merge_frame);
-       }
-
-        /* --- Do we need to force the outline flag --- */
-        if (dialog->priv->force_outline_flag)
-        {
-                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->priv->outline_check),
-                                              TRUE);
-
-                gtk_widget_set_sensitive (dialog->priv->outline_check, FALSE);
-                gtk_widget_set_sensitive (dialog->priv->reverse_check, FALSE);
-                gtk_widget_set_sensitive (dialog->priv->crop_marks_check, FALSE);
-        }
-
-       return G_OBJECT (vbox);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  "Custom widget apply" callback                                 */
-/*--------------------------------------------------------------------------*/
-static void
-custom_widget_apply_cb (GtkPrintOperation *operation,
-                        GtkWidget         *widget,
-                        gpointer           user_data)
-{
-        glPrintDialog *dialog = GL_PRINT_DIALOG (operation);
-        glMerge       *merge = NULL;
-
-
-        dialog->priv->outline_flag =
-                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-                                              (dialog->priv->outline_check));
-        dialog->priv->reverse_flag =
-                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-                                              (dialog->priv->reverse_check));
-        dialog->priv->crop_marks_flag =
-                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
-                                              (dialog->priv->crop_marks_check));
-
-        merge = gl_label_get_merge (dialog->priv->label);
-
-        if (merge == NULL)
-        {
-
-                dialog->priv->merge_flag = FALSE;
-                gl_wdgt_print_copies_get_range (GL_WDGT_PRINT_COPIES (dialog->priv->copies),
-                                                &dialog->priv->n_sheets,
-                                                &dialog->priv->first,
-                                                &dialog->priv->last);
-        }
-        else
-        {
-
-                dialog->priv->merge_flag = TRUE;
-                gl_wdgt_print_merge_get_copies (GL_WDGT_PRINT_MERGE (dialog->priv->prmerge),
-                                                &dialog->priv->n_copies,
-                                                &dialog->priv->first,
-                                                &dialog->priv->collate_flag,
-                                                &dialog->priv->n_sheets);
-                g_object_unref (G_OBJECT(merge));
-        }
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  "Begin print" callback                                         */
-/*--------------------------------------------------------------------------*/
-static void
-begin_print_cb (GtkPrintOperation *operation,
-               GtkPrintContext   *context,
-               gpointer           user_data)
-{
-        glPrintDialog *dialog = GL_PRINT_DIALOG (operation);
-
-        gtk_print_operation_set_n_pages (operation, dialog->priv->n_sheets);
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE.  "Draw page" callback.                                          */
-/*--------------------------------------------------------------------------*/
-static void
-draw_page_cb (GtkPrintOperation *operation,
-             GtkPrintContext   *context,
-             int                page_nr,
-             gpointer           user_data)
-{
-        glPrintDialog *dialog = GL_PRINT_DIALOG (operation);
-        cairo_t       *cr;
-
-        cr = gtk_print_context_get_cairo_context (context);
-
-        if (!dialog->priv->merge_flag)
-        {
-                gl_print_simple_sheet (dialog->priv->label,
-                                       cr,
-                                       page_nr,
-                                       dialog->priv->n_sheets,
-                                       dialog->priv->first,
-                                       dialog->priv->last,
-                                       dialog->priv->outline_flag,
-                                       dialog->priv->reverse_flag,
-                                       dialog->priv->crop_marks_flag);
-        }
-        else
-        {
-                if (dialog->priv->collate_flag)
-                {
-                        gl_print_collated_merge_sheet (dialog->priv->label,
-                                                       cr,
-                                                       page_nr,
-                                                       dialog->priv->n_copies,
-                                                       dialog->priv->first,
-                                                       dialog->priv->outline_flag,
-                                                       dialog->priv->reverse_flag,
-                                                       dialog->priv->crop_marks_flag,
-                                                       &dialog->priv->state);
-                }
-                else
-                {
-                        gl_print_uncollated_merge_sheet (dialog->priv->label,
-                                                         cr,
-                                                         page_nr,
-                                                         dialog->priv->n_copies,
-                                                         dialog->priv->first,
-                                                         dialog->priv->outline_flag,
-                                                         dialog->priv->reverse_flag,
-                                                         dialog->priv->crop_marks_flag,
-                                                         &dialog->priv->state);
-                }
-        }
-}
-
-
-/*****************************************************************************/
-/* Set outline flag/checkbox.                                                */
-/*****************************************************************************/
-void
-gl_print_dialog_force_outline_flag (glPrintDialog *dialog)
-{
-        dialog->priv->force_outline_flag = TRUE;
-}
-
-
diff --git a/glabels2/src/print-dialog.h b/glabels2/src/print-dialog.h
deleted file mode 100644 (file)
index d41bc45..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-
-/*
- *  (GLABELS) Label and Business Card Creation program for GNOME
- *
- *  print-dialog.h:  Print dialog module header file
- *
- *  Copyright (C) 2001-2007  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 __PRINT_DIALOG_H__
-#define __PRINT_DIALOG_H__
-
-#include <gtk/gtkprintoperation.h>
-#include "label.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_PRINT_DIALOG            (gl_print_dialog_get_type ())
-#define GL_PRINT_DIALOG(obj)            (GTK_CHECK_CAST ((obj), GL_TYPE_PRINT_DIALOG, glPrintDialog))
-#define GL_PRINT_DIALOG_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PRINT_DIALOG, glPrintDialogClass))
-#define GL_IS_PRINT_DIALOG(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_PRINT_DIALOG))
-#define GL_IS_PRINT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PRINT_DIALOG))
-#define GL_PRINT_DIALOG_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_PRINT_DIALOG, glPrintDialogClass))
-
-
-typedef struct _glPrintDialog         glPrintDialog;
-typedef struct _glPrintDialogClass    glPrintDialogClass;
-
-typedef struct _glPrintDialogPrivate  glPrintDialogPrivate;
-
-struct _glPrintDialog
-{
-        GtkPrintOperation     parent_instance;
-
-        glPrintDialogPrivate *priv;
-
-};
-
-struct  _glPrintDialogClass
-{
-        GtkPrintOperationClass        parent_class;
-};
-
-
-GType          gl_print_dialog_get_type            (void) G_GNUC_CONST;
-
-glPrintDialog *gl_print_dialog_new                 (glLabel       *label);
-
-void           gl_print_dialog_force_outline_flag  (glPrintDialog *dialog);
-
-G_END_DECLS
-
-#endif
diff --git a/glabels2/src/print-op.c b/glabels2/src/print-op.c
new file mode 100644 (file)
index 0000000..fbbade5
--- /dev/null
@@ -0,0 +1,562 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  print-op.c:  Print operation module
+ *
+ *  Copyright (C) 2001-2007  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 "print-op.h"
+
+#include <glib/gi18n.h>
+#include <glade/glade-xml.h>
+#include <math.h>
+#include <time.h>
+#include <ctype.h>
+#include <gtk/gtktogglebutton.h>
+
+#include "print.h"
+#include "label.h"
+
+#include "wdgt-print-copies.h"
+#include "wdgt-print-merge.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private data types                        */
+/*===========================================*/
+
+struct _glPrintOpPrivate {
+
+       glLabel   *label;
+
+       GladeXML  *gui;
+
+       GtkWidget *simple_frame;
+       GtkWidget *copies_vbox;
+       GtkWidget *copies;
+
+       GtkWidget *merge_frame;
+       GtkWidget *prmerge_vbox;
+       GtkWidget *prmerge;
+
+       GtkWidget *outline_check;
+       GtkWidget *reverse_check;
+       GtkWidget *crop_marks_check;
+
+        gboolean   force_outline_flag;
+
+        gchar     *filename;
+
+       gboolean   outline_flag;
+        gboolean   reverse_flag;
+        gboolean   crop_marks_flag;
+        gboolean   merge_flag;
+        gboolean   collate_flag;
+
+       gint       first;
+        gint       last;
+        gint       n_sheets;
+        gint       n_copies;
+
+        glPrintState state;
+};
+
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+static GtkPrintOperationClass* parent_class = NULL;
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void     gl_print_op_class_init    (glPrintOpClass     *klass);
+static void     gl_print_op_init          (glPrintOp          *op);
+static void     gl_print_op_finalize      (GObject            *object);
+
+static void     gl_print_op_construct       (glPrintOp          *op,
+                                             glLabel            *label);
+
+static void     gl_print_op_construct_batch (glPrintOp          *op,
+                                             glLabel            *label,
+                                             gchar              *filename,
+                                             gint                n_sheets,
+                                             gint                n_copies,
+                                             gint                first,
+                                             gboolean            outline_flag,
+                                             gboolean            reverse_flag,
+                                             gboolean            crop_marks_flag);
+
+
+static GObject *create_custom_widget_cb       (GtkPrintOperation *operation,
+                                               gpointer           user_data);
+
+static void     custom_widget_apply_cb        (GtkPrintOperation *operation,
+                                               GtkWidget         *widget,
+                                               gpointer           user_data);
+
+static void     begin_print_cb                (GtkPrintOperation *operation,
+                                               GtkPrintContext   *context,
+                                               gpointer           user_data);
+
+static void     draw_page_cb                  (GtkPrintOperation *operation,
+                                               GtkPrintContext   *context,
+                                               int                page_nr,
+                                               gpointer           user_data);
+
+
+
+\f
+/*****************************************************************************/
+/* Boilerplate object stuff.                                                 */
+/*****************************************************************************/
+GType
+gl_print_op_get_type (void)
+{
+       static GType type = 0;
+
+       if (!type)
+       {
+               static const GTypeInfo info =
+               {
+                       sizeof (glPrintOpClass),
+                       NULL,           /* base_init */
+                       NULL,           /* base_finalize */
+                       (GClassInitFunc) gl_print_op_class_init,
+                       NULL,           /* class_finalize */
+                       NULL,           /* class_data */
+                       sizeof (glPrintOp),
+                       0,              /* n_preallocs */
+                       (GInstanceInitFunc) gl_print_op_init,
+                       NULL
+               };
+
+               type = g_type_register_static (GTK_TYPE_PRINT_OPERATION,
+                                              "glPrintOp", &info, 0);
+       }
+
+       return type;
+}
+
+static void
+gl_print_op_class_init (glPrintOpClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkPrintOperationClass *print_class = GTK_PRINT_OPERATION_CLASS (klass);
+
+       gl_debug (DEBUG_PRINT, "");
+       
+       parent_class = g_type_class_peek_parent (klass);
+
+       object_class->finalize = gl_print_op_finalize;
+}
+
+static void
+gl_print_op_init (glPrintOp *op)
+{
+       GtkWidget *pp_button;
+
+       gl_debug (DEBUG_PRINT, "");
+
+       gtk_print_operation_set_use_full_page (GTK_PRINT_OPERATION (op), TRUE);
+
+        gtk_print_operation_set_unit (GTK_PRINT_OPERATION (op), GTK_UNIT_POINTS);
+
+       op->priv = g_new0 (glPrintOpPrivate, 1);
+
+}
+
+static void 
+gl_print_op_finalize (GObject *object)
+{
+       glPrintOp* op;
+       
+       gl_debug (DEBUG_PRINT, "");
+
+       g_return_if_fail (object != NULL);
+       
+       op = GL_PRINT_OP (object);
+
+       g_return_if_fail (GL_IS_PRINT_OP (op));
+       g_return_if_fail (op->priv != NULL);
+
+       if (op->priv->label) {
+               g_object_unref (G_OBJECT(op->priv->label));
+       }
+        g_free (op->priv->filename);
+       g_free (op->priv);
+
+       G_OBJECT_CLASS (parent_class)->finalize (object);
+
+       g_free (op->priv);
+}
+
+/*****************************************************************************/
+/* NEW print op.                                                         */
+/*****************************************************************************/
+glPrintOp *
+gl_print_op_new (glLabel      *label)
+{
+       glPrintOp *op;
+
+       gl_debug (DEBUG_PRINT, "");
+
+       op = GL_PRINT_OP (g_object_new (GL_TYPE_PRINT_OP, NULL));
+
+       gl_print_op_construct (GL_PRINT_OP(op), label);
+
+       return op;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Construct op.                                              */
+/*--------------------------------------------------------------------------*/
+static void
+gl_print_op_construct (glPrintOp      *op,
+                       glLabel        *label)
+{
+       op->priv->label              = label;
+       op->priv->force_outline_flag = FALSE;
+
+       gtk_print_operation_set_custom_tab_label ( GTK_PRINT_OPERATION (op),
+                                                  _("Labels"));
+
+       g_signal_connect (G_OBJECT (op), "create-custom-widget",
+                         G_CALLBACK (create_custom_widget_cb), label);
+
+       g_signal_connect (G_OBJECT (op), "custom-widget-apply",
+                         G_CALLBACK (custom_widget_apply_cb), label);
+
+       g_signal_connect (G_OBJECT (op), "begin-print",
+                         G_CALLBACK (begin_print_cb), label);
+
+       g_signal_connect (G_OBJECT (op), "draw-page",
+                         G_CALLBACK (draw_page_cb), label);
+}
+
+/*****************************************************************************/
+/* NEW batch print operation.                                                */
+/*****************************************************************************/
+glPrintOp *
+gl_print_op_new_batch (glLabel       *label,
+                       gchar         *filename,
+                       gint           n_sheets,
+                       gint           n_copies,
+                       gint           first,
+                       gboolean       outline_flag,
+                       gboolean       reverse_flag,
+                       gboolean       crop_marks_flag)
+{
+       glPrintOp *op;
+
+       gl_debug (DEBUG_PRINT, "");
+
+       op = GL_PRINT_OP (g_object_new (GL_TYPE_PRINT_OP, NULL));
+
+       gl_print_op_construct_batch (GL_PRINT_OP(op),
+                                         label,
+                                         filename,
+                                         n_sheets,
+                                         n_copies,
+                                         first,
+                                         outline_flag,
+                                         reverse_flag,
+                                         crop_marks_flag);
+
+       return op;
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Construct op.                                              */
+/*--------------------------------------------------------------------------*/
+static void
+gl_print_op_construct_batch (glPrintOp      *op,
+                             glLabel        *label,
+                             gchar          *filename,
+                             gint            n_sheets,
+                             gint            n_copies,
+                             gint            first,
+                             gboolean        outline_flag,
+                             gboolean        reverse_flag,
+                             gboolean        crop_marks_flag)
+
+{
+        glMerge                   *merge = NULL;
+        glTemplate                *template = NULL;
+        const glTemplateLabelType *label_type = NULL;
+
+       op->priv->label              = label;
+       op->priv->force_outline_flag = FALSE;
+        op->priv->filename           = g_strdup (filename);
+        op->priv->n_sheets           = n_sheets;
+        op->priv->n_copies           = n_copies;
+        op->priv->first              = first;
+        op->priv->outline_flag       = outline_flag;
+        op->priv->reverse_flag       = reverse_flag;
+        op->priv->crop_marks_flag    = crop_marks_flag;
+
+        merge = gl_label_get_merge (label);
+
+        template = gl_label_get_template (label);
+        label_type = gl_template_get_first_label_type (template);
+        if (merge == NULL)
+        {
+                op->priv->merge_flag = FALSE;
+
+                op->priv->last = gl_template_get_n_labels (label_type);
+
+        }
+        else
+        {
+                op->priv->merge_flag = TRUE;
+
+                op->priv->n_sheets =
+                        ceil ((double)(first-1 + n_copies * gl_merge_get_record_count(merge))
+                              / gl_template_get_n_labels (label_type));;
+
+                g_object_unref (G_OBJECT(merge));
+
+        }
+        gl_template_free (template);
+
+        gtk_print_operation_set_export_filename (GTK_PRINT_OPERATION (op),
+                                                 filename);
+
+       g_signal_connect (G_OBJECT (op), "begin-print",
+                         G_CALLBACK (begin_print_cb), label);
+
+       g_signal_connect (G_OBJECT (op), "draw-page",
+                         G_CALLBACK (draw_page_cb), label);
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Create custom widget" callback                                */
+/*--------------------------------------------------------------------------*/
+static GObject *
+create_custom_widget_cb (GtkPrintOperation *operation,
+                        gpointer           user_data)
+{
+       glPrintOp *op = GL_PRINT_OP (operation);
+       glLabel       *label  = GL_LABEL (user_data);
+
+       GtkWidget     *vbox;
+
+        glMerge       *merge = NULL;
+
+       op->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "print-custom-widget.glade",
+                                       "print_custom_widget_vbox",
+                                       NULL);
+
+       if (!op->priv->gui) {
+               g_warning ("Could not open print-op.glade, reinstall glabels!");
+               return;
+       }
+
+       vbox = glade_xml_get_widget (op->priv->gui, "print_custom_widget_vbox");
+
+       /* ----- Simple print control ----- */
+       op->priv->simple_frame = glade_xml_get_widget (op->priv->gui,
+                                                          "simple_frame");
+       op->priv->copies_vbox  = glade_xml_get_widget (op->priv->gui,
+                                                          "copies_vbox");
+       op->priv->copies = gl_wdgt_print_copies_new (label);
+       gtk_box_pack_start (GTK_BOX(op->priv->copies_vbox),
+                           op->priv->copies, FALSE, FALSE, 0);
+
+       /* ----- Merge print control ----- */
+       op->priv->merge_frame  = glade_xml_get_widget (op->priv->gui,
+                                                          "merge_frame");
+       op->priv->prmerge_vbox = glade_xml_get_widget (op->priv->gui,
+                                                          "prmerge_vbox");
+       op->priv->prmerge = gl_wdgt_print_merge_new (label);
+       gtk_box_pack_start (GTK_BOX(op->priv->prmerge_vbox),
+                           op->priv->prmerge, FALSE, FALSE, 0);
+
+       /* ----- Options ----------------- */
+       op->priv->outline_check    = glade_xml_get_widget (op->priv->gui,
+                                                              "outline_check");
+       op->priv->reverse_check    = glade_xml_get_widget (op->priv->gui,
+                                                              "reverse_check");
+       op->priv->crop_marks_check = glade_xml_get_widget (op->priv->gui,
+                                                              "crop_marks_check");
+
+        /* ---- Activate either simple or merge print control widgets. ---- */
+        merge = gl_label_get_merge (op->priv->label);
+       if (merge == NULL) {
+
+               gtk_widget_show_all (op->priv->simple_frame);
+               gtk_widget_hide_all (op->priv->merge_frame);
+
+       } else {
+
+               gint n_records = gl_merge_get_record_count( merge );
+               gl_wdgt_print_merge_set_copies (GL_WDGT_PRINT_MERGE(op->priv->prmerge),
+                                               1, 1, n_records, FALSE);
+               g_object_unref (G_OBJECT(merge));
+
+               gtk_widget_hide_all (op->priv->simple_frame);
+               gtk_widget_show_all (op->priv->merge_frame);
+       }
+
+        /* --- Do we need to force the outline flag --- */
+        if (op->priv->force_outline_flag)
+        {
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(op->priv->outline_check),
+                                              TRUE);
+
+                gtk_widget_set_sensitive (op->priv->outline_check, FALSE);
+                gtk_widget_set_sensitive (op->priv->reverse_check, FALSE);
+                gtk_widget_set_sensitive (op->priv->crop_marks_check, FALSE);
+        }
+
+       return G_OBJECT (vbox);
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Custom widget apply" callback                                 */
+/*--------------------------------------------------------------------------*/
+static void
+custom_widget_apply_cb (GtkPrintOperation *operation,
+                        GtkWidget         *widget,
+                        gpointer           user_data)
+{
+        glPrintOp *op = GL_PRINT_OP (operation);
+        glMerge       *merge = NULL;
+
+
+        op->priv->outline_flag =
+                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+                                              (op->priv->outline_check));
+        op->priv->reverse_flag =
+                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+                                              (op->priv->reverse_check));
+        op->priv->crop_marks_flag =
+                gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+                                              (op->priv->crop_marks_check));
+
+        merge = gl_label_get_merge (op->priv->label);
+
+        if (merge == NULL)
+        {
+
+                op->priv->merge_flag = FALSE;
+                gl_wdgt_print_copies_get_range (GL_WDGT_PRINT_COPIES (op->priv->copies),
+                                                &op->priv->n_sheets,
+                                                &op->priv->first,
+                                                &op->priv->last);
+        }
+        else
+        {
+
+                op->priv->merge_flag = TRUE;
+                gl_wdgt_print_merge_get_copies (GL_WDGT_PRINT_MERGE (op->priv->prmerge),
+                                                &op->priv->n_copies,
+                                                &op->priv->first,
+                                                &op->priv->collate_flag,
+                                                &op->priv->n_sheets);
+                g_object_unref (G_OBJECT(merge));
+        }
+
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Begin print" callback                                         */
+/*--------------------------------------------------------------------------*/
+static void
+begin_print_cb (GtkPrintOperation *operation,
+               GtkPrintContext   *context,
+               gpointer           user_data)
+{
+        glPrintOp *op = GL_PRINT_OP (operation);
+
+        gtk_print_operation_set_n_pages (operation, op->priv->n_sheets);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  "Draw page" callback.                                          */
+/*--------------------------------------------------------------------------*/
+static void
+draw_page_cb (GtkPrintOperation *operation,
+             GtkPrintContext   *context,
+             int                page_nr,
+             gpointer           user_data)
+{
+        glPrintOp *op = GL_PRINT_OP (operation);
+        cairo_t       *cr;
+
+        cr = gtk_print_context_get_cairo_context (context);
+
+        if (!op->priv->merge_flag)
+        {
+                gl_print_simple_sheet (op->priv->label,
+                                       cr,
+                                       page_nr,
+                                       op->priv->n_sheets,
+                                       op->priv->first,
+                                       op->priv->last,
+                                       op->priv->outline_flag,
+                                       op->priv->reverse_flag,
+                                       op->priv->crop_marks_flag);
+        }
+        else
+        {
+                if (op->priv->collate_flag)
+                {
+                        gl_print_collated_merge_sheet (op->priv->label,
+                                                       cr,
+                                                       page_nr,
+                                                       op->priv->n_copies,
+                                                       op->priv->first,
+                                                       op->priv->outline_flag,
+                                                       op->priv->reverse_flag,
+                                                       op->priv->crop_marks_flag,
+                                                       &op->priv->state);
+                }
+                else
+                {
+                        gl_print_uncollated_merge_sheet (op->priv->label,
+                                                         cr,
+                                                         page_nr,
+                                                         op->priv->n_copies,
+                                                         op->priv->first,
+                                                         op->priv->outline_flag,
+                                                         op->priv->reverse_flag,
+                                                         op->priv->crop_marks_flag,
+                                                         &op->priv->state);
+                }
+        }
+}
+
+
+/*****************************************************************************/
+/* Set outline flag/checkbox.                                                */
+/*****************************************************************************/
+void
+gl_print_op_force_outline_flag (glPrintOp *op)
+{
+        op->priv->force_outline_flag = TRUE;
+}
+
+
diff --git a/glabels2/src/print-op.h b/glabels2/src/print-op.h
new file mode 100644 (file)
index 0000000..cd82158
--- /dev/null
@@ -0,0 +1,79 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  print-op.h:  Print operation module header file
+ *
+ *  Copyright (C) 2001-2007  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 __PRINT_OP_H__
+#define __PRINT_OP_H__
+
+#include <gtk/gtkprintoperation.h>
+#include "label.h"
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_PRINT_OP            (gl_print_op_get_type ())
+#define GL_PRINT_OP(obj)            (GTK_CHECK_CAST ((obj), GL_TYPE_PRINT_OP, glPrintOp))
+#define GL_PRINT_OP_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_PRINT_OP, glPrintOpClass))
+#define GL_IS_PRINT_OP(obj)         (GTK_CHECK_TYPE ((obj), GL_TYPE_PRINT_OP))
+#define GL_IS_PRINT_OP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_PRINT_OP))
+#define GL_PRINT_OP_GET_CLASS(obj)  (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_PRINT_OP, glPrintOpClass))
+
+
+typedef struct _glPrintOp         glPrintOp;
+typedef struct _glPrintOpClass    glPrintOpClass;
+
+typedef struct _glPrintOpPrivate  glPrintOpPrivate;
+
+struct _glPrintOp
+{
+        GtkPrintOperation     parent_instance;
+
+        glPrintOpPrivate     *priv;
+
+};
+
+struct  _glPrintOpClass
+{
+        GtkPrintOperationClass        parent_class;
+};
+
+
+GType          gl_print_op_get_type           (void) G_GNUC_CONST;
+
+glPrintOp     *gl_print_op_new                (glLabel       *label);
+
+void           gl_print_op_force_outline_flag (glPrintOp *print_op);
+
+/*
+ * Batch print operation
+ */
+glPrintOp     *gl_print_op_new_batch          (glLabel       *label,
+                                               gchar         *filename,
+                                               gint           n_sheets,
+                                               gint           n_copies,
+                                               gint           first,
+                                               gboolean       outline_flag,
+                                               gboolean       reverse_flag,
+                                               gboolean       crop_marks_flag);
+
+G_END_DECLS
+
+#endif
index 29dbb6428010ef186ac3eba8dbf0cbfa8152ba27..d3cbd39cf505392d1c2de0207bdee371f0accf71 100644 (file)
@@ -382,42 +382,6 @@ gl_print_uncollated_merge_sheet (glLabel          *label,
        gl_debug (DEBUG_PRINT, "END");
 }
 
-#ifdef TODO
-/*****************************************************************************/
-/* Batch print.  Call appropriate function above.                            */
-/*****************************************************************************/
-void
-gl_print_batch (GnomePrintJob    *job,
-               glLabel          *label,
-               gint              n_sheets,
-               gint              n_copies,
-               gint              first,
-               glPrintFlags     *flags)
-{
-       glMerge                   *merge;
-       glTemplate                *template;
-       const glTemplateLabelType *label_type;
-       gint                       n_per_page;
-       
-       gl_debug (DEBUG_PRINT, "START");
-
-       merge = gl_label_get_merge (label);
-       template = gl_label_get_template (label);
-       label_type = gl_template_get_first_label_type (template);
-
-       if ( merge == NULL ) {
-               n_per_page = gl_template_get_n_labels(label_type);
-
-               gl_print_simple (job, label, n_sheets, first, n_per_page, flags);
-       } else {
-               gl_print_merge_collated (job, label, n_copies, first, flags);
-       }
-       gl_template_free (template);
-
-       gl_debug (DEBUG_PRINT, "END");
-}
-#endif
-
 /*---------------------------------------------------------------------------*/
 /* PRIVATE.  new print info structure                                        */
 /*---------------------------------------------------------------------------*/
index 43a05fbc205132a35c1f61f68a5552632bd22aa6..ed03109b47fa3d3735891229a5c93423cb9a8b40 100644 (file)
@@ -39,7 +39,7 @@
 #include <libglabels/paper.h>
 #include <libglabels/template.h>
 #include "wdgt-mini-preview.h"
-#include "print-dialog.h"
+#include "print-op.h"
 
 #include "debug.h"
 
@@ -1489,16 +1489,16 @@ print_test_cb (glTemplateDesigner      *dlg)
 {
        GObject    *label;
        glTemplate *template;
-       GtkWidget  *print_dialog;
+       glPrintOp  *print_op;
 
        label = gl_label_new ();
 
        template = build_template (dlg);
        gl_label_set_template (GL_LABEL(label), template);
 
-       print_dialog = gl_print_dialog_new (GL_LABEL(label));
-       gl_print_dialog_force_outline_flag (GL_PRINT_DIALOG(print_dialog));
-        gtk_print_operation_run (GTK_PRINT_OPERATION (print_dialog),
+       print_op = gl_print_op_new (GL_LABEL(label));
+       gl_print_op_force_outline_flag (print_op);
+        gtk_print_operation_run (GTK_PRINT_OPERATION (print_op),
                                  GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                  GTK_WINDOW (dlg),
                                  NULL);
index a7de525b51864383f0d1dc501e7cb1d1f8521a3d..722837354065dd7f017577342ac44a68743b5444 100644 (file)
@@ -35,7 +35,7 @@
 #include "view.h"
 #include "file.h"
 #include "template-designer.h"
-#include "print-dialog.h"
+#include "print-op.h"
 #include "prefs.h"
 #include "prefs-dialog.h"
 #include "recent.h"
@@ -191,16 +191,16 @@ void
 gl_ui_cmd_file_print (GtkAction *action,
                       glWindow  *window)
 {
-        glPrintDialog *dialog;
+        glPrintOp *op;
 
         gl_debug (DEBUG_COMMANDS, "START");
 
         g_return_if_fail (action && GTK_IS_ACTION(action));
         g_return_if_fail (window && GL_IS_WINDOW(window));
 
-        dialog = gl_print_dialog_new (GL_VIEW(window->view)->label);
+        op = gl_print_op_new (GL_VIEW(window->view)->label);
 
-        gtk_print_operation_run (GTK_PRINT_OPERATION (dialog),
+        gtk_print_operation_run (GTK_PRINT_OPERATION (op),
                                  GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                  GTK_WINDOW (window),
                                  NULL);