]> www.fi.muni.cz Git - evince.git/commitdiff
Add a flag to check if orientation has been overriden
authorMarco Pesenti Gritti <mpg@redhat.com>
Fri, 17 Jun 2005 14:18:04 +0000 (14:18 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Fri, 17 Jun 2005 14:18:04 +0000 (14:18 +0000)
2005-06-17  Marco Pesenti Gritti  <mpg@redhat.com>

        * pdf/ev-poppler.cc:

        Add a flag to check if orientation has been overriden

ChangeLog
pdf/ev-poppler.cc

index 33594657fea37464666b6ba3ffa210fee8235237..c07ae985f3c276082ed0ea8a3b57dd1627920846 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-06-17  Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * pdf/ev-poppler.cc:
+
+       Add a flag to check if orientation has been overriden
+
 2005-06-17  Martin Kretzschmar  <martink@gnome.org>
 
        * ps/ps.c (psscan, psfree): read "Creator:" comment, free creator
index 0f9a3562c2dde199d2ff3a763ba2ade5916be8ff..78475da5050673c032fceb849c1b32c76c52484b 100644 (file)
@@ -57,6 +57,7 @@ struct _PdfDocument
        gchar *password;
 
        PopplerOrientation orientation;
+       gboolean orientation_set;
 
        PopplerFontInfo *font_info;
        PopplerFontsIter *fonts_iter;
@@ -128,7 +129,6 @@ static void
 pdf_document_init (PdfDocument *pdf_document)
 {
        pdf_document->password = NULL;
-       pdf_document->orientation = POPPLER_ORIENTATION_PORTRAIT;
 }
 
 static void
@@ -210,8 +210,6 @@ pdf_document_load (EvDocument   *document,
                return FALSE;
        }
 
-       pdf_document->orientation = get_document_orientation (pdf_document);
-
        return TRUE;
 }
 
@@ -221,6 +219,15 @@ pdf_document_get_n_pages (EvDocument *document)
        return poppler_document_get_n_pages (PDF_DOCUMENT (document)->document);
 }
 
+/* FIXME This should not be necessary, poppler should rember it */
+static void
+set_page_orientation (PdfDocument *pdf_document, PopplerPage *page)
+{
+       if (pdf_document->orientation_set) {
+               poppler_page_set_orientation (page, pdf_document->orientation);
+       }
+}
+
 static void
 pdf_document_get_page_size (EvDocument   *document,
                            int           page,
@@ -231,7 +238,7 @@ pdf_document_get_page_size (EvDocument   *document,
        PopplerPage *poppler_page;
 
        poppler_page = poppler_document_get_page (pdf_document->document, page);
-       poppler_page_set_orientation (poppler_page, pdf_document->orientation);
+       set_page_orientation (pdf_document, poppler_page);
        poppler_page_get_size (poppler_page, width, height);
 }
 
@@ -305,7 +312,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);
+       set_page_orientation (pdf_document, poppler_page);
 
        poppler_page_get_size (poppler_page, &width_points, &height_points);
        width = (int) ((width_points * scale) + 0.5);
@@ -514,6 +521,10 @@ pdf_document_get_orientation (EvDocument *document)
 {
        EvOrientation result;
        PdfDocument *pdf_document = PDF_DOCUMENT (document);
+
+       if (!pdf_document->orientation_set) {
+               pdf_document->orientation = get_document_orientation (pdf_document);
+       }
        
        switch (pdf_document->orientation) {
                case POPPLER_ORIENTATION_PORTRAIT: