From 143fa3ca281c0e28f72532f12581992746224857 Mon Sep 17 00:00:00 2001 From: "Nickolay V. Shmyrev" Date: Sat, 23 Apr 2005 21:49:12 +0000 Subject: [PATCH] Fix crash on exit and scrolling to page --- ChangeLog | 7 +++++++ shell/ev-view.c | 42 +++++++++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0596cd0..e6924ddd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-04-24 Nickolay V. Shmyrev + + * shell/ev-view.c: (view_update_range_and_current_page), + (page_changed_cb): + + Fix crash on exit and scrolling to page in continuous view. + Sat Apr 23 13:13:04 2005 Jonathan Blandford * TODO: diff --git a/shell/ev-view.c b/shell/ev-view.c index 663c3bfc..07a71ead 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -233,16 +233,27 @@ view_update_range_and_current_page (EvView *view) GdkRectangle current_area, unused, page_area; gboolean found = FALSE; int i; - - current_area.x = view->hadjustment->value; - current_area.width = view->hadjustment->page_size; - current_area.y = view->vadjustment->value; - current_area.height = view->vadjustment->page_size; - + get_bounding_box_size (view, &(page_area.width), &(page_area.height)); page_area.x = view->spacing; page_area.y = view->spacing; + if (view->hadjustment) { + current_area.x = view->hadjustment->value; + current_area.width = view->hadjustment->page_size; + } else { + current_area.x = page_area.x; + current_area.width = page_area.width; + } + + if (view->vadjustment) { + current_area.y = view->vadjustment->value; + current_area.height = view->vadjustment->page_size; + } else { + current_area.y = page_area.y; + current_area.height = page_area.height; + } + for (i = 0; i < ev_page_cache_get_n_pages (view->page_cache); i++) { if (gdk_rectangle_intersect (¤t_area, &page_area, &unused)) { if (! found) { @@ -1872,6 +1883,7 @@ page_changed_cb (EvPageCache *page_cache, int old_page = view->current_page; int old_width, old_height; int new_width, new_height; + int max_height, n_rows; if (old_page == new_page) return; @@ -1895,9 +1907,21 @@ page_changed_cb (EvPageCache *page_cache, gtk_widget_queue_resize (GTK_WIDGET (view)); else gtk_widget_queue_draw (GTK_WIDGET (view)); - - gtk_adjustment_set_value (view->vadjustment, - view->vadjustment->lower); + + if (view->continuous) { + + n_rows = view->dual_page ? new_page / 2 : new_page; + + get_bounding_box_size (view, NULL, &max_height); + + gtk_adjustment_clamp_page(view->vadjustment, + (max_height + view->spacing) * n_rows, + (max_height + view->spacing) * n_rows + + view->vadjustment->page_size); + } else { + gtk_adjustment_set_value (view->vadjustment, + view->vadjustment->lower); + } if (EV_IS_DOCUMENT_FIND (view->document)) { view->find_page = new_page; -- 2.43.5