Follow incompatible API change in poppler-0.16 and fix an old bug in text selection. While here, adjust WANTLIB.
Index: Makefile =================================================================== RCS file: /cvs/ports/print/epdfview/Makefile,v retrieving revision 1.21 diff -u -p -r1.21 Makefile --- Makefile 6 Dec 2010 10:06:48 -0000 1.21 +++ Makefile 14 May 2011 10:47:45 -0000 @@ -3,7 +3,7 @@ COMMENT= lightweight PDF document viewer DISTNAME= epdfview-0.1.7 -REVISION= 7 +REVISION= 8 CATEGORIES= print HOMEPAGE= http://trac.emma-soft.com/epdfview/ @@ -19,19 +19,19 @@ PERMIT_PACKAGE_FTP= Yes PERMIT_DISTFILES_CDROM= Yes PERMIT_DISTFILES_FTP= Yes -WANTLIB+= X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes -WANTLIB+= Xi Xinerama Xrandr Xrender atk-1.0 c cairo expat fontconfig -WANTLIB+= freetype gdk-x11-2.0>=0.14 gdk_pixbuf-2.0>=0.14 gio-2.0 glib-2.0 -WANTLIB+= gmodule-2.0 gobject-2.0 gthread-2.0 gtk-x11-2.0>=0.14 m -WANTLIB+= pango-1.0 pangocairo-1.0 pangoft2-1.0 pixman-1 png poppler>=3 +WANTLIB+= GL X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes +WANTLIB+= Xi Xinerama Xrandr Xrender Xxf86vm atk-1.0 c cairo drm expat +WANTLIB+= fontconfig freetype gdk-x11-2.0>=0.14 gdk_pixbuf-2.0>=0.14 gio-2.0 +WANTLIB+= glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0 gtk-x11-2.0>=0.14 m +WANTLIB+= pango-1.0 pangocairo-1.0 pangoft2-1.0 pixman-1 png poppler>=10 WANTLIB+= poppler-glib>=3 pthread pthread-stubs stdc++ xcb xcb-render -WANTLIB+= xcb-render-util z +WANTLIB+= xcb-shm z MODULES= devel/gettext RUN_DEPENDS= devel/desktop-file-utils LIB_DEPENDS= x11/gtk+2 \ - print/poppler + print/poppler>=0.16 CONFIGURE_STYLE=gnu Index: patches/patch-src_PDFDocument_cxx =================================================================== RCS file: /cvs/ports/print/epdfview/patches/patch-src_PDFDocument_cxx,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_PDFDocument_cxx --- patches/patch-src_PDFDocument_cxx 12 Jan 2010 21:45:20 -0000 1.1 +++ patches/patch-src_PDFDocument_cxx 14 May 2011 10:47:45 -0000 @@ -1,10 +1,12 @@ $OpenBSD: patch-src_PDFDocument_cxx,v 1.1 2010/01/12 21:45:20 jasper Exp $ Fixes error handling, bogus encrypted files, r339. +Fix API breakage introduced with poppler-0.16, and a stupid bug +calculating the value of x2. ---- src/PDFDocument.cxx.orig Sat Feb 28 16:00:35 2009 -+++ src/PDFDocument.cxx Tue Dec 29 23:00:29 2009 -@@ -246,23 +246,25 @@ PDFDocument::loadFile (const gchar *filename, const gc +--- src/PDFDocument.cxx.orig Sat Feb 28 22:00:35 2009 ++++ src/PDFDocument.cxx Sat May 14 12:43:43 2011 +@@ -246,24 +246,26 @@ PDFDocument::loadFile (const gchar *filename, const gc // Check if the document couldn't be opened successfully and why. if ( NULL == newDocument ) { @@ -16,16 +18,6 @@ Fixes error handling, bogus encrypted fi + switch ( loadError->code ) { - errorCode = DocumentErrorEncrypted; -- } -- else -- { -- // OK, the glib's wrapper don't pass the error code directly -- // from Poppler. Instead returns G_FILE_ERROR_FAILED and a -- // non translated string. -- // Maybe I'm wrong (very probable) but that's a wrong way. -- // So I'm reading the error code from the error string... -- sscanf (loadError->message, "Failed to load document (error %d)", -- (gint *)&errorCode); + case POPPLER_ERROR_OPEN_FILE: + case POPPLER_ERROR_INVALID: + errorCode = DocumentErrorOpenFile; @@ -43,5 +35,36 @@ Fixes error handling, bogus encrypted fi + errorCode = DocumentErrorEncrypted; + break; } +- else +- { +- // OK, the glib's wrapper don't pass the error code directly +- // from Poppler. Instead returns G_FILE_ERROR_FAILED and a +- // non translated string. +- // Maybe I'm wrong (very probable) but that's a wrong way. +- // So I'm reading the error code from the error string... +- sscanf (loadError->message, "Failed to load document (error %d)", +- (gint *)&errorCode); +- } g_error_free (loadError); // Get our error message. + gchar *errorMessage = IDocument::getErrorMessage (errorCode); +@@ -678,15 +680,14 @@ PDFDocument::setTextSelection (DocumentRectangle *rect + gdouble pageWidth, pageHeight; + poppler_page_get_size(page, &pageWidth, &pageHeight); + +- //for get text we must exchange y coordinate, don't ask me where logic here. + PopplerRectangle textRect = { rect->getX1() / getZoom(), +- (pageHeight - rect->getY2() / getZoom()), +- rect->getX2() * getZoom() / getZoom(), +- (pageHeight - rect->getY1() / getZoom())}; ++ rect->getY1() / getZoom(), ++ rect->getX2() / getZoom(), ++ rect->getY2() / getZoom()}; + repairEmpty(textRect); + + #if defined (HAVE_POPPLER_0_6_0) +- gchar *text = poppler_page_get_text(page, POPPLER_SELECTION_GLYPH, ++ gchar *text = poppler_page_get_selected_text(page, POPPLER_SELECTION_GLYPH, + &textRect); + #else // !HAVE_POPPLER_0_6_0 + gchar *text = poppler_page_get_text(page, &textRect);