Enlightenment CVS committal

Author  : doursse
Project : e17
Module  : proto/epdf

Dir     : e17/proto/epdf/src/lib


Modified Files:
        poppler_document.cpp poppler_index.cpp poppler_page.cpp 
        poppler_page_transition.cpp poppler_postscript.cpp etk_pdf.c 


Log Message:
* configure.in:
* src/lib/poppler_document.cpp:
* src/lib/poppler_index.cpp:
* src/lib/poppler_page.cpp:
* src/lib/poppler_page_transition.cpp:
* src/lib/poppler_postscript.cpp:
support poppler 0.6 and 0.5.4.
* src/lib/etk_pdf.c: (etk_pdf_type_get):
adding NULL to the last parameter of etk_type_new. I don't
know if it's the correct value as there's no doc about that
param, but it seems to work.

===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/poppler_document.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- poppler_document.cpp        30 Aug 2007 09:18:19 -0000      1.7
+++ poppler_document.cpp        29 Sep 2007 20:02:42 -0000      1.8
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -9,6 +11,9 @@
 #include <ErrorCodes.h>
 #include <PDFDocEncoding.h>
 #include <UnicodeMap.h>
+#ifndef HAVE_POPPLER_0_6
+# include <UGooString.h>
+#endif // HAVE_POPPLER_0_6
 
 #include "poppler_enum.h"
 #include "poppler_private.h"
@@ -29,7 +34,11 @@
     return NULL;
 
   if (!globalParams)
+#ifdef HAVE_POPPLER_0_6
     globalParams = new GlobalParams();
