2005-09-06 09:21:05 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
2005-09-09 02:54:58 -07:00
|
|
|
*
|
2005-09-06 09:21:05 -07:00
|
|
|
* mooeditsearch.h
|
2005-06-22 11:20:32 -07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
2005-07-23 21:58:57 -07:00
|
|
|
*/
|
2005-06-22 11:20:32 -07:00
|
|
|
|
2005-09-06 09:21:05 -07:00
|
|
|
#ifndef __MOO_EDIT_SEARCH_H__
|
|
|
|
#define __MOO_EDIT_SEARCH_H__
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
#include "mooedit/mooedit.h"
|
2005-09-09 02:40:10 -07:00
|
|
|
#include "mooedit/mootextview.h"
|
2005-06-22 11:20:32 -07:00
|
|
|
#include "mooutils/eggregex.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
#define MOO_TYPE_TEXT_SEARCH_OPTIONS (moo_text_search_options_get_type ())
|
|
|
|
#define MOO_TYPE_TEXT_REPLACE_RESPONSE_TYPE (moo_text_replace_response_type_get_type ())
|
|
|
|
GType moo_text_search_options_get_type (void) G_GNUC_UNUSED;
|
|
|
|
GType moo_text_replace_response_type_get_type (void) G_GNUC_UNUSED;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
typedef enum {
|
2005-09-09 02:40:10 -07:00
|
|
|
MOO_TEXT_SEARCH_BACKWARDS = 1 << 0,
|
|
|
|
MOO_TEXT_SEARCH_CASE_INSENSITIVE = 1 << 1,
|
|
|
|
MOO_TEXT_SEARCH_REGEX = 1 << 2
|
|
|
|
} MooTextSearchOptions;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
gboolean moo_text_search (const GtkTextIter *start,
|
2005-06-22 11:20:32 -07:00
|
|
|
const GtkTextIter *limit,
|
|
|
|
const char *text,
|
|
|
|
GtkTextIter *match_start,
|
|
|
|
GtkTextIter *match_end,
|
2005-09-09 02:40:10 -07:00
|
|
|
MooTextSearchOptions options,
|
2005-06-22 11:20:32 -07:00
|
|
|
GError **error);
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
gboolean moo_text_search_regex (const GtkTextIter *start,
|
2005-06-22 11:20:32 -07:00
|
|
|
const GtkTextIter *limit,
|
|
|
|
EggRegex *regex,
|
|
|
|
GtkTextIter *match_start,
|
|
|
|
GtkTextIter *match_end,
|
|
|
|
gboolean backwards);
|
|
|
|
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
#define MOO_TEXT_REPLACE_INVALID_ARGS ((int)-1)
|
|
|
|
#define MOO_TEXT_REPLACE_REGEX_ERROR ((int)-2)
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
/* Do not change numerical values!!! */
|
|
|
|
typedef enum {
|
2005-09-09 02:40:10 -07:00
|
|
|
MOO_TEXT_REPLACE_STOP = 0,
|
|
|
|
MOO_TEXT_REPLACE_AND_STOP = 1,
|
|
|
|
MOO_TEXT_REPLACE_SKIP = 2,
|
|
|
|
MOO_TEXT_REPLACE = 3,
|
|
|
|
MOO_TEXT_REPLACE_ALL = 4
|
|
|
|
} MooTextReplaceResponseType;
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
/* replacement is real replacement text when searching for regex */
|
2005-09-09 02:40:10 -07:00
|
|
|
typedef MooTextReplaceResponseType (* MooTextReplaceFunc) (const char *text,
|
|
|
|
EggRegex *regex,
|
|
|
|
const char *replacement,
|
|
|
|
GtkTextIter *to_replace_start,
|
|
|
|
GtkTextIter *to_replace_end,
|
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
MooTextReplaceResponseType moo_text_replace_func_replace_all
|
2005-06-22 11:20:32 -07:00
|
|
|
(const char *text,
|
|
|
|
EggRegex *regex,
|
|
|
|
const char *replacement,
|
|
|
|
GtkTextIter *to_replace_start,
|
|
|
|
GtkTextIter *to_replace_end,
|
|
|
|
gpointer data);
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
int moo_text_replace_all_interactive(GtkTextIter *start,
|
2005-06-22 11:20:32 -07:00
|
|
|
GtkTextIter *end,
|
|
|
|
const char *text,
|
|
|
|
const char *replacement,
|
2005-09-09 02:40:10 -07:00
|
|
|
MooTextSearchOptions options,
|
2005-06-22 11:20:32 -07:00
|
|
|
GError **error,
|
2005-09-09 02:40:10 -07:00
|
|
|
MooTextReplaceFunc func,
|
2005-06-22 11:20:32 -07:00
|
|
|
gpointer data);
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
int moo_text_replace_regex_all_interactive
|
2005-06-22 11:20:32 -07:00
|
|
|
(GtkTextIter *start,
|
|
|
|
GtkTextIter *end,
|
|
|
|
EggRegex *regex,
|
|
|
|
const char *replacement,
|
|
|
|
gboolean backwards,
|
|
|
|
GError **error,
|
2005-09-09 02:40:10 -07:00
|
|
|
MooTextReplaceFunc func,
|
2005-06-22 11:20:32 -07:00
|
|
|
gpointer data);
|
|
|
|
|
|
|
|
|
2005-09-09 02:40:10 -07:00
|
|
|
void _moo_text_view_find (MooTextView *edit);
|
|
|
|
void _moo_text_view_replace (MooTextView *edit);
|
|
|
|
void _moo_text_view_find_next (MooTextView *edit);
|
|
|
|
void _moo_text_view_find_previous (MooTextView *edit);
|
2005-06-22 11:20:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2005-09-06 09:21:05 -07:00
|
|
|
#endif /* __MOO_EDIT_SEARCH_H__ */
|