]> www.fi.muni.cz Git - evince.git/commitdiff
Fix some bugs with xyz links, respect zoom
authorMarco Pesenti Gritti <mpg@redhat.com>
Thu, 8 Sep 2005 11:59:55 +0000 (11:59 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Thu, 8 Sep 2005 11:59:55 +0000 (11:59 +0000)
2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>

        * backend/ev-link.c: (ev_link_new_page_xyz):
        * pdf/ev-poppler.cc:
        * shell/ev-view.c: (goto_xyz_link), (ev_view_goto_link):

        Fix some bugs with xyz links, respect zoom

ChangeLog
backend/ev-link.c
pdf/ev-poppler.cc
shell/ev-view.c

index ac8a37991e0ca4cd4eb8dd53c60fb67e563a8df6..956c37718e725e646cb451f5d0a54c4f947ec37c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * backend/ev-link.c: (ev_link_new_page_xyz):
+       * pdf/ev-poppler.cc:
+       * shell/ev-view.c: (goto_xyz_link), (ev_view_goto_link):
+
+       Fix some bugs with xyz links, respect zoom
+
 2005-09-08  Marco Pesenti Gritti  <mpg@redhat.com>
 
        * shell/ev-window.c: (page_changed_cb),
index 9016ec0d679924542711997469150c5a5bab0f44..cde435542310edb43577ec35ea8e482f7719948b 100644 (file)
@@ -342,8 +342,8 @@ ev_link_new_page (const char *title, int page)
 EvLink *
 ev_link_new_page_xyz (const char *title,
                      int         page,
-                     double      top,
                      double      left,
+                     double      top,
                      double      zoom)
 {
        return EV_LINK (g_object_new (EV_TYPE_LINK,
index 769c78a7a1f684973f1e3eaf0b1a742344e158f5..414bfb453fcd350a49613755bb8393763de413c3 100644 (file)
@@ -705,7 +705,7 @@ pdf_document_links_has_document_links (EvDocumentLinks *document_links)
 static EvLink *
 ev_link_from_dest (PopplerAction *action)
 {
-       EvLink *link;
+       EvLink *link = NULL;
        const char *unimplemented_dest = NULL;
 
        switch (action->goto_dest.dest->type) {
@@ -747,7 +747,9 @@ ev_link_from_dest (PopplerAction *action)
                           unimplemented_dest);
        }
 
-       link = ev_link_new_page (action->any.title, action->goto_dest.dest->page_num - 1);
+       if (link == NULL) {
+               link = ev_link_new_page (action->any.title, action->goto_dest.dest->page_num - 1);
+       }
 
        return link;
 }
index 49b0be61aaacbb15277a91244419cd7a6d418365..7957b734a2b08bb37f01e0ec757ae75669cfcd29 100644 (file)
@@ -1091,16 +1091,25 @@ get_link_at_location (EvView  *view,
 }
 
 static void
-scroll_to_xyz_link (EvView *view, EvLink *link)
+goto_xyz_link (EvView *view, EvLink *link)
 {
        GdkPoint view_point;
        EvPoint doc_point;
+       int height, page;
+       double zoom;
 
-       doc_point.x = ev_link_get_left (link);
-       doc_point.y = ev_link_get_top (link);
+       zoom = ev_link_get_zoom (link);
+       page = ev_link_get_page (link);
+       ev_page_cache_get_size (view->page_cache, page, 0, 1.0, NULL, &height);
+
+       ev_view_set_sizing_mode (view, EV_SIZING_FREE);
+       if (zoom != 0) {
+               ev_view_set_zoom (view, zoom, FALSE);
+       }
 
-       doc_point_to_view_point (view, ev_link_get_page (link),
-                                &doc_point, &view_point);
+       doc_point.x = ev_link_get_left (link);
+       doc_point.y = height - ev_link_get_top (link);
+       doc_point_to_view_point (view, page, &doc_point, &view_point);
 
        gtk_adjustment_set_value (view->hadjustment, view_point.x);
        gtk_adjustment_set_value (view->vadjustment, view_point.y);
@@ -1123,7 +1132,7 @@ ev_view_goto_link (EvView *view, EvLink *link)
                        ev_page_cache_set_current_page (view->page_cache, page);
                        break;
                case EV_LINK_TYPE_PAGE_XYZ:
-                       scroll_to_xyz_link (view, link);
+                       goto_xyz_link (view, link);
                        break;
                case EV_LINK_TYPE_EXTERNAL_URI:
                        uri = ev_link_get_uri (link);