From: Marco Pesenti Gritti Date: Thu, 8 Sep 2005 11:59:55 +0000 (+0000) Subject: Fix some bugs with xyz links, respect zoom X-Git-Tag: EVINCE_0_5_0~172 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=9832f65434f957b1374d07e6a645b6b8ac88f459;p=evince.git Fix some bugs with xyz links, respect zoom 2005-09-08 Marco Pesenti Gritti * 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 --- diff --git a/ChangeLog b/ChangeLog index ac8a3799..956c3771 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-09-08 Marco Pesenti Gritti + + * 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 * shell/ev-window.c: (page_changed_cb), diff --git a/backend/ev-link.c b/backend/ev-link.c index 9016ec0d..cde43554 100644 --- a/backend/ev-link.c +++ b/backend/ev-link.c @@ -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, diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index 769c78a7..414bfb45 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -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; } diff --git a/shell/ev-view.c b/shell/ev-view.c index 49b0be61..7957b734 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -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);