]> git.sur5r.net Git - glabels/commitdiff
Moved gl_merge_get_record_list() to inner-most functions possible.
authorJim Evins <evins@snaught.com>
Sun, 8 Dec 2002 06:31:57 +0000 (06:31 +0000)
committerJim Evins <evins@snaught.com>
Sun, 8 Dec 2002 06:31:57 +0000 (06:31 +0000)
Fixed page_begin logic for merge print functions.

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

glabels2/src/print-dialog.c
glabels2/src/print.c
glabels2/src/print.h

index b2226e6013e13f4909bfb05a15bbf2966285c2e6..9e761133cbd435a72e75a7f5f3f038789ff7f64e 100644 (file)
@@ -73,7 +73,6 @@ static void print_sheets (GnomePrintConfig *config, glLabel * label,
                          gboolean outline_flag, gboolean reverse_flag);
 
 static void print_sheets_merge (GnomePrintConfig *config, glLabel * label,
-                               GList *record_list,
                                gboolean preview_flag,
                                gint n_copies, gint first,
                                gboolean collate_flag,
@@ -138,7 +137,6 @@ job_page_new (GtkWidget *dlg,
        GtkWidget *wframe;
        GtkWidget *copies = NULL, *prmerge = NULL;
        GtkWidget *wvbox, *outline_check, *reverse_check;
-       GList *record_list;
        gint n_records;
 
        vbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER);
@@ -167,9 +165,7 @@ job_page_new (GtkWidget *dlg,
                prmerge = gl_wdgt_print_merge_new (label);
                gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe), prmerge);
 
-               record_list = gl_merge_read_record_list (merge);
-
-               n_records = gl_merge_count_records( record_list );
+               n_records = gl_merge_get_record_count( merge );
                gl_wdgt_print_merge_set_copies (GL_WDGT_PRINT_MERGE(prmerge),
                                           n_copies, first, n_records,
                                           collate_flag);
