X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-print-job.c;h=bb463f96108d33f57fd1e8522800350832bf18a8;hb=a0af7b2e9d42e05aa0108ae6dc9c34deb9723404;hp=b9aded8b539f7f3e01dac17cc612724a7db1fc3f;hpb=96ab01a78dafd62f121b11010a9857cbd9a7922c;p=evince.git diff --git a/shell/ev-print-job.c b/shell/ev-print-job.c index b9aded8b..bb463f96 100644 --- a/shell/ev-print-job.c +++ b/shell/ev-print-job.c @@ -48,8 +48,8 @@ struct _EvPrintJob { double width; /* FIXME unused */ double height; /* FIXME unused */ gboolean duplex; /* FIXME unused */ - int copies; /* FIXME unused */ - int collate; /* FIXME unsued */ + int copies; + int collate; /* range printing */ int first_page; @@ -60,6 +60,7 @@ struct _EvPrintJob { guint idle_id; gboolean printing; int next_page; + int copies_done; }; struct _EvPrintJobClass { @@ -273,8 +274,7 @@ idle_print_handler (EvPrintJob *job) #if 0 g_printerr ("Printing page %d\n", job->next_page); #endif - rc = ev_render_context_new (EV_ORIENTATION_PORTRAIT, - job->next_page, 1.0); + rc = ev_render_context_new (0, job->next_page, 1.0); ev_document_doc_mutex_lock (); ev_ps_exporter_do_page (EV_PS_EXPORTER (job->document), rc); @@ -282,9 +282,25 @@ idle_print_handler (EvPrintJob *job) g_object_unref (rc); - job->next_page++; + if (job->collate) { + /* collate must repeat the same page */ + job->copies_done++; + if(job->copies == job->copies_done) { + job->next_page++; + job->copies_done = 0; + } + } else { + job->next_page++; + if (job->next_page > job->last_page){ + job->copies_done++; + if(job->copies_done < job->copies) { + /* more copies to go, restart to the first page */ + job->next_page = job->first_page; + } + } + } return TRUE; - } else { /* no more pages */ + } else { /* no more pages or copies */ ev_document_doc_mutex_lock (); ev_ps_exporter_end (EV_PS_EXPORTER (job->document)); ev_document_doc_mutex_unlock ();