Update HACKING for changed doc generation instructions
[geany-mirror.git] / src / search.h
blobe732697ce6c67f850bc40c3b92a0c2b90cb8c8c4
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 enum GeanyFindFlags
66 GEANY_FIND_MATCHCASE = 1 << 0,
67 GEANY_FIND_WHOLEWORD = 1 << 1,
68 GEANY_FIND_WORDSTART = 1 << 2,
69 GEANY_FIND_REGEXP = 1 << 3,
70 GEANY_FIND_MULTILINE = 1 << 4
73 /** Search preferences */
74 typedef struct GeanySearchPrefs
76 gboolean always_wrap; /* don't ask whether to wrap search */
77 gboolean use_current_word; /**< Use current word for default search text */
78 gboolean use_current_file_dir; /* find in files directory to use on showing dialog */
79 gboolean hide_find_dialog; /* hide the find dialog on next or previous */
80 enum GeanyFindSelOptions find_selection_type;
82 GeanySearchPrefs;
84 extern GeanySearchPrefs search_prefs;
87 typedef struct GeanyMatchInfo
89 gint flags;
90 /* range */
91 gint start, end;
92 /* only valid if (flags & SCFIND_REGEX) */
93 gchar *match_text; /* text actually matched */
94 struct
96 gint start, end;
98 matches[10]; /* sub-patterns */
100 GeanyMatchInfo;
103 void search_init(void);
105 void search_finalize(void);
107 void search_show_find_dialog(void);
109 void search_show_replace_dialog(void);
111 void search_show_find_in_files_dialog(const gchar *dir);
113 void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
115 void geany_match_info_free(GeanyMatchInfo *info);
117 gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, gint flags, GeanyMatchInfo **match_);
119 gint search_find_next(struct _ScintillaObject *sci, const gchar *str, gint flags, GeanyMatchInfo **match_);
121 gint search_find_text(struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_);
123 void search_find_again(gboolean change_direction);
125 void search_find_usage(const gchar *search_text, const gchar *original_search_text, gint flags, gboolean in_session);
127 void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
129 gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, gint flags);
131 gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
133 guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
134 gint flags, const gchar *replace_text);
136 G_END_DECLS
138 #endif /* GEANY_SEARCH_H */