+#else
+    globalParams = new GlobalParams("/etc/xpdfrc");
+#endif // HAVE_POPPLER_0_6
 
   doc->pdfdoc = new PDFDoc (new GooString (filename), NULL);
   if (doc->pdfdoc->isOk() || doc->pdfdoc->getErrorCode() == errEncrypted) {
@@ -325,13 +334,20 @@
 epdf_document_property_get (Epdf_Document *document, const char *property)
 {
   Object     obj;
+#ifndef HAVE_POPPLER_0_6
+  UGooString prop_str(property);
+#endif // HAVE_POPPLER_0_6
   GooString *goo_string;
   char      *title = NULL;
 
   if (!document)
     return NULL;
 
+#ifdef HAVE_POPPLER_0_6
   if (!document->dict->lookup ((char *)property, &obj)->isString ()) {
+#else
+  if (!document->dict->lookup (prop_str, &obj)->isString ()) {
+#endif // HAVE_POPPLER_0_6
     obj.free ();
 
     return NULL;
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/poppler_index.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- poppler_index.cpp   25 Jul 2007 17:01:03 -0000      1.5
+++ poppler_index.cpp   29 Sep 2007 20:02:42 -0000      1.6
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <stdlib.h>
 
 #include <GlobalParams.h>
@@ -99,7 +101,11 @@
   if (item->action->getKind () != actionGoTo)
     return -1;
 
+#ifdef HAVE_POPPLER_0_6
   GooString *named_dest = ((LinkGoTo *)item->action)->getNamedDest ();
+#else
+  UGooString *named_dest = ((LinkGoTo *)item->action)->getNamedDest ();
+#endif // HAVE_POPPLER_0_6
   LinkDest *dest = ((LinkGoTo *)item->action)->getDest ();
 
   if (!dest && named_dest)
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/poppler_page.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- poppler_page.cpp    19 Sep 2007 16:07:44 -0000      1.12
+++ poppler_page.cpp    29 Sep 2007 20:02:42 -0000      1.13
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <stdlib.h>
 #include <sys/time.h>
 
@@ -7,7 +9,11 @@
 #include <PDFDoc.h>
 #include <Page.h>
 #include <Gfx.h>
-#include <PDFDocEncoding.h>
+#ifdef HAVE_POPPLER_0_6
+# include <PDFDocEncoding.h>
+#else
+# include <UGooString.h>
+#endif // HAVE_POPPLER_0_6
 #include <TextOutputDev.h>
 #include <SplashOutputDev.h>
 #include <splash/SplashBitmap.h>
@@ -92,7 +98,11 @@
 
   doc = page->doc;
 
+#ifdef HAVE_POPPLER_0_6
   output_dev = new SplashOutputDev(splashModeXBGR8, 4, gFalse, white);
+#else
+  output_dev = new SplashOutputDev(splashModeBGRA8, 4, gFalse, white);
+#endif // HAVE_POPPLER_0_6
   output_dev->startDoc(doc->pdfdoc->getXRef ());
   switch (orientation) {
   case EPDF_PAGE_ORIENTATION_LANDSCAPE:
@@ -113,7 +123,11 @@
                             rotate,
                             false, false,
                             x, y, w, h,
+#ifdef HAVE_POPPLER_0_6
                            false,
+#else
+                           NULL,
+#endif // HAVE_POPPLER_0_6
                             doc->pdfdoc->getCatalog ());
   color_ptr = output_dev->getBitmap ()->getDataPtr ();
 
@@ -160,6 +174,7 @@
   if (!page->text_dev) {
     page->text_dev = new TextOutputDev (NULL, 1, 0, 0);
 
+#ifdef HAVE_POPPLER_0_6
     page->gfx = page->page->createGfx (page->text_dev,
                                        72.0, 72.0, 0,
                                        false, /* useMediaBox */
@@ -168,6 +183,16 @@
                                        false, /* printing */
                                        page->doc->pdfdoc->getCatalog (),
                                        NULL, NULL, NULL, NULL);
+#else
+    page->gfx = page->page->createGfx (page->text_dev,
+                                       72.0, 72.0, 0,
+                                       0, /* useMediaBox */
+                                       1, /* Crop */
+                                       -1, -1, -1, -1,
+                                       NULL, /* links */
+                                       page->doc->pdfdoc->getCatalog (),
+                                       NULL, NULL, NULL, NULL);
+#endif // HAVE_POPPLER_0_6
 
     page->page->display(page->gfx);
 
@@ -201,7 +226,11 @@
   sel_text = new GooString;
   /* added selectionStyleGlyph to catch up with poppler 0.6. Is that correct
      or should we rather use selectionStyleLine or selectionStyleWord? :M: */
+#ifdef HAVE_POPPLER_0_6
   sel_text = text_dev->getSelectionText (&pdf_selection, selectionStyleGlyph);
+#else
+  sel_text = text_dev->getSelectionText (&pdf_selection);
+#endif // HAVE_POPPLER_0_6
   result = strdup (sel_text->getCString ());
   delete sel_text;
 
@@ -219,10 +248,15 @@
   double          xMin, yMin, xMax, yMax;
   int             length;
   int             height;
+#ifndef HAVE_POPPLER_0_6
+  UGooString      utext(text);
+#endif // HAVE_POPPLER_0_6
+
 
   if (!page || !text)
     return NULL;
 
+#ifdef HAVE_POPPLER_0_6
   GooString tmp (text);
   Unicode *s;
 
@@ -241,20 +275,31 @@
        }
       }
   }
+#endif // HAVE_POPPLER_0_6
 
   length = strlen (text);
 
   output_dev = new TextOutputDev (NULL, 1, 0, 0);
 
   height = epdf_page_height_get (page);
+#ifdef HAVE_POPPLER_0_6
   page->page->display (output_dev, 72, 72, 0, false,
                       true, false,
                       page->doc->pdfdoc->getCatalog());
+#else
+  page->page->display (output_dev, 72, 72, 0, 0,
+                       1, NULL,
+                       page->doc->pdfdoc->getCatalog());
+#endif // HAVE_POPPLER_0_6
 
   xMin = 0;
   yMin = 0;
 #warning you probably want to add backwards as parameters
+#ifdef HAVE_POPPLER_0_6
   while (output_dev->findText (s, tmp.getLength (),
+#else
+  while (output_dev->findText (utext.unicode (), utext.getLength (),
+#endif // HAVE_POPPLER_0_6
                               0, 1, // startAtTop, stopAtBottom
                               1, 0, // startAtLast, stopAtLast
                               is_case_sensitive, 0, // caseSensitive, backwards
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/poppler_page_transition.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- poppler_page_transition.cpp 7 Jul 2007 16:12:09 -0000       1.3
+++ poppler_page_transition.cpp 29 Sep 2007 20:02:42 -0000      1.4
@@ -1,8 +1,13 @@
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 
 #include <Object.h>
 #include <Dict.h>
+#ifndef HAVE_POPPLER_0_6
+# include <UGooString.h>
+#endif // HAVE_POPPLER_0_6
 
 #include "poppler_enum.h"
 #include "poppler_private.h"
@@ -33,7 +38,12 @@
 
   trans_dict = data->getDict ();
 
+#ifdef HAVE_POPPLER_0_6
   if (trans_dict->lookup ("S", &obj)->isName ()) {
+#else
+  UGooString trans_str("S");
+  if (trans_dict->lookup (trans_str, &obj)->isName ()) {
+#endif // HAVE_POPPLER_0_6
     const char *s;
 
     s = obj.getName();
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/poppler_postscript.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- poppler_postscript.cpp      7 Jul 2007 16:12:09 -0000       1.3
+++ poppler_postscript.cpp      29 Sep 2007 20:02:42 -0000      1.4
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -84,7 +86,9 @@
   ps_dev = new PSOutputDev (postscript->filename,
                             postscript->pdfdoc->getXRef(),
                             postscript->pdfdoc->getCatalog(),
+#ifdef HAVE_POPPLER_0_6
                            "PS title",
+#endif // HAVE_POPPLER_0_6
                             postscript->first_page,
                             postscript->last_page,
                             psModePS,
===================================================================
RCS file: /cvs/e/e17/proto/epdf/src/lib/etk_pdf.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- etk_pdf.c   30 Aug 2007 14:26:08 -0000      1.10
+++ etk_pdf.c   29 Sep 2007 20:02:42 -0000      1.11
@@ -49,7 +49,7 @@
 
    if (!pdf_type)
    {
-      pdf_type = etk_type_new("Etk_Pdf", ETK_WIDGET_TYPE, sizeof(Etk_Pdf), 
ETK_CONSTRUCTOR(_etk_pdf_constructor), ETK_DESTRUCTOR(_etk_pdf_destructor));
+      pdf_type = etk_type_new("Etk_Pdf", ETK_WIDGET_TYPE, sizeof(Etk_Pdf), 
ETK_CONSTRUCTOR(_etk_pdf_constructor), ETK_DESTRUCTOR(_etk_pdf_destructor), 
NULL);
 
       etk_type_property_add(pdf_type, "pdf_file", ETK_PDF_FILE_PROPERTY, 
ETK_PROPERTY_STRING, ETK_PROPERTY_READABLE_WRITABLE, 
etk_property_value_string(NULL));
 



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to