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 "form_search.h"
20 typedef FormCB<ControlSearch, FormDB<FD_form_search> > base_class;
22 FormSearch::FormSearch(ControlSearch & c)
23 : base_class(c, _("LyX: Find and Replace"))
27 void FormSearch::build()
29 dialog_.reset(build_search());
31 // Manage the ok, apply and cancel/close buttons
32 bc().setCancel(dialog_->button_close);
33 bc().addReadOnly(dialog_->input_replace);
34 bc().addReadOnly(dialog_->button_replace);
35 bc().addReadOnly(dialog_->button_replaceall);
39 ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
41 if (obj == dialog_->button_findnext ||
42 obj == dialog_->button_findprev) {
43 bool const forward = (obj == dialog_->button_findnext);
45 controller().find(fl_get_input(dialog_->input_search),
46 fl_get_button(dialog_->check_casesensitive),
47 fl_get_button(dialog_->check_matchword),
50 } else if (obj == dialog_->button_replace ||
51 obj == dialog_->button_replaceall) {
52 bool const all = (obj == dialog_->button_replaceall);
54 controller().replace(fl_get_input(dialog_->input_search),
55 fl_get_input(dialog_->input_replace),
56 fl_get_button(dialog_->check_casesensitive),
57 fl_get_button(dialog_->check_matchword),
61 return ButtonPolicy::SMI_VALID;