From 2a48d5a2d826240b1439c57621f9f63b2bcdd31a Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Sat, 18 Feb 2006 09:28:41 +0000 Subject: [PATCH] Inverse order printing, bug #320919. * shell/ev-print-job.c: (idle_print_handler): Inverse order printing, bug #320919. --- ChangeLog | 6 ++++++ shell/ev-print-job.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 038d7156..3dba8080 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-18 Nickolay V. Shmyrev + + * shell/ev-print-job.c: (idle_print_handler): + + Inverse order printing, bug #320919. + 2006-02-17 Nickolay V. Shmyrev * data/evince-toolbar.xml: diff --git a/shell/ev-print-job.c b/shell/ev-print-job.c index bb463f96..59a8130d 100644 --- a/shell/ev-print-job.c +++ b/shell/ev-print-job.c @@ -61,6 +61,7 @@ struct _EvPrintJob { gboolean printing; int next_page; int copies_done; + int shift; }; struct _EvPrintJobClass { @@ -261,15 +262,18 @@ idle_print_handler (EvPrintJob *job) ev_document_doc_mutex_lock (); ev_ps_exporter_begin ( EV_PS_EXPORTER (job->document), - job->temp_file, job->first_page, job->last_page, + job->temp_file, + MIN (job->first_page, job->last_page), + MAX (job->first_page, job->last_page), job->width, job->height, job->duplex); ev_document_doc_mutex_unlock (); job->next_page = job->first_page; + job->shift = (job->first_page > job->last_page) ? -1 : 1; job->printing = TRUE; return TRUE; } - - if (job->next_page <= job->last_page) { + + if ((job->next_page - job->last_page) * job->shift <= 0) { EvRenderContext *rc; #if 0 g_printerr ("Printing page %d\n", job->next_page); @@ -286,12 +290,12 @@ idle_print_handler (EvPrintJob *job) /* collate must repeat the same page */ job->copies_done++; if(job->copies == job->copies_done) { - job->next_page++; + job->next_page += job->shift; job->copies_done = 0; } } else { - job->next_page++; - if (job->next_page > job->last_page){ + job->next_page += job->shift; + if ((job->next_page - job->last_page) * job->shift > 0){ job->copies_done++; if(job->copies_done < job->copies) { /* more copies to go, restart to the first page */ -- 2.43.5