c++: Fix handling of the `final` contextual keyword
[geany-mirror.git] / src / search.h
blob32bf322fc4285d77960df0f538a464d44a4f9f99
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 typedef enum GeanyFindFlags
38 GEANY_FIND_MATCHCASE = 1 << 0,
39 GEANY_FIND_WHOLEWORD = 1 << 1,
40 GEANY_FIND_WORDSTART = 1 << 2,
41 GEANY_FIND_REGEXP = 1 << 3,
42 GEANY_FIND_MULTILINE = 1 << 4
44 GeanyFindFlags;
46 enum GeanyFindSelOptions
48 GEANY_FIND_SEL_CURRENT_WORD,
49 GEANY_FIND_SEL_X,
50 GEANY_FIND_SEL_AGAIN
53 /** Search preferences */
54 typedef struct GeanySearchPrefs
56 gboolean always_wrap; /* don't ask whether to wrap search */
57 gboolean use_current_word; /**< Use current word for default search text */
58 gboolean use_current_file_dir; /* find in files directory to use on showing dialog */
59 gboolean hide_find_dialog; /* hide the find dialog on next or previous */
60 gboolean replace_and_find_by_default; /* enter in replace window performs Replace & Find instead of Replace */
61 enum GeanyFindSelOptions find_selection_type;
63 GeanySearchPrefs;
65 typedef struct GeanyMatchInfo
67 GeanyFindFlags flags;
68 /* range */
69 gint start, end;
70 /* only valid if (flags & GEANY_FIND_REGEX) */
71 gchar *match_text; /* text actually matched */
72 struct
74 gint start, end;
76 matches[10]; /* sub-patterns */
78 GeanyMatchInfo;
80 void search_show_find_in_files_dialog(const gchar *dir);
83 #ifdef GEANY_PRIVATE
85 struct GeanyDocument; /* document.h includes this header */
86 struct _ScintillaObject;
87 struct Sci_TextToFind;
90 /* the flags given in the search dialog for "find next", also used by the search bar */
91 typedef struct GeanySearchData
93 gchar *text;
94 GeanyFindFlags flags;
95 gboolean backwards;
96 /* set to TRUE when text was set by a search bar callback to keep track of
97 * search bar background colour */
98 gboolean search_bar;
99 /* text as it was entered by user */
100 gchar *original_text;
102 GeanySearchData;
104 extern GeanySearchData search_data;
106 extern GeanySearchPrefs search_prefs;
109 void search_init(void);
111 void search_finalize(void);
113 void search_show_find_dialog(void);
115 void search_show_replace_dialog(void);
117 void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
119 void geany_match_info_free(GeanyMatchInfo *info);
121 gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
123 gint search_find_next(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
125 gint search_find_text(struct _ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_);
127 void search_find_again(gboolean change_direction);
129 void search_find_usage(const gchar *search_text, const gchar *original_search_text, GeanyFindFlags flags, gboolean in_session);
131 void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
133 gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags);
135 gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
137 guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
138 GeanyFindFlags flags, const gchar *replace_text);
140 #endif /* GEANY_PRIVATE */
142 G_END_DECLS
144 #endif /* GEANY_SEARCH_H */