2006-07-13 14:30:44 +00:00
|
|
|
/*
|
2006-08-20 11:54:33 +00:00
|
|
|
* search.h - this file is part of Geany, a fast and lightweight IDE
|
2006-07-13 14:30:44 +00:00
|
|
|
*
|
2012-06-18 01:13:05 +02:00
|
|
|
* Copyright 2006-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
|
|
|
* Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
2006-07-13 14:30:44 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2012-08-24 19:25:57 +02:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-07-13 14:30:44 +00:00
|
|
|
*/
|
|
|
|
|
2009-10-26 12:58:52 +00:00
|
|
|
/**
|
|
|
|
* @file search.h
|
|
|
|
* Search (prefs).
|
|
|
|
**/
|
|
|
|
|
2006-07-13 14:30:44 +00:00
|
|
|
|
2006-09-20 11:03:33 +00:00
|
|
|
#ifndef GEANY_SEARCH_H
|
|
|
|
#define GEANY_SEARCH_H 1
|
2006-07-28 18:37:32 +00:00
|
|
|
|
2012-03-28 22:50:18 -07:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2008-02-27 13:17:29 +00:00
|
|
|
/* the flags given in the search dialog for "find next", also used by the search bar */
|
2008-05-16 12:08:39 +00:00
|
|
|
typedef struct GeanySearchData
|
2006-08-11 21:12:49 +00:00
|
|
|
{
|
|
|
|
gchar *text;
|
|
|
|
gint flags;
|
|
|
|
gboolean backwards;
|
2008-02-27 13:17:29 +00:00
|
|
|
/* set to TRUE when text was set by a search bar callback to keep track of
|
|
|
|
* search bar background colour */
|
2007-07-11 17:44:43 +00:00
|
|
|
gboolean search_bar;
|
2011-06-03 13:40:42 +00:00
|
|
|
/* text as it was entered by user */
|
|
|
|
gchar *original_text;
|
2008-05-16 12:08:39 +00:00
|
|
|
}
|
|
|
|
GeanySearchData;
|
2006-08-11 21:12:49 +00:00
|
|
|
|
|
|
|
extern GeanySearchData search_data;
|
|
|
|
|
|
|
|
|
2010-09-23 12:22:44 +00:00
|
|
|
enum GeanyFindSelOptions
|
|
|
|
{
|
|
|
|
GEANY_FIND_SEL_CURRENT_WORD,
|
|
|
|
GEANY_FIND_SEL_X,
|
|
|
|
GEANY_FIND_SEL_AGAIN
|
|
|
|
};
|
|
|
|
|
2009-10-26 12:58:52 +00:00
|
|
|
/** Search preferences */
|
2008-05-16 12:08:39 +00:00
|
|
|
typedef struct GeanySearchPrefs
|
2007-04-15 15:59:57 +00:00
|
|
|
{
|
2011-12-05 21:24:33 +02:00
|
|
|
gboolean always_wrap; /* don't ask whether to wrap search */
|
2009-10-26 12:58:52 +00:00
|
|
|
gboolean use_current_word; /**< Use current word for default search text */
|
2008-06-25 11:56:58 +00:00
|
|
|
gboolean use_current_file_dir; /* find in files directory to use on showing dialog */
|
2011-12-05 21:24:33 +02:00
|
|
|
gboolean hide_find_dialog; /* hide the find dialog on next or previous */
|
2010-09-23 12:22:44 +00:00
|
|
|
enum GeanyFindSelOptions find_selection_type;
|
2008-05-16 12:08:39 +00:00
|
|
|
}
|
|
|
|
GeanySearchPrefs;
|
2007-04-15 15:59:57 +00:00
|
|
|
|
2008-05-16 12:08:39 +00:00
|
|
|
extern GeanySearchPrefs search_prefs;
|
2007-04-15 15:59:57 +00:00
|
|
|
|
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void search_init(void);
|
2006-08-11 21:12:49 +00:00
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void search_finalize(void);
|
2006-08-11 21:12:49 +00:00
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void search_show_find_dialog(void);
|
2006-08-11 21:12:49 +00:00
|
|
|
|
2008-02-20 11:24:23 +00:00
|
|
|
void search_show_replace_dialog(void);
|
2006-08-11 21:12:49 +00:00
|
|
|
|
2007-12-02 10:52:19 +00:00
|
|
|
void search_show_find_in_files_dialog(const gchar *dir);
|
2006-07-28 18:37:32 +00:00
|
|
|
|
2010-05-05 12:50:59 +00:00
|
|
|
|
2010-03-02 13:21:41 +00:00
|
|
|
struct _ScintillaObject;
|
2010-05-05 12:50:59 +00:00
|
|
|
struct Sci_TextToFind;
|
2010-03-02 13:21:41 +00:00
|
|
|
|
|
|
|
gint search_find_next(struct _ScintillaObject *sci, const gchar *str, gint flags);
|
|
|
|
|
2010-05-05 12:50:59 +00:00
|
|
|
gint search_find_text(struct _ScintillaObject *sci, gint flags, struct Sci_TextToFind *ttf);
|
|
|
|
|
2010-09-21 16:16:15 +00:00
|
|
|
void search_find_again(gboolean change_direction);
|
|
|
|
|
2011-06-03 13:40:42 +00:00
|
|
|
void search_find_usage(const gchar *search_text, const gchar *original_search_text, gint flags, gboolean in_session);
|
2006-11-01 15:26:41 +00:00
|
|
|
|
2008-06-15 13:35:48 +00:00
|
|
|
void search_find_selection(GeanyDocument *doc, gboolean search_backwards);
|
2007-01-23 17:51:30 +00:00
|
|
|
|
2009-07-10 15:17:27 +00:00
|
|
|
gint search_mark_all(GeanyDocument *doc, const gchar *search_text, gint flags);
|
|
|
|
|
2010-03-02 13:21:41 +00:00
|
|
|
gint search_replace_target(struct _ScintillaObject *sci, const gchar *replace_text,
|
|
|
|
gboolean regex);
|
|
|
|
|
2010-03-08 13:28:04 +00:00
|
|
|
guint search_replace_range(struct _ScintillaObject *sci, struct Sci_TextToFind *ttf,
|
|
|
|
gint flags, const gchar *replace_text);
|
|
|
|
|
2012-03-28 22:50:18 -07:00
|
|
|
G_END_DECLS
|
|
|
|
|
2006-09-20 11:03:33 +00:00
|
|
|
#endif
|