2008-07-19 17:23:13 +00:00
|
|
|
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This third patch just re-factors some code presently in QCitation*. (It also incorporates some bug fixes that have been committed separately.) We're going to use essentially the same set of widgets for choosing modules that is used for choosing citation keys, so we pull the controlling logic out into a new class, QSelectionManager. I did not make this a QWidget. That seemed to me to be overkill, and it would have made things much more complicated, I think...and I'm not all that experienced with Qt, anyway. Anyone who wants to do that is of course welcome.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19860 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-28 16:49:40 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiCitation.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 Angus Leeming
|
|
|
|
* \author Kalle Dalheimer
|
2007-03-25 01:32:12 +00:00
|
|
|
* \author Abdelrazak Younes
|
2007-08-31 22:37:05 +00:00
|
|
|
* \author Richard Heck
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiCitation.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2008-05-06 13:50:37 +00:00
|
|
|
#include "GuiSelectionManager.h"
|
2007-03-25 01:32:12 +00:00
|
|
|
#include "qt_helpers.h"
|
2008-05-06 13:50:37 +00:00
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
#include "Buffer.h"
|
2008-05-06 13:50:37 +00:00
|
|
|
#include "BiblioInfo.h"
|
2007-10-06 11:33:33 +00:00
|
|
|
#include "BufferParams.h"
|
2008-04-20 09:24:14 +00:00
|
|
|
#include "FuncRequest.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-10-07 14:59:01 +00:00
|
|
|
#include "insets/InsetCommand.h"
|
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
|
|
|
#include "support/docstring.h"
|
|
|
|
#include "support/gettext.h"
|
|
|
|
#include "support/lstrings.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
#include <QCloseEvent>
|
2008-05-14 14:37:33 +00:00
|
|
|
#include <QSettings>
|
2007-12-09 22:35:04 +00:00
|
|
|
#include <QShowEvent>
|
2008-05-14 14:37:33 +00:00
|
|
|
#include <QVariant>
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
#undef KeyPress
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
#include <boost/regex.hpp>
|
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-12-12 19:57:42 +00:00
|
|
|
using namespace lyx::support;
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
static vector<CiteStyle> citeStyles_;
|
2007-10-06 11:33:33 +00:00
|
|
|
|
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
template<typename String>
|
|
|
|
static QStringList to_qstring_list(vector<String> const & v)
|
2006-03-25 21:26:09 +00:00
|
|
|
{
|
2006-04-11 08:26:43 +00:00
|
|
|
QStringList qlist;
|
|
|
|
|
2007-04-25 16:39:21 +00:00
|
|
|
for (size_t i = 0; i != v.size(); ++i) {
|
2006-03-25 21:26:09 +00:00
|
|
|
if (v[i].empty())
|
|
|
|
continue;
|
2006-10-21 00:16:43 +00:00
|
|
|
qlist.append(lyx::toqstr(v[i]));
|
2006-03-25 21:26:09 +00:00
|
|
|
}
|
2006-04-11 08:26:43 +00:00
|
|
|
return qlist;
|
2006-03-25 21:26:09 +00:00
|
|
|
}
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
|
2007-08-31 22:37:05 +00:00
|
|
|
static vector<lyx::docstring> to_docstring_vector(QStringList const & qlist)
|
2007-03-25 01:32:12 +00:00
|
|
|
{
|
2007-08-20 16:30:02 +00:00
|
|
|
vector<lyx::docstring> v;
|
2007-03-25 10:32:22 +00:00
|
|
|
for (int i = 0; i != qlist.size(); ++i) {
|
2007-03-25 01:32:12 +00:00
|
|
|
if (qlist[i].isEmpty())
|
|
|
|
continue;
|
2007-08-20 16:30:02 +00:00
|
|
|
v.push_back(lyx::qstring_to_ucs4(qlist[i]));
|
2007-03-25 01:32:12 +00:00
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
GuiCitation::GuiCitation(GuiView & lv)
|
2008-05-06 13:50:37 +00:00
|
|
|
: DialogView(lv, "citation", qt_("Citation")),
|
2008-04-20 09:24:14 +00:00
|
|
|
params_(insetCode("citation"))
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
connect(citationStyleCO, SIGNAL(activated(int)),
|
2007-12-20 15:46:14 +00:00
|
|
|
this, SLOT(on_citationStyleCO_currentIndexChanged(int)));
|
2007-08-31 22:37:05 +00:00
|
|
|
connect(fulllistCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changed()));
|
|
|
|
connect(forceuppercaseCB, SIGNAL(clicked()),
|
|
|
|
this, SLOT(changed()));
|
2007-10-06 11:33:33 +00:00
|
|
|
connect(textBeforeED, SIGNAL(textChanged(QString)),
|
2007-08-31 22:37:05 +00:00
|
|
|
this, SLOT(changed()));
|
2007-10-06 11:33:33 +00:00
|
|
|
connect(textAfterED, SIGNAL(textChanged(QString)),
|
2007-08-31 22:37:05 +00:00
|
|
|
this, SLOT(changed()));
|
2008-04-24 18:30:31 +00:00
|
|
|
connect(findLE, SIGNAL(returnPressed()),
|
|
|
|
this, SLOT(on_searchPB_clicked()));
|
|
|
|
connect(textBeforeED, SIGNAL(returnPressed()),
|
|
|
|
this, SLOT(on_okPB_clicked()));
|
|
|
|
connect(textAfterED, SIGNAL(returnPressed()),
|
|
|
|
this, SLOT(on_okPB_clicked()));
|
2008-06-06 16:02:52 +00:00
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
selectionManager = new GuiSelectionManager(availableLV, selectedLV,
|
2008-05-06 14:33:38 +00:00
|
|
|
addPB, deletePB, upPB, downPB, &available_model_, &selected_model_);
|
2007-08-31 22:37:05 +00:00
|
|
|
connect(selectionManager, SIGNAL(selectionChanged()),
|
|
|
|
this, SLOT(setCitedKeys()));
|
|
|
|
connect(selectionManager, SIGNAL(updateHook()),
|
2008-05-06 13:50:37 +00:00
|
|
|
this, SLOT(updateControls()));
|
2007-08-31 22:37:05 +00:00
|
|
|
connect(selectionManager, SIGNAL(okHook()),
|
2007-10-06 11:33:33 +00:00
|
|
|
this, SLOT(on_okPB_clicked()));
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2008-04-26 08:07:46 +00:00
|
|
|
// FIXME: the sizeHint() for this is _way_ too high
|
|
|
|
infoML->setFixedHeight(60);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-29 13:57:07 +00:00
|
|
|
GuiCitation::~GuiCitation()
|
|
|
|
{
|
|
|
|
delete selectionManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::closeEvent(QCloseEvent * e)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
clearSelection();
|
2008-06-06 15:53:02 +00:00
|
|
|
DialogView::closeEvent(e);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::applyView()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2008-04-26 08:07:46 +00:00
|
|
|
int const choice = max(0, citationStyleCO->currentIndex());
|
2007-08-31 22:37:05 +00:00
|
|
|
style_ = choice;
|
|
|
|
bool const full = fulllistCB->isChecked();
|
|
|
|
bool const force = forceuppercaseCB->isChecked();
|
|
|
|
|
|
|
|
QString const before = textBeforeED->text();
|
|
|
|
QString const after = textAfterED->text();
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
apply(choice, full, force, before, after);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
void GuiCitation::showEvent(QShowEvent * e)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
findLE->clear();
|
|
|
|
availableLV->setFocus();
|
2008-05-06 13:50:37 +00:00
|
|
|
DialogView::showEvent(e);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_okPB_clicked()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-03 20:28:26 +00:00
|
|
|
applyView();
|
2007-09-05 20:33:29 +00:00
|
|
|
clearSelection();
|
2007-12-09 22:35:04 +00:00
|
|
|
hide();
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_cancelPB_clicked()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
clearSelection();
|
2007-12-09 22:35:04 +00:00
|
|
|
hide();
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_applyPB_clicked()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-03 20:28:26 +00:00
|
|
|
applyView();
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_restorePB_clicked()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
init();
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::updateControls()
|
|
|
|
{
|
|
|
|
BiblioInfo const & bi = bibInfo();
|
|
|
|
updateControls(bi);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
// The main point of separating this out is that the fill*() methods
|
|
|
|
// called in update() do not need to be called for INTERNAL updates,
|
|
|
|
// such as when addPB is pressed, as the list of fields, entries, etc,
|
|
|
|
// will not have changed. At the moment, however, the division between
|
2007-12-20 15:46:14 +00:00
|
|
|
// fillStyles() and updateStyle() doesn't lend itself to dividing the
|
2007-09-05 20:33:29 +00:00
|
|
|
// two methods, though they should be divisible.
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::updateControls(BiblioInfo const & bi)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
if (selectionManager->selectedFocused()) {
|
|
|
|
if (selectedLV->selectionModel()->selectedIndexes().isEmpty())
|
2008-07-19 17:23:13 +00:00
|
|
|
updateInfo(bi, availableLV->currentIndex());
|
2007-08-31 22:37:05 +00:00
|
|
|
else
|
2008-07-19 17:23:13 +00:00
|
|
|
updateInfo(bi, selectedLV->currentIndex());
|
2007-08-31 22:37:05 +00:00
|
|
|
} else {
|
|
|
|
if (availableLV->selectionModel()->selectedIndexes().isEmpty())
|
2008-07-19 17:23:13 +00:00
|
|
|
updateInfo(bi, QModelIndex());
|
2007-08-31 22:37:05 +00:00
|
|
|
else
|
2008-07-19 17:23:13 +00:00
|
|
|
updateInfo(bi, availableLV->currentIndex());
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
setButtons();
|
|
|
|
|
2008-05-06 14:33:38 +00:00
|
|
|
textBeforeED->setText(toqstr(params_["before"]));
|
|
|
|
textAfterED->setText(toqstr(params_["after"]));
|
2008-07-19 17:23:13 +00:00
|
|
|
fillStyles(bi);
|
2007-08-31 22:37:05 +00:00
|
|
|
updateStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
void GuiCitation::updateFormatting(CiteStyle currentStyle)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2008-04-20 15:00:11 +00:00
|
|
|
CiteEngine const engine = citeEngine();
|
2007-08-31 22:37:05 +00:00
|
|
|
bool const natbib_engine =
|
2008-04-20 15:00:11 +00:00
|
|
|
engine == ENGINE_NATBIB_AUTHORYEAR ||
|
|
|
|
engine == ENGINE_NATBIB_NUMERICAL;
|
|
|
|
bool const basic_engine = engine == ENGINE_BASIC;
|
2007-08-31 22:37:05 +00:00
|
|
|
|
|
|
|
bool const haveSelection =
|
|
|
|
selectedLV->model()->rowCount() > 0;
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
bool const isNocite = currentStyle == NOCITE;
|
2007-12-20 15:46:14 +00:00
|
|
|
|
|
|
|
fulllistCB->setEnabled(natbib_engine && haveSelection && !isNocite);
|
|
|
|
forceuppercaseCB->setEnabled(natbib_engine && haveSelection && !isNocite);
|
|
|
|
textBeforeED->setEnabled(!basic_engine && haveSelection && !isNocite);
|
|
|
|
textBeforeLA->setEnabled(!basic_engine && haveSelection && !isNocite);
|
|
|
|
textAfterED->setEnabled(haveSelection && !isNocite);
|
|
|
|
textAfterLA->setEnabled(haveSelection && !isNocite);
|
|
|
|
citationStyleCO->setEnabled(haveSelection);
|
|
|
|
citationStyleLA->setEnabled(haveSelection);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiCitation::updateStyle()
|
|
|
|
{
|
2007-10-07 14:59:01 +00:00
|
|
|
string const & command = params_.getCmdName();
|
2007-08-31 22:37:05 +00:00
|
|
|
|
|
|
|
// Find the style of the citekeys
|
2008-04-20 15:00:11 +00:00
|
|
|
vector<CiteStyle> const & styles = citeStyles_;
|
|
|
|
CitationStyle const cs = citationStyleFromString(command);
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
vector<CiteStyle>::const_iterator cit =
|
2007-08-31 22:37:05 +00:00
|
|
|
std::find(styles.begin(), styles.end(), cs.style);
|
|
|
|
|
|
|
|
// restore the latest natbib style
|
|
|
|
if (style_ >= 0 && style_ < citationStyleCO->count())
|
|
|
|
citationStyleCO->setCurrentIndex(style_);
|
|
|
|
else
|
|
|
|
citationStyleCO->setCurrentIndex(0);
|
|
|
|
|
|
|
|
if (cit != styles.end()) {
|
|
|
|
int const i = int(cit - styles.begin());
|
|
|
|
citationStyleCO->setCurrentIndex(i);
|
|
|
|
fulllistCB->setChecked(cs.full);
|
2008-04-20 15:00:11 +00:00
|
|
|
forceuppercaseCB->setChecked(cs.forceUpperCase);
|
2007-08-31 22:37:05 +00:00
|
|
|
} else {
|
|
|
|
fulllistCB->setChecked(false);
|
|
|
|
forceuppercaseCB->setChecked(false);
|
|
|
|
}
|
2007-12-20 15:46:14 +00:00
|
|
|
updateFormatting(cs.style);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
// This one needs to be called whenever citationStyleCO needs
|
|
|
|
// to be updated---and this would be on anything that changes the
|
|
|
|
// selection in selectedLV, or on a general update.
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::fillStyles(BiblioInfo const & bi)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
int const oldIndex = citationStyleCO->currentIndex();
|
|
|
|
|
|
|
|
citationStyleCO->clear();
|
|
|
|
|
2008-05-06 14:33:38 +00:00
|
|
|
QStringList selected_keys = selected_model_.stringList();
|
2007-08-31 22:37:05 +00:00
|
|
|
if (selected_keys.empty()) {
|
|
|
|
citationStyleCO->setEnabled(false);
|
|
|
|
citationStyleLA->setEnabled(false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int curr = selectedLV->model()->rowCount() - 1;
|
|
|
|
if (curr < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!selectedLV->selectionModel()->selectedIndexes().empty())
|
|
|
|
curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
QStringList sty = citationStyles(bi, curr);
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2007-12-20 15:46:14 +00:00
|
|
|
citationStyleCO->setEnabled(!sty.isEmpty());
|
|
|
|
citationStyleLA->setEnabled(!sty.isEmpty());
|
2007-08-31 22:37:05 +00:00
|
|
|
|
2007-12-20 15:46:14 +00:00
|
|
|
if (sty.isEmpty())
|
2007-08-31 22:37:05 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
citationStyleCO->insertItems(0, sty);
|
|
|
|
|
|
|
|
if (oldIndex != -1 && oldIndex < citationStyleCO->count())
|
|
|
|
citationStyleCO->setCurrentIndex(oldIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::fillFields(BiblioInfo const & bi)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
fieldsCO->blockSignals(true);
|
|
|
|
int const oldIndex = fieldsCO->currentIndex();
|
|
|
|
fieldsCO->clear();
|
2008-07-19 17:23:13 +00:00
|
|
|
QStringList const fields = to_qstring_list(bi.getFields());
|
2007-08-31 22:37:05 +00:00
|
|
|
fieldsCO->insertItem(0, qt_("All Fields"));
|
|
|
|
fieldsCO->insertItem(1, qt_("Keys"));
|
|
|
|
fieldsCO->insertItems(2, fields);
|
|
|
|
if (oldIndex != -1 && oldIndex < fieldsCO->count())
|
|
|
|
fieldsCO->setCurrentIndex(oldIndex);
|
|
|
|
fieldsCO->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::fillEntries(BiblioInfo const & bi)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
entriesCO->blockSignals(true);
|
|
|
|
int const oldIndex = entriesCO->currentIndex();
|
|
|
|
entriesCO->clear();
|
2008-07-19 17:23:13 +00:00
|
|
|
QStringList const entries = to_qstring_list(bi.getEntries());
|
2007-08-31 22:37:05 +00:00
|
|
|
entriesCO->insertItem(0, qt_("All Entry Types"));
|
|
|
|
entriesCO->insertItems(1, entries);
|
|
|
|
if (oldIndex != -1 && oldIndex < entriesCO->count())
|
|
|
|
entriesCO->setCurrentIndex(oldIndex);
|
|
|
|
entriesCO->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
bool GuiCitation::isSelected(const QModelIndex & idx)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
QString const str = idx.data().toString();
|
2008-05-06 14:33:38 +00:00
|
|
|
return selected_model_.stringList().contains(str);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::setButtons()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2007-09-15 01:53:26 +00:00
|
|
|
selectionManager->update();
|
2007-08-31 22:37:05 +00:00
|
|
|
int const srows = selectedLV->model()->rowCount();
|
|
|
|
applyPB->setEnabled(srows > 0);
|
|
|
|
okPB->setEnabled(srows > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::updateInfo(BiblioInfo const & bi, QModelIndex const & idx)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2008-07-19 17:23:13 +00:00
|
|
|
if (!idx.isValid() || bi.empty()) {
|
2007-08-31 22:37:05 +00:00
|
|
|
infoML->document()->clear();
|
2008-05-06 14:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString const keytxt = toqstr(
|
2008-07-19 17:23:13 +00:00
|
|
|
bi.getInfo(qstring_to_ucs4(idx.data().toString())));
|
2008-05-06 14:33:38 +00:00
|
|
|
infoML->document()->setPlainText(keytxt);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::findText(QString const & text, bool reset)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
//"All Fields" and "Keys" are the first two
|
|
|
|
int index = fieldsCO->currentIndex() - 2;
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo const & bi = bibInfo();
|
|
|
|
vector<docstring> const & fields = bi.getFields();
|
2007-08-31 22:37:05 +00:00
|
|
|
docstring field;
|
|
|
|
|
|
|
|
if (index <= -1 || index >= int(fields.size()))
|
|
|
|
//either "All Fields" or "Keys" or an invalid value
|
|
|
|
field = from_ascii("");
|
|
|
|
else
|
|
|
|
field = fields[index];
|
|
|
|
|
|
|
|
//Was it "Keys"?
|
|
|
|
bool const onlyKeys = index == -1;
|
|
|
|
|
|
|
|
//"All Entry Types" is first.
|
|
|
|
index = entriesCO->currentIndex() - 1;
|
2008-07-19 17:23:13 +00:00
|
|
|
vector<docstring> const & entries = bi.getEntries();
|
2008-02-14 07:10:12 +00:00
|
|
|
docstring entry_type;
|
2007-08-31 22:37:05 +00:00
|
|
|
if (index < 0 || index >= int(entries.size()))
|
2008-02-14 07:10:12 +00:00
|
|
|
entry_type = from_ascii("");
|
2007-08-31 22:37:05 +00:00
|
|
|
else
|
2008-02-14 07:10:12 +00:00
|
|
|
entry_type = entries[index];
|
2007-08-31 22:37:05 +00:00
|
|
|
|
|
|
|
bool const case_sentitive = caseCB->checkState();
|
|
|
|
bool const reg_exp = regexCB->checkState();
|
2008-07-19 17:23:13 +00:00
|
|
|
findKey(bi, text, onlyKeys, field, entry_type,
|
2007-08-31 22:37:05 +00:00
|
|
|
case_sentitive, reg_exp, reset);
|
|
|
|
//FIXME
|
|
|
|
//It'd be nice to save and restore the current selection in
|
|
|
|
//availableLV. Currently, we get an automatic reset, since the
|
|
|
|
//model is reset.
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
updateControls(bi);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_fieldsCO_currentIndexChanged(int /*index*/)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
findText(findLE->text(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_entriesCO_currentIndexChanged(int /*index*/)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
findText(findLE->text(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-20 15:46:14 +00:00
|
|
|
void GuiCitation::on_citationStyleCO_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
if (index >= 0 && index < citationStyleCO->count()) {
|
2008-04-20 15:00:11 +00:00
|
|
|
vector<CiteStyle> const & styles = citeStyles_;
|
2007-12-20 15:46:14 +00:00
|
|
|
updateFormatting(styles[index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_findLE_textChanged(const QString & text)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
2008-04-25 19:38:31 +00:00
|
|
|
bool const searchAsWeGo = (asTypeCB->checkState() == Qt::Checked);
|
|
|
|
searchPB->setDisabled(text.isEmpty() || searchAsWeGo);
|
|
|
|
if (!text.isEmpty()) {
|
|
|
|
if (searchAsWeGo)
|
|
|
|
findText(findLE->text());
|
2008-04-24 18:30:31 +00:00
|
|
|
return;
|
2008-04-25 19:38:31 +00:00
|
|
|
}
|
2008-04-24 18:30:31 +00:00
|
|
|
findText(findLE->text());
|
|
|
|
findLE->setFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
void GuiCitation::on_searchPB_clicked()
|
|
|
|
{
|
2008-04-25 19:38:31 +00:00
|
|
|
findText(findLE->text(), true);
|
2007-08-31 22:37:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_caseCB_stateChanged(int)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
findText(findLE->text());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::on_regexCB_stateChanged(int)
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
findText(findLE->text());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-25 19:38:31 +00:00
|
|
|
void GuiCitation::on_asTypeCB_stateChanged(int)
|
|
|
|
{
|
|
|
|
bool const searchAsWeGo = (asTypeCB->checkState() == Qt::Checked);
|
|
|
|
searchPB->setDisabled(findLE->text().isEmpty() || searchAsWeGo);
|
|
|
|
if (searchAsWeGo)
|
|
|
|
findText(findLE->text(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::changed()
|
2007-08-31 22:37:05 +00:00
|
|
|
{
|
|
|
|
setButtons();
|
|
|
|
}
|
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
|
2007-12-20 15:46:14 +00:00
|
|
|
void GuiCitation::apply(int const choice, bool full, bool force,
|
2007-09-05 20:33:29 +00:00
|
|
|
QString before, QString after)
|
2006-03-05 17:24:44 +00:00
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
if (cited_keys_.isEmpty())
|
2006-06-28 08:28:16 +00:00
|
|
|
return;
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
vector<CiteStyle> const & styles = citeStyles_;
|
|
|
|
if (styles[choice] == NOCITE) {
|
2007-12-20 15:46:14 +00:00
|
|
|
full = false;
|
|
|
|
force = false;
|
|
|
|
before.clear();
|
|
|
|
after.clear();
|
|
|
|
}
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
CitationStyle s;
|
|
|
|
s.style = styles[choice];
|
|
|
|
s.full = full;
|
|
|
|
s.forceUpperCase = force;
|
|
|
|
string const command = citationStyleToString(s);
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2007-10-07 14:59:01 +00:00
|
|
|
params_.setCmdName(command);
|
|
|
|
params_["key"] = qstring_to_ucs4(cited_keys_.join(","));
|
|
|
|
params_["before"] = qstring_to_ucs4(before);
|
|
|
|
params_["after"] = qstring_to_ucs4(after);
|
2007-10-06 11:33:33 +00:00
|
|
|
dispatchParams();
|
2006-03-25 21:26:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::clearSelection()
|
2006-12-15 09:58:44 +00:00
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
cited_keys_.clear();
|
|
|
|
selected_model_.setStringList(cited_keys_);
|
2006-12-15 09:58:44 +00:00
|
|
|
}
|
|
|
|
|
2007-05-28 22:27:45 +00:00
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::init()
|
2006-04-11 08:26:43 +00:00
|
|
|
{
|
2006-03-25 21:26:09 +00:00
|
|
|
// Make the list of all available bibliography keys
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo const & bi = bibInfo();
|
|
|
|
all_keys_ = to_qstring_list(bi.getKeys());
|
2007-03-25 01:32:12 +00:00
|
|
|
available_model_.setStringList(all_keys_);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2006-03-25 21:26:09 +00:00
|
|
|
// Ditto for the keys cited in this inset
|
2007-10-07 14:59:01 +00:00
|
|
|
QString str = toqstr(params_["key"]);
|
2007-03-25 01:32:12 +00:00
|
|
|
if (str.isEmpty())
|
|
|
|
cited_keys_.clear();
|
|
|
|
else
|
|
|
|
cited_keys_ = str.split(",");
|
|
|
|
selected_model_.setStringList(cited_keys_);
|
2008-07-19 17:23:13 +00:00
|
|
|
fillFields(bi);
|
|
|
|
fillEntries(bi);
|
|
|
|
updateControls(bi);
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::findKey(BiblioInfo const & bi,
|
|
|
|
QString const & str, bool only_keys,
|
2008-02-14 07:10:12 +00:00
|
|
|
docstring field, docstring entry_type,
|
2007-08-20 16:30:02 +00:00
|
|
|
bool case_sensitive, bool reg_exp, bool reset)
|
2006-03-25 21:26:09 +00:00
|
|
|
{
|
2007-03-25 01:32:12 +00:00
|
|
|
// Used for optimisation: store last searched string.
|
|
|
|
static QString last_searched_string;
|
|
|
|
// Used to disable the above optimisation.
|
|
|
|
static bool last_case_sensitive;
|
|
|
|
static bool last_reg_exp;
|
|
|
|
// Reset last_searched_string in case of changed option.
|
|
|
|
if (last_case_sensitive != case_sensitive
|
|
|
|
|| last_reg_exp != reg_exp) {
|
2007-11-15 20:04:51 +00:00
|
|
|
LYXERR(Debug::GUI, "GuiCitation::findKey: optimisation disabled!");
|
2007-03-25 01:32:12 +00:00
|
|
|
last_searched_string.clear();
|
|
|
|
}
|
|
|
|
// save option for next search.
|
|
|
|
last_case_sensitive = case_sensitive;
|
|
|
|
last_reg_exp = reg_exp;
|
|
|
|
|
2008-04-24 18:30:31 +00:00
|
|
|
Qt::CaseSensitivity qtcase = case_sensitive ?
|
2007-03-25 01:32:12 +00:00
|
|
|
Qt::CaseSensitive: Qt::CaseInsensitive;
|
|
|
|
QStringList keys;
|
|
|
|
// If new string (str) contains the last searched one...
|
2007-08-20 16:30:02 +00:00
|
|
|
if (!reset &&
|
|
|
|
!last_searched_string.isEmpty() &&
|
|
|
|
str.size() > 1 &&
|
|
|
|
str.contains(last_searched_string, qtcase))
|
2007-03-25 01:32:12 +00:00
|
|
|
// ... then only search within already found list.
|
|
|
|
keys = available_model_.stringList();
|
|
|
|
else
|
|
|
|
// ... else search all keys.
|
|
|
|
keys = all_keys_;
|
|
|
|
// save searched string for next search.
|
|
|
|
last_searched_string = str;
|
|
|
|
|
|
|
|
QStringList result;
|
2007-08-20 16:30:02 +00:00
|
|
|
|
2008-02-14 07:10:12 +00:00
|
|
|
// First, filter by entry_type, which will be faster than
|
2007-08-31 22:37:05 +00:00
|
|
|
// what follows, so we may get to do that on less.
|
2007-08-20 16:30:02 +00:00
|
|
|
vector<docstring> keyVector = to_docstring_vector(keys);
|
2008-07-19 17:23:13 +00:00
|
|
|
filterByEntryType(bi, keyVector, entry_type);
|
2007-08-20 16:30:02 +00:00
|
|
|
|
|
|
|
if (str.isEmpty())
|
|
|
|
result = to_qstring_list(keyVector);
|
2007-03-25 01:32:12 +00:00
|
|
|
else
|
2008-07-19 17:23:13 +00:00
|
|
|
result = to_qstring_list(searchKeys(bi, keyVector, only_keys,
|
2007-08-20 16:30:02 +00:00
|
|
|
qstring_to_ucs4(str), field, case_sensitive, reg_exp));
|
|
|
|
|
2007-03-25 01:32:12 +00:00
|
|
|
available_model_.setStringList(result);
|
2006-03-25 21:26:09 +00:00
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2006-04-11 08:26:43 +00:00
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
QStringList GuiCitation::citationStyles(BiblioInfo const & bi, int sel)
|
2006-04-11 08:26:43 +00:00
|
|
|
{
|
2007-08-20 16:30:02 +00:00
|
|
|
docstring const key = qstring_to_ucs4(cited_keys_[sel]);
|
2008-07-19 17:23:13 +00:00
|
|
|
return to_qstring_list(bi.getCiteStrings(key, buffer()));
|
2006-03-05 17:24:44 +00:00
|
|
|
}
|
|
|
|
|
2006-06-28 08:28:16 +00:00
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
void GuiCitation::setCitedKeys()
|
This is one of a series of patches that will merge the layout modules development in personal/branches/rgheck back into the tree.
Design goal: Allow the use of layout "modules", which are to LaTeX packages as layout files are to LaTeX document classes. Thus, one could have a module that defined certain character styles, environments, commands, or what have you, and include it in various documents, each of which uses a different document class, without having to modify the layout files themselves. For example, a theorems.module could be used with article.layout to provide support for theorem-type environments, without having to modify article.layout itself, and the same module could be used with book.layout, etc.
This third patch just re-factors some code presently in QCitation*. (It also incorporates some bug fixes that have been committed separately.) We're going to use essentially the same set of widgets for choosing modules that is used for choosing citation keys, so we pull the controlling logic out into a new class, QSelectionManager. I did not make this a QWidget. That seemed to me to be overkill, and it would have made things much more complicated, I think...and I'm not all that experienced with Qt, anyway. Anyone who wants to do that is of course welcome.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19860 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-28 16:49:40 +00:00
|
|
|
{
|
|
|
|
cited_keys_ = selected_model_.stringList();
|
|
|
|
}
|
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
|
|
|
|
bool GuiCitation::initialiseParams(string const & data)
|
|
|
|
{
|
2008-04-20 09:24:14 +00:00
|
|
|
InsetCommand::string2params("citation", data, params_);
|
2008-04-20 15:00:11 +00:00
|
|
|
CiteEngine const engine = buffer().params().citeEngine();
|
|
|
|
citeStyles_ = citeStyles(engine);
|
2008-05-06 13:50:37 +00:00
|
|
|
init();
|
2007-10-06 11:33:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiCitation::clearParams()
|
|
|
|
{
|
2007-10-07 14:59:01 +00:00
|
|
|
params_.clear();
|
2007-10-06 11:33:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
void GuiCitation::filterByEntryType(BiblioInfo const & bi,
|
2008-02-14 07:10:12 +00:00
|
|
|
vector<docstring> & keyVector, docstring entry_type)
|
2007-10-06 11:33:33 +00:00
|
|
|
{
|
2008-02-14 07:10:12 +00:00
|
|
|
if (entry_type.empty())
|
2007-10-06 11:33:33 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
vector<docstring>::iterator it = keyVector.begin();
|
|
|
|
vector<docstring>::iterator end = keyVector.end();
|
2008-07-19 17:23:13 +00:00
|
|
|
|
2007-10-06 11:33:33 +00:00
|
|
|
vector<docstring> result;
|
|
|
|
for (; it != end; ++it) {
|
|
|
|
docstring const key = *it;
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo::const_iterator cit = bi.find(key);
|
|
|
|
if (cit == bi.end())
|
2007-10-06 11:33:33 +00:00
|
|
|
continue;
|
2008-02-14 07:10:12 +00:00
|
|
|
if (cit->second.entryType() == entry_type)
|
2007-10-06 11:33:33 +00:00
|
|
|
result.push_back(key);
|
|
|
|
}
|
|
|
|
keyVector = result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-20 15:00:11 +00:00
|
|
|
CiteEngine GuiCitation::citeEngine() const
|
2007-10-06 11:33:33 +00:00
|
|
|
{
|
2008-03-15 00:22:54 +00:00
|
|
|
return buffer().params().citeEngine();
|
2007-10-06 11:33:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Escape special chars.
|
|
|
|
// All characters are literals except: '.|*?+(){}[]^$\'
|
|
|
|
// These characters are literals when preceded by a "\", which is done here
|
|
|
|
// @todo: This function should be moved to support, and then the test in tests
|
|
|
|
// should be moved there as well.
|
|
|
|
static docstring escape_special_chars(docstring const & expr)
|
|
|
|
{
|
|
|
|
// Search for all chars '.|*?+(){}[^$]\'
|
|
|
|
// Note that '[' and '\' must be escaped.
|
|
|
|
// This is a limitation of boost::regex, but all other chars in BREs
|
|
|
|
// are assumed literal.
|
|
|
|
static const boost::regex reg("[].|*?+(){}^$\\[\\\\]");
|
|
|
|
|
|
|
|
// $& is a perl-like expression that expands to all
|
|
|
|
// of the current match
|
|
|
|
// The '$' must be prefixed with the escape character '\' for
|
|
|
|
// boost to treat it as a literal.
|
|
|
|
// Thus, to prefix a matched expression with '\', we use:
|
|
|
|
// FIXME: UNICODE
|
|
|
|
return from_utf8(boost::regex_replace(to_utf8(expr), reg, "\\\\$&"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-19 17:23:13 +00:00
|
|
|
vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
|
2007-10-06 11:33:33 +00:00
|
|
|
vector<docstring> const & keys_to_search, bool only_keys,
|
|
|
|
docstring const & search_expression, docstring field,
|
|
|
|
bool case_sensitive, bool regex)
|
|
|
|
{
|
|
|
|
vector<docstring> foundKeys;
|
|
|
|
|
2007-12-12 19:57:42 +00:00
|
|
|
docstring expr = trim(search_expression);
|
2007-10-06 11:33:33 +00:00
|
|
|
if (expr.empty())
|
|
|
|
return foundKeys;
|
|
|
|
|
|
|
|
if (!regex)
|
|
|
|
// We must escape special chars in the search_expr so that
|
|
|
|
// it is treated as a simple string by boost::regex.
|
|
|
|
expr = escape_special_chars(expr);
|
|
|
|
|
2007-12-12 10:52:23 +00:00
|
|
|
boost::regex reg_exp;
|
|
|
|
try {
|
|
|
|
reg_exp.assign(to_utf8(expr), case_sensitive ?
|
|
|
|
boost::regex_constants::normal : boost::regex_constants::icase);
|
|
|
|
} catch (boost::regex_error & e) {
|
|
|
|
// boost::regex throws an exception if the regular expression is not
|
|
|
|
// valid.
|
2007-12-12 10:53:44 +00:00
|
|
|
LYXERR(Debug::GUI, e.what());
|
2007-12-12 10:52:23 +00:00
|
|
|
return vector<docstring>();
|
|
|
|
}
|
2007-10-06 11:33:33 +00:00
|
|
|
|
|
|
|
vector<docstring>::const_iterator it = keys_to_search.begin();
|
|
|
|
vector<docstring>::const_iterator end = keys_to_search.end();
|
|
|
|
for (; it != end; ++it ) {
|
2008-07-19 17:23:13 +00:00
|
|
|
BiblioInfo::const_iterator info = bi.find(*it);
|
|
|
|
if (info == bi.end())
|
2007-10-06 11:33:33 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
BibTeXInfo const & kvm = info->second;
|
|
|
|
string data;
|
|
|
|
if (only_keys)
|
|
|
|
data = to_utf8(*it);
|
|
|
|
else if (field.empty())
|
2008-02-14 05:00:54 +00:00
|
|
|
data = to_utf8(*it) + ' ' + to_utf8(kvm.allData());
|
2007-10-06 11:33:33 +00:00
|
|
|
else if (kvm.hasField(field))
|
|
|
|
data = to_utf8(kvm.getValueForField(field));
|
|
|
|
|
|
|
|
if (data.empty())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (boost::regex_search(data, reg_exp))
|
|
|
|
foundKeys.push_back(*it);
|
|
|
|
}
|
2007-12-12 10:52:23 +00:00
|
|
|
catch (boost::regex_error & e) {
|
|
|
|
LYXERR(Debug::GUI, e.what());
|
2007-10-06 11:33:33 +00:00
|
|
|
return vector<docstring>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return foundKeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-20 09:24:14 +00:00
|
|
|
void GuiCitation::dispatchParams()
|
|
|
|
{
|
|
|
|
std::string const lfun = InsetCommand::params2string("citation", params_);
|
|
|
|
dispatch(FuncRequest(getLfun(), lfun));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-25 20:03:03 +00:00
|
|
|
BiblioInfo const & GuiCitation::bibInfo() const
|
|
|
|
{
|
|
|
|
return buffer().masterBibInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-14 14:37:33 +00:00
|
|
|
void GuiCitation::saveSession() const
|
|
|
|
{
|
|
|
|
Dialog::saveSession();
|
|
|
|
QSettings settings;
|
|
|
|
settings.setValue(
|
|
|
|
sessionKey() + "/regex", regexCB->isChecked());
|
|
|
|
settings.setValue(
|
|
|
|
sessionKey() + "/casesensitive", caseCB->isChecked());
|
|
|
|
settings.setValue(
|
|
|
|
sessionKey() + "/autofind", asTypeCB->isChecked());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GuiCitation::restoreSession()
|
|
|
|
{
|
|
|
|
Dialog::restoreSession();
|
|
|
|
QSettings settings;
|
|
|
|
regexCB->setChecked(
|
|
|
|
settings.value(sessionKey() + "/regex").toBool());
|
|
|
|
caseCB->setChecked(
|
|
|
|
settings.value(sessionKey() + "/casesensitive").toBool());
|
|
|
|
asTypeCB->setChecked(
|
|
|
|
settings.value(sessionKey() + "/autofind").toBool());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiCitation(GuiView & lv) { return new GuiCitation(lv); }
|
2007-10-06 11:33:33 +00:00
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-08-31 22:37:05 +00:00
|
|
|
|
|
|
|
#include "GuiCitation_moc.cpp"
|
|
|
|
|