diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2005-06-14 21:04:23 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2005-06-14 21:04:23 (GMT) |
commit | 79986dda7231d1ef1c530909bde8e18a507a2a2a (patch) | |
tree | 4da2836164c375d4fc17c3bc3dfbc67441b2a1b3 /pdf/ev-poppler.cc | |
parent | c7d050d9ac60d8711e8dd6369a1991296bde282f (diff) |
Add orientation api. Currently poppler api is not optimal, we need to set
2005-06-14 Marco Pesenti Gritti <mpg@redhat.com>
* backend/ev-document.c: (ev_document_set_orientation):
* backend/ev-document.h:
* pdf/ev-poppler.cc:
Add orientation api. Currently poppler api is not optimal,
we need to set orientation every time we _get a page
* data/evince-ui.xml:
* shell/ev-window.c: (ev_window_cmd_edit_landscape),
(ev_window_cmd_edit_portrait), (ev_window_cmd_edit_flip):
Add orientation menu items
* shell/ev-page-cache.c: (ev_page_cache_clear):
* shell/ev-page-cache.h:
Add api to clear the cache
* shell/ev-view.c: (setup_caches), (clear_caches),
(ev_view_set_document), (ev_view_zoom_out),
(ev_view_set_orientation):
* shell/ev-view.h:
Implement orientation changing
Diffstat (limited to 'pdf/ev-poppler.cc')
-rw-r--r-- | pdf/ev-poppler.cc | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index 7c60d9c..9989d82 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -56,6 +56,8 @@ struct _PdfDocument PopplerPSFile *ps_file; gchar *password; + PopplerOrientation orientation; + PopplerFontInfo *font_info; PopplerFontsIter *fonts_iter; int fonts_scanned_pages; @@ -204,11 +206,11 @@ pdf_document_get_page_size (EvDocument *document, double *width, double *height) { + PdfDocument *pdf_document = PDF_DOCUMENT (document); PopplerPage *poppler_page; - poppler_page = poppler_document_get_page (PDF_DOCUMENT (document)->document, - page); - + poppler_page = poppler_document_get_page (pdf_document->document, page); + poppler_page_set_orientation (poppler_page, pdf_document->orientation); poppler_page_get_size (poppler_page, width, height); } @@ -282,6 +284,7 @@ pdf_document_render_pixbuf (EvDocument *document, pdf_document = PDF_DOCUMENT (document); poppler_page = poppler_document_get_page (pdf_document->document, page); + poppler_page_set_orientation (poppler_page, pdf_document->orientation); poppler_page_get_size (poppler_page, &width_points, &height_points); width = (int) ((width_points * scale) + 0.5); @@ -486,6 +489,33 @@ pdf_document_get_text (EvDocument *document, int page, EvRectangle *rect) } static void +pdf_document_set_orientation (EvDocument *document, EvOrientation orientation) +{ + PdfDocument *pdf_document = PDF_DOCUMENT (document); + PopplerOrientation poppler_orientation; + + switch (orientation) { + case EV_ORIENTATION_DOCUMENT: + poppler_orientation = POPPLER_ORIENTATION_DOCUMENT; + break; + case EV_ORIENTATION_PORTRAIT: + poppler_orientation = POPPLER_ORIENTATION_PORTRAIT; + break; + case EV_ORIENTATION_LANDSCAPE: + poppler_orientation = POPPLER_ORIENTATION_LANDSCAPE; + break; + case EV_ORIENTATION_UPSIDEDOWN: + poppler_orientation = POPPLER_ORIENTATION_UPSIDEDOWN; + break; + case EV_ORIENTATION_SEASCAPE: + poppler_orientation = POPPLER_ORIENTATION_SEASCAPE; + break; + } + + pdf_document->orientation = poppler_orientation; +} + +static void pdf_document_document_iface_init (EvDocumentIface *iface) { iface->save = pdf_document_save; @@ -498,6 +528,7 @@ pdf_document_document_iface_init (EvDocumentIface *iface) iface->get_text = pdf_document_get_text; iface->can_get_text = pdf_document_can_get_text; iface->get_info = pdf_document_get_info; + iface->set_orientation = pdf_document_set_orientation; }; static void |