X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-view.c;h=c8b17834adc2689d4ea89284d78e948e84b5ba66;hb=d2a9f2931d33360fdaac769b2e94bdd9e91b3096;hp=7432171222772a604b657061c709109f31b87275;hpb=cb1b1546df981d4e3f0fbc4e4e1dacb64090a473;p=evince.git diff --git a/shell/ev-view.c b/shell/ev-view.c index 74321712..c8b17834 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -52,7 +52,6 @@ enum { PROP_0, - PROP_STATUS, PROP_FIND_STATUS, PROP_CONTINUOUS, PROP_DUAL_PAGE, @@ -301,14 +300,11 @@ static void ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y); -/*** Status messages ***/ -static void ev_view_set_status (EvView *view, - const char *message); +/*** Find ***/ static void update_find_status_message (EvView *view, gboolean this_page); static void ev_view_set_find_status (EvView *view, const char *message); -/*** Find ***/ static void jump_to_find_result (EvView *view); static void jump_to_find_page (EvView *view, EvViewFindDirection direction, @@ -1493,8 +1489,12 @@ tip_from_link (EvView *view, EvLink *link) static void ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y) { - EvLink *link; + EvLink *link; + EvFormField *field; + if (view->cursor == EV_VIEW_CURSOR_HIDDEN) + return; + link = ev_view_get_link_at_location (view, x, y); if (view->link_tooltip == NULL) { @@ -1519,12 +1519,19 @@ ev_view_handle_cursor_over_xy (EvView *view, gint x, gint y) g_free (msg); ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK); + } else if ((field = ev_view_get_form_field_at_location (view, x, y))) { + if (field->is_read_only) { + if (view->cursor == EV_VIEW_CURSOR_LINK || + view->cursor == EV_VIEW_CURSOR_IBEAM) + ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); + } else if (EV_IS_FORM_FIELD_TEXT (field)) { + ev_view_set_cursor (view, EV_VIEW_CURSOR_IBEAM); + } else { + ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK); + } } else if (location_in_text (view, x + view->scroll_x, y + view->scroll_y)) { ev_view_set_cursor (view, EV_VIEW_CURSOR_IBEAM); - } else if (ev_view_get_form_field_at_location (view, x, y)) { - ev_view_set_cursor (view, EV_VIEW_CURSOR_LINK); } else { - ev_view_set_status (view, NULL); if (view->cursor == EV_VIEW_CURSOR_LINK || view->cursor == EV_VIEW_CURSOR_IBEAM) ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); @@ -3248,8 +3255,6 @@ ev_view_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event) { EvView *view = EV_VIEW (widget); - ev_view_set_status (view, NULL); - if (view->cursor == EV_VIEW_CURSOR_LINK || view->cursor == EV_VIEW_CURSOR_IBEAM) ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); @@ -3563,7 +3568,6 @@ ev_view_finalize (GObject *object) { EvView *view = EV_VIEW (object); - g_free (view->status); g_free (view->find_status); clear_selection (view); @@ -3698,11 +3702,8 @@ ev_view_get_property (GObject *object, EvView *view = EV_VIEW (object); switch (prop_id) { - case PROP_STATUS: - g_value_set_string (value, view->status); - break; case PROP_FIND_STATUS: - g_value_set_string (value, view->status); + g_value_set_string (value, view->find_status); break; case PROP_CONTINUOUS: g_value_set_boolean (value, view->continuous); @@ -3815,13 +3816,6 @@ ev_view_class_init (EvViewClass *class) G_TYPE_NONE, 1, G_TYPE_OBJECT); - g_object_class_install_property (object_class, - PROP_STATUS, - g_param_spec_string ("status", - "Status Message", - "The status message", - NULL, - G_PARAM_READABLE)); g_object_class_install_property (object_class, PROP_FIND_STATUS, @@ -3906,6 +3900,15 @@ ev_view_class_init (EvViewClass *class) add_scroll_binding_keypad (binding_set, GDK_Down, 0, EV_SCROLL_STEP_FORWARD, FALSE); add_scroll_binding_keypad (binding_set, GDK_Up, GDK_MOD1_MASK, EV_SCROLL_STEP_DOWN, FALSE); add_scroll_binding_keypad (binding_set, GDK_Down, GDK_MOD1_MASK, EV_SCROLL_STEP_UP, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_H, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, + EV_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, TRUE); + gtk_binding_entry_add_signal (binding_set, GDK_J, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, + EV_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_K, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, + EV_SCROLL_STEP_BACKWARD, G_TYPE_BOOLEAN, FALSE); + gtk_binding_entry_add_signal (binding_set, GDK_L, 0, "binding_activated", 2, EV_TYPE_SCROLL_TYPE, + EV_SCROLL_STEP_FORWARD, G_TYPE_BOOLEAN, TRUE); + } static void @@ -4691,13 +4694,14 @@ ev_view_zoom_for_size_single_page (EvView *view, ev_view_set_zoom (view, scale, FALSE); } -void +static void ev_view_set_zoom_for_size (EvView *view, int width, int height, int vsb_width, int hsb_height) { + g_return_if_fail (EV_IS_VIEW (view)); g_return_if_fail (view->sizing_mode == EV_SIZING_FIT_WIDTH || view->sizing_mode == EV_SIZING_BEST_FIT); g_return_if_fail (width >= 0); @@ -4718,28 +4722,7 @@ ev_view_set_zoom_for_size (EvView *view, ev_view_zoom_for_size_single_page (view, width, height, vsb_width, hsb_height); } -/*** Status text messages ***/ - -const char * -ev_view_get_status (EvView *view) -{ - g_return_val_if_fail (EV_IS_VIEW (view), NULL); - - return view->status; -} - -static void -ev_view_set_status (EvView *view, const char *message) -{ - g_return_if_fail (EV_IS_VIEW (view)); - - if (message != view->status) { - g_free (view->status); - view->status = g_strdup (message); - g_object_notify (G_OBJECT (view), "status"); - } -} - +/*** Find ***/ static void update_find_status_message (EvView *view, gboolean this_page) { @@ -4789,8 +4772,6 @@ ev_view_set_find_status (EvView *view, const char *message) g_object_notify (G_OBJECT (view), "find-status"); } -/*** Find ***/ - static void jump_to_find_result (EvView *view) { @@ -5593,3 +5574,37 @@ ev_scroll_type_get_type (void) } return etype; } + +void +ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window) +{ + int width, height; + GtkRequisition vsb_requisition; + GtkRequisition hsb_requisition; + int scrollbar_spacing; + + /* Calculate the width available for the content */ + width = GTK_WIDGET (scrolled_window)->allocation.width; + height = GTK_WIDGET (scrolled_window)->allocation.height; + + if (gtk_scrolled_window_get_shadow_type (scrolled_window) == GTK_SHADOW_IN + && view) { + width -= 2 * GTK_WIDGET(view)->style->xthickness; + height -= 2 * GTK_WIDGET(view)->style->ythickness; + } + + gtk_widget_size_request (scrolled_window->vscrollbar, &vsb_requisition); + gtk_widget_size_request (scrolled_window->hscrollbar, &hsb_requisition); + gtk_widget_style_get (GTK_WIDGET (scrolled_window), + "scrollbar_spacing", + &scrollbar_spacing, + NULL); + + if (EV_IS_VIEW(view)) { + ev_view_set_zoom_for_size (EV_VIEW (view), + MAX (1, width), + MAX (1, height), + vsb_requisition.width + scrollbar_spacing, + hsb_requisition.height + scrollbar_spacing); + } +}