1 /* $Id: search.h,v 1.25 2004/11/09 21:58:44 yooden Exp $ */
2 /*******************************************************************************
4 * search.h -- Nirvana Editor Search Header File *
6 * Copyright 2003 The NEdit Developers *
8 * This is free software; you can redistribute it and/or modify it under the *
9 * terms of the GNU General Public License as published by the Free Software *
10 * Foundation; either version 2 of the License, or (at your option) any later *
11 * version. In addition, you may distribute versions of this program linked to *
12 * Motif or Open Motif. See README for details. *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
23 * Nirvana Text Editor *
26 *******************************************************************************/
28 #ifndef NEDIT_SEARCH_H_INCLUDED
29 #define NEDIT_SEARCH_H_INCLUDED
33 #include <X11/Intrinsic.h>
36 enum SearchDirection
{SEARCH_FORWARD
, SEARCH_BACKWARD
};
38 void CreateFindDlog(Widget parent
, WindowInfo
*window
);
39 void CreateReplaceDlog(Widget parent
, WindowInfo
*window
);
40 void CreateReplaceMultiFileDlog(WindowInfo
*window
);
41 void DoFindReplaceDlog(WindowInfo
*window
, int direction
, int keepDialogs
,
42 int searchType
, Time time
);
43 void DoReplaceMultiFileDlog(WindowInfo
*window
);
44 void UpdateReplaceActionButtons(WindowInfo
* window
);
45 void DoFindDlog(WindowInfo
*window
, int direction
, int keepDialogs
,
46 int searchType
, Time time
);
47 int SearchAndSelect(WindowInfo
*window
, int direction
, const char *searchString
,
48 int searchType
, int searchWrap
);
49 int SearchAndSelectSame(WindowInfo
*window
, int direction
, int searchWrap
);
50 int SearchAndSelectIncremental(WindowInfo
*window
, int direction
,
51 const char *searchString
, int searchType
, int searchWrap
, int continued
);
52 void SearchForSelected(WindowInfo
*window
, int direction
, int searchWrap
,
53 int searchType
, Time time
);
54 int SearchAndReplace(WindowInfo
*window
, int direction
, const char *searchString
,
55 const char *replaceString
, int searchType
, int searchWrap
);
56 int ReplaceAndSearch(WindowInfo
*window
, int direction
, const char *searchString
,
57 const char *replaceString
, int searchType
, int searchWrap
);
58 int ReplaceFindSame(WindowInfo
*window
, int direction
, int searchWrap
);
59 int ReplaceSame(WindowInfo
*window
, int direction
, int searchWrap
);
60 int ReplaceAll(WindowInfo
*window
, const char *searchString
, const char *replaceString
,
62 int ReplaceInSelection(WindowInfo
*window
, const char *searchString
,
63 const char *replaceString
, int searchType
);
64 int SearchWindow(WindowInfo
*window
, int direction
, const char *searchString
,
65 int searchType
, int searchWrap
, int beginPos
, int *startPos
, int *endPos
,
66 int *extentBW
, int* extentFW
);
67 int SearchString(const char *string
, const char *searchString
, int direction
,
68 int searchType
, int wrap
, int beginPos
, int *startPos
, int *endPos
,
69 int *searchExtentBW
, int*searchExtentFW
, const char *delimiters
);
70 char *ReplaceAllInString(char *inString
, const char *searchString
,
71 const char *replaceString
, int searchType
, int *copyStart
,
72 int *copyEnd
, int *replacementLength
, const char *delimiters
);
73 void BeginISearch(WindowInfo
*window
, int direction
);
74 void EndISearch(WindowInfo
*window
);
75 void SetISearchTextCallbacks(WindowInfo
*window
);
76 void FlashMatching(WindowInfo
*window
, Widget textW
);
77 void SelectToMatchingCharacter(WindowInfo
*window
);
78 void GotoMatchingCharacter(WindowInfo
*window
);
79 void RemoveFromMultiReplaceDialog(WindowInfo
*window
);
82 ** Schwarzenberg: added SEARCH_LITERAL_WORD .. SEARCH_REGEX_NOCASE
84 ** The order of the integers in this enumeration must be exactly
85 ** the same as the order of the coressponding strings of the
86 ** array SearchMethodStrings defined in preferences.c (!!)
90 SEARCH_LITERAL
, SEARCH_CASE_SENSE
, SEARCH_REGEX
,
91 SEARCH_LITERAL_WORD
, SEARCH_CASE_SENSE_WORD
, SEARCH_REGEX_NOCASE
,
92 N_SEARCH_TYPES
/* must be last in enum SearchType */ };
95 /* Scope on which the replace operations apply */
96 enum ReplaceScope
{ REPL_SCOPE_WIN
, REPL_SCOPE_SEL
, REPL_SCOPE_MULTI
};
98 /* Default scope if selection exists when replace dialog pops up.
99 "Smart" means "In Selection" if the selection spans more than
100 one line; "In Window" otherwise. */
101 enum ReplaceAllDefaultScope
{ REPL_DEF_SCOPE_WINDOW
,
102 REPL_DEF_SCOPE_SELECTION
,
103 REPL_DEF_SCOPE_SMART
};
107 ** Returns a pointer to the string describing the search type for search
108 ** action routine parameters (see menu.c for processing of action routines)
109 ** If searchType is invalid defaultRV is returned.
111 const char *SearchTypeArg(int searchType
, const char * defaultRV
);
114 ** Parses a search type description string. If the string contains a valid
115 ** search type description, returns TRUE and writes the corresponding
116 ** SearchType in searchType. Returns FALSE and leaves searchType untouched
119 int StringToSearchType(const char * string
, int *searchType
);
122 ** History of search actions.
126 #endif /* NEDIT_SEARCH_H_INCLUDED */