meson: Only perform macos checks on macos
[geany-mirror.git] / src / search.h
blob7c7474ba692539f4cadd892c7a81d71631453d7a
1 /*
2 * search.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2006 The Geany contributors
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 /**
22 * @file search.h
23 * Search (prefs).
24 **/
27 #ifndef GEANY_SEARCH_H
28 #define GEANY_SEARCH_H 1
30 #include <glib.h>
33 G_BEGIN_DECLS
35 typedef enum GeanyFindFlags
37 GEANY_FIND_MATCHCASE = 1 << 0,
38 GEANY_FIND_WHOLEWORD = 1 << 1,
39 GEANY_FIND_WORDSTART = 1 << 2,
40 GEANY_FIND_REGEXP = 1 << 3,
41 GEANY_FIND_MULTILINE = 1 << 4
43 GeanyFindFlags;
45 /** @gironly
46 * Find selection options */
47 typedef enum
49 GEANY_FIND_SEL_CURRENT_WORD,
50 GEANY_FIND_SEL_X,
51 GEANY_FIND_SEL_AGAIN
53 GeanyFindSelOptions;
55 /** Search preferences */
56 typedef struct GeanySearchPrefs
58 gboolean always_wrap; /* don't ask whether to wrap search */
59 gboolean use_current_word; /**< Use current word for default search text */
60 gboolean use_current_file_dir; /* find in files directory to use on showing dialog */
61 gboolean hide_find_dialog; /* hide the find dialog on next or previous */
62 gboolean replace_and_find_by_default; /* enter in replace window performs Replace & Find instead of Replace */
63 GeanyFindSelOptions find_selection_type;
65 GeanySearchPrefs;
67 typedef struct GeanyMatchInfo
69 GeanyFindFlags flags;
70 /* range */
71 gint start, end;
72 /* only valid if (flags & GEANY_FIND_REGEX) */
73 gchar *match_text; /* text actually matched */
74 struct
76 gint start, end;
78 matches[10]; /* sub-patterns */
80 GeanyMatchInfo;
82 void search_show_find_in_files_dialog(const gchar *dir);
85 #ifdef GEANY_PRIVATE
87 struct GeanyDocument; /* document.h includes this header */
88 struct _ScintillaObject;
89 struct Sci_TextToFind;
92 /* the flags given in the search dialog for "find next", also used by the search bar */
93 typedef struct GeanySearchData
95 gchar *text;
96 GeanyFindFlags flags;
97 gboolean backwards;
98 /* set to TRUE when text was set by a search bar callback to keep track of
99 * search bar background colour */
100 gboolean search_bar;
101 /* text as it was entered by user */
102 gchar *original_text;
104 GeanySearchData;
106 extern GeanySearchData search_data;
108 extern GeanySearchPrefs search_prefs;
111 void search_init(void);
113 void search_finalize(void);
115 void search_show_find_dialog(void);
117 void search_show_replace_dialog(void);
119 void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
121 void geany_match_info_free(GeanyMatchInfo *info);
123 gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
125 gint search_find_next(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
127 gint search_find_text(struct _ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_);
129 void search_find_again(gboolean change_direction);
131 void search_find_usage(const gchar *search_text, const gchar *original_search_text, GeanyFindFlags flags, gboolean in_session);
133 void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
135 gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags);
137 gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
139 guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
140 GeanyFindFlags flags, const gchar *replace_text);
142 #endif /* GEANY_PRIVATE */
144 G_END_DECLS
146 #endif /* GEANY_SEARCH_H */