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 <a.leeming@ic.ac.uk>
17 #pragma implementation
20 #include "ControlSearch.h"
26 #include "support/lstrings.h"
28 using Liason::setMinibuffer;
31 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
32 : ControlDialogBD(lv, d)
36 void ControlSearch::find(string const & search,
37 bool casesensitive, bool matchword, bool forward)
39 bool const found = lyxfind::LyXFind(bufferview(), search,
40 forward, casesensitive,
44 setMinibuffer(&lv_, _("String not found!"));
48 void ControlSearch::replace(string const & search, string const & replace,
49 bool casesensitive, bool matchword, bool all)
51 // If not replacing all instances of the word, then do not
52 // move on to the next instance once the present instance has been
54 bool const once = !all;
55 int const replace_count =
56 lyxfind::LyXReplace(bufferview(),
57 search, replace, true, casesensitive,
58 matchword, all, once);
60 if (replace_count == 0) {
61 setMinibuffer(&lv_, _("String not found!"));
63 if (replace_count == 1) {
64 setMinibuffer(&lv_, _("String has been replaced."));
66 string str = tostr(replace_count);
67 str += _(" strings have been replaced.");
68 setMinibuffer(&lv_, str.c_str());