2001-03-06 10:20:33 +00:00
|
|
|
/**
|
|
|
|
* \file FormSearch.C
|
|
|
|
* Copyright 2001 The LyX Team.
|
|
|
|
* See the file COPYING.
|
|
|
|
*
|
2002-03-11 17:00:41 +00:00
|
|
|
* \author Edwin Leuven, leuven@fee.uva.nl
|
2001-03-06 10:20:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2001-03-15 13:37:04 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
#include "xformsBC.h"
|
|
|
|
#include "ControlSearch.h"
|
2001-03-06 10:20:33 +00:00
|
|
|
#include "FormSearch.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms/form_search.h"
|
|
|
|
#include FORMS_H_LOCATION
|
2001-03-06 10:20:33 +00:00
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
typedef FormCB<ControlSearch, FormDB<FD_search> > base_class;
|
2001-03-06 10:20:33 +00:00
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
FormSearch::FormSearch()
|
|
|
|
: base_class(_("LyX: Find and Replace"))
|
2001-03-26 15:25:37 +00:00
|
|
|
{}
|
2001-03-06 10:20:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
void FormSearch::build()
|
|
|
|
{
|
2002-06-13 13:43:51 +00:00
|
|
|
dialog_.reset(build_search(this));
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
// Manage the ok, apply and cancel/close buttons
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().setCancel(dialog_->button_close);
|
2001-03-26 15:25:37 +00:00
|
|
|
bc().addReadOnly(dialog_->input_replace);
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().addReadOnly(dialog_->button_replace);
|
|
|
|
bc().addReadOnly(dialog_->button_replaceall);
|
2001-03-06 10:20:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-18 17:31:41 +00:00
|
|
|
void FormSearch::update()
|
|
|
|
{
|
|
|
|
fl_set_input_selected(dialog_->input_search, true);
|
|
|
|
fl_set_focus_object(dialog_->form, dialog_->input_search);
|
|
|
|
}
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
ButtonPolicy::SMInput FormSearch::input(FL_OBJECT * obj, long)
|
2001-03-06 10:20:33 +00:00
|
|
|
{
|
2002-03-12 14:11:15 +00:00
|
|
|
if (obj == dialog_->button_findnext ||
|
|
|
|
obj == dialog_->button_findprev) {
|
|
|
|
bool const forward = (obj == dialog_->button_findnext);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
controller().find(fl_get_input(dialog_->input_search),
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_get_button(dialog_->check_casesensitive),
|
|
|
|
fl_get_button(dialog_->check_matchword),
|
2001-03-26 15:25:37 +00:00
|
|
|
forward);
|
2001-03-06 10:20:33 +00:00
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
} else if (obj == dialog_->button_replace ||
|
|
|
|
obj == dialog_->button_replaceall) {
|
|
|
|
bool const all = (obj == dialog_->button_replaceall);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
controller().replace(fl_get_input(dialog_->input_search),
|
|
|
|
fl_get_input(dialog_->input_replace),
|
2002-03-12 14:11:15 +00:00
|
|
|
fl_get_button(dialog_->check_casesensitive),
|
|
|
|
fl_get_button(dialog_->check_matchword),
|
2001-03-26 15:25:37 +00:00
|
|
|
all);
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-03-26 15:25:37 +00:00
|
|
|
return ButtonPolicy::SMI_VALID;
|
2001-03-06 11:05:15 +00:00
|
|
|
}
|