From f308e319f3170a2949624e211adf75002ee5d3f1 Mon Sep 17 00:00:00 2001 From: defanor Date: Sat, 24 Aug 2019 13:38:44 +0300 Subject: Introduce incremental text search It is quite rough and should be refined, but as with most of the other features, introducing it at this stage primarily to ensure that it will not require major changes. --- src/documentbox.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/documentbox.h') diff --git a/src/documentbox.h b/src/documentbox.h index 351471b..64a2320 100644 --- a/src/documentbox.h +++ b/src/documentbox.h @@ -46,14 +46,32 @@ struct _SelectionState gboolean selecting; }; +typedef enum _TSState TSState; +enum _TSState { + START, + LOOKING, + FOUND +}; + +typedef struct _TextSearchState TextSearchState; +struct _TextSearchState +{ + InlineBox *ib; + gint start; + gint end; + const gchar *str; + gboolean forward; + TSState state; +}; + struct _DocumentBox { GtkScrolledWindow parent_instance; GtkEventBox *evbox; GList *links; SelectionState sel; + TextSearchState search; GdkWindow *event_window; - /* GList *forms; */ }; struct _DocumentBoxClass @@ -63,7 +81,7 @@ struct _DocumentBoxClass GType document_box_get_type(void) G_GNUC_CONST; DocumentBox *document_box_new(void); - +gboolean document_box_find (DocumentBox *db, const gchar *str); G_END_DECLS -- cgit v1.2.3