]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-view.c
Check for execinfo.h and use it only if it exists.
[evince.git] / shell / ev-view.c
index 7fe99552eb4e3ea83c3c9cf6454bad465bcb0537..05d3954256add7a27a41fa06d7e9099a20207b15 100644 (file)
@@ -53,6 +53,7 @@ enum {
        PROP_PRESENTATION,
        PROP_SIZING_MODE,
        PROP_ZOOM,
+       PROP_ROTATION,
 };
 
 enum {
@@ -1465,15 +1466,20 @@ ev_view_motion_notify_event (GtkWidget      *widget,
        if (!view->document)
                return FALSE;
 
-       if (view->pressed_button == 1) {
+       /* For the Evince 0.4.x release, we limit selection to un-rotated
+        * documents only.
+        */
+       if (view->pressed_button == 1 &&
+           view->rotation == 0) {
                view->selection_info.in_selection = TRUE;
                view->motion_x = event->x + view->scroll_x;
                view->motion_y = event->y + view->scroll_y;
 
                /* Queue an idle to handle the motion.  We do this because
-                * handling any selection events in the motion is probably going
-                * to be slower than new motion events reach us.  This means that */
-
+                * handling any selection events in the motion could be slower
+                * than new motion events reach us.  We always put it in the
+                * idle to make sure we catch up and don't visibly lag the
+                * mouse. */
                if (! view->selection_update_id)
                        view->selection_update_id = g_idle_add ((GSourceFunc)selection_update_idle_cb, view);
 
@@ -1514,7 +1520,11 @@ ev_view_motion_notify_event (GtkWidget      *widget,
 
                        return TRUE;
                }
-       } else if (view->pressed_button <= 0) {
+       /* For the Evince 0.4.x release, we limit links to un-rotated documents
+        * only.
+        */
+       } else if (view->pressed_button <= 0 &&
+                  view->rotation == 0) {
                EvLink *link;
 
                link = get_link_at_location (view, event->x + view->scroll_x, event->y + view->scroll_y);
@@ -1685,8 +1695,7 @@ highlight_find_results (EvView *view, int page)
                        alpha = 0x20;
                }
 
-               ev_document_find_get_result (find, page,
-                                            i, &rectangle);
+               ev_document_find_get_result (find, page, i, &rectangle);
                doc_rect_to_view_rect (view, page, &rectangle, &view_rectangle);
                draw_rubberband (GTK_WIDGET (view), GTK_WIDGET(view)->window,
                                 &view_rectangle, alpha);
@@ -1856,6 +1865,9 @@ ev_view_set_property (GObject      *object,
        case PROP_ZOOM:
                ev_view_set_zoom (view, g_value_get_double (value), FALSE);
                break;
+       case PROP_ROTATION:
+               ev_view_set_rotation (view, g_value_get_int (value));
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        }
@@ -1895,6 +1907,9 @@ ev_view_get_property (GObject *object,
        case PROP_ZOOM:
                g_value_set_double (value, view->scale);
                break;
+       case PROP_ROTATION:
+               g_value_set_int (value, view->rotation);
+               break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        }
@@ -2023,6 +2038,15 @@ ev_view_class_init (EvViewClass *class)
                                                               MAX_SCALE,
                                                               1.0,
                                                               G_PARAM_READWRITE));
+       g_object_class_install_property (object_class,
+                                        PROP_ROTATION,
+                                        g_param_spec_double ("rotation",
+                                                             "Rotation",
+                                                              "Rotation",
+                                                              0,
+                                                              360,
+                                                              0,
+                                                              G_PARAM_READWRITE));
 
        binding_set = gtk_binding_set_by_class (class);
 
@@ -2432,6 +2456,11 @@ ev_view_set_rotation (EvView *view, int rotation)
                ev_pixbuf_cache_clear (view->pixbuf_cache);
                gtk_widget_queue_resize (GTK_WIDGET (view));
        }
+
+       if (rotation != 0)
+               clear_selection (view);
+
+       g_object_notify (G_OBJECT (view), "rotation");
 }
 
 int
@@ -2952,6 +2981,7 @@ compute_new_selection_text (EvView   *view,
        GList *list = NULL;
        EvViewSelection *selection;
        gint width, height;
+       int start_page, end_page;
 
        g_assert (view->selection_mode == EV_VIEW_SELECTION_TEXT);
 
@@ -2961,7 +2991,18 @@ compute_new_selection_text (EvView   *view,
         * affects. */
        first = n_pages;
        last = 0;
-       for (i = 0; i < n_pages; i++) {
+       if (view->continuous) {
+               start_page = 0;
+               end_page = n_pages;
+       } else if (view->dual_page) {
+               start_page = view->start_page;
+               end_page = view->end_page + 1;
+       } else {
+               start_page = view->current_page;
+               end_page = view->current_page + 1;
+       }
+
+       for (i = start_page; i < end_page; i++) {
                GdkRectangle page_area;
                GtkBorder border;
                
@@ -3177,6 +3218,10 @@ ev_view_select_all (EvView *view)
 {
        int n_pages, i;
 
+       /* Disable selection on rotated pages for the 0.4.0 series */
+       if (view->rotation != 0)
+               return;
+
        clear_selection (view);
 
        n_pages = ev_page_cache_get_n_pages (view->page_cache);