]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QSearch.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QSearch.C
1 /**
2  * \file QSearch.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QSearch.h"
14 #include "QSearchDialog.h"
15 #include "Qt2BC.h"
16
17 #include "controllers/ControlSearch.h"
18
19 #include <qpushbutton.h>
20
21 using std::string;
22
23 namespace lyx {
24 namespace frontend {
25
26 typedef QController<ControlSearch, QView<QSearchDialog> > base_class;
27
28
29 QSearch::QSearch(Dialog & parent)
30         : base_class(parent, lyx::to_utf8(_("Find and Replace")))
31 {
32 }
33
34
35 void QSearch::build_dialog()
36 {
37         dialog_.reset(new QSearchDialog(this));
38
39         bcview().setCancel(dialog_->closePB);
40         bcview().addReadOnly(dialog_->replaceCO);
41         bcview().addReadOnly(dialog_->replacePB);
42         bcview().addReadOnly(dialog_->replaceallPB);
43
44         dialog_->replacePB->setEnabled(false);
45         dialog_->replaceallPB->setEnabled(false);
46 }
47
48
49 void QSearch::find(string const & str, bool casesens,
50                    bool words, bool backwards)
51 {
52         controller().find(str, casesens, words, !backwards);
53 }
54
55
56 void QSearch::replace(string const & findstr, string const & replacestr,
57         bool casesens, bool words, bool backwards, bool all)
58 {
59         controller().replace(findstr, replacestr, casesens, words,
60                              !backwards, all);
61 }
62
63 } // namespace frontend
64 } // namespace lyx