1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
10 * \file ControlSearch.C
11 * \author Angus Leeming <leeming@lyx.org>
17 #pragma implementation
20 #include "ControlSearch.h"
25 #include "frontends/Liason.h"
27 #include "support/lstrings.h"
29 using Liason::setMinibuffer;
32 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
33 : ControlDialogBD(lv, d)
37 void ControlSearch::find(string const & search,
38 bool casesensitive, bool matchword, bool forward)
40 bool const found = lyxfind::LyXFind(bufferview(), search,
41 forward, casesensitive,
45 setMinibuffer(&lv_, _("String not found!"));
49 void ControlSearch::replace(string const & search, string const & replace,
50 bool casesensitive, bool matchword, bool all)
52 // If not replacing all instances of the word, then do not
53 // move on to the next instance once the present instance has been
55 bool const once = !all;
56 int const replace_count =
57 lyxfind::LyXReplace(bufferview(),
58 search, replace, true, casesensitive,
59 matchword, all, once);
61 if (replace_count == 0) {
62 setMinibuffer(&lv_, _("String not found!"));
64 if (replace_count == 1) {
65 setMinibuffer(&lv_, _("String has been replaced."));
67 string str = tostr(replace_count);
68 str += _(" strings have been replaced.");
69 setMinibuffer(&lv_, str.c_str());