2001-03-06 14:23:02 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QSearch.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2001-03-06 14:23:02 +00:00
|
|
|
*
|
2002-09-24 13:57:09 +00:00
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2001-03-06 14:23:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
#include <fstream>
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "LyXView.h"
|
|
|
|
#include "ControlSearch.h"
|
|
|
|
#include "gettext.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QSearch.h"
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QSearchDialog.h"
|
2001-08-31 02:34:10 +00:00
|
|
|
#include "Qt2BC.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qcombobox.h>
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
typedef Qt2CB<ControlSearch, Qt2DB<QSearchDialog> > base_class;
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2002-08-12 14:28:43 +00:00
|
|
|
QSearch::QSearch()
|
|
|
|
: base_class(_("Search"))
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearch::build_dialog()
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
dialog_.reset(new QSearchDialog(this));
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
bc().setCancel(dialog_->closePB);
|
2002-03-21 21:21:28 +00:00
|
|
|
bc().addReadOnly(dialog_->replaceCO);
|
|
|
|
bc().addReadOnly(dialog_->replacePB);
|
|
|
|
bc().addReadOnly(dialog_->replaceallPB);
|
2001-08-31 02:34:10 +00:00
|
|
|
bc().addReadOnly(dialog_->caseCB);
|
|
|
|
bc().addReadOnly(dialog_->wordsCB);
|
|
|
|
bc().addReadOnly(dialog_->backwardsCB);
|
2001-03-06 14:23:02 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
dialog_->replacePB->setEnabled(false);
|
|
|
|
dialog_->replaceallPB->setEnabled(false);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearch::find(string const & str, bool casesens, bool words, bool backwards)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
controller().find(str, casesens, words, !backwards);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|
2001-08-19 13:25:15 +00:00
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
void QSearch::replace(string const & findstr, string const & replacestr,
|
|
|
|
bool casesens, bool words, bool all)
|
2001-03-06 14:23:02 +00:00
|
|
|
{
|
2001-08-31 02:34:10 +00:00
|
|
|
controller().replace(findstr, replacestr, casesens, words, all);
|
2001-03-06 14:23:02 +00:00
|
|
|
}
|