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"
29 using Liason::setMinibuffer;
32 ControlSearch::ControlSearch(LyXView & lv, Dialogs & d)
33 : ControlDialog<ControlConnectBD>(lv, d)
35 d_.showSearch.connect(SigC::slot(this, &ControlSearch::show));
37 // perhaps in the future we'd like a
38 // "search again" button/keybinding
39 // d_.searchAgain.connect(SigC::slot(this, &ControlSearch::FindNext));
43 void ControlSearch::find(string const & search,
44 bool casesensitive, bool matchword, bool forward) const
46 bool const found = LyXFind(lv_.view(), search, casesensitive,
50 setMinibuffer(&lv_, _("String not found!"));
54 void ControlSearch::replace(string const & search, string const & replace,
55 bool casesensitive, bool matchword, bool all) const
57 int const replace_count = LyXReplace(lv_.view(),
58 search, replace, casesensitive,
59 matchword, true, all);
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());