From: Michael Meeks Date: Tue, 24 Aug 1999 17:19:42 +0000 (+0000) Subject: Fix ( workaround ) for xpdf's global xref feature :-) X-Git-Tag: ChangeLog~5 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=ae59cfdd10d16d5f360a97bf40f74e50ad998d92;p=evince.git Fix ( workaround ) for xpdf's global xref feature :-) --- diff --git a/pdf/xpdf/BonoboFile.cc b/pdf/xpdf/BonoboFile.cc deleted file mode 100644 index ea8f2f71..00000000 --- a/pdf/xpdf/BonoboFile.cc +++ /dev/null @@ -1,98 +0,0 @@ -//======================================================================== -// -// BonoboFile.cc -// -// Copyright 1999 Derek B. Noonburg assigned by Michael Meeks. -// -//======================================================================== - -#ifdef __GNUC__ -#pragma implementation -#endif - -#include -#include -#include -#ifndef WIN32 -#include -#endif -#include -#include - -#include "BaseFile.h" - -//define HARD_DEBUG - -/* The open/close is done for you by the Bonobo server */ - -void -bfclose (BaseFile file) -{ -} - -size_t -bfread (void *ptr, size_t size, size_t nmemb, BaseFile file) -{ - CORBA_long len; - CORBA_Environment ev; - GNOME_Stream_iobuf *buffer = NULL; - - g_return_val_if_fail (ptr != NULL, 0); - -#ifdef HARD_DEBUG - printf ("read %p %d %d to %p\n", file, size, nmemb, ptr); -#endif - len = GNOME_Stream_read (file, size*nmemb, &buffer, &ev); - g_return_val_if_fail (ev._major == CORBA_NO_EXCEPTION, 0); - -#ifdef HARD_DEBUG - printf ("Read %d bytes %p %d\n", len, buffer->_buffer, buffer->_length); -#endif - memcpy (ptr, buffer->_buffer, buffer->_length); - - return len; -} - -int -bfseek (BaseFile file, long offset, int whence) -{ - CORBA_Environment ev; - GNOME_Stream_SeekType t; -#ifdef HARD_DEBUG - printf ("Seek %p %d %d\n", file, offset, whence); -#endif - if (whence == SEEK_SET) - t = GNOME_Stream_SEEK_SET; - else if (whence == SEEK_CUR) - t = GNOME_Stream_SEEK_CUR; - else - t = GNOME_Stream_SEEK_END; - - return GNOME_Stream_seek (file, offset, t, &ev); -} - -void -brewind (BaseFile file) -{ - CORBA_Environment ev; -#ifdef HARD_DEBUG - printf ("rewind %p\n", file); -#endif - GNOME_Stream_seek (file, 0, GNOME_Stream_SEEK_SET, &ev); -} - -long -bftell (BaseFile file) -{ - CORBA_Environment ev; - CORBA_long pos; -#ifdef HARD_DEBUG - printf ("tell %p\n", file); -#endif - pos = GNOME_Stream_seek (file, 0, GNOME_Stream_SEEK_CUR, &ev); -#ifdef HARD_DEBUG - printf ("tell returns %d\n", pos); -#endif - - return pos; -} diff --git a/pdf/xpdf/BonoboFile.h b/pdf/xpdf/BonoboFile.h deleted file mode 100644 index d834d044..00000000 --- a/pdf/xpdf/BonoboFile.h +++ /dev/null @@ -1,30 +0,0 @@ -//======================================================================== -// -// BonoboFile.h -// -// Copyright 1999 Derek B. Noonburg assigned by Michael Meeks. -// -//======================================================================== - -#ifndef BONOBOFILE_H -#define BONOBOFILE_H - -extern "C" { -#define GString G_String -#include -#include -#include -#undef GString -} - -typedef GNOME_Stream BaseFile; - -/* The open/close is done for you by the Bonobo server */ - -extern void bfclose (BaseFile file); -extern size_t bfread (void *ptr, size_t size, size_t nmemb, BaseFile file); -extern int bfseek (BaseFile file, long offset, int whence); -extern void brewind (BaseFile file); -extern long bftell (BaseFile file); - -#endif /* BONOBOFILE_H */ diff --git a/pdf/xpdf/Object.h b/pdf/xpdf/Object.h index 789cd5fa..b3625759 100644 --- a/pdf/xpdf/Object.h +++ b/pdf/xpdf/Object.h @@ -22,6 +22,7 @@ class Array; class Dict; class Stream; +class XRef; //------------------------------------------------------------------------ // Ref @@ -292,4 +293,6 @@ inline void Object::streamSetPos(int pos) inline Dict *Object::streamGetDict() { return stream->getDict(); } +#include "XRef.h" + #endif diff --git a/pdf/xpdf/bonobo-image-x-pdf.cc b/pdf/xpdf/bonobo-image-x-pdf.cc index 346ab5c2..caa65fcd 100644 --- a/pdf/xpdf/bonobo-image-x-pdf.cc +++ b/pdf/xpdf/bonobo-image-x-pdf.cc @@ -66,6 +66,7 @@ typedef struct { GnomeEmbeddable *embeddable; PDFDoc *pdf; + XRef *xref; /* Ugly global XRef hack fix */ BonoboStream *pdf_stream; GNOME_Stream bonobo_stream; @@ -147,10 +148,13 @@ render_page (view_data_t *view_data) { setup_pixmap (view_data->bed, view_data, view_data->win); + xref = view_data->bed->xref; /* Ugly global XRef hack fix */ view_data->out->startDoc(); view_data->bed->pdf->displayPage(view_data->out, view_data->page, view_data->zoom, 0, gTrue); + view_data->bed->xref = xref; + xref = NULL; } static void @@ -236,7 +240,6 @@ bed_free_data (bed_t *bed) } } - /* * Loads a PDF from a GNOME_Stream */ @@ -269,6 +272,8 @@ load_image_from_stream (GnomePersistStream *ps, GNOME_Stream stream, void *data) obj.initNull(); bed->pdf_stream = new BonoboStream (stream, 0, -1, &obj); bed->pdf = new PDFDoc (bed->pdf_stream); + bed->xref = xref; /* Ugly global XRef hack fix */ + xref = NULL; #if PDF_DEBUG > 0 printf ("Done load\n"); @@ -303,6 +308,8 @@ extern "C" { { CORBA_Environment ev; + printf ("Destroying embedded component\n"); + while (bed->views) destroy_view (NULL, (view_data_t *)bed->views->data);