From a50e3f1032fe4e868c92668477aea37bb86052d6 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sat, 25 Aug 2007 15:55:07 +0000 Subject: Adjust number of pages per row according to page orientation when printing 2007-08-25 Carlos Garcia Campos * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_begin): * libdocument/ev-file-exporter.[ch]: (ev_file_exporter_get_capabilities): * shell/ev-jobs.[ch]: (ev_job_print_new), (ev_job_print_run): * shell/ev-window.c: (ev_window_print_dialog_response_cb): Adjust number of pages per row according to page orientation when printing 2 or 6 pages per sheet. svn path=/trunk/; revision=2641 --- (limited to 'shell') diff --git a/shell/ev-jobs.c b/shell/ev-jobs.c index 1218cd0..c78b28c 100644 --- a/shell/ev-jobs.c +++ b/shell/ev-jobs.c @@ -10,8 +10,6 @@ #include "ev-document-fonts.h" #include "ev-selection.h" #include "ev-async-renderer.h" -#include "ev-file-exporter.h" -#include "ev-window.h" #include #include @@ -564,6 +562,7 @@ ev_job_print_new (EvDocument *document, const gchar *format, gdouble width, gdouble height, + EvFileExporterOrientation orientation, EvPrintRange *ranges, gint n_ranges, EvPrintPageSet page_set, @@ -585,6 +584,7 @@ ev_job_print_new (EvDocument *document, job->width = width; job->height = height; + job->orientation = orientation; job->ranges = ranges; job->n_ranges = n_ranges; @@ -718,6 +718,7 @@ ev_job_print_run (EvJobPrint *job) fc.last_page = MAX (first_page, last_page); fc.paper_width = job->width; fc.paper_height = job->height; + fc.orientation = job->orientation; fc.duplex = FALSE; fc.pages_per_sheet = job->pages_per_sheet; diff --git a/shell/ev-jobs.h b/shell/ev-jobs.h index 1f348d8..b15f260 100644 --- a/shell/ev-jobs.h +++ b/shell/ev-jobs.h @@ -23,6 +23,7 @@ #include #include "ev-document.h" #include "ev-window.h" +#include "ev-file-exporter.h" G_BEGIN_DECLS @@ -204,6 +205,7 @@ struct _EvJobPrint gboolean reverse; gdouble width; gdouble height; + EvFileExporterOrientation orientation; }; struct _EvJobPrintClass @@ -262,6 +264,7 @@ EvJob *ev_job_print_new (EvDocument *document, const gchar *format, gdouble width, gdouble height, + EvFileExporterOrientation orientation, EvPrintRange *ranges, gint n_ranges, EvPrintPageSet page_set, diff --git a/shell/ev-window.c b/shell/ev-window.c index b390644..9700746 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2332,6 +2332,7 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, gdouble width; gdouble height; GtkPrintPages print_pages; + EvFileExporterOrientation orientation; const gchar *file_format; if (response == GTK_RESPONSE_CANCEL) { @@ -2410,6 +2411,17 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, GTK_UNIT_PIXEL); height = gtk_page_setup_get_paper_height (window->priv->print_page_setup, GTK_UNIT_PIXEL); + + switch (gtk_page_setup_get_orientation (window->priv->print_page_setup)) { + case GTK_PAGE_ORIENTATION_PORTRAIT: + case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT: + orientation = EV_FILE_EXPORTER_PORTRAIT; + break; + case GTK_PAGE_ORIENTATION_LANDSCAPE: + case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: + orientation = EV_FILE_EXPORTER_LANDSCAPE; + break; + } if (scale != 1.0) { width *= scale; @@ -2425,6 +2437,7 @@ ev_window_print_dialog_response_cb (GtkDialog *dialog, window->priv->print_job = ev_job_print_new (window->priv->document, file_format ? file_format : "ps", width, height, + orientation, ranges, n_ranges, page_set, pages_per_sheet, -- cgit v0.9.1