+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),
static EvLink *
ev_link_from_dest (PopplerAction *action)
{
- EvLink *link;
+ EvLink *link = NULL;
const char *unimplemented_dest = NULL;
switch (action->goto_dest.dest->type) {
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;
}
}
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);
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);