+Tue Dec 21 16:30:58 2004 Owen Taylor <otaylor@redhat.com>
+
+ * pdf/**: Import of xpdf code from gpdf.
+
+ * pdf/xpdf/xpdfconfig.h: Move the non-config.h config.h to xpdfconfig.h
+
+ * pdf/splash/SplashFTFont.{cc,h} pdf/splash/SplashFTFont.h
+ pdf/splash/SplashFTFontEngine.h pdf/splash/SplashFTFontFile.h:
+ Fix FreeType includes.
+
+ * pdf/xpdf/{Error.h GnomeVFSStream.cc ImageOutputDev.cc PDFDoc.cc\
+ pdffonts.cc pdfimages.cc pdfinfo.cc pdftoppm.cc pdftops.cc
+ pdftotext.cc PSOutputDev.cc PSOutputDev.h SplashOutputDev.h
+ Stream.cc TextOutputDev.cc XPDFApp.cc xpdf.cc XPDFViewer.cc
+ pdf/xpdf/Error.h PSOutputDev.h SplashOutputDev.h}:
+ Include xpdfconfig.h
+
Tue Dec 21 16:08:17 2004 Jonathan Blandford <jrb@redhat.com>
* shell/ev-window.c (ev_window_dispose): dispose can be called
-SUBDIRS = cut-n-paste data shell viewer po
+SUBDIRS = cut-n-paste data shell viewer po pdf
intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
exit 1
}
-USE_COMMON_DOC_BUILD=yes REQUIRED_AUTOMAKE_VERSION=1.8 USE_GNOME2_MACROS=1 . gnome-autogen.sh
+USE_COMMON_DOC_BUILD=yes REQUIRED_AUTOMAKE_VERSION=1.7 USE_GNOME2_MACROS=1 . gnome-autogen.sh
PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0 libbonobo-2.0)
PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libbonoboui-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
+PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0)
dnl Compile with disable-deprecated switches
set_enable_deprecated=no
else
set_enable_deprecated=yes
-fi
+ fi
])
AC_MSG_CHECKING([whether to disable deprecated glib/gtk+/etc. features])
if test "$set_enable_deprecated" != "yes"; then
fi
AC_SUBST(EVINCE_DISABLE_DEPRECATED)
+dnl ================== Xpdf aconf.h.in checks ==================================
+
+AH_TEMPLATE([HAVE_LIBSM], [Define to 1 if you have session management.])
+AH_TEMPLATE([ENABLE_NLS], [Use Native Language Support.])
+AH_TEMPLATE([HAVE_CATGETS], [Use catgets functions.])
+AH_TEMPLATE([HAVE_GETTEXT], [Use gettext functions.])
+
+dnl Optional features.
+AH_TEMPLATE([A4_PAPER],
+ [Use A4 paper size instead of Letter for PostScript output.])
+AC_ARG_ENABLE(a4-paper,
+ AC_HELP_STRING([--enable-a4-paper],
+ [use A4 paper size instead of Letter for
+ PostScript output]),
+ AC_DEFINE(A4_PAPER))
+
+dnl never define NO_TEXT_SELECT, just remember this Xpdf setting.
+AH_TEMPLATE([NO_TEXT_SELECT], [Do not allow text selection.])
+
+AH_TEMPLATE([OPI_SUPPORT],
+ [Include support for OPI comments.])
+AC_ARG_ENABLE(opi,
+ AC_HELP_STRING([--enable-opi],
+ [include support for OPI comments]),
+ AC_DEFINE(OPI_SUPPORT))
+
+dnl enable these unconditionally.
+AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
+AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])
+
+AH_TEMPLATE([APPDEFDIR],
+ [Directory with the Xpdf app-defaults file.])
+AC_ARG_WITH(appdef-dir,
+ AC_HELP_STRING([--with-appdef-dir],
+ [set app-defaults directory]),
+ AC_DEFINE_UNQUOTED(APPDEFDIR, "$with_appdef_dir"))
+
+dnl Path to xpdfrc.
+dnl This ugly kludge to get the sysconfdir path is needed because
+dnl autoconf doesn't actually set the prefix variable until later.
+if test "$sysconfdir" = '${prefix}/etc'; then
+ if test "x$prefix" = xNONE; then
+ system_xpdfrc="$ac_default_prefix/etc/xpdfrc"
+ else
+ system_xpdfrc="$prefix/etc/xpdfrc"
+ fi
+else
+ system_xpdfrc="$sysconfdir/xpdfrc"
+fi
+AC_DEFINE_UNQUOTED(SYSTEM_XPDFRC, "$system_xpdfrc",
+ [Full path for the system-wide xpdfrc file.])
+
+dnl Checks for header files.
+AC_HEADER_DIRENT
+
+dnl Switch over to C++. This will make the checks below a little
+dnl bit stricter (requiring function prototypes in include files).
+dnl (99% of xpdf is written in C++.)
+AC_LANG_CPLUSPLUS
+
+dnl Look for header that defines select() and fd_set.
+AC_MSG_CHECKING([select() and fd_set in sys/select.h and sys/bsdtypes.h])
+AC_TRY_COMPILE([#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>],
+ [fd_set fds;
+select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
+if test $xpdf_ok = yes; then
+ AC_MSG_RESULT([not needed])
+else
+ AC_TRY_COMPILE([#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/select.h>],
+ [fd_set fds;
+select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
+ if test $xpdf_ok = yes; then
+ AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Have sys/select.h.])
+ AC_MSG_RESULT([need sys/select.h])
+ else
+ AC_TRY_COMPILE([#include <stdlib.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/bsdtypes.h>],
+ [fd_set fds;
+select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no)
+ if test $xpdf_ok = yes; then
+ AC_DEFINE(HAVE_SYS_BSDTYPES_H, 1, [Have sys/bsdtypes.h.])
+ AC_MSG_RESULT([need sys/bsdtypes.h])
+ else
+ AC_MSG_RESULT([problem])
+ fi
+ fi
+fi
+
+dnl Look for header that defines FD_ZERO.
+AC_MSG_CHECKING([FD_ZERO and strings.h or bstring.h])
+AC_TRY_COMPILE([#include <stdlib.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif],
+[fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
+if test $xpdf_ok = yes; then
+ AC_MSG_RESULT([not needed])
+else
+ AC_TRY_COMPILE([#include <stdlib.h>
+#include <sys/types.h>
+#include <strings.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif],
+ [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
+ if test $xpdf_ok = yes; then
+ AC_DEFINE(HAVE_STRINGS_H, 1, [Have strings.h.])
+ AC_MSG_RESULT([need strings.h])
+ else
+ AC_TRY_COMPILE([#include <stdlib.h>
+#include <sys/types.h>
+#include <bstring.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif],
+ [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no)
+ if test $xpdf_ok = yes; then
+ AC_DEFINE(HAVE_BSTRING_H, 1, [Have bstring.h.])
+ AC_MSG_RESULT([need bstring.h])
+ else
+ AC_MSG_RESULT([problem])
+ fi
+ fi
+fi
+
+dnl Look for rewinddir.
+AC_CHECK_FUNCS(rewinddir)
+if test $ac_cv_func_rewinddir = no; then
+ AC_CHECK_LIB(cposix, rewinddir)
+fi
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(popen)
+dnl # This should use 'AC_CHECK_FUNCS(mkstemp)' but that fails if
+dnl # the mkstemp exists in the library but isn't declared in the
+dnl # include file (e.g., in cygwin 1.1.2).
+AC_CACHE_CHECK([for mkstemp],
+xpdf_cv_func_mkstemp,
+[AC_TRY_LINK([#include <stdlib.h>
+#include <unistd.h>],
+[mkstemp("foo");],
+xpdf_cv_func_mkstemp=yes, xpdf_cv_func_mkstemp=no)])
+if test "$xpdf_cv_func_mkstemp" = yes; then
+ AC_DEFINE(HAVE_MKSTEMP, 1, [Have mkstemp().])
+fi
+dnl Check for mkstemps, just like mkstemp.
+AC_CACHE_CHECK([for mkstemps],
+xpdf_cv_func_mkstemps,
+[AC_TRY_LINK([#include <stdlib.h>
+#include <unistd.h>],
+[mkstemps("foo", 0);],
+xpdf_cv_func_mkstemps=yes, xpdf_cv_func_mkstemps=no)])
+if test "$xpdf_cv_func_mkstemps" = yes; then
+ AC_DEFINE(HAVE_MKSTEMPS, 1, [Have mkstemps().])
+fi
+
+dnl Check select argument type: on HP-UX before version 10, select
+dnl takes (int *) instead of (fd_set *).
+AC_CACHE_CHECK([whether select takes fd_set arguments],
+xpdf_cv_func_select_arg,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif],
+[fd_set fds;
+select(1, &fds, &fds, &fds, 0);],
+xpdf_cv_func_select_arg=yes, xpdf_cv_func_select_arg=no)])
+if test "$xpdf_cv_func_select_arg" != yes; then
+ AC_DEFINE(SELECT_TAKES_INT, 1, [select() takes int, not fd_set arguments.])
+fi
+
+dnl Back to C for the library tests.
+AC_LANG_C
+
+dnl Check for fseeko/ftello or fseek64/ftell64
+dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
+AC_SYS_LARGEFILE
+AC_FUNC_FSEEKO
+AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
+AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
+if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
+ AC_DEFINE(HAVE_FSEEK64, 1, [Have fseek64().])
+fi
+
+dnl Check for freetype headers
+FREETYPE_LIBS=
+FREETYPE_CFLAGS=
+AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
+if test "x$FREETYPE_CONFIG" != "xno" ; then
+ FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
+ FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
+ AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
+fi
+
+AC_SUBST(FREETYPE_CFLAGS)
+AC_SUBST(FREETYPE_LIBS)
+
+dnl ================== End of xpdf checks ===========================================
+
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
dnl stolen from nautilus and gnome-common
cut-n-paste/Makefile
cut-n-paste/recent-files/Makefile
data/Makefile
+pdf/Makefile
+pdf/goo/Makefile
+pdf/fofi/Makefile
+pdf/splash/Makefile
+pdf/xpdf/Makefile
po/Makefile.in
shell/Makefile
viewer/Makefile
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+SUBDIRS = goo fofi splash xpdf
+
+EXTRA_DIST = aconf.h aconf2.h
--- /dev/null
+#include <aconf2.h>
+#include <config.h>
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_srcdir)/goo
+ -I$(top_srcdir)/pdf \
+ -I$(top_srcdir)/pdf/goo
noinst_LIBRARIES = libfofi.a
-INCLUDES = \
- -I$(top_srcdir)
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/pdf
noinst_LIBRARIES = libGoo.a
vms_unix_time.h \
vms_unix_times.c\
vms_unlink.c \
- vms_make.com
\ No newline at end of file
+ vms_make.com
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/goo \
- -I$(top_srcdir)/fofi
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/pdf \
+ -I$(top_srcdir)/pdf/goo \
+ -I$(top_srcdir)/pdf/fofi \
+ $(FREETYPE_CFLAGS)
noinst_LIBRARIES = libsplash.a
#pragma implementation
#endif
-#include "freetype/ftoutln.h"
-#include "freetype/internal/ftobjs.h" // needed for FT_New_Size decl
#include "gmem.h"
#include "SplashMath.h"
#include "SplashGlyphBitmap.h"
#include "SplashFTFontFile.h"
#include "SplashFTFont.h"
+#include FT_OUTLINE_H
+#include FT_INTERNAL_OBJECTS_H // needed for FT_New_Size decl
+
//------------------------------------------------------------------------
static int glyphPathMoveTo(FT_Vector *pt, void *path);
#pragma interface
#endif
-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
#include "SplashFont.h"
class SplashFTFontFile;
#pragma interface
#endif
-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
#include "gtypes.h"
class SplashFontFile;
#pragma interface
#endif
-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
#include "SplashFontFile.h"
class SplashFontFileID;
pdftops
pdftotext
semantic.cache
+test-gdk-output-dev
xpdf
#endif
#include <stdio.h>
-#include "config.h"
+#include "xpdfconfig.h"
extern void CDECL error(int pos, char *msg, ...);
--- /dev/null
+//========================================================================
+//
+// GDKSplashOutputDev.cc
+//
+// Copyright 2003 Glyph & Cog, LLC
+// Copyright 2004 Red Hat, Inc. (GDK port)
+//
+//========================================================================
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include "gmem.h"
+#include "SplashTypes.h"
+#include "SplashBitmap.h"
+#include "Object.h"
+#include "GfxState.h"
+#include "TextOutputDev.h"
+#include "GDKSplashOutputDev.h"
+
+//------------------------------------------------------------------------
+// Constants and macros
+//------------------------------------------------------------------------
+
+#define xoutRound(x) ((int)(x + 0.5))
+
+//------------------------------------------------------------------------
+// GDKSplashOutputDev
+//------------------------------------------------------------------------
+
+static SplashColor makeSplashColor(int r, int g, int b)
+{
+ SplashColor c;
+ c.rgb8 = splashMakeRGB8 (r, g, b);
+ return c;
+}
+
+GDKSplashOutputDev::GDKSplashOutputDev(GdkScreen *screen,
+ void (*redrawCbkA)(void *data),
+ void *redrawCbkDataA):
+ SplashOutputDev(splashModeRGB8, gFalse, makeSplashColor (255,255,255)),
+ incrementalUpdate (1)
+{
+ redrawCbk = redrawCbkA;
+ redrawCbkData = redrawCbkDataA;
+
+ // create text object
+ text = new TextPage(gFalse);
+}
+
+GDKSplashOutputDev::~GDKSplashOutputDev() {
+ delete text;
+}
+
+void GDKSplashOutputDev::drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, Unicode *u, int uLen) {
+ text->addChar(state, x, y, dx, dy, code, u, uLen);
+ SplashOutputDev::drawChar(state, x, y, dx, dy, originX, originY,
+ code, u, uLen);
+}
+
+GBool GDKSplashOutputDev::beginType3Char(GfxState *state, double x, double y,
+ double dx, double dy,
+ CharCode code, Unicode *u, int uLen) {
+ text->addChar(state, x, y, dx, dy, code, u, uLen);
+ return SplashOutputDev::beginType3Char(state, x, y, dx, dy, code, u, uLen);
+}
+
+void GDKSplashOutputDev::clear() {
+ startDoc(NULL);
+ startPage(0, NULL);
+}
+
+void GDKSplashOutputDev::startPage(int pageNum, GfxState *state) {
+ SplashOutputDev::startPage(pageNum, state);
+ text->startPage(state);
+}
+
+void GDKSplashOutputDev::endPage() {
+ SplashOutputDev::endPage();
+ if (!incrementalUpdate) {
+ (*redrawCbk)(redrawCbkData);
+ }
+ text->coalesce(gTrue);
+}
+
+void GDKSplashOutputDev::dump() {
+ if (incrementalUpdate) {
+ (*redrawCbk)(redrawCbkData);
+ }
+}
+
+void GDKSplashOutputDev::updateFont(GfxState *state) {
+ SplashOutputDev::updateFont(state);
+ text->updateFont(state);
+}
+
+void GDKSplashOutputDev::redraw(int srcX, int srcY,
+ GdkDrawable *drawable,
+ int destX, int destY,
+ int width, int height) {
+ SplashColorPtr dataPtr;
+ GdkGC *gc;
+ guchar *gdk_buf;
+ int gdk_rowstride;
+ int bw, x, y, r, g, b;
+
+ gdk_rowstride = width * 3;
+
+ /* better to draw nothing than crash on a huge image */
+ gdk_buf = (guchar*) g_try_malloc (height * gdk_rowstride);
+ if (gdk_buf == NULL)
+ return;
+
+ bw = getBitmap()->getWidth();
+ dataPtr = getBitmap()->getDataPtr();
+
+ for (y = 0; y < height; ++y)
+ {
+ SplashRGB8 *p;
+ SplashRGB8 rgb;
+ guchar *gdk_p;
+
+ p = dataPtr.rgb8 + (y + srcY) * bw + srcX;
+ gdk_p = gdk_buf + y * gdk_rowstride;
+ for (x = 0; x < width; ++x)
+ {
+ rgb = *p++;
+ r = splashRGB8R(rgb);
+ g = splashRGB8G(rgb);
+ b = splashRGB8B(rgb);
+
+ *gdk_p++ = r;
+ *gdk_p++ = g;
+ *gdk_p++ = b;
+ }
+ }
+
+ gc = gdk_gc_new (drawable);
+
+ gdk_draw_rgb_image (drawable, gc,
+ destX, destY,
+ width, height,
+ GDK_RGB_DITHER_NORMAL,
+ gdk_buf,
+ gdk_rowstride);
+
+ g_object_unref (gc);
+
+ g_free (gdk_buf);
+}
+
+GBool GDKSplashOutputDev::findText(Unicode *s, int len,
+ GBool startAtTop, GBool stopAtBottom,
+ GBool startAtLast, GBool stopAtLast,
+ int *xMin, int *yMin,
+ int *xMax, int *yMax) {
+ double xMin1, yMin1, xMax1, yMax1;
+
+ xMin1 = (double)*xMin;
+ yMin1 = (double)*yMin;
+ xMax1 = (double)*xMax;
+ yMax1 = (double)*yMax;
+ if (text->findText(s, len, startAtTop, stopAtBottom,
+ startAtLast, stopAtLast,
+ &xMin1, &yMin1, &xMax1, &yMax1)) {
+ *xMin = xoutRound(xMin1);
+ *xMax = xoutRound(xMax1);
+ *yMin = xoutRound(yMin1);
+ *yMax = xoutRound(yMax1);
+ return gTrue;
+ }
+ return gFalse;
+}
+
+GString *GDKSplashOutputDev::getText(int xMin, int yMin, int xMax, int yMax) {
+ return text->getText((double)xMin, (double)yMin,
+ (double)xMax, (double)yMax);
+}
--- /dev/null
+//========================================================================
+//
+// GDKSplashOutputDev.h
+//
+// Copyright 2003 Glyph & Cog, LLC
+// Copyright 2004 Red Hat, Inc. (GDK port)
+//
+//========================================================================
+
+#ifndef XSPLASHOUTPUTDEV_H
+#define XSPLASHOUTPUTDEV_H
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "gpdf-g-switch.h"
+# include <gdk/gdk.h>
+#include "gpdf-g-switch.h"
+#include "SplashTypes.h"
+#include "SplashOutputDev.h"
+#include "TextOutputDev.h"
+
+//------------------------------------------------------------------------
+
+#define xOutMaxRGBCube 6 // max size of RGB color cube
+
+//------------------------------------------------------------------------
+// GDKSplashOutputDev
+//------------------------------------------------------------------------
+
+class GDKSplashOutputDev: public SplashOutputDev {
+public:
+
+ GDKSplashOutputDev(GdkScreen *screen,
+ void (*redrawCbkA)(void *data),
+ void *redrawCbkDataA);
+
+ virtual ~GDKSplashOutputDev();
+
+ //----- initialization and control
+
+ // Start a page.
+ virtual void startPage(int pageNum, GfxState *state);
+
+ // End a page.
+ virtual void endPage();
+
+ // Dump page contents to display.
+ virtual void dump();
+
+ //----- update text state
+ virtual void updateFont(GfxState *state);
+
+ //----- text drawing
+ virtual void drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, Unicode *u, int uLen);
+ virtual GBool beginType3Char(GfxState *state, double x, double y,
+ double dx, double dy,
+ CharCode code, Unicode *u, int uLen);
+
+ //----- special access
+
+ // Clear out the document (used when displaying an empty window).
+ void clear();
+
+ // Copy the rectangle (srcX, srcY, width, height) to (destX, destY)
+ // in destDC.
+ void redraw(int srcX, int srcY,
+ GdkDrawable *drawable,
+ int destX, int destY,
+ int width, int height);
+
+ // Find a string. If <startAtTop> is true, starts looking at the
+ // top of the page; else if <startAtLast> is true, starts looking
+ // immediately after the last find result; else starts looking at
+ // <xMin>,<yMin>. If <stopAtBottom> is true, stops looking at the
+ // bottom of the page; else if <stopAtLast> is true, stops looking
+ // just before the last find result; else stops looking at
+ // <xMax>,<yMax>.
+ GBool findText(Unicode *s, int len,
+ GBool startAtTop, GBool stopAtBottom,
+ GBool startAtLast, GBool stopAtLast,
+ int *xMin, int *yMin,
+ int *xMax, int *yMax);
+
+ // Get the text which is inside the specified rectangle.
+ GString *getText(int xMin, int yMin, int xMax, int yMax);
+
+private:
+
+ int incrementalUpdate;
+ void (*redrawCbk)(void *data);
+ void *redrawCbkData;
+ TextPage *text; // text from the current page
+};
+
+#endif
#endif
#include <aconf.h>
-#include "config.h"
+#include "xpdfconfig.h"
#include "GnomeVFSStream.h"
#include "gpdf-g-switch.h"
#include <stddef.h>
#include <ctype.h>
#include "gmem.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "Error.h"
#include "GfxState.h"
#include "Object.h"
-SUBDIRS = . tests
-
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_srcdir)/goo \
- -I$(top_srcdir)/lib/ggv-sidebar \
- -I$(top_srcdir)/fofi \
- -I$(top_srcdir)/splash \
- -DDATADIR=\""$(datadir)"\" \
- -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
- -DGNOMEICONDIR=\""$(datadir)/pixmaps"\" \
- $(EXTRA_GNOME_CFLAGS) \
- $(GNOME_PRINT_PRIVATE_CFLAGS) \
- $(GPDF_DEPRECATED_CFLAGS) \
- $(libpaper_CFLAGS)
-
-marshal_sources = \
- gpdf-marshal.c \
- gpdf-marshal.h
+ -I$(top_srcdir)/pdf \
+ -I$(top_srcdir)/pdf/goo \
+ -I$(top_srcdir)/pdf/fofi \
+ -I$(top_srcdir)/pdf/splash \
+ $(GTK_CFLAGS) \
+ -DDATADIR=\""$(datadir)"\"
-libexec_PROGRAMS = gnome-pdf-viewer
+noinst_PROGRAMS = test-gdk-output-dev
-noinst_LIBRARIES = libxpdf.a libgpdf.a
+noinst_LIBRARIES = libxpdf.a
libxpdf_a_SOURCES = \
Annot.cc \
TextOutputDev.h \
UTF8.h
-ANNOTS_VIEW_SRCS =
-
-if USE_ANNOTS_VIEW
- ANNOTS_VIEW_SRCS += \
- gpdf-annots-view.cc \
- gpdf-annots-view.h
-endif
-
-libgpdf_a_SOURCES = \
- BonoboStream.cc \
- BonoboStream.h \
- GnomeVFSStream.cc \
- GnomeVFSStream.h \
- GPOutputDev.cc \
- GPOutputDev.h \
- PSOutputDev.cc \
- PSOutputDev.h \
- Thumb.cc \
- Thumb.h \
- gpdf-control.cc \
- gpdf-control.h \
- gpdf-control-private.h \
- gpdf-g-switch.h \
- gpdf-link-canvas-item.cc \
- gpdf-link-canvas-item.h \
- gpdf-links-canvas-layer.cc \
- gpdf-links-canvas-layer.h \
- gpdf-persist-file.cc \
- gpdf-persist-file.h \
- gpdf-persist-stream.cc \
- gpdf-persist-stream.h \
- gpdf-stock-icons.c \
- gpdf-stock-icons.h \
- gpdf-util.h \
- gpdf-view.cc \
- gpdf-view.h \
- gpdf-bookmarks-view.cc \
- gpdf-bookmarks-view.h \
- gpdf-thumbnails-view.cc \
- gpdf-thumbnails-view.h \
- $(ANNOTS_VIEW_SRCS) \
- eel-gconf-extensions.c \
- eel-gconf-extensions.h \
- prefs-strings.h \
- gpdf-sidebar.c \
- gpdf-sidebar.h \
- gtkgesture.c \
- gtkgesture.h \
- page-control.c \
- page-control.h \
- pdf-info-dict-util.cc \
- pdf-info-dict-util.h \
- pdf-properties-display.c \
- pdf-properties-display.h \
- gpdf-font-face.c \
- gpdf-font-face.h \
- $(marshal_sources)
-
-gnome_pdf_viewer_SOURCES = \
- $(common_sources) \
- bonobo-application-x-pdf.cc \
- nautilus-pdf-property-page.cc \
- nautilus-pdf-property-page.h
-
-# Old files
-# GOutputDev.cc \
-# GOutputDev.h \
-# pdf-view.cc \
-# pdf-view.h \
-# gpdf-embeddable.cc \
-# gpdf-embeddable.h \
-# gpdf-embeddable-view.cc \
-# gpdf-embeddable-view.h
-
-gnome_pdf_viewer_LDADD = \
- libxpdf.a \
- libgpdf.a \
- $(top_builddir)/goo/libGoo.a \
- $(top_builddir)/fofi/libfofi.a \
- $(top_builddir)/lib/ggv-sidebar/libggv-sidebar.a \
- $(EXTRA_GNOME_LIBS) \
- $(libpaper_LIBS)
-
-gpdf-marshal.h: gpdf-marshal.list $(GLIB_GENMARSHAL)
- $(GLIB_GENMARSHAL) $< --header --prefix=gpdf_marshal > $@
-
-gpdf-marshal.c: gpdf-marshal.list $(GLIB_GENMARSHAL)
- echo "#include \"gpdf-marshal.h\"" > $@ && \
- $(GLIB_GENMARSHAL) $< --body --prefix=gpdf_marshal >> $@
-
-BUILT_SOURCES = $(marshal_sources)
-DONT_DIST_SOURCE = $(marshal_sources)
-
-dist-hook:
- for file in $(DONT_DIST_SOURCE) ; do \
- rm -f $(distdir)/$$file ; \
- done
-
-STOCK_ANNOTS_ICONS =
-
-if USE_ANNOTS_VIEW
- STOCK_ANNOTS_ICONS += \
- stock-annot-circle.png \
- stock-annot-fileattachment.png \
- stock-annot-freetext.png \
- stock-annot-highlight.png \
- stock-annot-ink.png \
- stock-annot-line.png \
- stock-annot-link.png \
- stock-annot-movie.png \
- stock-annot-popup.png \
- stock-annot-sound.png \
- stock-annot-square.png \
- stock-annot-stamp.png \
- stock-annot-strikeout.png \
- stock-annot-text.png \
- stock-annot-trapnet.png \
- stock-annot-underline.png \
- stock-annot-widget.png \
- stock-annot-unknown.png
-endif
-
-stockdir = $(datadir)/pixmaps/gpdf
-stock_DATA = \
- fitwidth.png \
- stock_book-closed-mark.png \
- stock_book-closed.png \
- stock_book-opened-mark.png \
- stock_book-opened.png \
- stock_bookmarks.png \
- $(STOCK_ANNOTS_ICONS)
-
-gladedir = $(datadir)/gpdf/glade
-glade_DATA = \
- gpdf-print-progress-dialog.glade \
- gpdf-properties-dialog.glade
-
-server_in_files = GNOME_PDF.server.in.in
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:%.server.in.in=%.server)
-
-$(server_in_files:%.server.in.in=%.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-
-@INTLTOOL_SERVER_RULE@
-
-uidir = $(datadir)/gnome-2.0/ui
-ui_DATA = \
- gpdf-control-ui.xml
-
-CLEANFILES = \
- $(server_DATA) \
- $(server_in_files:.server.in.in=.server.in) \
- $(marshal_sources)
-
-if USE_ANNOTS_VIEW
- EXTRA_DIST = $(stock_DATA) \
- gpdf-marshal.list \
- $(server_in_files) \
- config.h \
- $(ui_DATA) \
- $(glade_DATA)
-else
- EXTRA_DIST = $(stock_DATA) \
- gpdf-marshal.list \
- $(server_in_files) \
- config.h \
- $(ui_DATA) \
- $(glade_DATA) \
- stock-annot-circle.png \
- stock-annot-fileattachment.png \
- stock-annot-freetext.png \
- stock-annot-highlight.png \
- stock-annot-ink.png \
- stock-annot-line.png \
- stock-annot-link.png \
- stock-annot-movie.png \
- stock-annot-popup.png \
- stock-annot-sound.png \
- stock-annot-square.png \
- stock-annot-stamp.png \
- stock-annot-strikeout.png \
- stock-annot-text.png \
- stock-annot-trapnet.png \
- stock-annot-underline.png \
- stock-annot-widget.png \
- stock-annot-unknown.png
-endif
+test_gdk_output_dev_SOURCES = \
+ GDKSplashOutputDev.cc \
+ GDKSplashOutputDev.h \
+ SplashOutputDev.cc \
+ SplashOutputDev.h \
+ $(common_sources) \
+ test-gdk-output-dev.cc
+
+test_gdk_output_dev_LDADD = \
+ libxpdf.a \
+ $(top_builddir)/pdf/goo/libGoo.a \
+ $(top_builddir)/pdf/fofi/libfofi.a \
+ $(top_builddir)/pdf/splash/libsplash.a \
+ $(GTK_LIBS)
+
+EXTRA_DIST = config.h
#include <stddef.h>
#include <string.h>
#include "GString.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "GlobalParams.h"
#include "Page.h"
#include "Catalog.h"
#include <math.h>
#include "GString.h"
#include "GList.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "GlobalParams.h"
#include "Object.h"
#include "Error.h"
#endif
#include <stddef.h>
-#include "config.h"
+#include "xpdfconfig.h"
#include "Object.h"
#include "GlobalParams.h"
#include "OutputDev.h"
#include "gtypes.h"
#include "SplashTypes.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "OutputDev.h"
class GfxState;
class SplashFontEngine;
class SplashFont;
class T3FontCache;
+class XRef;
struct T3FontCacheTag;
struct T3GlyphStack;
struct GfxRGB;
#include <ctype.h>
#include "gmem.h"
#include "gfile.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "Error.h"
#include "Object.h"
#ifndef NO_DECRYPTION
#include "gmem.h"
#include "GString.h"
#include "GList.h"
-#include "config.h"
+#include "xpdfconfig.h"
#include "Error.h"
#include "GlobalParams.h"
#include "UnicodeMap.h"
#include "Error.h"
#include "XPDFViewer.h"
#include "XPDFApp.h"
-#include "config.h"
+#include "xpdfconfig.h"
// these macro defns conflict with xpdf's Object class
#ifdef LESSTIF_VERSION
#include "XPDFApp.h"
#include "XPDFViewer.h"
#include "PSOutputDev.h"
-#include "config.h"
+#include "xpdfconfig.h"
// these macro defns conflict with xpdf's Object class
#ifdef LESSTIF_VERSION
#include "GfxFont.h"
#include "Annot.h"
#include "PDFDoc.h"
-#include "config.h"
+#include "xpdfconfig.h"
static char *fontTypeNames[] = {
"unknown",
#include "PDFDoc.h"
#include "ImageOutputDev.h"
#include "Error.h"
-#include "config.h"
+#include "xpdfconfig.h"
static int firstPage = 1;
static int lastPage = 0;
#include "CharTypes.h"
#include "UnicodeMap.h"
#include "Error.h"
-#include "config.h"
+#include "xpdfconfig.h"
static void printInfoString(Dict *infoDict, char *key, char *text,
UnicodeMap *uMap);
#include "SplashBitmap.h"
#include "Splash.h"
#include "SplashOutputDev.h"
-#include "config.h"
+#include "xpdfconfig.h"
static int firstPage = 1;
static int lastPage = 0;
#include "PDFDoc.h"
#include "PSOutputDev.h"
#include "Error.h"
-#include "config.h"
+#include "xpdfconfig.h"
static int firstPage = 1;
static int lastPage = 0;
#include "CharTypes.h"
#include "UnicodeMap.h"
#include "Error.h"
-#include "config.h"
+#include "xpdfconfig.h"
static void printInfoString(FILE *f, Dict *infoDict, char *key,
char *text1, char *text2, UnicodeMap *uMap);
--- /dev/null
+/**
+ * render a PDF to GDKSplashOutputDev
+ *
+ * Copyright 2004 Red Hat, Inc.
+ */
+
+#include <config.h>
+
+#include <aconf.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gpdf-g-switch.h"
+#include <gtk/gtk.h>
+#include "gpdf-g-switch.h"
+
+#include "GlobalParams.h"
+#include "GDKSplashOutputDev.h"
+#include "PDFDoc.h"
+#include "ErrorCodes.h"
+
+typedef struct
+{
+ GtkWidget *window;
+ GtkWidget *sw;
+ GtkWidget *drawing_area;
+ GDKSplashOutputDev *out;
+ PDFDoc *doc;
+} View;
+
+static void
+drawing_area_expose (GtkWidget *drawing_area,
+ GdkEventExpose *event,
+ void *data)
+{
+ View *v = (View*) data;
+ int x, y, w, h;
+ GdkRectangle document;
+ GdkRectangle draw;
+
+ gdk_window_clear (drawing_area->window);
+
+ document.x = 0;
+ document.y = 0;
+ document.width = v->out->getBitmapWidth();
+ document.height = v->out->getBitmapHeight();
+
+ if (gdk_rectangle_intersect (&document, &event->area, &draw))
+ {
+ v->out->redraw (draw.x, draw.y,
+ drawing_area->window,
+ draw.x, draw.y,
+ draw.width, draw.height);
+ }
+}
+
+static int
+view_load (View *v,
+ const char *filename)
+{
+ PDFDoc *newDoc;
+ int err;
+ GString *filename_g;
+ GtkAdjustment *hadj;
+ GtkAdjustment *vadj;
+ int w, h;
+
+ filename_g = new GString (filename);
+
+ // open the PDF file
+ newDoc = new PDFDoc(filename_g, 0, 0);
+
+ delete filename_g;
+
+ if (!newDoc->isOk())
+ {
+ err = newDoc->getErrorCode();
+ delete newDoc;
+ return err;
+ }
+
+ if (v->doc)
+ delete v->doc;
+ v->doc = newDoc;
+
+ v->out->startDoc(v->doc->getXRef());
+
+ v->doc->displayPage (v->out, 1, 72, 72, 0, gTrue, gTrue);
+
+ w = v->out->getBitmapWidth();
+ h = v->out->getBitmapHeight();
+
+ gtk_widget_set_size_request (v->drawing_area, w, h);
+}
+
+static void
+view_show (View *v)
+{
+ gtk_widget_show (v->window);
+}
+
+static void
+redraw_callback (void *data)
+{
+ View *v = (View*) data;
+
+ gtk_widget_queue_draw (v->drawing_area);
+}
+
+static View*
+view_new (void)
+{
+ View *v;
+ GtkWidget *window;
+ GtkWidget *drawing_area;
+ GtkWidget *sw;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ drawing_area = gtk_drawing_area_new ();
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+
+ gtk_container_add (GTK_CONTAINER (window), sw);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), drawing_area);
+
+ gtk_widget_show_all (sw);
+
+ v = g_new0 (View, 1);
+
+ v->window = window;
+ v->drawing_area = drawing_area;
+ v->sw = sw;
+ v->out = new GDKSplashOutputDev (gtk_widget_get_screen (window),
+ redraw_callback, (void*) v);
+ v->doc = 0;
+
+ g_signal_connect (drawing_area,
+ "expose_event",
+ G_CALLBACK (drawing_area_expose),
+ (void*) v);
+
+ return v;
+}
+
+int
+main (int argc, char *argv [])
+{
+ View *v;
+ int i;
+
+ gtk_init (&argc, &argv);
+
+ globalParams = new GlobalParams("/etc/xpdfrc");
+ globalParams->setupBaseFonts(NULL);
+
+ i = 1;
+ while (i < argc)
+ {
+ int err;
+
+ v = view_new ();
+
+ err = view_load (v, argv[i]);
+
+ if (err != errNone)
+ g_printerr ("Error loading document!\n");
+
+ view_show (v);
+
+ ++i;
+ }
+
+ gtk_main ();
+
+ delete globalParams;
+
+ return 0;
+}
#include "GlobalParams.h"
#include "Object.h"
#include "XPDFApp.h"
-#include "config.h"
+#include "xpdfconfig.h"
//------------------------------------------------------------------------
// command line options