]> www.fi.muni.cz Git - evince.git/commitdiff
Keep offset in consideration in a few places
authorMarco Pesenti Gritti <marco@gnome.org>
Thu, 20 Jan 2005 18:05:09 +0000 (18:05 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Thu, 20 Jan 2005 18:05:09 +0000 (18:05 +0000)
2005-01-20  Marco Pesenti Gritti  <marco@gnome.org>

        * pdf/xpdf/pdf-document.cc:

        Keep offset in consideration in a few places

        * shell/ev-view.c: (expose_bin_window):

        Set the offsets so that the document is ever centered

ChangeLog
pdf/xpdf/pdf-document.cc

index b458e5424a8989cfd03edb13bc8841db7b566c07..5f99192ce7d4f2df77a3f084a4feea37eee3be21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-01-20  Marco Pesenti Gritti  <marco@gnome.org>
+
+       * pdf/xpdf/pdf-document.cc:
+
+       Keep offset in consideration in a few places
+
+       * shell/ev-view.c: (expose_bin_window):
+
+       Set the offsets so that the document is ever centered
+
 2005-01-20  Bryan Clark  <clarkbw@cvs.gnome.org>
 
        * TODO: Added TODO items and finished off the first todo item
index 2ec9d5e28ca4b423d519d29d0d11fe5a891a37bb..b9180bd9988b1e712c4c79a445401f5777e33e3e 100644 (file)
@@ -484,8 +484,8 @@ pdf_document_search_page_changed (PdfDocumentSearch   *search)
                                          &xMin, &yMin, &xMax, &yMax)) {
                 result.page_num = pdf_document->page;
 
-                result.highlight_area.x = xMin;
-                result.highlight_area.y = yMin;
+                result.highlight_area.x = xMin + pdf_document->page_x_offset;
+                result.highlight_area.y = yMin + pdf_document->page_y_offset;
                 result.highlight_area.width = xMax - xMin;
                 result.highlight_area.height = yMax - yMin;
 
@@ -499,8 +499,8 @@ pdf_document_search_page_changed (PdfDocumentSearch   *search)
 
                         result.page_num = pdf_document->page;
 
-                        result.highlight_area.x = xMin;
-                        result.highlight_area.y = yMin;
+                        result.highlight_area.x = xMin + pdf_document->page_x_offset;
+                        result.highlight_area.y = yMin + pdf_document->page_y_offset;
                         result.highlight_area.width = xMax - xMin;
                         result.highlight_area.height = yMax - yMin;
 
@@ -1023,10 +1023,10 @@ pdf_document_get_text (EvDocument *document, GdkRectangle *rect)
        const char *text;
        int x1, y1, x2, y2;
 
-       x1 = rect->x;
-       y1 = rect->y;
-       x2 = x1 + rect->width;
-       y2 = y1 + rect->height;
+       x1 = rect->x + pdf_document->page_x_offset;
+       y1 = rect->y + pdf_document->page_y_offset;
+       x2 = x1 + rect->width + pdf_document->page_x_offset;
+       y2 = y1 + rect->height + pdf_document->page_y_offset;
 
        sel_text = pdf_document->out->getText (x1, y1, x2, y2);
        text = sel_text->getCString ();
@@ -1039,11 +1039,20 @@ pdf_document_get_link (EvDocument *document, int x, int y)
 {
        PdfDocument *pdf_document = PDF_DOCUMENT (document);
        LinkAction *action;
+       double link_x, link_y;
 
-       y = pdf_document->out->getBitmapHeight() - y;
+       /* Zoom */
+       link_x = x / pdf_document->scale;
+       link_y = y / pdf_document->scale;
 
-       action = pdf_document->links->find ((double)x / pdf_document->scale,
-                                           (double)y / pdf_document->scale);
+       /* Offset */
+       link_x -= pdf_document->page_x_offset;
+       link_y -= pdf_document->page_y_offset;
+
+       /* Inverse y */
+       link_y = pdf_document->out->getBitmapHeight() - link_y;
+
+       action = pdf_document->links->find (link_x, link_y);
        
        if (action) {
                return build_link_from_action (pdf_document, action, "");