3 * Copyright 2001 The LyX Team.
4 * See the file COPYING.
6 * \author Edwin Leuven, leuven@fee.uva.nl
12 #pragma implementation
16 #include "ControlSearch.h"
17 #include "FormSearch.h"
18 #include "forms/form_search.h"
19 #include FORMS_H_LOCATION
21 typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
23 FormSearch::FormSearch(ControlSearch & c, Dialogs & d)
24 : base_class(c, d, _("LyX: Find and Replace"))
28 void FormSearch::build()
30 dialog_.reset(build_search(this));
32 // Manage the ok, apply and cancel/close buttons
33 bc().setCancel(dialog_->button_close);
34 bc().addReadOnly(dialog_->input_replace);
35 bc().addReadOnly(dialog_->button_replace);
36 bc().addReadOnly(dialog_->button_replaceall);
40 void FormSearch::update()
42 fl_set_input_selected(dialog_->input_search, true);
43 fl_set_focus_object(dialog_->form, dialog_->input_search);
47 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
49 if (obj == dialog_->button_findnext ||
50 obj == dialog_->button_findprev) {
51 bool const forward = (obj == dialog_->button_findnext);
53 controller().find(fl_get_input(dialog_->input_search),
54 fl_get_button(dialog_->check_casesensitive),
55 fl_get_button(dialog_->check_matchword),
58 } else if (obj == dialog_->button_replace ||
59 obj == dialog_->button_replaceall) {
60 bool const all = (obj == dialog_->button_replaceall);
62 controller().replace(fl_get_input(dialog_->input_search),
63 fl_get_input(dialog_->input_replace),
64 fl_get_button(dialog_->check_casesensitive),
65 fl_get_button(dialog_->check_matchword),
69 return ButtonPolicy::SMI_VALID;