]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QSearch.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / 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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "LyXView.h"
18 #include "ControlSearch.h"
19 #include "gettext.h"
20
21 #include "QSearch.h"
22 #include "QSearchDialog.h"
23 #include "Qt2BC.h"
24
25 #include <qpushbutton.h>
26 #include <qcheckbox.h>
27 #include <qcombobox.h>
28
29
30 typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
31
32
33 QSearch::QSearch()
34         : base_class(_("Search"))
35 {
36 }
37
38
39 void QSearch::build_dialog()
40 {
41         dialog_.reset(new QSearchDialog(this));
42
43         bc().setCancel(dialog_->closePB);
44         bc().addReadOnly(dialog_->replaceCO);
45         bc().addReadOnly(dialog_->replacePB);
46         bc().addReadOnly(dialog_->replaceallPB);
47         bc().addReadOnly(dialog_->caseCB);
48         bc().addReadOnly(dialog_->wordsCB);
49         bc().addReadOnly(dialog_->backwardsCB);
50
51         dialog_->replacePB->setEnabled(false);
52         dialog_->replaceallPB->setEnabled(false);
53 }
54
55
56 void QSearch::find(string const & str, bool casesens,
57                    bool words, bool backwards)
58 {
59         controller().find(str, casesens, words, !backwards);
60 }
61
62
63 void QSearch::replace(string const & findstr, string const & replacestr,
64         bool casesens, bool words, bool all)
65 {
66         controller().replace(findstr, replacestr, casesens, words, all);
67 }