+2007-08-25 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * 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.
+
2007-08-25 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-window.c: (ev_window_print_send):
PdfDocument *pdf_document = PDF_DOCUMENT (exporter);
PdfPrintContext *ctx;
gdouble width, height;
- gboolean change_orient = FALSE;
+ gboolean landscape, change_orient = FALSE;
#ifdef HAVE_CAIRO_PRINT
cairo_surface_t *surface = NULL;
#endif
ctx->format = fc->format;
ctx->pages_per_sheet = fc->pages_per_sheet;
+ landscape = (fc->orientation == EV_FILE_EXPORTER_LANDSCAPE);
+
switch (fc->pages_per_sheet) {
default:
case 1:
break;
case 2:
change_orient = TRUE;
- ctx->pages_x = 2;
- ctx->pages_y = 1;
+ landscape = !landscape;
+ ctx->pages_x = 1;
+ ctx->pages_y = 2;
break;
case 4:
ctx->pages_x = 2;
break;
case 6:
change_orient = TRUE;
- ctx->pages_x = 3;
- ctx->pages_y = 2;
+ landscape = !landscape;
+ ctx->pages_x = 2;
+ ctx->pages_y = 3;
break;
case 9:
ctx->pages_x = 3;
width = fc->paper_width;
height = fc->paper_height;
}
+
+ if (landscape) {
+ gint tmp;
+ tmp = ctx->pages_x;
+ ctx->pages_x = ctx->pages_y;
+ ctx->pages_y = tmp;
+ }
+
ctx->page_width = width / ctx->pages_x;
ctx->page_height = height / ctx->pages_y;
{
EvFileExporterIface *iface = EV_FILE_EXPORTER_GET_IFACE (exporter);
- iface->get_capabilities (exporter);
+ return iface->get_capabilities (exporter);
}
EV_FILE_EXPORTER_CAN_NUMBER_UP = 1 << 8
} EvFileExporterCapabilities;
+typedef enum {
+ EV_FILE_EXPORTER_PORTRAIT,
+ EV_FILE_EXPORTER_LANDSCAPE
+} EvFileExporterOrientation;
+
typedef struct {
- EvFileExporterFormat format;
- const gchar *filename;
- gint first_page;
- gint last_page;
- gdouble paper_width;
- gdouble paper_height;
- gboolean duplex;
- gint pages_per_sheet;
+ EvFileExporterFormat format;
+ const gchar *filename;
+ gint first_page;
+ gint last_page;
+ gdouble paper_width;
+ gdouble paper_height;
+ EvFileExporterOrientation orientation;
+ gboolean duplex;
+ gint pages_per_sheet;
} EvFileExporterContext;
#define EV_TYPE_FILE_EXPORTER (ev_file_exporter_get_type ())
#include "ev-document-fonts.h"
#include "ev-selection.h"
#include "ev-async-renderer.h"
-#include "ev-file-exporter.h"
-#include "ev-window.h"
#include <glib/gstdio.h>
#include <unistd.h>
const gchar *format,
gdouble width,
gdouble height,
+ EvFileExporterOrientation orientation,
EvPrintRange *ranges,
gint n_ranges,
EvPrintPageSet page_set,
job->width = width;
job->height = height;
+ job->orientation = orientation;
job->ranges = ranges;
job->n_ranges = n_ranges;
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;
#include <gtk/gtk.h>
#include "ev-document.h"
#include "ev-window.h"
+#include "ev-file-exporter.h"
G_BEGIN_DECLS
gboolean reverse;
gdouble width;
gdouble height;
+ EvFileExporterOrientation orientation;
};
struct _EvJobPrintClass
const gchar *format,
gdouble width,
gdouble height,
+ EvFileExporterOrientation orientation,
EvPrintRange *ranges,
gint n_ranges,
EvPrintPageSet page_set,
gdouble width;
gdouble height;
GtkPrintPages print_pages;
+ EvFileExporterOrientation orientation;
const gchar *file_format;
if (response == GTK_RESPONSE_CANCEL) {
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;
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,