X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-view.c;h=8e494adedc1a527007b1860ddb634a725c1dc06a;hb=848665b157185945d190a7a746d054d7f5d5e6e0;hp=c9eb4d2ee0233277bc778f4625e4d396e6e4cf42;hpb=df1b45e49e809c90e5f79e36c2da95b342d063d6;p=evince.git diff --git a/shell/ev-view.c b/shell/ev-view.c index c9eb4d2e..8e494ade 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -78,6 +78,7 @@ static guint signals[N_SIGNALS]; typedef enum { EV_VIEW_CURSOR_NORMAL, + EV_VIEW_CURSOR_IBEAM, EV_VIEW_CURSOR_LINK, EV_VIEW_CURSOR_WAIT, EV_VIEW_CURSOR_HIDDEN, @@ -371,6 +372,10 @@ scroll_to_current_page (EvView *view, GtkOrientation orientation) GdkRectangle page_area; GtkBorder border; + if (view->document == NULL) { + return; + } + get_page_extents (view, view->current_page, &page_area, &border); if (orientation == GTK_ORIENTATION_VERTICAL) { @@ -944,6 +949,28 @@ find_page_at_location (EvView *view, *page = -1; } +static gboolean +location_in_text (EvView *view, + gdouble x, + gdouble y) +{ + GdkRegion *region; + gint page = -1; + gint x_offset = 0, y_offset = 0; + + find_page_at_location (view, x, y, &page, &x_offset, &y_offset); + + if (page == -1) + return FALSE; + + region = ev_pixbuf_cache_get_text_mapping (view->pixbuf_cache, page); + + if (region) + return gdk_region_point_in (region, x_offset / view->scale, y_offset / view->scale); + else + return FALSE; +} + /*** Hyperref ***/ static EvLink * get_link_at_location (EvView *view, @@ -1337,7 +1364,7 @@ ev_view_button_press_event (GtkWidget *widget, } view->selection_info.start.x = event->x + view->scroll_x; - view->selection_info.start.y = event->y + view->scroll_x; + view->selection_info.start.y = event->y + view->scroll_y; return TRUE; case 2: /* use root coordinates as reference point because @@ -1420,11 +1447,13 @@ ev_view_motion_notify_event (GtkWidget *widget, ev_view_set_status (view, msg); ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK); g_free (msg); + } else if (location_in_text (view, event->x + view->scroll_x, event->y + view->scroll_y)) { + ev_view_set_cursor (view, EV_VIEW_CURSOR_IBEAM); } else { ev_view_set_status (view, NULL); - if (view->cursor == EV_VIEW_CURSOR_LINK) { + if (view->cursor == EV_VIEW_CURSOR_LINK || + view->cursor == EV_VIEW_CURSOR_IBEAM) ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); - } } return TRUE; } @@ -2070,6 +2099,14 @@ ev_view_get_zoom (EvView *view) return view->scale; } +gboolean +ev_view_get_continuous (EvView *view) +{ + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + return view->continuous; +} + void ev_view_set_continuous (EvView *view, gboolean continuous) @@ -2087,6 +2124,14 @@ ev_view_set_continuous (EvView *view, g_object_notify (G_OBJECT (view), "continuous"); } +gboolean +ev_view_get_dual_page (EvView *view) +{ + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + return view->dual_page; +} + void ev_view_set_dual_page (EvView *view, gboolean dual_page) @@ -2116,11 +2161,12 @@ ev_view_set_fullscreen (EvView *view, fullscreen = fullscreen != FALSE; - if (view->fullscreen != fullscreen) { - view->fullscreen = fullscreen; - gtk_widget_queue_resize (GTK_WIDGET (view)); - } - + if (view->fullscreen == fullscreen) + return; + + view->fullscreen = fullscreen; + gtk_widget_queue_resize (GTK_WIDGET (view)); + g_object_notify (G_OBJECT (view), "fullscreen"); } @@ -2144,7 +2190,9 @@ ev_view_set_presentation (EvView *view, return; view->presentation = presentation; + view->pending_scroll = SCROLL_TO_CURRENT_PAGE; gtk_widget_queue_resize (GTK_WIDGET (view)); + if (GTK_WIDGET_REALIZED (view)) { if (view->presentation) gdk_window_set_background (GTK_WIDGET(view)->window, @@ -3036,6 +3084,9 @@ ev_view_set_cursor (EvView *view, EvViewCursor new_cursor) case EV_VIEW_CURSOR_NORMAL: gdk_window_set_cursor (widget->window, NULL); break; + case EV_VIEW_CURSOR_IBEAM: + cursor = gdk_cursor_new_for_display (display, GDK_XTERM); + break; case EV_VIEW_CURSOR_LINK: cursor = gdk_cursor_new_for_display (display, GDK_HAND2); break;