From ae6a79781ff5126c19c84570277376f43158ec86 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 29 Jan 2005 17:50:09 +0000 Subject: Enanche the find interface to be really able to do multi page find. 2005-01-29 Marco Pesenti Gritti * backend/ev-backend-marshalers.list: * backend/ev-document-find.c: (ev_document_find_base_init), (ev_document_find_cancel), (ev_document_find_page_has_results), (ev_document_find_get_n_results), (ev_document_find_get_result), (ev_document_find_get_progress), (ev_document_find_changed): * backend/ev-document-find.h: Enanche the find interface to be really able to do multi page find. * pdf/xpdf/pdf-document.cc: Implement * shell/ev-view.c: (ev_view_finalize), (highlight_find_results), (expose_bin_window), (ev_view_init), (ev_view_get_find_status_message), (find_changed_cb), (ev_view_set_document), (set_document_page): Adapt to the new interface. A few things are regressed sorry, I will finish it soon. --- (limited to 'backend') diff --git a/backend/ev-backend-marshalers.list b/backend/ev-backend-marshalers.list index ad912f9..e69de29 100644 --- a/backend/ev-backend-marshalers.list +++ b/backend/ev-backend-marshalers.list @@ -1 +0,0 @@ -VOID:POINTER,INT,DOUBLE diff --git a/backend/ev-document-find.c b/backend/ev-document-find.c index 78c07c9..9dc05c4 100644 --- a/backend/ev-document-find.c +++ b/backend/ev-document-find.c @@ -53,16 +53,13 @@ ev_document_find_base_init (gpointer g_class) static gboolean initialized = FALSE; if (!initialized) { - g_signal_new ("found", + g_signal_new ("find_changed", EV_TYPE_DOCUMENT_FIND, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EvDocumentFindIface, found), + G_STRUCT_OFFSET (EvDocumentFindIface, find_changed), NULL, NULL, - _ev_backend_marshal_VOID__POINTER_INT_DOUBLE, - G_TYPE_NONE, 3, - G_TYPE_POINTER, - G_TYPE_INT, - G_TYPE_DOUBLE); + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); initialized = TRUE; } @@ -85,18 +82,43 @@ ev_document_find_cancel (EvDocumentFind *document_find) { EvDocumentFindIface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); iface->cancel (document_find); +} + +int +ev_document_find_page_has_results (EvDocumentFind *document_find, + int page) +{ + EvDocumentFindIface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); + return iface->page_has_results (document_find, page); +} + +int +ev_document_find_get_n_results (EvDocumentFind *document_find) +{ + EvDocumentFindIface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); + return iface->get_n_results (document_find); +} + +gboolean +ev_document_find_get_result (EvDocumentFind *document_find, + int n_result, + GdkRectangle *rectangle) +{ + EvDocumentFindIface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); + return iface->get_result (document_find, n_result, rectangle); +} - ev_document_find_found (document_find, NULL, 0, 1.0); +void +ev_document_find_get_progress (EvDocumentFind *document_find, + double percent_complete) +{ + EvDocumentFindIface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); + iface->get_progress (document_find, percent_complete); } void -ev_document_find_found (EvDocumentFind *document_find, - const EvFindResult *results, - int n_results, - double percent_complete) +ev_document_find_changed (EvDocumentFind *document_find) { - g_signal_emit_by_name (document_find, - "found", - results, n_results, percent_complete); + g_signal_emit_by_name (document_find, "find_changed"); } diff --git a/backend/ev-document-find.h b/backend/ev-document-find.h index 112faf2..d17b9de 100644 --- a/backend/ev-document-find.h +++ b/backend/ev-document-find.h @@ -28,12 +28,6 @@ G_BEGIN_DECLS -typedef struct -{ - int page_num; - GdkRectangle highlight_area; -} EvFindResult; - #define EV_TYPE_DOCUMENT_FIND (ev_document_find_get_type ()) #define EV_DOCUMENT_FIND(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT_FIND, EvDocumentFind)) #define EV_DOCUMENT_FIND_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT_FIND, EvDocumentFindIface)) @@ -50,29 +44,38 @@ struct _EvDocumentFindIface /* Methods */ - void (* begin) (EvDocumentFind *document_find, - const char *search_string, - gboolean case_sensitive); - void (* cancel) (EvDocumentFind *document_find); + void (* begin) (EvDocumentFind *document_find, + const char *search_string, + gboolean case_sensitive); + void (* cancel) (EvDocumentFind *document_find); + int (* page_has_results) (EvDocumentFind *document_find, + int page); + int (* get_n_results) (EvDocumentFind *document_find); + gboolean (* get_result) (EvDocumentFind *document_find, + int n_result, + GdkRectangle *rectangle); + void (* get_progress) (EvDocumentFind *document_find, + double percent_complete); /* Signals */ - void (* found) (EvDocumentFind *document_find, - const EvFindResult *results, - int n_results, - double percent_complete); + void (* find_changed) (EvDocumentFind *document_find); }; -GType ev_document_find_get_type (void); - -void ev_document_find_begin (EvDocumentFind *document_find, - const char *search_string, - gboolean case_sensitive); -void ev_document_find_cancel (EvDocumentFind *document_find); -void ev_document_find_found (EvDocumentFind *document_find, - const EvFindResult *results, - int n_results, - double percent_complete); +GType ev_document_find_get_type (void); +void ev_document_find_begin (EvDocumentFind *document_find, + const char *search_string, + gboolean case_sensitive); +void ev_document_find_cancel (EvDocumentFind *document_find); +int ev_document_find_page_has_results (EvDocumentFind *document_find, + int page); +int ev_document_find_get_n_results (EvDocumentFind *document_find); +gboolean ev_document_find_get_result (EvDocumentFind *document_find, + int n_result, + GdkRectangle *rectangle); +void ev_document_find_get_progress (EvDocumentFind *document_find, + double percent_complete); +void ev_document_find_changed (EvDocumentFind *document_find); /* How this interface works: @@ -81,14 +84,6 @@ void ev_document_find_found (EvDocumentFind *document_find, * * cancel() cancels a search if any, otherwise does nothing. * - * If begin() has been called and cancel() has not, then the - * "found" signal can be emitted at any time. - * The results given in the "found" signal are always all-inclusive, - * that is, the array will contain all results found so far. - * There are no guarantees about the ordering of the array, - * or consistency of ordering between "found" signal emissions. - * - * When cancel() is called, "found" will always be emitted with NULL,0 */ G_END_DECLS -- cgit v0.9.1