3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #pragma implementation
18 #include "ControlSearch.h"
19 #include "FormSearch.h"
20 #include "forms/form_search.h"
21 #include FORMS_H_LOCATION
23 typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
25 FormSearch::FormSearch()
26 : base_class(_("Find and Replace"))
30 void FormSearch::build()
32 dialog_.reset(build_search(this));
34 // Manage the ok, apply and cancel/close buttons
35 bc().setCancel(dialog_->button_close);
36 bc().addReadOnly(dialog_->input_replace);
37 bc().addReadOnly(dialog_->button_replace);
38 bc().addReadOnly(dialog_->button_replaceall);
42 void FormSearch::update()
44 fl_set_input_selected(dialog_->input_search, true);
45 fl_set_focus_object(dialog_->form, dialog_->input_search);
49 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
51 if (obj == dialog_->button_findnext ||
52 obj == dialog_->button_findprev) {
53 bool const forward = (obj == dialog_->button_findnext);
55 controller().find(fl_get_input(dialog_->input_search),
56 fl_get_button(dialog_->check_casesensitive),
57 fl_get_button(dialog_->check_matchword),
60 } else if (obj == dialog_->button_replace ||
61 obj == dialog_->button_replaceall) {
62 bool const all = (obj == dialog_->button_replaceall);
64 controller().replace(fl_get_input(dialog_->input_search),
65 fl_get_input(dialog_->input_replace),
66 fl_get_button(dialog_->check_casesensitive),
67 fl_get_button(dialog_->check_matchword),
71 return ButtonPolicy::SMI_VALID;