mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-24 18:43:37 +00:00
da4456f2aa
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5334 a592a061-630c-0410-9148-cb99ea01b6c8
97 lines
1.9 KiB
C
97 lines
1.9 KiB
C
/**
|
|
* \file QSearchDialog.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Edwin Leuven
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "ControlSearch.h"
|
|
#include "QSearchDialog.h"
|
|
#include "QSearch.h"
|
|
#include "debug.h"
|
|
|
|
#include <qpushbutton.h>
|
|
#include <qcombobox.h>
|
|
#include <qcheckbox.h>
|
|
#include <qlineedit.h>
|
|
#include <qlabel.h>
|
|
|
|
QSearchDialog::QSearchDialog(QSearch * form)
|
|
: QSearchDialogBase(0, 0, false, 0),
|
|
form_(form)
|
|
{
|
|
connect(closePB, SIGNAL(clicked()),
|
|
form_, SLOT(slotClose()));
|
|
}
|
|
|
|
|
|
void QSearchDialog::show()
|
|
{
|
|
QSearchDialogBase::show();
|
|
findCO->setFocus();
|
|
findCO->lineEdit()->setSelection(0, findCO->lineEdit()->text().length());
|
|
}
|
|
|
|
|
|
void QSearchDialog::closeEvent(QCloseEvent * e)
|
|
{
|
|
form_->slotWMHide();
|
|
e->accept();
|
|
}
|
|
|
|
|
|
void QSearchDialog::findChanged()
|
|
{
|
|
if (findCO->currentText().isEmpty()) {
|
|
findPB->setEnabled(false);
|
|
replacePB->setEnabled(false);
|
|
replaceallPB->setEnabled(false);
|
|
} else {
|
|
findPB->setEnabled(true);
|
|
replacePB->setEnabled(!form_->readOnly());
|
|
replaceallPB->setEnabled(!form_->readOnly());
|
|
}
|
|
}
|
|
|
|
|
|
void QSearchDialog::findClicked()
|
|
{
|
|
string const find(findCO->currentText().latin1());
|
|
form_->find(find,
|
|
caseCB->isChecked(),
|
|
wordsCB->isChecked(),
|
|
backwardsCB->isChecked());
|
|
findCO->insertItem(findCO->currentText());
|
|
}
|
|
|
|
|
|
void QSearchDialog::replaceClicked()
|
|
{
|
|
string const find(findCO->currentText().latin1());
|
|
string const replace(replaceCO->currentText().latin1());
|
|
form_->replace(find, replace,
|
|
caseCB->isChecked(),
|
|
wordsCB->isChecked(),
|
|
false);
|
|
replaceCO->insertItem(replaceCO->currentText());
|
|
}
|
|
|
|
|
|
void QSearchDialog::replaceallClicked()
|
|
{
|
|
form_->replace(findCO->currentText().latin1(),
|
|
replaceCO->currentText().latin1(),
|
|
caseCB->isChecked(),
|
|
wordsCB->isChecked(),
|
|
true);
|
|
}
|