* GuiDocument.cpp:

* GuiIndices.cpp:
	- allow custom processor setting per document. The missing UI was an oversight.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37459 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2011-02-03 15:03:38 +00:00
parent 728d664367
commit 73ab3e8b9c
2 changed files with 31 additions and 9 deletions

View File

@ -1074,7 +1074,8 @@ GuiDocument::GuiDocument(GuiView & lv)
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
biblioModule->bibtexCO->addItem(command, command);
}
biblioModule->bibtexCO->addItem(qt_("Custom"), QString("custom"));
// indices
indicesModule = new GuiIndices;
@ -1903,7 +1904,13 @@ void GuiDocument::languagePackageChanged(int i)
void GuiDocument::bibtexChanged(int n)
{
biblioModule->bibtexOptionsED->setEnabled(n != 0);
QString const data =
biblioModule->bibtexCO->itemData(n).toString();
biblioModule->bibtexOptionsED->setEnabled(data != "default");
if (data == "custom")
biblioModule->bibtexOptionsLA->setText(qt_("Co&mmand:"));
else
biblioModule->bibtexOptionsLA->setText(qt_("&Options:"));
changed();
}
@ -2164,7 +2171,9 @@ void GuiDocument::applyView()
biblioModule->bibtexCO->currentIndex()).toString());
string const bibtex_options =
fromqstr(biblioModule->bibtexOptionsED->text());
if (bibtex_command == "default" || bibtex_options.empty())
if (bibtex_command == "custom")
bp_.bibtex_command = bibtex_options;
else if (bibtex_command == "default" || bibtex_options.empty())
bp_.bibtex_command = bibtex_command;
else
bp_.bibtex_command = bibtex_command + " " + bibtex_options;
@ -2601,9 +2610,12 @@ void GuiDocument::paramsToDialog()
if (bpos != -1) {
biblioModule->bibtexCO->setCurrentIndex(bpos);
biblioModule->bibtexOptionsED->setText(toqstr(options).trimmed());
biblioModule->bibtexOptionsLA->setText(qt_("&Options:"));
} else {
biblioModule->bibtexCO->setCurrentIndex(0);
biblioModule->bibtexOptionsED->clear();
biblioModule->bibtexCO->setCurrentIndex(
biblioModule->bibtexCO->findData(toqstr("custom")));
biblioModule->bibtexOptionsED->setText(toqstr(bp_.bibtex_command));
biblioModule->bibtexOptionsLA->setText(qt_("&Command:"));
}
biblioModule->bibtexOptionsED->setEnabled(
biblioModule->bibtexCO->currentIndex() != 0);

View File

@ -59,6 +59,7 @@ GuiIndices::GuiIndices(QWidget * parent)
QString const command = toqstr(*it).left(toqstr(*it).indexOf(" "));
indexCO->addItem(command, command);
}
indexCO->addItem(qt_("Custom"), QString("custom"));
}
void GuiIndices::update(BufferParams const & params)
@ -82,9 +83,11 @@ void GuiIndices::update(BufferParams const & params)
if (pos != -1) {
indexCO->setCurrentIndex(pos);
indexOptionsED->setText(toqstr(options).trimmed());
indexOptionsLA->setText(qt_("&Options:"));
} else {
indexCO->setCurrentIndex(0);
indexOptionsED->clear();
indexCO->setCurrentIndex(indexCO->findData(toqstr("custom")));
indexOptionsED->setText(toqstr(params.index_command));
indexOptionsLA->setText(qt_("Co&mmand:"));
}
indexOptionsED->setEnabled(
indexCO->currentIndex() != 0);
@ -143,7 +146,9 @@ void GuiIndices::apply(BufferParams & params) const
fromqstr(indexCO->itemData(
indexCO->currentIndex()).toString());
string const index_options = fromqstr(indexOptionsED->text());
if (index_command == "default" || index_options.empty())
if (index_command == "custom")
params.index_command = index_options;
else if (index_command == "default" || index_options.empty())
params.index_command = index_command;
else
params.index_command = index_command + " " + index_options;
@ -152,7 +157,12 @@ void GuiIndices::apply(BufferParams & params) const
void GuiIndices::on_indexCO_activated(int n)
{
indexOptionsED->setEnabled(n != 0);
QString const data = indexCO->itemData(n).toString();
indexOptionsED->setEnabled(data != "default");
if (data == "custom")
indexOptionsLA->setText(qt_("Co&mmand:"));
else
indexOptionsLA->setText(qt_("&Options:"));
changed();
}