infobars: Intercept some keys when the info bar is shown to allow interacting with...
[geany-mirror.git] / src / search.h
blobf51175e55baf5f9d559b315292998fb2b1634f71
1 /*
2 * search.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2006-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 /**
23 * @file search.h
24 * Search (prefs).
25 **/
28 #ifndef GEANY_SEARCH_H
29 #define GEANY_SEARCH_H 1
31 #include <glib.h>
34 G_BEGIN_DECLS
36 struct GeanyDocument; /* document.h includes this header */
37 struct _ScintillaObject;
38 struct Sci_TextToFind;
40 /* the flags given in the search dialog for "find next", also used by the search bar */
41 typedef struct GeanySearchData
43 gchar *text;
44 gint flags;
45 gboolean backwards;
46 /* set to TRUE when text was set by a search bar callback to keep track of
47 * search bar background colour */
48 gboolean search_bar;
49 /* text as it was entered by user */
50 gchar *original_text;
52 GeanySearchData;
54 extern GeanySearchData search_data;
57 enum GeanyFindSelOptions
59 GEANY_FIND_SEL_CURRENT_WORD,
60 GEANY_FIND_SEL_X,
61 GEANY_FIND_SEL_AGAIN
64 /** Search preferences */
65 typedef struct GeanySearchPrefs
67 gboolean always_wrap; /* don't ask whether to wrap search */
68 gboolean use_current_word; /**< Use current word for default search text */
69 gboolean use_current_file_dir; /* find in files directory to use on showing dialog */
70 gboolean hide_find_dialog; /* hide the find dialog on next or previous */
71 enum GeanyFindSelOptions find_selection_type;
73 GeanySearchPrefs;
75 extern GeanySearchPrefs search_prefs;
78 typedef struct GeanyMatchInfo
80 gint flags;
81 /* range */
82 gint start, end;
83 /* only valid if (flags & SCFIND_REGEX) */
84 gchar *match_text; /* text actually matched */
85 struct
87 gint start, end;
89 matches[10]; /* sub-patterns */
91 GeanyMatchInfo;
94 void search_init(void);
96 void search_finalize(void);
98 void search_show_find_dialog(void);
100 void search_show_replace_dialog(void);
102 void search_show_find_in_files_dialog(const gchar *dir);
104 void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
106 void geany_match_info_free(GeanyMatchInfo *info);
108 gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, gint flags, GeanyMatchInfo **match_);
110 gint search_find_next(struct _ScintillaObject *sci, const gchar *str, gint flags, GeanyMatchInfo **match_);
112 gint search_find_text(struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_);
114 void search_find_again(gboolean change_direction);
116 void search_find_usage(const gchar *search_text, const gchar *original_search_text, gint flags, gboolean in_session);
118 void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
120 gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, gint flags);
122 gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
124 guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
125 gint flags, const gchar *replace_text);
127 G_END_DECLS
129 #endif /* GEANY_SEARCH_H */