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.
28 #ifndef GEANY_SEARCH_H
29 #define GEANY_SEARCH_H 1
33 /* the flags given in the search dialog for "find next", also used by the search bar */
34 typedef struct GeanySearchData
39 /* set to TRUE when text was set by a search bar callback to keep track of
40 * search bar background colour */
42 /* text as it was entered by user */
47 extern GeanySearchData search_data
;
50 enum GeanyFindSelOptions
52 GEANY_FIND_SEL_CURRENT_WORD
,
57 /** Search preferences */
58 typedef struct GeanySearchPrefs
60 gboolean always_wrap
; /* don't ask whether to wrap search */
61 gboolean use_current_word
; /**< Use current word for default search text */
62 gboolean use_current_file_dir
; /* find in files directory to use on showing dialog */
63 gboolean hide_find_dialog
; /* hide the find dialog on next or previous */
64 enum GeanyFindSelOptions find_selection_type
;
68 extern GeanySearchPrefs search_prefs
;
71 void search_init(void);
73 void search_finalize(void);
75 void search_show_find_dialog(void);
77 void search_show_replace_dialog(void);
79 void search_show_find_in_files_dialog(const gchar
*dir
);
82 struct _ScintillaObject
;
83 struct Sci_TextToFind
;
85 gint
search_find_next(struct _ScintillaObject
*sci
, const gchar
*str
, gint flags
);
87 gint
search_find_text(struct _ScintillaObject
*sci
, gint flags
, struct Sci_TextToFind
*ttf
);
89 void search_find_again(gboolean change_direction
);
91 void search_find_usage(const gchar
*search_text
, const gchar
*original_search_text
, gint flags
, gboolean in_session
);
93 void search_find_selection(GeanyDocument
*doc
, gboolean search_backwards
);
95 gint
search_mark_all(GeanyDocument
*doc
, const gchar
*search_text
, gint flags
);
97 gint
search_replace_target(struct _ScintillaObject
*sci
, const gchar
*replace_text
,
100 guint
search_replace_range(struct _ScintillaObject
*sci
, struct Sci_TextToFind
*ttf
,
101 gint flags
, const gchar
*replace_text
);