Lines 3203-3222
Link Here
|
3203 |
|
3203 |
|
3204 |
ev_page_cache_mark_dirty (view->page_cache, page, EV_PAGE_DATA_INCLUDE_ANNOTS); |
3204 |
ev_page_cache_mark_dirty (view->page_cache, page, EV_PAGE_DATA_INCLUDE_ANNOTS); |
3205 |
|
3205 |
|
3206 |
/* FIXME: only redraw the annot area */ |
3206 |
/* FIXME: only redraw the annot area */ |
3207 |
ev_view_reload_page (view, page, NULL); |
3207 |
ev_view_reload_page (view, page, NULL); |
3208 |
|
3208 |
|
3209 |
g_signal_emit (view, signals[SIGNAL_ANNOT_REMOVED], 0, annot); |
3209 |
g_signal_emit (view, signals[SIGNAL_ANNOT_REMOVED], 0, annot); |
3210 |
g_object_unref (annot); |
3210 |
g_object_unref (annot); |
3211 |
} |
3211 |
} |
3212 |
|
3212 |
|
|
|
3213 |
#ifdef ENABLE_SYNCTEX |
3213 |
static gboolean |
3214 |
static gboolean |
3214 |
ev_view_synctex_backward_search (EvView *view, |
3215 |
ev_view_synctex_backward_search (EvView *view, |
3215 |
gdouble x, |
3216 |
gdouble x, |
3216 |
gdouble y) |
3217 |
gdouble y) |
3217 |
{ |
3218 |
{ |
3218 |
gint page = -1; |
3219 |
gint page = -1; |
3219 |
gint x_new = 0, y_new = 0; |
3220 |
gint x_new = 0, y_new = 0; |
3220 |
EvSourceLink *link; |
3221 |
EvSourceLink *link; |
3221 |
|
3222 |
|
3222 |
if (!ev_document_has_synctex (view->document)) |
3223 |
if (!ev_document_has_synctex (view->document)) |
Lines 3228-3247
Link Here
|
3228 |
link = ev_document_synctex_backward_search (view->document, page, x_new, y_new); |
3229 |
link = ev_document_synctex_backward_search (view->document, page, x_new, y_new); |
3229 |
if (link) { |
3230 |
if (link) { |
3230 |
g_signal_emit (view, signals[SIGNAL_SYNC_SOURCE], 0, link); |
3231 |
g_signal_emit (view, signals[SIGNAL_SYNC_SOURCE], 0, link); |
3231 |
ev_source_link_free (link); |
3232 |
ev_source_link_free (link); |
3232 |
|
3233 |
|
3233 |
return TRUE; |
3234 |
return TRUE; |
3234 |
} |
3235 |
} |
3235 |
|
3236 |
|
3236 |
return FALSE; |
3237 |
return FALSE; |
3237 |
} |
3238 |
} |
|
|
3239 |
#endif |
3238 |
|
3240 |
|
3239 |
/* Caret navigation */ |
3241 |
/* Caret navigation */ |
3240 |
#define CURSOR_ON_MULTIPLIER 2 |
3242 |
#define CURSOR_ON_MULTIPLIER 2 |
3241 |
#define CURSOR_OFF_MULTIPLIER 1 |
3243 |
#define CURSOR_OFF_MULTIPLIER 1 |
3242 |
#define CURSOR_PEND_MULTIPLIER 3 |
3244 |
#define CURSOR_PEND_MULTIPLIER 3 |
3243 |
#define CURSOR_DIVIDER 3 |
3245 |
#define CURSOR_DIVIDER 3 |
3244 |
|
3246 |
|
3245 |
static inline gboolean |
3247 |
static inline gboolean |
3246 |
cursor_is_in_visible_page (EvView *view) |
3248 |
cursor_is_in_visible_page (EvView *view) |
3247 |
{ |
3249 |
{ |
Lines 4071-4092
Link Here
|
4071 |
draw_one_page (view, i, cr, &page_area, &border, area, &page_ready); |
4073 |
draw_one_page (view, i, cr, &page_area, &border, area, &page_ready); |
4072 |
|
4074 |
|
4073 |
if (page_ready && should_draw_caret_cursor (view, i)) |
4075 |
if (page_ready && should_draw_caret_cursor (view, i)) |
4074 |
draw_caret_cursor (view, cr); |
4076 |
draw_caret_cursor (view, cr); |
4075 |
if (page_ready && view->find_pages && view->highlight_find_results) |
4077 |
if (page_ready && view->find_pages && view->highlight_find_results) |
4076 |
highlight_find_results (view, cr, i); |
4078 |
highlight_find_results (view, cr, i); |
4077 |
if (page_ready && EV_IS_DOCUMENT_ANNOTATIONS (view->document)) |
4079 |
if (page_ready && EV_IS_DOCUMENT_ANNOTATIONS (view->document)) |
4078 |
show_annotation_windows (view, i); |
4080 |
show_annotation_windows (view, i); |
4079 |
if (page_ready && view->focused_element) |
4081 |
if (page_ready && view->focused_element) |
4080 |
draw_focus (view, cr, i, &clip_rect); |
4082 |
draw_focus (view, cr, i, &clip_rect); |
|
|
4083 |
#ifdef ENABLE_SYNCTEX |
4081 |
if (page_ready && view->synctex_result) |
4084 |
if (page_ready && view->synctex_result) |
4082 |
highlight_forward_search_results (view, cr, i); |
4085 |
highlight_forward_search_results (view, cr, i); |
|
|
4086 |
#endif |
4083 |
} |
4087 |
} |
4084 |
|
4088 |
|
4085 |
if (GTK_WIDGET_CLASS (ev_view_parent_class)->draw) |
4089 |
if (GTK_WIDGET_CLASS (ev_view_parent_class)->draw) |
4086 |
(* GTK_WIDGET_CLASS (ev_view_parent_class)->draw) (widget, cr); |
4090 |
(* GTK_WIDGET_CLASS (ev_view_parent_class)->draw) (widget, cr); |
4087 |
|
4091 |
|
4088 |
return FALSE; |
4092 |
return FALSE; |
4089 |
} |
4093 |
} |
4090 |
|
4094 |
|
4091 |
static void |
4095 |
static void |
4092 |
ev_view_set_focused_element_at_location (EvView *view, |
4096 |
ev_view_set_focused_element_at_location (EvView *view, |
Lines 4465-4487
Link Here
|
4465 |
if (view->scroll_info.autoscrolling) |
4469 |
if (view->scroll_info.autoscrolling) |
4466 |
return TRUE; |
4470 |
return TRUE; |
4467 |
|
4471 |
|
4468 |
switch (event->button) { |
4472 |
switch (event->button) { |
4469 |
case 1: { |
4473 |
case 1: { |
4470 |
EvImage *image; |
4474 |
EvImage *image; |
4471 |
EvAnnotation *annot; |
4475 |
EvAnnotation *annot; |
4472 |
EvFormField *field; |
4476 |
EvFormField *field; |
4473 |
EvMapping *link; |
4477 |
EvMapping *link; |
4474 |
gint page; |
4478 |
gint page; |
4475 |
|
4479 |
#ifdef ENABLE_SYNCTEX |
4476 |
if (event->state & GDK_CONTROL_MASK) |
4480 |
if (event->state & GDK_CONTROL_MASK) |
4477 |
return ev_view_synctex_backward_search (view, event->x , event->y); |
4481 |
return ev_view_synctex_backward_search (view, event->x , event->y); |
|
|
4482 |
#endif |
4478 |
|
4483 |
|
4479 |
if (EV_IS_SELECTION (view->document) && view->selection_info.selections) { |
4484 |
if (EV_IS_SELECTION (view->document) && view->selection_info.selections) { |
4480 |
if (event->type == GDK_3BUTTON_PRESS) { |
4485 |
if (event->type == GDK_3BUTTON_PRESS) { |
4481 |
start_selection_for_event (view, event); |
4486 |
start_selection_for_event (view, event); |
4482 |
} else if (event->state & GDK_SHIFT_MASK) { |
4487 |
} else if (event->state & GDK_SHIFT_MASK) { |
4483 |
GdkPoint end_point; |
4488 |
GdkPoint end_point; |
4484 |
|
4489 |
|
4485 |
end_point.x = event->x + view->scroll_x; |
4490 |
end_point.x = event->x + view->scroll_x; |
4486 |
end_point.y = event->y + view->scroll_y; |
4491 |
end_point.y = event->y + view->scroll_y; |
4487 |
extend_selection (view, &view->selection_info.start, &end_point); |
4492 |
extend_selection (view, &view->selection_info.start, &end_point); |
Lines 7515-7534
Link Here
|
7515 |
view->highlight_find_results = value; |
7520 |
view->highlight_find_results = value; |
7516 |
gtk_widget_queue_draw (GTK_WIDGET (view)); |
7521 |
gtk_widget_queue_draw (GTK_WIDGET (view)); |
7517 |
} |
7522 |
} |
7518 |
|
7523 |
|
7519 |
void |
7524 |
void |
7520 |
ev_view_find_cancel (EvView *view) |
7525 |
ev_view_find_cancel (EvView *view) |
7521 |
{ |
7526 |
{ |
7522 |
view->find_pages = NULL; |
7527 |
view->find_pages = NULL; |
7523 |
} |
7528 |
} |
7524 |
|
7529 |
|
|
|
7530 |
#ifdef ENABLE_SYNCTEX |
7525 |
/*** Synctex ***/ |
7531 |
/*** Synctex ***/ |
7526 |
void |
7532 |
void |
7527 |
ev_view_highlight_forward_search (EvView *view, |
7533 |
ev_view_highlight_forward_search (EvView *view, |
7528 |
EvSourceLink *link) |
7534 |
EvSourceLink *link) |
7529 |
{ |
7535 |
{ |
7530 |
EvMapping *mapping; |
7536 |
EvMapping *mapping; |
7531 |
gint page; |
7537 |
gint page; |
7532 |
GdkRectangle view_rect; |
7538 |
GdkRectangle view_rect; |
7533 |
|
7539 |
|
7534 |
if (!ev_document_has_synctex (view->document)) |
7540 |
if (!ev_document_has_synctex (view->document)) |
Lines 7542-7561
Link Here
|
7542 |
g_free (view->synctex_result); |
7548 |
g_free (view->synctex_result); |
7543 |
view->synctex_result = mapping; |
7549 |
view->synctex_result = mapping; |
7544 |
|
7550 |
|
7545 |
page = GPOINTER_TO_INT (mapping->data); |
7551 |
page = GPOINTER_TO_INT (mapping->data); |
7546 |
ev_document_model_set_page (view->model, page); |
7552 |
ev_document_model_set_page (view->model, page); |
7547 |
|
7553 |
|
7548 |
_ev_view_transform_doc_rect_to_view_rect (view, page, &mapping->area, &view_rect); |
7554 |
_ev_view_transform_doc_rect_to_view_rect (view, page, &mapping->area, &view_rect); |
7549 |
ensure_rectangle_is_visible (view, &view_rect); |
7555 |
ensure_rectangle_is_visible (view, &view_rect); |
7550 |
gtk_widget_queue_draw (GTK_WIDGET (view)); |
7556 |
gtk_widget_queue_draw (GTK_WIDGET (view)); |
7551 |
} |
7557 |
} |
|
|
7558 |
#endif /* ENABLE_SYNCTEX */ |
7552 |
|
7559 |
|
7553 |
/*** Selections ***/ |
7560 |
/*** Selections ***/ |
7554 |
static gboolean |
7561 |
static gboolean |
7555 |
gdk_rectangle_point_in (GdkRectangle *rectangle, |
7562 |
gdk_rectangle_point_in (GdkRectangle *rectangle, |
7556 |
GdkPoint *point) |
7563 |
GdkPoint *point) |
7557 |
{ |
7564 |
{ |
7558 |
return rectangle->x <= point->x && |
7565 |
return rectangle->x <= point->x && |
7559 |
rectangle->y <= point->y && |
7566 |
rectangle->y <= point->y && |
7560 |
point->x < rectangle->x + rectangle->width && |
7567 |
point->x < rectangle->x + rectangle->width && |
7561 |
point->y < rectangle->y + rectangle->height; |
7568 |
point->y < rectangle->y + rectangle->height; |