|
|
d6c6b3 |
From e699044575e17f708f428bf0865d13e26fab0f7d Mon Sep 17 00:00:00 2001
|
|
|
d6c6b3 |
From: Felipe Borges <felipeborges@gnome.org>
|
|
|
d6c6b3 |
Date: Tue, 22 Mar 2016 15:15:04 +0100
|
|
|
d6c6b3 |
Subject: [PATCH] libview: Add annots to the right page
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
We were assuming that annots were always added to the current page,
|
|
|
d6c6b3 |
which is not always true in continuous or dual modes.
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
https://bugzilla.redhat.com/show_bug.cgi?id=1292195
|
|
|
d6c6b3 |
---
|
|
|
d6c6b3 |
libview/ev-view.c | 20 ++++++++++++++------
|
|
|
d6c6b3 |
1 file changed, 14 insertions(+), 6 deletions(-)
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
diff --git a/libview/ev-view.c b/libview/ev-view.c
|
|
|
d6c6b3 |
index 6098fc0..afea8ed 100644
|
|
|
d6c6b3 |
--- a/libview/ev-view.c
|
|
|
d6c6b3 |
+++ b/libview/ev-view.c
|
|
|
d6c6b3 |
@@ -3167,17 +3167,25 @@ ev_view_create_annotation (EvView *view,
|
|
|
d6c6b3 |
GdkColor color = { 0, 65535, 65535, 0 };
|
|
|
d6c6b3 |
GdkRectangle view_rect;
|
|
|
d6c6b3 |
cairo_region_t *region;
|
|
|
d6c6b3 |
+ gint annot_page;
|
|
|
d6c6b3 |
+ gint offset;
|
|
|
d6c6b3 |
+
|
|
|
d6c6b3 |
+ find_page_at_location (view, x, y, &annot_page, &offset, &offset);
|
|
|
d6c6b3 |
+ if (annot_page == -1) {
|
|
|
d6c6b3 |
+ ev_view_cancel_add_annotation (view);
|
|
|
d6c6b3 |
+ return;
|
|
|
d6c6b3 |
+ }
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
point.x = x;
|
|
|
d6c6b3 |
point.y = y;
|
|
|
d6c6b3 |
- ev_view_get_page_extents (view, view->current_page, &page_area, &border);
|
|
|
d6c6b3 |
+ ev_view_get_page_extents (view, annot_page, &page_area, &border);
|
|
|
d6c6b3 |
_ev_view_transform_view_point_to_doc_point (view, &point, &page_area, &border,
|
|
|
d6c6b3 |
&doc_rect.x1, &doc_rect.y1);
|
|
|
d6c6b3 |
doc_rect.x2 = doc_rect.x1 + 24;
|
|
|
d6c6b3 |
doc_rect.y2 = doc_rect.y1 + 24;
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
ev_document_doc_mutex_lock ();
|
|
|
d6c6b3 |
- page = ev_document_get_page (view->document, view->current_page);
|
|
|
d6c6b3 |
+ page = ev_document_get_page (view->document, annot_page);
|
|
|
d6c6b3 |
switch (annot_type) {
|
|
|
d6c6b3 |
case EV_ANNOTATION_TYPE_TEXT:
|
|
|
d6c6b3 |
annot = ev_annotation_text_new (page);
|
|
|
d6c6b3 |
@@ -3212,8 +3220,8 @@ ev_view_create_annotation (EvView *view,
|
|
|
d6c6b3 |
ev_document_doc_mutex_unlock ();
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
/* If the page didn't have annots, mark the cache as dirty */
|
|
|
d6c6b3 |
- if (!ev_page_cache_get_annot_mapping (view->page_cache, view->current_page))
|
|
|
d6c6b3 |
- ev_page_cache_mark_dirty (view->page_cache, view->current_page, EV_PAGE_DATA_INCLUDE_ANNOTS);
|
|
|
d6c6b3 |
+ if (!ev_page_cache_get_annot_mapping (view->page_cache, annot_page))
|
|
|
d6c6b3 |
+ ev_page_cache_mark_dirty (view->page_cache, annot_page, EV_PAGE_DATA_INCLUDE_ANNOTS);
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
if (EV_IS_ANNOTATION_MARKUP (annot)) {
|
|
|
d6c6b3 |
GtkWindow *parent;
|
|
|
d6c6b3 |
@@ -3226,11 +3234,11 @@ ev_view_create_annotation (EvView *view,
|
|
|
d6c6b3 |
ev_view_annotation_show_popup_window (view, window);
|
|
|
d6c6b3 |
}
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
- _ev_view_transform_doc_rect_to_view_rect (view, view->current_page, &doc_rect, &view_rect);
|
|
|
d6c6b3 |
+ _ev_view_transform_doc_rect_to_view_rect (view, annot_page, &doc_rect, &view_rect);
|
|
|
d6c6b3 |
view_rect.x -= view->scroll_x;
|
|
|
d6c6b3 |
view_rect.y -= view->scroll_y;
|
|
|
d6c6b3 |
region = cairo_region_create_rectangle (&view_rect);
|
|
|
d6c6b3 |
- ev_view_reload_page (view, view->current_page, region);
|
|
|
d6c6b3 |
+ ev_view_reload_page (view, annot_page, region);
|
|
|
d6c6b3 |
cairo_region_destroy (region);
|
|
|
d6c6b3 |
|
|
|
d6c6b3 |
g_signal_emit (view, signals[SIGNAL_ANNOT_ADDED], 0, annot);
|
|
|
d6c6b3 |
--
|
|
|
d6c6b3 |
2.5.0
|
|
|
d6c6b3 |
|