3 * See the file COPYING.
7 * Full author contact details are available in file CREDITS
13 #pragma implementation
17 #include "ControlSearch.h"
18 #include "FormSearch.h"
19 #include "forms/form_search.h"
20 #include FORMS_H_LOCATION
22 typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
24 FormSearch::FormSearch()
25 : base_class(_("LyX: Find and Replace"))
29 void FormSearch::build()
31 dialog_.reset(build_search(this));
33 // Manage the ok, apply and cancel/close buttons
34 bc().setCancel(dialog_->button_close);
35 bc().addReadOnly(dialog_->input_replace);
36 bc().addReadOnly(dialog_->button_replace);
37 bc().addReadOnly(dialog_->button_replaceall);
41 void FormSearch::update()
43 fl_set_input_selected(dialog_->input_search, true);
44 fl_set_focus_object(dialog_->form, dialog_->input_search);
48 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
50 if (obj == dialog_->button_findnext ||
51 obj == dialog_->button_findprev) {
52 bool const forward = (obj == dialog_->button_findnext);
54 controller().find(fl_get_input(dialog_->input_search),
55 fl_get_button(dialog_->check_casesensitive),
56 fl_get_button(dialog_->check_matchword),
59 } else if (obj == dialog_->button_replace ||
60 obj == dialog_->button_replaceall) {
61 bool const all = (obj == dialog_->button_replaceall);
63 controller().replace(fl_get_input(dialog_->input_search),
64 fl_get_input(dialog_->input_replace),
65 fl_get_button(dialog_->check_casesensitive),
66 fl_get_button(dialog_->check_matchword),
70 return ButtonPolicy::SMI_VALID;