2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
|
* \file GuiRef.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author J<EFBFBD>rgen Spitzm<EFBFBD>ller
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiRef.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "insets/InsetRef.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QListWidgetItem>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QToolTip>
|
2007-04-25 10:57:54 +00:00
|
|
|
|
#include <QCloseEvent>
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
using std::string;
|
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiRefDialog
|
2007-04-25 10:57:54 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
GuiRefDialog::GuiRefDialog(GuiRef * form)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
: form_(form)
|
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
|
|
connect(okPB, SIGNAL(clicked()), form_, SLOT(slotOK()));
|
|
|
|
|
connect(applyPB, SIGNAL(clicked()), form_, SLOT(slotApply()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), form_, SLOT(slotClose()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()), this, SLOT(reset_dialog()));
|
2007-05-17 12:11:56 +00:00
|
|
|
|
connect(this, SIGNAL(rejected()), this, SLOT(reset_dialog()));
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(typeCO, SIGNAL(activated(int)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(changed_adaptor()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(referenceED, SIGNAL(textChanged(const QString &)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(changed_adaptor()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(nameED, SIGNAL(textChanged(const QString &)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(changed_adaptor()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(refsLW, SIGNAL(itemClicked(QListWidgetItem *)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(refHighlighted(QListWidgetItem *)));
|
|
|
|
|
connect(refsLW, SIGNAL(itemSelectionChanged()),
|
|
|
|
|
this, SLOT(selectionChanged()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(refsLW, SIGNAL(itemActivated(QListWidgetItem *)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(refSelected(QListWidgetItem *)));
|
|
|
|
|
connect(sortCB, SIGNAL(clicked(bool)),
|
|
|
|
|
this, SLOT(sortToggled(bool)));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(gotoPB, SIGNAL(clicked()),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(gotoClicked()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(updatePB, SIGNAL(clicked()),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(updateClicked()));
|
2007-05-28 22:27:45 +00:00
|
|
|
|
connect(bufferCO, SIGNAL(activated(int)),
|
2007-04-25 10:57:54 +00:00
|
|
|
|
this, SLOT(updateClicked()));
|
|
|
|
|
|
|
|
|
|
setFocusProxy(refsLW);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::show()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
QDialog::show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::changed_adaptor()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::gotoClicked()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
form_->gotoRef();
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::selectionChanged()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
if (form_->readOnly())
|
|
|
|
|
return;
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2007-04-25 10:57:54 +00:00
|
|
|
|
QList<QListWidgetItem *> selections = refsLW->selectedItems();
|
|
|
|
|
if (selections.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
QListWidgetItem * sel = selections.first();
|
|
|
|
|
refHighlighted(sel);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::refHighlighted(QListWidgetItem * sel)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
if (form_->readOnly())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* int const cur_item = refsLW->currentRow();
|
|
|
|
|
bool const cur_item_selected = cur_item >= 0 ?
|
|
|
|
|
refsLB->isSelected(cur_item) : false;*/
|
|
|
|
|
bool const cur_item_selected = refsLW->isItemSelected(sel);
|
|
|
|
|
|
|
|
|
|
if (cur_item_selected)
|
|
|
|
|
referenceED->setText(sel->text());
|
|
|
|
|
|
|
|
|
|
if (form_->at_ref_)
|
|
|
|
|
form_->gotoRef();
|
|
|
|
|
gotoPB->setEnabled(true);
|
|
|
|
|
if (form_->typeAllowed())
|
|
|
|
|
typeCO->setEnabled(true);
|
|
|
|
|
if (form_->nameAllowed())
|
|
|
|
|
nameED->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::refSelected(QListWidgetItem * sel)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
if (form_->readOnly())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* int const cur_item = refsLW->currentRow();
|
|
|
|
|
bool const cur_item_selected = cur_item >= 0 ?
|
|
|
|
|
refsLB->isSelected(cur_item) : false;*/
|
|
|
|
|
bool const cur_item_selected = refsLW->isItemSelected(sel);
|
|
|
|
|
|
|
|
|
|
if (cur_item_selected)
|
|
|
|
|
referenceED->setText(sel->text());
|
|
|
|
|
// <enter> or double click, inserts ref and closes dialog
|
|
|
|
|
form_->slotOK();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::sortToggled(bool on)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
form_->sort_ = on;
|
|
|
|
|
form_->redoRefs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::updateClicked()
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
form_->updateRefs();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::reset_dialog() {
|
2007-04-25 10:57:54 +00:00
|
|
|
|
form_->at_ref_ = false;
|
|
|
|
|
form_->setGotoRef();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRefDialog::closeEvent(QCloseEvent * e)
|
2007-04-25 10:57:54 +00:00
|
|
|
|
{
|
|
|
|
|
form_->slotWMHide();
|
|
|
|
|
reset_dialog();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2007-08-31 05:53:55 +00:00
|
|
|
|
// GuiRef
|
2007-04-25 10:57:54 +00:00
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
GuiRef::GuiRef(GuiDialog & parent)
|
2007-08-31 22:16:11 +00:00
|
|
|
|
: GuiView<GuiRefDialog>(parent, _("Cross-reference")),
|
2006-03-05 17:24:44 +00:00
|
|
|
|
sort_(false), at_ref_(false)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::build_dialog()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
2007-08-31 05:53:55 +00:00
|
|
|
|
dialog_.reset(new GuiRefDialog(this));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
|
bc().setOK(dialog_->okPB);
|
|
|
|
|
bc().setApply(dialog_->applyPB);
|
|
|
|
|
bc().setCancel(dialog_->closePB);
|
|
|
|
|
bc().addReadOnly(dialog_->refsLW);
|
|
|
|
|
bc().addReadOnly(dialog_->sortCB);
|
|
|
|
|
bc().addReadOnly(dialog_->nameED);
|
|
|
|
|
bc().addReadOnly(dialog_->referenceED);
|
|
|
|
|
bc().addReadOnly(dialog_->typeCO);
|
|
|
|
|
bc().addReadOnly(dialog_->bufferCO);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
restored_buffer_ = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::update_contents()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
InsetCommandParams const & params = controller().params();
|
|
|
|
|
|
2006-08-17 08:58:28 +00:00
|
|
|
|
int orig_type = dialog_->typeCO->currentIndex();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-10-20 13:53:43 +00:00
|
|
|
|
dialog_->referenceED->setText(toqstr(params["reference"]));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-10-20 13:53:43 +00:00
|
|
|
|
dialog_->nameED->setText(toqstr(params["name"]));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
dialog_->nameED->setReadOnly(!nameAllowed() && !readOnly());
|
|
|
|
|
|
|
|
|
|
// restore type settings for new insets
|
2006-10-20 13:53:43 +00:00
|
|
|
|
if (params["reference"].empty())
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->typeCO->setCurrentIndex(orig_type);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->typeCO->setCurrentIndex(InsetRef::getType(params.getCmdName()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
dialog_->typeCO->setEnabled(typeAllowed() && !readOnly());
|
|
|
|
|
if (!typeAllowed())
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->typeCO->setCurrentIndex(0);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
dialog_->sortCB->setChecked(sort_);
|
|
|
|
|
|
|
|
|
|
// insert buffer list
|
|
|
|
|
dialog_->bufferCO->clear();
|
|
|
|
|
vector<string> const buffers = controller().getBufferList();
|
|
|
|
|
for (vector<string>::const_iterator it = buffers.begin();
|
|
|
|
|
it != buffers.end(); ++it) {
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->bufferCO->addItem(toqstr(*it));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
// restore the buffer combo setting for new insets
|
2006-10-20 13:53:43 +00:00
|
|
|
|
if (params["reference"].empty() && restored_buffer_ != -1
|
2006-03-05 17:24:44 +00:00
|
|
|
|
&& restored_buffer_ < dialog_->bufferCO->count())
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->bufferCO->setCurrentIndex(restored_buffer_);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
else
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->bufferCO->setCurrentIndex(controller().getBufferNum());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
updateRefs();
|
2007-09-03 05:59:32 +00:00
|
|
|
|
bc().setValid(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::apply()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
InsetCommandParams & params = controller().params();
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2007-04-24 22:10:56 +00:00
|
|
|
|
last_reference_ = dialog_->referenceED->text();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-08-17 08:58:28 +00:00
|
|
|
|
params.setCmdName(InsetRef::getName(dialog_->typeCO->currentIndex()));
|
2007-04-24 22:10:56 +00:00
|
|
|
|
params["reference"] = qstring_to_ucs4(last_reference_);
|
2006-10-20 13:53:43 +00:00
|
|
|
|
params["name"] = qstring_to_ucs4(dialog_->nameED->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-08-17 08:58:28 +00:00
|
|
|
|
restored_buffer_ = dialog_->bufferCO->currentIndex();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
bool GuiRef::nameAllowed()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
Kernel::DocType const doc_type = kernel().docType();
|
|
|
|
|
return doc_type != Kernel::LATEX &&
|
|
|
|
|
doc_type != Kernel::LITERATE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
bool GuiRef::typeAllowed()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
Kernel::DocType const doc_type = kernel().docType();
|
2006-08-23 10:57:45 +00:00
|
|
|
|
return doc_type != Kernel::DOCBOOK;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::setGoBack()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
dialog_->gotoPB->setText(qt_("&Go Back"));
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->gotoPB->setToolTip("");
|
|
|
|
|
dialog_->gotoPB->setToolTip(qt_("Jump back"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::setGotoRef()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
dialog_->gotoPB->setText(qt_("&Go to Label"));
|
2006-08-17 08:58:28 +00:00
|
|
|
|
dialog_->gotoPB->setToolTip("");
|
|
|
|
|
dialog_->gotoPB->setToolTip(qt_("Jump to label"));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::gotoRef()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
string ref(fromqstr(dialog_->referenceED->text()));
|
|
|
|
|
|
|
|
|
|
if (at_ref_) {
|
|
|
|
|
// go back
|
|
|
|
|
setGotoRef();
|
|
|
|
|
controller().gotoBookmark();
|
|
|
|
|
} else {
|
|
|
|
|
// go to the ref
|
|
|
|
|
setGoBack();
|
|
|
|
|
controller().gotoRef(ref);
|
|
|
|
|
}
|
|
|
|
|
at_ref_ = !at_ref_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::redoRefs()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
// Prevent these widgets from emitting any signals whilst
|
|
|
|
|
// we modify their state.
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->blockSignals(true);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
dialog_->referenceED->blockSignals(true);
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->setUpdatesEnabled(false);
|
2007-05-28 22:27:45 +00:00
|
|
|
|
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->clear();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
// need this because Qt will send a highlight() here for
|
|
|
|
|
// the first item inserted
|
2007-04-24 22:10:56 +00:00
|
|
|
|
QString const oldSelection(dialog_->referenceED->text());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2006-10-12 10:50:45 +00:00
|
|
|
|
for (std::vector<docstring>::const_iterator iter = refs_.begin();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
iter != refs_.end(); ++iter) {
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->addItem(toqstr(*iter));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sort_)
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->sortItems();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-04-24 22:10:56 +00:00
|
|
|
|
dialog_->referenceED->setText(oldSelection);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
2007-04-24 22:10:56 +00:00
|
|
|
|
// restore the last selection or, for new insets, highlight
|
|
|
|
|
// the previous selection
|
|
|
|
|
if (!oldSelection.isEmpty() || !last_reference_.isEmpty()) {
|
|
|
|
|
bool const newInset = oldSelection.isEmpty();
|
|
|
|
|
QString textToFind = newInset ? last_reference_ : oldSelection;
|
|
|
|
|
bool foundItem = false;
|
|
|
|
|
for (int i = 0; !foundItem && i < dialog_->refsLW->count(); ++i) {
|
2006-07-06 08:18:51 +00:00
|
|
|
|
QListWidgetItem * item = dialog_->refsLW->item(i);
|
2007-04-24 22:10:56 +00:00
|
|
|
|
if (textToFind == item->text()) {
|
|
|
|
|
dialog_->refsLW->setCurrentItem(item);
|
|
|
|
|
dialog_->refsLW->setItemSelected(item, !newInset);
|
|
|
|
|
//Make sure selected item is visible
|
|
|
|
|
dialog_->refsLW->scrollToItem(item);
|
|
|
|
|
foundItem = true;
|
2006-05-03 19:51:15 +00:00
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
}
|
2007-04-24 22:10:56 +00:00
|
|
|
|
if (foundItem)
|
|
|
|
|
last_reference_ = textToFind;
|
|
|
|
|
else last_reference_ = "";
|
|
|
|
|
}
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->setUpdatesEnabled(true);
|
|
|
|
|
dialog_->refsLW->update();
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
// Re-activate the emission of signals by these widgets.
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->blockSignals(false);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
dialog_->referenceED->blockSignals(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
void GuiRef::updateRefs()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
refs_.clear();
|
2006-08-17 08:58:28 +00:00
|
|
|
|
string const name = controller().getBufferName(dialog_->bufferCO->currentIndex());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
refs_ = controller().getLabelList(name);
|
|
|
|
|
dialog_->sortCB->setEnabled(!refs_.empty());
|
2006-05-03 19:51:15 +00:00
|
|
|
|
dialog_->refsLW->setEnabled(!refs_.empty());
|
2006-03-05 17:24:44 +00:00
|
|
|
|
dialog_->gotoPB->setEnabled(!refs_.empty());
|
|
|
|
|
redoRefs();
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
bool GuiRef::isValid()
|
2006-03-05 17:24:44 +00:00
|
|
|
|
{
|
|
|
|
|
return !dialog_->referenceED->text().isEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2007-04-25 10:57:54 +00:00
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
|
#include "GuiRef_moc.cpp"
|