+++ /dev/null
-/*
- * image/x-pdf BonoboObject.
- *
- * Author:
- * Michael Meeks <michael@imaginator.com>
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <config.h>
-extern "C" {
-#define GString G_String
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <bonobo/gnome-bonobo.h>
-#undef GString
-}
-#include "gtypes.h"
-#include "GString.h"
-#include "parseargs.h"
-#include "gfile.h"
-#include "gmem.h"
-#include "Object.h"
-#include "Stream.h"
-#include "Array.h"
-#include "Dict.h"
-#include "XRef.h"
-#include "Catalog.h"
-#include "Page.h"
-#include "Link.h"
-#include "PDFDoc.h"
-#include "GOutputDev.h"
-#include "PSOutputDev.h"
-#include "TextOutputDev.h"
-#include "Params.h"
-#include "Error.h"
-#include "config.h"
-#include "BonoboStream.h"
-
-#define PDF_DEBUG 0
-
-GBool printCommands = gFalse;
-
-/*
- * Number of servers running on the system
- * when the count reaches zero, we unregister from the
- * Name Server and we shut down.
- */
-static int embeddable_servers = 0;
-
-/*
- * Our embeddable factory
- */
-static GnomeEmbeddableFactory *factory;
-
-/* This lock protects the global PDF 'xref' variable */
-GMutex *xref_lock;
-
-/*
- * BonoboObject data
- */
-typedef struct {
- GnomeEmbeddable *embeddable;
-
- PDFDoc *pdf;
- XRef *xref; /* Ugly global XRef hack fix */
-
- BonoboStream *pdf_stream;
- GNOME_Stream bonobo_stream;
-
- GList *views;
-} bed_t;
-
-/*
- * View data
- */
-typedef struct {
- GnomeView *view;
- bed_t *bed;
-
- double scale;
- GtkWidget *drawing_area;
- GdkPixmap *pixmap;
- GdkWindow *win;
- GOutputDev *out;
- GdkColor paper;
- gint w, h;
- gdouble zoom;
- gint page;
-} view_data_t;
-
-static inline void
-xref_do_lock (bed_t *bed)
-{
- g_return_if_fail (bed != NULL);
-
- g_mutex_lock (xref_lock);
- xref = bed->xref; /* Ugly global XRef hack fix */
-}
-
-static inline void
-xref_do_unlock (bed_t *bed)
-{
- xref = NULL;
- g_mutex_unlock (xref_lock);
-}
-
-
-extern "C" {
- static void realize_drawing_areas (bed_t *bed);
- static void setup_pixmap (bed_t *doc, view_data_t *view, GdkWindow *window);
-}
-
-static void
-redraw_view (view_data_t *view_data, GdkRectangle *rect)
-{
- gint width, height;
- bed_t *bed = view_data->bed;
-
- g_return_if_fail (view_data->pixmap != NULL);
-
- /*
- * Do not draw outside the region that we know how to display
- */
- if (rect->x > view_data->w)
- return;
-
- if (rect->y > view_data->h)
- return;
-
- /*
- * Clip the draw region
- */
- if (rect->x + rect->width > view_data->w)
- rect->width = view_data->w - rect->x;
-
- if (rect->y + rect->height > view_data->h)
- rect->height = view_data->h - rect->y;
-
- /*
- * Draw the exposed region.
- */
- gdk_draw_pixmap (view_data->drawing_area->window,
- view_data->drawing_area->style->white_gc,
- view_data->pixmap,
- rect->x, rect->y,
- rect->x, rect->y,
- rect->width,
- rect->height);
-}
-
-static void
-configure_size (view_data_t *view_data)
-{
- gtk_widget_set_usize (
- view_data->drawing_area,
- view_data->w,
- view_data->h);
-}
-
-static void
-render_page (view_data_t *view_data)
-{
- setup_pixmap (view_data->bed, view_data,
- view_data->win);
-
- xref_do_lock (view_data->bed);
- view_data->out->startDoc();
- view_data->bed->pdf->displayPage (view_data->out,
- view_data->page, view_data->zoom,
- 0, gTrue);
- xref_do_unlock (view_data->bed);
-}
-
-static void
-redraw_view_all (view_data_t *view_data)
-{
- GdkRectangle rect;
- g_return_if_fail (view_data != NULL);
-
-#if PDF_DEBUG > 0
- printf ("Redraw view of page %d\n", view_data->page);
-#endif
- render_page (view_data);
- rect.x = 0;
- rect.y = 0;
- rect.width = view_data->w;
- rect.height = view_data->h;
- redraw_view (view_data, &rect);
- gtk_widget_queue_draw (GTK_WIDGET (view_data->drawing_area));
-}
-
-static void
-redraw_all (bed_t *bed)
-{
- GList *l;
-
- for (l = bed->views; l; l = l->next) {
- GdkRectangle rect;
- view_data_t *view_data = (view_data_t *)l->data;
- redraw_view_all (view_data);
- }
-}
-
-static int
-save_image (GnomePersistStream *ps, GNOME_Stream stream, void *data)
-{
- g_warning ("Unimplemented");
- return -1;
-}
-
-/*
- * different size ?
- */
-static gboolean
-setup_size (bed_t *doc, view_data_t *view_data)
-{
- int w, h;
- gboolean same;
-
- if (!doc || !view_data || !doc->pdf) {
- view_data->w = 320;
- view_data->h = 200;
- return FALSE;
- }
- xref_do_lock (view_data->bed);
- w = (int)((doc->pdf->getPageWidth (view_data->page)
- * view_data->zoom) / 72.0);
- h = (int)((doc->pdf->getPageHeight (view_data->page)
- * view_data->zoom) / 72.0);
- xref_do_unlock (view_data->bed);
-
- if (view_data->w == w && view_data->h == h)
- same = TRUE;
- else
- same = FALSE;
- view_data->w = w;
- view_data->h = h;
-
- return same;
-}
-
-static void
-bed_free_data (bed_t *bed)
-{
- g_return_if_fail (bed != NULL);
-
- xref_do_lock (bed);
- if (bed->pdf)
- delete bed->pdf;
- bed->pdf = NULL;
- xref_do_unlock (bed);
-
- if (bed->pdf_stream)
- delete (bed->pdf_stream);
- bed->pdf_stream = NULL;
-
- if (bed->bonobo_stream) {
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
- CORBA_Object_release (bed->bonobo_stream, &ev);
- bed->bonobo_stream = NULL;
- CORBA_exception_free (&ev);
- }
-}
-
-/*
- * Loads a PDF from a GNOME_Stream
- */
-static int
-load_image_from_stream (GnomePersistStream *ps, GNOME_Stream stream, void *data)
-{
- bed_t *bed = (bed_t *)data;
- CORBA_long length;
- GNOME_Stream_iobuf *buffer;
- CORBA_Environment ev;
- guint lp;
- #define CHUNK 512
- FILE *hack;
- char *name;
- Object obj;
-
- if (bed->pdf || bed->pdf_stream ||
- bed->bonobo_stream) {
- g_warning ("Won't overwrite pre-existing stream: you wierdo");
- return 0;
- }
- CORBA_exception_init (&ev);
-
- /* We need this for later */
- CORBA_Object_duplicate (stream, &ev);
- bed->bonobo_stream = stream;
- g_return_val_if_fail (ev._major == CORBA_NO_EXCEPTION, 0);
-
-#if PDF_DEBUG > 0
- printf ("Loading PDF from persiststream\n");
-#endif
- xref_do_lock (bed);
- 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");
-#endif
- if (!(bed->pdf->isOk())) {
- g_warning ("Duff pdf data\n");
- bed_free_data (bed);
- }
- if (!bed->pdf->getCatalog()) {
- g_warning ("Duff pdf catalog\n");
- bed_free_data (bed);
- }
- xref_do_unlock (bed);
-
- realize_drawing_areas (bed);
- redraw_all (bed);
-
- CORBA_exception_free (&ev);
- return 0;
-}
-
-extern "C" {
-
- static void
- destroy_view (GnomeView *view, view_data_t *view_data)
- {
- view_data->bed->views = g_list_remove (view_data->bed->views, view_data);
- gtk_object_unref (GTK_OBJECT (view_data->drawing_area));
-
- g_free (view_data);
- }
-
- static void
- destroy_embed (GnomeView *view, bed_t *bed)
- {
- CORBA_Environment ev;
-
- printf ("Destroying embedded component\n");
-
- while (bed->views)
- destroy_view (NULL, (view_data_t *)bed->views->data);
-
- bed_free_data (bed);
- g_free (bed);
-
- embeddable_servers--;
-
- if (embeddable_servers == 0){
- gnome_object_unref (GNOME_OBJECT (factory));
- gtk_main_quit ();
- }
- }
-
- static void
- setup_pixmap (bed_t *doc, view_data_t *view_data, GdkWindow *window)
- {
- GdkGCValues gcValues;
- GdkGC *strokeGC;
- PDFDoc *pdf;
- int w, h;
- GdkPixmap *pixmap = NULL;
-
- g_return_if_fail (doc != NULL);
- g_return_if_fail (doc->pdf != NULL);
- g_return_if_fail (view_data != NULL);
-
- pdf = doc->pdf;
-
- if (setup_size (doc, view_data) &&
- view_data->pixmap) {
-#if PDF_DEBUG > 0
- printf ("No need to re-init output device\n");
-#endif
- return;
- }
-
- w = view_data->w;
- h = view_data->h;
-
- pixmap = gdk_pixmap_new (window, w, h, -1);
-
- gdk_color_white (gtk_widget_get_default_colormap(), &view_data->paper);
- view_data->out = new GOutputDev (pixmap, view_data->paper, window);
-
- gdk_color_white (gtk_widget_get_default_colormap (), &gcValues.foreground);
- gdk_color_black (gtk_widget_get_default_colormap (), &gcValues.background);
- gcValues.line_width = 1;
- gcValues.line_style = GDK_LINE_SOLID;
- strokeGC = gdk_gc_new_with_values (
- pixmap, &gcValues,
- (enum GdkGCValuesMask)(GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_LINE_WIDTH | GDK_GC_LINE_STYLE));
-
- gdk_draw_rectangle (pixmap, strokeGC,
- TRUE, 0, 0,
- w, h);
-
- view_data->pixmap = pixmap;
- configure_size (view_data);
- }
-
- static gboolean
- view_is_good (view_data_t *view_data)
- {
- if (!view_data ||
- !view_data->bed ||
- !view_data->bed->pdf)
- return FALSE;
-
- return TRUE;
- }
-
- static gboolean
- first_page (view_data_t *view_data)
- {
- g_return_val_if_fail (view_is_good (view_data), FALSE);
- if (view_data->page != 1) {
- view_data->page = 1;
- return TRUE;
- } else
- return FALSE;
- }
-
- static gboolean
- last_page (view_data_t *view_data)
- {
- g_return_val_if_fail (view_is_good (view_data), FALSE);
- if (view_data->page < view_data->bed->pdf->getNumPages()) {
- view_data->page = view_data->bed->pdf->getNumPages();
- return TRUE;
- } else
- return FALSE;
- }
-
- static gboolean
- next_page (view_data_t *view_data)
- {
- g_return_val_if_fail (view_is_good (view_data), FALSE);
- if (view_data->page < view_data->bed->pdf->getNumPages()) {
- view_data->page++;
- return TRUE;
- } else
- return FALSE;
- }
-
- static gboolean
- prev_page (view_data_t *view_data)
- {
- g_return_val_if_fail (view_is_good (view_data), FALSE);
- if (view_data->page > 1) {
- view_data->page--;
- return TRUE;
- } else
- return FALSE;
- }
-
- static void
- page_first_cb (GnomeUIHandler *uih, void *data, char *path)
- {
- first_page ((view_data_t *)data);
- redraw_view_all ((view_data_t *)data);
- }
-
- static void
- page_next_cb (GnomeUIHandler *uih, void *data, char *path)
- {
- next_page ((view_data_t *)data);
- redraw_view_all ((view_data_t *)data);
- }
-
- static void
- page_prev_cb (GnomeUIHandler *uih, void *data, char *path)
- {
- prev_page ((view_data_t *)data);
- redraw_view_all ((view_data_t *)data);
- }
-
- static void
- page_last_cb (GnomeUIHandler *uih, void *data, char *path)
- {
- last_page ((view_data_t *)data);
- redraw_view_all ((view_data_t *)data);
- }
-}
-
-static void
-view_create_menus (view_data_t *view_data)
-{
- GNOME_UIHandler remote_uih;
- GnomeView *view = view_data->view;
- GnomeUIHandler *uih;
-
- uih = gnome_view_get_ui_handler (view);
- remote_uih = gnome_view_get_remote_ui_handler (view);
-
- if (remote_uih == CORBA_OBJECT_NIL) {
- g_warning ("server has no UI hander");
- return;
- }
-
- gnome_ui_handler_set_container (uih, remote_uih);
-
- gnome_ui_handler_menu_new_subtree (uih, "/Page",
- N_("Page..."),
- N_("Set the currently displayed page"),
- 1,
- GNOME_UI_HANDLER_PIXMAP_NONE, NULL,
- 0, (GdkModifierType)0);
-
- gnome_ui_handler_menu_new_item (uih, "/Page/First",
- N_("First"), N_("View the first page"), -1,
- GNOME_UI_HANDLER_PIXMAP_NONE, NULL, 0,
- (GdkModifierType)0, page_first_cb, (gpointer)view_data);
-
- gnome_ui_handler_menu_new_item (uih, "/Page/Prev",
- N_("Previous"), N_("View the previous page"), -1,
- GNOME_UI_HANDLER_PIXMAP_NONE, NULL, 0,
- (GdkModifierType)0, page_prev_cb, (gpointer)view_data);
-
- gnome_ui_handler_menu_new_item (uih, "/Page/Next",
- N_("Next"), N_("View the next page"), -1,
- GNOME_UI_HANDLER_PIXMAP_NONE, NULL, 0,
- (GdkModifierType)0, page_next_cb, (gpointer)view_data);
-
- gnome_ui_handler_menu_new_item (uih, "/Page/Last",
- N_("Last"), N_("View the last page"), -1,
- GNOME_UI_HANDLER_PIXMAP_NONE, NULL, 0,
- (GdkModifierType)0, page_last_cb, (gpointer)view_data);
-
- gnome_ui_handler_toolbar_new_item (uih, "/First",
- N_("First"), N_("View the first page"), -1,
- GNOME_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_FIRST,
- 0, (GdkModifierType)0, page_first_cb, (gpointer)view_data);
- gnome_ui_handler_toolbar_new_item (uih, "/Prev",
- N_("Previous"), N_("View the previous page"), -1,
- GNOME_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_BACK,
- 0, (GdkModifierType)0, page_prev_cb, (gpointer)view_data);
- gnome_ui_handler_toolbar_new_item (uih, "/Next",
- N_("Next"), N_("View the next page"), -1,
- GNOME_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_FORWARD,
- 0, (GdkModifierType)0, page_next_cb, (gpointer)view_data);
- gnome_ui_handler_toolbar_new_item (uih, "/Last",
- N_("Last"), N_("View the last page"), -1,
- GNOME_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_LAST,
- 0, (GdkModifierType)0, page_last_cb, (gpointer)view_data);
-}
-
-/*
- * When this view is deactivated, we must remove our menu items.
- */
-static void
-view_remove_menus (view_data_t *view_data)
-{
- GnomeView *view = view_data->view;
- GnomeUIHandler *uih;
-
- uih = gnome_view_get_ui_handler (view);
-
- gnome_ui_handler_unset_container (uih);
-}
-
-extern "C" {
-
- static void
- drawing_area_realize (GtkWidget *drawing_area, view_data_t *view_data)
- {
- g_return_if_fail (view_data != NULL);
- g_return_if_fail (drawing_area != NULL);
-
- view_data->win = gtk_widget_get_parent_window (drawing_area);
- }
-
- static int
- drawing_area_exposed (GtkWidget *widget, GdkEventExpose *event, view_data_t *view_data)
- {
- if (!view_data ||
- !view_data->bed->pdf)
- return TRUE;
-
- redraw_view (view_data, &event->area);
-
- return TRUE;
- }
-
- static void
- view_activate (GnomeView *view, gboolean activate, gpointer data)
- {
- view_data_t *view_data = (view_data_t *) data;
- g_return_if_fail (view != NULL);
- g_return_if_fail (view_data != NULL);
-
- gnome_view_activate_notify (view, activate);
-
-#if PDF_DEBUG > 0
- printf ("View change activation to %d\n", activate);
-#endif
- /*
- * If we were just activated, we merge in our menu entries.
- * If we were just deactivated, we remove them.
- */
- if (activate)
- view_create_menus (view_data);
- else
- view_remove_menus (view_data);
- }
-
- static void
- view_size_query (GnomeView *view, int *desired_width, int *desired_height,
- gpointer data)
- {
- view_data_t *view_data = (view_data_t *) data;
-
- g_return_if_fail (view_data != NULL);
-
- *desired_width = view_data->w;
- *desired_height = view_data->h;
- }
-
- static void
- view_zoom_query (GnomeView *view, gdouble new_zoom, gpointer data)
- {
- view_data_t *view_data = (view_data_t *) data;
-
- g_return_if_fail (view_data != NULL);
-
- /* The rational behind this is that the _entire_ page is allocated
- regardless of viewport size, so you _really_ don't want it too big ! */
- g_return_if_fail (new_zoom > 10.0);
- g_return_if_fail (new_zoom < 180.0);
-
- view_data->zoom = new_zoom;
- redraw_view_all (view_data);
- }
-
- static void
- realize_drawing_areas (bed_t *bed)
- {
- GList *l;
-
- for (l = bed->views; l; l = l->next) {
- view_data_t *view_data = (view_data_t *)l->data;
- g_return_if_fail (view_data->win);
- render_page (view_data);
- configure_size (view_data);
- }
- }
-
- static void
- view_switch_page (GnomeView *view, const char *verb_name, void *user_data)
- {
- view_data_t *view_data = (view_data_t *) user_data;
- GdkRectangle rect;
- gboolean changed = FALSE;
-
- if (!g_strcasecmp (verb_name, "firstpage")) {
- changed = first_page (view_data);
- } else if (!g_strcasecmp (verb_name, "prevpage")) {
- changed = prev_page (view_data);
- } else if (!g_strcasecmp (verb_name, "nextpage")) {
- changed = next_page (view_data);
- } else if (!g_strcasecmp (verb_name, "lastpage")) {
- changed = last_page (view_data);
- } else
- g_warning ("Unknown verb");
-
- if (changed) {
- render_page (view_data);
- redraw_view (view_data, &rect);
- gtk_widget_queue_draw (GTK_WIDGET (view_data->drawing_area));
- }
- }
-}
-
-static GnomeView *
-view_factory (GnomeEmbeddable *embeddable,
- const GNOME_ViewFrame view_frame,
- void *data)
-{
- GnomeView *view;
- GnomeUIHandler *uih;
- bed_t *bed = (bed_t *)data;
- view_data_t *view_data = g_new (view_data_t, 1);
-
-#if PDF_DEBUG > 0
- printf ("Created new bonobo object view %p\n", view_data);
-#endif
-
- view_data->scale = 1.0;
- view_data->bed = bed;
- view_data->drawing_area = gtk_drawing_area_new ();
- view_data->pixmap = NULL;
- view_data->win = NULL;
- view_data->out = NULL;
- view_data->w = 320;
- view_data->h = 320;
- view_data->zoom = 43.0; /* 86.0; Must be small for demos :-) */
- view_data->page = 1;
-
- gtk_signal_connect (
- GTK_OBJECT (view_data->drawing_area),
- "realize",
- GTK_SIGNAL_FUNC (drawing_area_realize), view_data);
-
- gtk_signal_connect (
- GTK_OBJECT (view_data->drawing_area),
- "expose_event",
- GTK_SIGNAL_FUNC (drawing_area_exposed), view_data);
-
- gtk_widget_show (view_data->drawing_area);
-
- setup_size (bed, view_data);
-
- view = gnome_view_new (view_data->drawing_area);
- view_data->view = view;
-
- gtk_signal_connect (
- GTK_OBJECT (view), "destroy",
- GTK_SIGNAL_FUNC (destroy_view), view_data);
-
- /* UI handling */
- uih = gnome_ui_handler_new ();
- gnome_view_set_ui_handler (view, uih);
-
- gtk_signal_connect (GTK_OBJECT (view), "view_activate",
- GTK_SIGNAL_FUNC (view_activate), view_data);
-
- gtk_signal_connect (GTK_OBJECT (view), "size_query",
- GTK_SIGNAL_FUNC (view_size_query), view_data);
-
- gtk_signal_connect (GTK_OBJECT (view), "set_zoom_factor",
- GTK_SIGNAL_FUNC (view_zoom_query), view_data);
-
- bed->views = g_list_prepend (bed->views, view_data);
-
- /* Verb handling */
- gnome_view_register_verb (view, "FirstPage",
- view_switch_page, view_data);
- gnome_view_register_verb (view, "PrevPage",
- view_switch_page, view_data);
- gnome_view_register_verb (view, "NextPage",
- view_switch_page, view_data);
- gnome_view_register_verb (view, "LastPage",
- view_switch_page, view_data);
-
- return view;
-}
-
-static GnomeObject *
-embeddable_factory (GnomeEmbeddableFactory *This, void *data)
-{
- GnomeEmbeddable *embeddable;
- GnomePersistStream *stream;
- bed_t *bed = (bed_t *)data;
-
- bed = g_new0 (bed_t, 1);
- if (!bed)
- return NULL;
-
-#if PDF_DEBUG > 0
- printf ("Created new bonobo object %p\n", bed);
-#endif
- /*
- * Creates the BonoboObject server
- */
- embeddable = gnome_embeddable_new (view_factory, bed);
- if (embeddable == NULL){
- g_free (bed);
- return NULL;
- }
-
- bed->pdf = NULL;
-
- /*
- * Interface GNOME::PersistStream
- */
- stream = gnome_persist_stream_new ("bonobo-object:image-x-pdf",
- load_image_from_stream,
- save_image,
- bed);
- if (stream == NULL) {
- gtk_object_unref (GTK_OBJECT (embeddable));
- g_free (bed);
- return NULL;
- }
-
- bed->embeddable = embeddable;
-
- /*
- * Bind the interfaces
- */
- gnome_object_add_interface (GNOME_OBJECT (embeddable),
- GNOME_OBJECT (stream));
- gtk_signal_connect (
- GTK_OBJECT (embeddable), "destroy",
- GTK_SIGNAL_FUNC (destroy_embed), bed);
-
- embeddable_servers++;
-
- /* Setup some verbs */
- gnome_embeddable_add_verb (embeddable,
- "FirstPage",
- _("_First page"),
- _("goto the first page"));
- gnome_embeddable_add_verb (embeddable,
- "PrevPage",
- _("_Previous page"),
- _("goto the previous page"));
- gnome_embeddable_add_verb (embeddable,
- "NextPage",
- _("_Next page"),
- _("goto the next page"));
- gnome_embeddable_add_verb (embeddable,
- "LastPage",
- _("_Last page"),
- _("goto the last page"));
-
- return (GnomeObject *) embeddable;
-}
-
-static gboolean
-init_bonobo_image_x_pdf_factory (void)
-{
- factory = gnome_embeddable_factory_new (
- "bonobo-object-factory:image-x-pdf",
- embeddable_factory, NULL);
-
- if (factory == NULL)
- return FALSE;
- else
- return TRUE;
-}
-
-static void
-init_server_factory (int argc, char **argv)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- gnome_CORBA_init_with_popt_table (
- "bonobo-image-x-pdf", "1.0",
- &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-
- if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("I could not initialize Bonobo"));
-
- CORBA_exception_free (&ev);
-}
-
-int
-main (int argc, char *argv [])
-{
- g_thread_init (NULL);
- xref_lock = g_mutex_new ();
-
- init_server_factory (argc, argv);
- if (!init_bonobo_image_x_pdf_factory ()) {
- fprintf (stderr, "Could not initialize the Bonobo PDF factory\n"
- "probably a server is already running?");
- exit (1);
- }
-
- errorInit ();
-
- initParams (xpdfConfigFile); /* Init font path */
-
- gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
- gtk_widget_set_default_visual (gdk_rgb_get_visual ());
-
- bonobo_main ();
-
- freeParams ();
- g_mutex_free (xref_lock);
-
- return 0;
-}
-
+++ /dev/null
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>gpdf</name>
- <program_name>gpdf</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>True</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
- <translatable_strings_file></translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeApp</class>
- <name>gpdf</name>
- <width>600</width>
- <height>400</height>
- <title>GNOME PDF viewer</title>
- <enable_layout_config>True</enable_layout_config>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GnomeDock</class>
- <child_name>GnomeApp:dock</child_name>
- <name>dock1</name>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- <allow_floating>True</allow_floating>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem1</name>
- <border_width>2</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>0</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>True</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkMenuBar</class>
- <name>menubar1</name>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>file_menu</name>
- <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>file_menu_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>open_menu</name>
- <stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>close_menu</name>
- <stock_item>GNOMEUIINFO_MENU_CLOSE_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator1</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>print_menu</name>
- <stock_item>GNOMEUIINFO_MENU_PRINT_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>print_setup_menu</name>
- <stock_item>GNOMEUIINFO_MENU_PRINT_SETUP_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator2</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>exit_menu</name>
- <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>edit_menu</name>
- <stock_item>GNOMEUIINFO_MENU_EDIT_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>edit_menu_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>replace_menu</name>
- <stock_item>GNOMEUIINFO_MENU_FIND_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>find_again_menu</name>
- <stock_item>GNOMEUIINFO_MENU_FIND_AGAIN_ITEM</stock_item>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>separator5</name>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>properties_menu</name>
- <stock_item>GNOMEUIINFO_MENU_PROPERTIES_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>view_menu</name>
- <stock_item>GNOMEUIINFO_MENU_VIEW_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>view_menu_menu</name>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>larger_menu</name>
- <label>Larger</label>
- <right_justify>False</right_justify>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>smaller_menu</name>
- <label>smaller</label>
- <right_justify>False</right_justify>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>settings_menu</name>
- <stock_item>GNOMEUIINFO_MENU_SETTINGS_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>settings_menu_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>preferences_menu</name>
- <stock_item>GNOMEUIINFO_MENU_PREFERENCES_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkMenuItem</class>
- <name>help_menu</name>
- <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>
-
- <widget>
- <class>GtkMenu</class>
- <name>help_menu_menu</name>
-
- <widget>
- <class>GtkPixmapMenuItem</class>
- <name>about_menu</name>
- <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeDockItem</class>
- <name>dockitem2</name>
- <border_width>1</border_width>
- <placement>GNOME_DOCK_TOP</placement>
- <band>1</band>
- <position>0</position>
- <offset>0</offset>
- <locked>False</locked>
- <exclusive>True</exclusive>
- <never_floating>False</never_floating>
- <never_vertical>False</never_vertical>
- <never_horizontal>False</never_horizontal>
- <shadow_type>GTK_SHADOW_OUT</shadow_type>
-
- <widget>
- <class>GtkToolbar</class>
- <name>toolbar1</name>
- <border_width>1</border_width>
- <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
- <type>GTK_TOOLBAR_BOTH</type>
- <space_size>16</space_size>
- <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
- <relief>GTK_RELIEF_NONE</relief>
- <tooltips>True</tooltips>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>button2</name>
- <tooltip>Open File</tooltip>
- <label>Open</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_OPEN</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>first</name>
- <label>First</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_FIRST</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>back</name>
- <label>back</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_BACK</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>forward</name>
- <label>forward</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_FORWARD</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>last</name>
- <label>Last</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_LAST</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>larger</name>
- <label>larger</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_UP</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <child_name>Toolbar:button</child_name>
- <name>smaller</name>
- <label>smaller</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_DOWN</stock_pixmap>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDock:contents</child_name>
- <name>pane</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeAppBar</class>
- <child_name>GnomeApp:appbar</child_name>
- <name>appbar1</name>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- <has_progress>True</has_progress>
- <has_status>True</has_status>
- </widget>
-</widget>
-
-</GTK-Interface>