geany  1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

search.h
Go to the documentation of this file.
1/*
2 * search.h - this file is part of Geany, a fast and lightweight IDE
3 *
4 * Copyright 2006 The Geany contributors
5 *
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.
10 *
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.
15 *
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.
19 */
20
21/**
22 * @file search.h
23 * Search (prefs).
24 **/
25
26
27#ifndef GEANY_SEARCH_H
28#define GEANY_SEARCH_H 1
29
30#include <glib.h>
31
32
33G_BEGIN_DECLS
34
35typedef enum GeanyFindFlags
36{
44
45/** @gironly
46 * Find selection options */
47typedef enum
48{
54
55/** Search preferences */
56typedef struct GeanySearchPrefs
57{
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 */
64}
66
67typedef struct GeanyMatchInfo
68{
70 /* range */
71 gint start, end;
72 /* only valid if (flags & GEANY_FIND_REGEX) */
73 gchar *match_text; /* text actually matched */
74 struct
75 {
76 gint start, end;
77 }
78 matches[10]; /* sub-patterns */
79}
81
82void search_show_find_in_files_dialog(const gchar *dir);
83
84
85#ifdef GEANY_PRIVATE
86
87struct GeanyDocument; /* document.h includes this header */
88struct _ScintillaObject;
89struct Sci_TextToFind;
90
91
92/* the flags given in the search dialog for "find next", also used by the search bar */
93typedef struct GeanySearchData
94{
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;
103}
104GeanySearchData;
105
106extern GeanySearchData search_data;
107
109
110
111void search_init(void);
112
113void search_finalize(void);
114
115void search_show_find_dialog(void);
116
118
119void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir);
120
122
123gint search_find_prev(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
124
125gint search_find_next(struct _ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_);
126
127gint search_find_text(struct _ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_);
128
129void search_find_again(gboolean change_direction);
130
131void search_find_usage(const gchar *search_text, const gchar *original_search_text, GeanyFindFlags flags, gboolean in_session);
132
133void search_find_selection(struct GeanyDocument *doc, gboolean search_backwards);
134
135gint search_mark_all(struct GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags);
136
137gint search_replace_match(struct _ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text);
138
139guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
140 GeanyFindFlags flags, const gchar *replace_text);
141
142#endif /* GEANY_PRIVATE */
143
144G_END_DECLS
145
146#endif /* GEANY_SEARCH_H */
gchar * text
Definition: editor.c:83
ScintillaObject * sci
Definition: editor.c:88
static bool match(const unsigned char *line, const char *word)
Definition: geany_tcl.c:55
gint search_mark_all(GeanyDocument *doc, const gchar *search_text, GeanyFindFlags flags)
Definition: search.c:1231
void search_find_usage(const gchar *search_text, const gchar *original_search_text, GeanyFindFlags flags, gboolean in_session)
Definition: search.c:2189
void search_show_find_dialog(void)
Definition: search.c:557
void geany_match_info_free(GeanyMatchInfo *info)
Definition: search.c:1184
void search_find_selection(GeanyDocument *doc, gboolean search_backwards)
Definition: search.c:403
gint search_find_text(ScintillaObject *sci, GeanyFindFlags flags, struct Sci_TextToFind *ttf, GeanyMatchInfo **match_)
Definition: search.c:2110
void search_finalize(void)
Definition: search.c:285
guint search_replace_range(ScintillaObject *sci, struct Sci_TextToFind *ttf, GeanyFindFlags flags, const gchar *replace_text)
Definition: search.c:2243
void search_show_find_in_files_dialog_full(const gchar *text, const gchar *dir)
Definition: search.c:1047
GeanySearchData search_data
Definition: search.c:77
void search_find_again(gboolean change_direction)
Definition: search.c:2282
void search_init(void)
Definition: search.c:274
gint search_replace_match(ScintillaObject *sci, const GeanyMatchInfo *match, const gchar *replace_text)
Definition: search.c:2064
gint search_find_next(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
Definition: search.c:2025
GeanySearchPrefs search_prefs
Definition: search.c:78
gint search_find_prev(ScintillaObject *sci, const gchar *str, GeanyFindFlags flags, GeanyMatchInfo **match_)
Definition: search.c:2012
void search_show_replace_dialog(void)
Definition: search.c:734
void search_show_find_in_files_dialog(const gchar *dir)
Shows the Find in Files dialog.
Definition: search.c:1041
struct GeanyMatchInfo GeanyMatchInfo
struct GeanySearchPrefs GeanySearchPrefs
Search preferences.
GeanyFindSelOptions
Definition: search.h:48
@ GEANY_FIND_SEL_X
Definition: search.h:50
@ GEANY_FIND_SEL_CURRENT_WORD
Definition: search.h:49
@ GEANY_FIND_SEL_AGAIN
Definition: search.h:51
GeanyFindFlags
Definition: search.h:36
@ GEANY_FIND_WORDSTART
Definition: search.h:39
@ GEANY_FIND_REGEXP
Definition: search.h:40
@ GEANY_FIND_WHOLEWORD
Definition: search.h:38
@ GEANY_FIND_MATCHCASE
Definition: search.h:37
@ GEANY_FIND_MULTILINE
Definition: search.h:41
Structure for representing an open tab with all its properties.
Definition: document.h:81
struct GeanyMatchInfo::@109 matches[10]
gint start
Definition: search.h:71
gchar * match_text
Definition: search.h:73
GeanyFindFlags flags
Definition: search.h:69
gint end
Definition: search.h:71
Search preferences.
Definition: search.h:57
gboolean hide_find_dialog
Definition: search.h:61
gboolean replace_and_find_by_default
Definition: search.h:62
gboolean always_wrap
Definition: search.h:58
gboolean use_current_word
Use current word for default search text.
Definition: search.h:59
gboolean use_current_file_dir
Definition: search.h:60
GeanyFindSelOptions find_selection_type
Definition: search.h:63