]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormSearch.C
use exclicit temp var
[lyx.git] / src / frontends / xforms / FormSearch.C
1 /**
2  * \file FormSearch.C
3  * Copyright 2001 The LyX Team.
4  * See the file COPYING.
5  *
6  * \author Edwin Leuven
7  */
8
9 #include <config.h>
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include "xformsBC.h"
16 #include "ControlSearch.h"
17 #include "FormSearch.h"
18 #include "form_search.h"
19
20 typedef FormCB<ControlSearch, FormDB<FD_form_search> > base_class;
21
22 FormSearch::FormSearch(ControlSearch & c)
23         : base_class(c, _("LyX: Find and Replace"))
24 {}
25
26
27 void FormSearch::build()
28 {
29         dialog_.reset(build_search());
30         
31         // Manage the ok, apply and cancel/close buttons
32         bc().setCancel(dialog_->button_cancel);
33         bc().addReadOnly(dialog_->input_replace);
34         bc().addReadOnly(dialog_->replace);
35         bc().addReadOnly(dialog_->replaceall);
36 }
37
38
39 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
40 {
41         if (obj == dialog_->findnext || obj == dialog_->findprev) {
42                 bool const forward = (obj == dialog_->findnext);
43         
44                 controller().find(fl_get_input(dialog_->input_search),
45                                   fl_get_button(dialog_->casesensitive),
46                                   fl_get_button(dialog_->matchword),
47                                   forward);
48
49         } else if (obj == dialog_->replace || obj == dialog_->replaceall) {
50                 bool const all = (obj == dialog_->replaceall);
51         
52                 controller().replace(fl_get_input(dialog_->input_search),
53                                      fl_get_input(dialog_->input_replace),
54                                      fl_get_button(dialog_->casesensitive),
55                                      fl_get_button(dialog_->matchword),
56                                      all);
57         }
58    
59         return ButtonPolicy::SMI_VALID;
60 }