From e4d427349a63af1a0d37687ef5f3012312e955e2 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sat, 20 Jul 2013 09:34:18 +0200 Subject: libview: Remove unused rectangle selection mode origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=848459e --- libview/ev-view-private.h | 1 - libview/ev-view.c | 64 ++++------------------------------------------- libview/ev-view.h | 5 ---- 3 files changed, 5 insertions(+), 65 deletions(-) diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h index 178733a7..5cbce64e 100644 --- a/libview/ev-view-private.h +++ b/libview/ev-view-private.h @@ -191,7 +191,6 @@ struct _EvView { guint selection_update_id; guint selection_scroll_id; - EvViewSelectionMode selection_mode; SelectionInfo selection_info; /* Copy link address selection */ diff --git a/libview/ev-view.c b/libview/ev-view.c index 2e277cff..2109af11 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -6480,7 +6480,6 @@ ev_view_init (EvView *view) view->scroll_info.autoscrolling = FALSE; view->selection_info.selections = NULL; view->selection_info.in_drag = FALSE; - view->selection_mode = EV_VIEW_SELECTION_TEXT; view->continuous = TRUE; view->dual_even_left = TRUE; view->fullscreen = FALSE; @@ -7529,51 +7528,6 @@ ev_view_highlight_forward_search (EvView *view, } /*** Selections ***/ - -/* compute_new_selection_rect/text calculates the area currently selected by - * view_rect. each handles a different mode; - */ -static GList * -compute_new_selection_rect (EvView *view, - GdkPoint *start, - GdkPoint *stop) -{ - GdkRectangle view_rect; - int n_pages, i; - GList *list = NULL; - - g_assert (view->selection_mode == EV_VIEW_SELECTION_RECTANGLE); - - view_rect.x = MIN (start->x, stop->x); - view_rect.y = MIN (start->y, stop->y); - view_rect.width = MAX (start->x, stop->x) - view_rect.x; - view_rect.width = MAX (start->y, stop->y) - view_rect.y; - - n_pages = ev_document_get_n_pages (view->document); - - for (i = 0; i < n_pages; i++) { - GdkRectangle page_area; - GtkBorder border; - - if (ev_view_get_page_extents (view, i, &page_area, &border)) { - GdkRectangle overlap; - - if (gdk_rectangle_intersect (&page_area, &view_rect, &overlap)) { - EvViewSelection *selection; - - selection = g_slice_new0 (EvViewSelection); - selection->page = i; - _ev_view_transform_view_rect_to_doc_rect (view, &overlap, &page_area, - &(selection->rect)); - - list = g_list_append (list, selection); - } - } - } - - return list; -} - static gboolean gdk_rectangle_point_in (GdkRectangle *rectangle, GdkPoint *point) @@ -7585,10 +7539,10 @@ gdk_rectangle_point_in (GdkRectangle *rectangle, } static GList * -compute_new_selection_text (EvView *view, - EvSelectionStyle style, - GdkPoint *start, - GdkPoint *stop) +compute_new_selection (EvView *view, + EvSelectionStyle style, + GdkPoint *start, + GdkPoint *stop) { int n_pages, i, first, last; GList *list = NULL; @@ -7596,8 +7550,6 @@ compute_new_selection_text (EvView *view, gdouble width, height; int start_page, end_page; - g_assert (view->selection_mode == EV_VIEW_SELECTION_TEXT); - n_pages = ev_document_get_n_pages (view->document); /* First figure out the range of pages the selection @@ -7819,13 +7771,7 @@ compute_selections (EvView *view, GdkPoint *start, GdkPoint *stop) { - GList *list; - - if (view->selection_mode == EV_VIEW_SELECTION_RECTANGLE) - list = compute_new_selection_rect (view, start, stop); - else - list = compute_new_selection_text (view, style, start, stop); - merge_selection_region (view, list); + merge_selection_region (view, compute_new_selection (view, style, start, stop)); } /* Free's the selection. It's up to the caller to queue redraws if needed. diff --git a/libview/ev-view.h b/libview/ev-view.h index 97c8cac2..be829357 100644 --- a/libview/ev-view.h +++ b/libview/ev-view.h @@ -40,11 +40,6 @@ G_BEGIN_DECLS typedef struct _EvView EvView; typedef struct _EvViewClass EvViewClass; -typedef enum { - EV_VIEW_SELECTION_TEXT, - EV_VIEW_SELECTION_RECTANGLE, -} EvViewSelectionMode; - GType ev_view_get_type (void) G_GNUC_CONST; GtkWidget* ev_view_new (void); -- cgit v1.2.1