2001-08-19 13:25:15 +00:00
|
|
|
/**
|
|
|
|
* \file QRefDialog.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-08-19 13:25:15 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author Kalle Dalheimer
|
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2001-08-19 13:25:15 +00:00
|
|
|
*/
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2002-06-19 03:38:44 +00:00
|
|
|
#include "QRefDialog.h"
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "QRef.h"
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
#include <qcombobox.h>
|
2004-05-20 09:36:28 +00:00
|
|
|
#include <qlineedit.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
#include <qlistbox.h>
|
2004-05-20 09:36:28 +00:00
|
|
|
#include <qpushbutton.h>
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
QRefDialog::QRefDialog(QRef * form)
|
2004-06-02 20:13:18 +00:00
|
|
|
: QRefDialogBase(0, 0, false, 0),
|
2001-08-19 13:25:15 +00:00
|
|
|
form_(form)
|
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
connect(okPB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotOK()));
|
2003-02-09 00:11:51 +00:00
|
|
|
connect(applyPB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotApply()));
|
2001-08-26 00:29:39 +00:00
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form_, SLOT(slotClose()));
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-03 21:27:12 +00:00
|
|
|
void QRefDialog::show()
|
|
|
|
{
|
|
|
|
QRefDialogBase::show();
|
|
|
|
refsLB->setFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QRefDialog::changed_adaptor()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2006-01-08 10:57:31 +00:00
|
|
|
form_->changed();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QRefDialog::gotoClicked()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
form_->gotoRef();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QRefDialog::refHighlighted(const QString & sel)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
if (form_->readOnly())
|
|
|
|
return;
|
|
|
|
|
2005-07-22 13:46:03 +00:00
|
|
|
int const cur_item = refsLB->currentItem();
|
|
|
|
bool const cur_item_selected = cur_item >= 0 ?
|
|
|
|
refsLB->isSelected(cur_item) : false;
|
|
|
|
|
|
|
|
if (cur_item_selected)
|
|
|
|
referenceED->setText(sel);
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
if (form_->at_ref_)
|
2001-08-26 00:29:39 +00:00
|
|
|
form_->gotoRef();
|
|
|
|
gotoPB->setEnabled(true);
|
|
|
|
if (form_->typeAllowed())
|
|
|
|
typeCO->setEnabled(true);
|
|
|
|
if (form_->nameAllowed())
|
|
|
|
nameED->setEnabled(true);
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2005-02-10 21:47:53 +00:00
|
|
|
void QRefDialog::refSelected(const QString & sel)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2005-02-10 21:47:53 +00:00
|
|
|
if (form_->readOnly())
|
|
|
|
return;
|
|
|
|
|
2006-01-08 10:57:31 +00:00
|
|
|
int const cur_item = refsLB->currentItem();
|
|
|
|
bool const cur_item_selected = cur_item >= 0 ?
|
|
|
|
refsLB->isSelected(cur_item) : false;
|
|
|
|
|
|
|
|
if (cur_item_selected)
|
|
|
|
referenceED->setText(sel);
|
2003-04-03 21:27:12 +00:00
|
|
|
// <enter> or double click, inserts ref and closes dialog
|
|
|
|
form_->slotOK();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QRefDialog::sortToggled(bool on)
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
form_->sort_ = on;
|
|
|
|
form_->redoRefs();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-26 00:29:39 +00:00
|
|
|
void QRefDialog::updateClicked()
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
form_->updateRefs();
|
2001-08-19 13:25:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QRefDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
2001-08-26 00:29:39 +00:00
|
|
|
form_->slotWMHide();
|
2001-08-19 13:25:15 +00:00
|
|
|
e->accept();
|
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|