@@ -241,7 +237,6 @@ print_response (GtkDialog *dlg,
        GtkWidget *printer_select;
        GnomePrintConfig *config;
        glMerge *merge;
-       GList *record_list;
 
        switch (response) {
 
@@ -278,11 +273,10 @@ print_response (GtkDialog *dlg,
 
                } else {
 
-                       record_list = gl_merge_read_record_list (merge);
                        gl_wdgt_print_merge_get_copies (GL_WDGT_PRINT_MERGE (prmerge),
                                                        &n_copies, &first,
                                                        &collate_flag);
-                       print_sheets_merge (config, label, record_list,
+                       print_sheets_merge (config, label,
                                            (response == GNOME_PRINT_DIALOG_RESPONSE_PREVIEW),
                                            n_copies, first,
                                            collate_flag,
@@ -305,13 +299,13 @@ print_response (GtkDialog *dlg,
 /*---------------------------------------------------------------------------*/
 static void
 print_sheets (GnomePrintConfig *config,
-             glLabel label,
-             gboolean preview_flag,
-             gint n_sheets,
-             gint first,
-             gint last,
-             gboolean outline_flag,
-             gboolean reverse_flag)
+             glLabel          *label,
+             gboolean          preview_flag,
+             gint              n_sheets,
+             gint              first,
+             gint              last,
+             gboolean          outline_flag,
+             gboolean          reverse_flag)
 {
        GnomePrintMaster *master;
 
@@ -336,24 +330,23 @@ print_sheets (GnomePrintConfig *config,
 /*---------------------------------------------------------------------------*/
 static void
 print_sheets_merge (GnomePrintConfig *config,
-                   glLabel * label,
-                   GList * record_list,
-                   gboolean preview_flag,
-                   gint n_copies,
-                   gint first,
-                   gboolean collate_flag,
-                   gboolean outline_flag,
-                   gboolean reverse_flag)
+                   glLabel          *label,
+                   gboolean          preview_flag,
+                   gint              n_copies,
+                   gint              first,
+                   gboolean          collate_flag,
+                   gboolean          outline_flag,
+                   gboolean          reverse_flag)
 {
        GnomePrintMaster *master;
 
        master = gnome_print_master_new_from_config (config);
        if ( collate_flag ) {
-               gl_print_merge_collated (master, label, record_list,
+               gl_print_merge_collated (master, label,
                                         n_copies, first,
                                         outline_flag, reverse_flag);
        } else {
-               gl_print_merge_uncollated (master, label, record_list,
+               gl_print_merge_uncollated (master, label,
                                           n_copies, first,
                                           outline_flag, reverse_flag);
        }
index 80cb4886378d88cd0758f0e566e40f1eed38b7c6..317673120d4d133d6b0a0d8dc3d65f8948a0e035 100644 (file)
@@ -196,20 +196,24 @@ gl_print_simple (GnomePrintMaster *master,
 void
 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;
-       glMergeRecord *record;
-       GList *p;
-       glTemplateOrigin *origins;
+       glMerge                *merge;
+       const GList            *record_list;
+       PrintInfo              *pi;
+       gint                    i_sheet, i_label, n_labels_per_page, i_copy;
+       glMergeRecord          *record;
+       GList                  *p;
+       glTemplateOrigin       *origins;
 
        gl_debug (DEBUG_PRINT, "START");
 
+       merge = gl_label_get_merge (label);
+       record_list = gl_merge_get_record_list (merge);
+
        pi = print_info_new (master, label);
 
        n_labels_per_page = gl_template_get_n_labels (pi->template);
@@ -218,13 +222,14 @@ gl_print_merge_collated (GnomePrintMaster *master,
        i_sheet = 0;
        i_label = first - 1;
 
-       for ( p=record_list; p!=NULL; p=p->next ) {
+       for ( p=(GList *)record_list; p!=NULL; p=p->next ) {
                record = (glMergeRecord *)p->data;
                        
                if ( record->select_flag ) {
                        for (i_copy = 0; i_copy < n_copies; i_copy++) {
 
                                if ((i_label == 0) || (i_sheet == 0)) {
+                                       i_sheet++;
                                        print_page_begin (pi);
                                }
 
@@ -259,20 +264,24 @@ gl_print_merge_collated (GnomePrintMaster *master,
 void
 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;
-       glMergeRecord *record;
-       GList *p;
-       glTemplateOrigin *origins;
+       glMerge                *merge;
+       const GList            *record_list;
+       PrintInfo              *pi;
+       gint                    i_sheet, i_label, n_labels_per_page, i_copy;
+       glMergeRecord          *record;
+       GList                  *p;
+       glTemplateOrigin       *origins;
 
        gl_debug (DEBUG_PRINT, "START");
 
+       merge = gl_label_get_merge (label);
+       record_list = gl_merge_get_record_list (merge);
+
        pi = print_info_new (master, label);
 
        n_labels_per_page = gl_template_get_n_labels (pi->template);
@@ -283,13 +292,14 @@ gl_print_merge_uncollated (GnomePrintMaster *master,
 
        for (i_copy = 0; i_copy < n_copies; i_copy++) {
 
-               for ( p=record_list; p!=NULL; p=p->next ) {
+               for ( p=(GList *)record_list; p!=NULL; p=p->next ) {
                        record = (glMergeRecord *)p->data;
                        
                        if ( record->select_flag ) {
 
 
                                if ((i_label == 0) || (i_sheet == 0)) {
+                                       i_sheet++;
                                        print_page_begin (pi);
                                }
 
@@ -330,7 +340,6 @@ gl_print_batch (GnomePrintMaster *master,
                gboolean          reverse_flag)
 {
        gint n_per_page;
-       GList *record_list = NULL;
        glMerge *merge;
        glTemplate *template;
        
@@ -345,10 +354,7 @@ gl_print_batch (GnomePrintMaster *master,
                gl_print_simple (master, label, n_sheets, 1, n_per_page,
                                 outline_flag, reverse_flag);
        } else {
-               record_list = gl_merge_read_record_list (merge);
-
-               gl_print_merge_collated (master, label, record_list,
-                                        n_copies, 1,
+               gl_print_merge_collated (master, label, n_copies, 1,
                                         outline_flag, reverse_flag);
        }
        gl_template_free (&template);
@@ -451,6 +457,8 @@ print_page_begin (PrintInfo *pi)
 {
        gchar *str;
 
+       gl_debug (DEBUG_PRINT, "START");
+
        pi->sheet++;
 
        str = g_strdup_printf ("sheet%02d", pi->sheet);
@@ -460,6 +468,8 @@ print_page_begin (PrintInfo *pi)
        /* 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);
+
+       gl_debug (DEBUG_PRINT, "END");
 }
 
 /*---------------------------------------------------------------------------*/
@@ -468,7 +478,11 @@ print_page_begin (PrintInfo *pi)
 static void
 print_page_end (PrintInfo *pi)
 {
+       gl_debug (DEBUG_PRINT, "START");
+
        gnome_print_showpage (pi->pc);
+
+       gl_debug (DEBUG_PRINT, "END");
 }
 
 /*---------------------------------------------------------------------------*/
index a6e6d589f325b7a8cb8240609e25cb63ce1857c3..df7e827a9da13adeb9d8d3fd3e7a20e3112629e8 100644 (file)
@@ -39,7 +39,6 @@ void gl_print_simple           (GnomePrintMaster *master,
 
 void gl_print_merge_collated   (GnomePrintMaster *master,
                                glLabel          *label,
-                               GList            *record_list,
                                gint              n_copies,
                                gint              first,
                                gboolean          outline_flag,
@@ -47,7 +46,6 @@ void gl_print_merge_collated   (GnomePrintMaster *master,
 
 void gl_print_merge_uncollated (GnomePrintMaster *master,
                                glLabel          *label,
-                               GList            *record_list,
                                gint              n_copies,
                                gint              first,
                                gboolean          outline_flag,