]> www.fi.muni.cz Git - evince.git/blobdiff - ps/ps-document.c
Updated German translation.
[evince.git] / ps / ps-document.c
index 3796f7d0d818d645c01e1e8a1fb0fc276daae4b0..fd6fc4a62d5785fcf250a806cda5b5e441f465d8 100644 (file)
@@ -272,6 +272,9 @@ ps_document_init(PSDocument * gs)
   gs->right_margin = 0;
   gs->bottom_margin = 0;
 
   gs->right_margin = 0;
   gs->bottom_margin = 0;
 
+  gs->page_x_offset = 0;
+  gs->page_y_offset = 0;
+
   /* Set user defined defaults */
   gs->override_orientation = gtk_gs_defaults_get_override_orientation();
   gs->fallback_orientation = gtk_gs_defaults_get_orientation();
   /* Set user defined defaults */
   gs->override_orientation = gtk_gs_defaults_get_override_orientation();
   gs->fallback_orientation = gtk_gs_defaults_get_orientation();
@@ -1434,7 +1437,7 @@ ps_document_get_page_count(PSDocument * gs)
     if(gs->structured_doc)
       return gs->doc->numpages;
     else
     if(gs->structured_doc)
       return gs->doc->numpages;
     else
-      return 1;
+      return G_MAXINT;
   }
   else
     return 0;
   }
   else
     return 0;
@@ -1454,8 +1457,6 @@ ps_document_goto_page(PSDocument * gs, gint page)
   if(page < 0)
     page = 0;
 
   if(page < 0)
     page = 0;
 
-  ps_document_set_page_size(gs, -1, page);
-
   if(gs->structured_doc && gs->doc) {
     if(page >= gs->doc->numpages)
       page = gs->doc->numpages - 1;
   if(gs->structured_doc && gs->doc) {
     if(page >= gs->doc->numpages)
       page = gs->doc->numpages - 1;
@@ -1472,6 +1473,8 @@ ps_document_goto_page(PSDocument * gs, gint page)
       gs->changed = TRUE;
     }
 
       gs->changed = TRUE;
     }
 
+    ps_document_set_page_size(gs, -1, page);
+
     gs->changed = FALSE;
 
     if(is_interpreter_ready(gs)) {
     gs->changed = FALSE;
 
     if(is_interpreter_ready(gs)) {
@@ -1498,6 +1501,8 @@ ps_document_goto_page(PSDocument * gs, gint page)
     if(page == gs->current_page && !gs->changed)
       return TRUE;
 
     if(page == gs->current_page && !gs->changed)
       return TRUE;
 
+    ps_document_set_page_size(gs, -1, page);
+
     if(!is_interpreter_ready(gs))
       ps_document_enable_interpreter(gs);
 
     if(!is_interpreter_ready(gs))
       ps_document_enable_interpreter(gs);
 
@@ -1692,6 +1697,15 @@ ps_document_load (EvDocument  *document,
        return result;
 }
 
        return result;
 }
 
+static gboolean
+ps_document_save (EvDocument  *document,
+                 const char  *uri,
+                 GError     **error)
+{
+       g_warning ("ps_document_save not implemented"); /* FIXME */
+       return TRUE;
+}
+
 static int
 ps_document_get_n_pages (EvDocument  *document)
 {
 static int
 ps_document_get_n_pages (EvDocument  *document)
 {
@@ -1762,13 +1776,20 @@ ps_document_set_page_offset (EvDocument  *document,
                              int          x,
                              int          y)
 {
                              int          x,
                              int          y)
 {
+       PSDocument *gs = PS_DOCUMENT (document);
+
+       gs->page_x_offset = x;
+       gs->page_y_offset = y;
 }
 
 static void
 ps_document_get_page_size (EvDocument   *document,
 }
 
 static void
 ps_document_get_page_size (EvDocument   *document,
-                           int          *width,
-                           int          *height)
+                          int           page,
+                          int          *width,
+                          int          *height)
 {
 {
+       /* Post script documents never vary in size */
+
        PSDocument *gs = PS_DOCUMENT (document);
 
        if (width) {
        PSDocument *gs = PS_DOCUMENT (document);
 
        if (width) {
@@ -1788,6 +1809,8 @@ ps_document_render (EvDocument  *document,
                    int          clip_height)
 {
        PSDocument *gs = PS_DOCUMENT (document);
                    int          clip_height)
 {
        PSDocument *gs = PS_DOCUMENT (document);
+       GdkRectangle page;
+       GdkRectangle draw;
        GdkGC *gc;
 
        if (gs->pstarget == NULL ||
        GdkGC *gc;
 
        if (gs->pstarget == NULL ||
@@ -1795,21 +1818,49 @@ ps_document_render (EvDocument  *document,
                return;
        }
 
                return;
        }
 
+       page.x = gs->page_x_offset;
+       page.y = gs->page_y_offset;
+       page.width = gs->width;
+       page.height = gs->height;
+
+       draw.x = clip_x;
+       draw.y = clip_y;
+       draw.width = clip_width;
+       draw.height = clip_height;
+
        gc = gdk_gc_new (gs->pstarget);
 
        gdk_draw_drawable (gs->pstarget, gc,
                           gs->bpixmap,
        gc = gdk_gc_new (gs->pstarget);
 
        gdk_draw_drawable (gs->pstarget, gc,
                           gs->bpixmap,
-                          clip_x, clip_y,
-                          clip_x, clip_y,
-                          clip_width, clip_height);
+                          draw.x - page.x, draw.y - page.y,
+                          draw.x, draw.y,
+                          draw.width, draw.height);
 
        g_object_unref (gc);
 }
 
 
        g_object_unref (gc);
 }
 
+static char *
+ps_document_get_text (EvDocument *document, GdkRectangle *rect)
+{
+       g_warning ("ps_document_get_text not implemented"); /* FIXME ? */
+       return NULL;
+}
+
+static EvLink *
+ps_document_get_link (EvDocument *document,
+                     int         x,
+                     int         y)
+{
+       return NULL;
+}
+
 static void
 ps_document_document_iface_init (EvDocumentIface *iface)
 {
        iface->load = ps_document_load;
 static void
 ps_document_document_iface_init (EvDocumentIface *iface)
 {
        iface->load = ps_document_load;
+       iface->save = ps_document_save;
+       iface->get_text = ps_document_get_text;
+       iface->get_link = ps_document_get_link;
        iface->get_n_pages = ps_document_get_n_pages;
        iface->set_page = ps_document_set_page;
        iface->get_page = ps_document_get_page;
        iface->get_n_pages = ps_document_get_n_pages;
        iface->set_page = ps_document_set_page;
        iface->get_page = ps_document_get_page;