2 * search.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2006-2011 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2006-2011 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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 #ifndef GEANY_SEARCH_H
29 #define GEANY_SEARCH_H 1
31 /* the flags given in the search dialog for "find next", also used by the search bar */
32 typedef struct GeanySearchData
37 /* set to TRUE when text was set by a search bar callback to keep track of
38 * search bar background colour */
40 /* text as it was entered by user */
45 extern GeanySearchData search_data
;
48 enum GeanyFindSelOptions
50 GEANY_FIND_SEL_CURRENT_WORD
,
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 enum GeanyFindSelOptions find_selection_type
;
66 extern GeanySearchPrefs search_prefs
;
69 void search_init(void);
71 void search_finalize(void);
73 void search_show_find_dialog(void);
75 void search_show_replace_dialog(void);
77 void search_show_find_in_files_dialog(const gchar
*dir
);
80 struct _ScintillaObject
;
81 struct Sci_TextToFind
;
83 gint
search_find_next(struct _ScintillaObject
*sci
, const gchar
*str
, gint flags
);
85 gint
search_find_text(struct _ScintillaObject
*sci
, gint flags
, struct Sci_TextToFind
*ttf
);
87 void search_find_again(gboolean change_direction
);
89 void search_find_usage(const gchar
*search_text
, const gchar
*original_search_text
, gint flags
, gboolean in_session
);
91 void search_find_selection(GeanyDocument
*doc
, gboolean search_backwards
);
93 gint
search_mark_all(GeanyDocument
*doc
, const gchar
*search_text
, gint flags
);
95 gint
search_replace_target(struct _ScintillaObject
*sci
, const gchar
*replace_text
,
98 guint
search_replace_range(struct _ScintillaObject
*sci
, struct Sci_TextToFind
*ttf
,
99 gint flags
, const gchar
*replace_text
);