]> www.fi.muni.cz Git - evince.git/blobdiff - libview/ev-view.c
Updated Galician Translation
[evince.git] / libview / ev-view.c
index b5afdcd1a3494265bbfb60f5a53b1f2368065903..e1c84037e2209902e708ce14e4bee609cfc4e6be 100644 (file)
@@ -1136,6 +1136,22 @@ get_doc_point_from_location (EvView  *view,
        return get_doc_point_from_offset (view, *page, x_offset, y_offset, x_new, y_new);
 }
 
+static void
+ev_view_get_area_from_mapping (EvView       *view,
+                              guint         page,
+                              GList        *mapping_list,
+                              gconstpointer data,
+                              GdkRectangle *area)
+{
+       EvMapping *mapping;
+
+       mapping = ev_mapping_list_find (mapping_list, data);
+       doc_rect_to_view_rect (view, page, &mapping->area, area);
+       area->x -= view->scroll_x;
+       area->y -= view->scroll_y;
+}
+
+
 /*** Hyperref ***/
 static EvLink *
 ev_view_get_link_at_location (EvView  *view,
@@ -1623,14 +1639,12 @@ ev_view_form_field_get_region (EvView      *view,
 {
        GdkRectangle view_area;
        GList       *forms_mapping;
-       EvMapping   *mapping;
 
        forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
                                                                field->page->index);
-       mapping = ev_mapping_list_find (forms_mapping, field);
-       doc_rect_to_view_rect (view, field->page->index, &mapping->area, &view_area);
-       view_area.x -= view->scroll_x;
-       view_area.y -= view->scroll_y;
+       ev_view_get_area_from_mapping (view, field->page->index,
+                                      forms_mapping,
+                                      field, &view_area);
 
        return gdk_region_rectangle (&view_area);
 }
@@ -2039,7 +2053,6 @@ ev_view_handle_form_field (EvView      *view,
 {
        GtkWidget   *field_widget = NULL;
        GList       *form_field_mapping;
-       EvMapping   *mapping;
        GdkRectangle view_area;
 
        if (field->is_read_only)
@@ -2064,11 +2077,9 @@ ev_view_handle_form_field (EvView      *view,
                                (GDestroyNotify)g_object_unref);
 
        form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache, field->page->index);
-       mapping = ev_mapping_list_find (form_field_mapping, field);
-
-       doc_rect_to_view_rect (view, field->page->index, &mapping->area, &view_area);
-       view_area.x -= view->scroll_x;
-       view_area.y -= view->scroll_y;
+       ev_view_get_area_from_mapping (view, field->page->index,
+                                      form_field_mapping,
+                                      field, &view_area);
 
        gtk_layout_put (GTK_LAYOUT (view), field_widget, view_area.x, view_area.y);
        gtk_widget_show (field_widget);
@@ -2303,6 +2314,9 @@ show_annotation_windows (EvView *view,
                if (!EV_IS_ANNOTATION_MARKUP (annot))
                        continue;
 
+               if (!ev_annotation_markup_has_popup (EV_ANNOTATION_MARKUP (annot)))
+                       continue;
+
                window = g_object_get_data (G_OBJECT (annot), "popup");
                if (window) {
                        ev_view_window_child_move_with_parent (view, window);
@@ -2594,7 +2608,6 @@ ev_view_size_allocate (GtkWidget      *widget,
                EvFormField   *field;
                GdkRectangle   view_area;
                GList         *form_field_mapping;
-               EvMapping     *mapping;
                GtkAllocation  child_allocation;
                GtkRequisition child_requisition;
                GtkWidget     *child = (GtkWidget *)l->data;
@@ -2605,11 +2618,9 @@ ev_view_size_allocate (GtkWidget      *widget,
 
                form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
                                                                             field->page->index);
-               mapping = ev_mapping_list_find (form_field_mapping, field);
-
-               doc_rect_to_view_rect (view, field->page->index, &mapping->area, &view_area);
-               view_area.x -= view->scroll_x;
-               view_area.y -= view->scroll_y;
+               ev_view_get_area_from_mapping (view, field->page->index,
+                                              form_field_mapping,
+                                              field, &view_area);
 
                gtk_widget_size_request (child, &child_requisition);
                if (child_requisition.width != view_area.width ||
@@ -2724,7 +2735,9 @@ ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event)
                state &= ~GDK_SHIFT_MASK;
        }
 
-       if (state == 0 && view->presentation) {
+       if (state == 0 &&
+           (view->presentation ||
+            (view->sizing_mode == EV_SIZING_BEST_FIT && !view->continuous))) {
                switch (event->direction) {
                        case GDK_SCROLL_DOWN:
                        case GDK_SCROLL_RIGHT:
@@ -2926,10 +2939,9 @@ get_link_area (EvView       *view,
               EvLink       *link,
               GdkRectangle *area)
 {
-       GList     *link_mapping;
-       EvMapping *mapping;
-       gint       page;
-       gint       x_offset = 0, y_offset = 0;
+       GList *link_mapping;
+       gint   page;
+       gint   x_offset = 0, y_offset = 0;
 
        x += view->scroll_x;
        y += view->scroll_y;
@@ -2937,10 +2949,9 @@ get_link_area (EvView       *view,
        find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
        
        link_mapping = ev_pixbuf_cache_get_link_mapping (view->pixbuf_cache, page);
-       mapping = ev_mapping_list_find (link_mapping, link);
-
-       doc_rect_to_view_rect (view, page, &mapping->area, area);
-       area->y -= view->scroll_y;
+       ev_view_get_area_from_mapping (view, page,
+                                      link_mapping,
+                                      link, area);
 }
 
 static void
@@ -2950,10 +2961,9 @@ get_annot_area (EvView       *view,
               EvAnnotation *annot,
               GdkRectangle *area)
 {
-       GList     *annots_mapping;
-       EvMapping *mapping;
-       gint       page;
-       gint       x_offset = 0, y_offset = 0;
+       GList *annots_mapping;
+       gint   page;
+       gint   x_offset = 0, y_offset = 0;
 
        x += view->scroll_x;
        y += view->scroll_y;
@@ -2961,10 +2971,9 @@ get_annot_area (EvView       *view,
        find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
 
        annots_mapping = ev_pixbuf_cache_get_annots_mapping (view->pixbuf_cache, page);
-       mapping = ev_mapping_list_find (annots_mapping, annot);
-
-       doc_rect_to_view_rect (view, page, &mapping->area, area);
-       area->y -= view->scroll_y;
+       ev_view_get_area_from_mapping (view, page,
+                                      annots_mapping,
+                                      annot, area);
 }
 
 static gboolean
@@ -3011,26 +3020,28 @@ static void
 start_selection_for_event (EvView         *view,
                           GdkEventButton *event)
 {
-       EvSelectionStyle style;
-
        clear_selection (view);
-       
+
        view->selection_info.start.x = event->x + view->scroll_x;
        view->selection_info.start.y = event->y + view->scroll_y;
 
        switch (event->type) {
                case GDK_2BUTTON_PRESS:
-                       style = EV_SELECTION_STYLE_WORD;
+                       view->selection_info.style = EV_SELECTION_STYLE_WORD;
                        break;
                case GDK_3BUTTON_PRESS:
-                       style = EV_SELECTION_STYLE_LINE;
+                       view->selection_info.style = EV_SELECTION_STYLE_LINE;
                        break;
                default:
-                       style = EV_SELECTION_STYLE_GLYPH;
-                       break;
+                       view->selection_info.style = EV_SELECTION_STYLE_GLYPH;
+                       return;
        }
 
-       view->selection_info.style = style;
+       /* In case of WORD or LINE, compute selections now */
+       compute_selections (view,
+                           view->selection_info.style,
+                           &(view->selection_info.start),
+                           &(view->selection_info.start));
 }
 
 static gboolean
@@ -3513,14 +3524,6 @@ ev_view_button_release_event (GtkWidget      *widget,
            view->selection_update_id = 0;
        }
 
-       if (!view->selection_info.in_selection &&
-           view->selection_info.style != EV_SELECTION_STYLE_GLYPH) {
-               compute_selections (view,
-                                   view->selection_info.style,
-                                   &(view->selection_info.start),
-                                   &(view->selection_info.start));
-       }
-
        if (view->selection_info.selections) {
                clear_link_selected (view);
                ev_view_update_primary_selection (view);
@@ -4621,10 +4624,14 @@ ev_view_presentation_animation_start (EvView *view,
        if (!effect)
                return;
 
-       surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, view->current_page);
        view->animation = ev_transition_animation_new (effect);
+
+       surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, view->current_page);
        ev_transition_animation_set_origin_surface (view->animation, surface);
-               
+       surface = ev_pixbuf_cache_get_surface (view->pixbuf_cache, new_page);
+       if (surface)
+               ev_transition_animation_set_dest_surface (view->animation, surface);
+
        g_signal_connect (view->animation, "frame",
                          G_CALLBACK (ev_view_transition_animation_frame), view);
        g_signal_connect (view->animation, "finished",