X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxfind.h;h=9ff26374b4d76ed0428ec0d683b878abf2c1dfc2;hb=52eb91c94fb70d58dceef430659c8781de2eccda;hp=61e3977053bd935b4bdd1a5df94b525c93a5967b;hpb=32a716152e3e19d0afe039fe7220e982619348cf;p=lyx.git diff --git a/src/lyxfind.h b/src/lyxfind.h index 61e3977053..9ff26374b4 100644 --- a/src/lyxfind.h +++ b/src/lyxfind.h @@ -15,61 +15,48 @@ #ifndef LYXFIND_H #define LYXFIND_H -#include "support/types.h" +#include "support/docstring.h" -#include +namespace lyx { class BufferView; +class FuncRequest; class LyXText; -namespace lyx { -namespace find { - -/** - * This function replaces an ocurrence of \param search with the - * string \param replace - * - * \param bv the BufferView in which the search is to be performed, - * starting at the current cursor position. - * \param search the string we're looking for. - * \param replace if \c search is found, replace it with this. - * \param cs perform a case-sensitive search for \c search. - * \param mw match whole words only. - * \param fw search forward from the current cursor position. +/** Encode the parameters needed to find \c search as a string + * that can be dispatched to the LyX core in a FuncRequest wrapper. */ - -int replace(BufferView * bv, - std::string const & search, std::string const & replace, - bool cs, bool mw, bool fw); -/** - * This function replaces all ocurrences of \param search with - * the string \param replace - * - * \param bv the BufferView in which the search is to be performed, - * starting at the current cursor position. - * \param search the string we're looking for. - * \param replace if \c search is found, replace it with this. - * \param cs perform a case-sensitive search for \c search. - * \param mw match whole words only. +docstring const find2string(docstring const & search, + bool casesensitive, + bool matchword, + bool forward); + +/** Encode the parameters needed to replace \c search with \c replace + * as a string that can be dispatched to the LyX core in a FuncRequest + * wrapper. */ - -int replaceAll(BufferView * bv, - std::string const & search, std::string const & replace, - bool cs, bool mw); - -/** - * This function is called as a general interface to find some text - * from the actual cursor position in whatever direction we want to - * go. This does also update the screen. +docstring const replace2string(docstring const & search, + docstring const & replace, + bool casesensitive, + bool matchword, + bool all, + bool forward); + +/** Parse the string encoding of the find request that is found in + * \c ev.argument and act on it. + * The string is encoded by \c find2string. */ -bool find(BufferView *, std::string const & search, - bool cs, bool mw, bool fw); +void find(BufferView * bv, FuncRequest const & ev); +/** Parse the string encoding of the replace request that is found in + * \c ev.argument and act on it. + * The string is encoded by \c replace2string. + */ +void replace(BufferView * bv, FuncRequest const &); /// find the next change in the buffer bool findNextChange(BufferView * bv); -} // namespace find } // namespace lyx #endif // LYXFIND_H