2001-03-06 14:23:02 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QSearch.C
|
2001-08-31 02:34:10 +00:00
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
2001-03-06 14:23:02 +00:00
|
|
|
*
|
2001-08-31 02:34:10 +00:00
|
|
|
* \author John Levon <moz@compsoc.man.ac.uk>
|
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
|
|
|
|
2001-08-31 02:34:10 +00:00
|
|
|
QSearch::QSearch(ControlSearch & c)
|
|
|
|
: base_class(c, _("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
|
|
|
}
|