2 * \file ControlSearch.C
3 * See the file COPYING.
5 * \author Angus Leeming
7 * Full author contact details are available in file CREDITS
13 #pragma implementation
16 #include "ControlSearch.h"
21 #include "frontends/Liason.h"
23 #include "support/lstrings.h"
25 using Liason::setMinibuffer;
28 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
29 : ControlDialogBD(lv, d)
33 void ControlSearch::find(string const & search,
34 bool casesensitive, bool matchword, bool forward)
36 bool const found = lyxfind::LyXFind(bufferview(), search,
37 forward, casesensitive,
41 setMinibuffer(&lv_, _("String not found!"));
45 void ControlSearch::replace(string const & search, string const & replace,
46 bool casesensitive, bool matchword, bool all)
48 // If not replacing all instances of the word, then do not
49 // move on to the next instance once the present instance has been
51 bool const once = !all;
52 int const replace_count =
53 lyxfind::LyXReplace(bufferview(),
54 search, replace, true, casesensitive,
55 matchword, all, once);
57 if (replace_count == 0) {
58 setMinibuffer(&lv_, _("String not found!"));
60 if (replace_count == 1) {
61 setMinibuffer(&lv_, _("String has been replaced."));
63 string str = tostr(replace_count);
64 str += _(" strings have been replaced.");
65 setMinibuffer(&lv_, str.c_str());