+// change the current page if necessary for pointer at pt
+void set_current_page(gdouble *pt)
+{
+ gboolean page_change;
+ struct Page *tmppage;
+
+ page_change = FALSE;
+ tmppage = ui.cur_page;
+ while (ui.view_continuous && (pt[1] < - VIEW_CONTINUOUS_SKIP)) {
+ if (ui.pageno == 0) break;
+ page_change = TRUE;
+ ui.pageno--;
+ tmppage = g_list_nth_data(journal.pages, ui.pageno);
+ pt[1] += tmppage->height + VIEW_CONTINUOUS_SKIP;
+ }
+ while (ui.view_continuous && (pt[1] > tmppage->height + VIEW_CONTINUOUS_SKIP)) {
+ if (ui.pageno == journal.npages-1) break;
+ pt[1] -= tmppage->height + VIEW_CONTINUOUS_SKIP;
+ page_change = TRUE;
+ ui.pageno++;
+ tmppage = g_list_nth_data(journal.pages, ui.pageno);
+ }
+ if (page_change) do_switch_page(ui.pageno, FALSE, FALSE);
+}
+