encodinglist.sort();
langModule->encodingCO->addItems(encodinglist);
- for (int i = 0; i < quoteparams.stylescount(); ++i) {
- InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i);
- if (qs == InsetQuotesParams::DynamicQuotes)
- continue;
- langModule->quoteStyleCO->addItem(toqstr(quoteparams.getGuiLabel(qs)), qs);
- }
-
langModule->languagePackageCO->addItem(
qt_("Default"), toqstr("default"));
langModule->languagePackageCO->addItem(
this, SLOT(citeStyleChanged()));
connect(biblioModule->bibtopicCB, SIGNAL(clicked()),
this, SLOT(biblioChanged()));
+ connect(biblioModule->bibunitsCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
this, SLOT(bibtexChanged(int)));
connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
this, SLOT(biblioChanged()));
+ connect(biblioModule->citePackageOptionsLE, SIGNAL(textChanged(QString)),
+ this, SLOT(biblioChanged()));
connect(biblioModule->defaultBiblioCO, SIGNAL(activated(int)),
this, SLOT(biblioChanged()));
connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
this, SLOT(biblioChanged()));
connect(biblioModule->defaultBiblioCO, SIGNAL(editTextChanged(QString)),
this, SLOT(updateResetDefaultBiblio()));
+ connect(biblioModule->biblatexBbxCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->biblatexBbxCO, SIGNAL(editTextChanged(QString)),
+ this, SLOT(updateResetDefaultBiblio()));
+ connect(biblioModule->biblatexCbxCO, SIGNAL(activated(int)),
+ this, SLOT(biblioChanged()));
+ connect(biblioModule->biblatexCbxCO, SIGNAL(editTextChanged(QString)),
+ this, SLOT(updateResetDefaultBiblio()));
connect(biblioModule->rescanBibliosPB, SIGNAL(clicked()),
this, SLOT(rescanBibFiles()));
connect(biblioModule->resetDefaultBiblioPB, SIGNAL(clicked()),
this, SLOT(resetDefaultBibfile()));
+ connect(biblioModule->resetCbxPB, SIGNAL(clicked()),
+ this, SLOT(resetDefaultCbxBibfile()));
+ connect(biblioModule->resetBbxPB, SIGNAL(clicked()),
+ this, SLOT(resetDefaultBbxBibfile()));
+ connect(biblioModule->matchBbxPB, SIGNAL(clicked()),
+ this, SLOT(matchBiblatexStyles()));
biblioModule->citeEngineCO->clear();
for (LyXCiteEngine const & cet : theCiteEnginesList) {
}
+void GuiDocument::updateQuoteStyles(bool const set)
+{
+ Language const * lang = lyx::languages.getLanguage(
+ fromqstr(langModule->languageCO->itemData(
+ langModule->languageCO->currentIndex()).toString()));
+
+ InsetQuotesParams::QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle());
+
+ langModule->quoteStyleCO->clear();
+
+ bool has_default = false;
+ for (int i = 0; i < quoteparams.stylescount(); ++i) {
+ InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i);
+ if (qs == InsetQuotesParams::DynamicQuotes)
+ continue;
+ bool const langdef = (qs == def);
+ if (langdef) {
+ // add the default style on top
+ langModule->quoteStyleCO->insertItem(0,
+ toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+ has_default = true;
+ }
+ else
+ langModule->quoteStyleCO->addItem(
+ toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+ }
+ if (set && has_default)
+ // (re)set to the default style
+ langModule->quoteStyleCO->setCurrentIndex(0);
+}
+
+
void GuiDocument::languageChanged(int i)
{
// some languages only work with polyglossia
}
// set appropriate quotation mark style
- if (!lang->quoteStyle().empty()) {
- langModule->quoteStyleCO->setCurrentIndex(
- bp_.getQuoteStyle(lang->quoteStyle()));
- }
+ updateQuoteStyles(true);
}
void GuiDocument::rescanBibFiles()
{
- rescanTexStyles("bst");
+ if (isBiblatex())
+ rescanTexStyles("bbx cbx");
+ else
+ rescanTexStyles("bst");
}
-void GuiDocument::resetDefaultBibfile()
+void GuiDocument::resetDefaultBibfile(string const & which)
{
QString const engine =
biblioModule->citeEngineCO->itemData(
CiteEngineType(biblioModule->citeStyleCO->itemData(
biblioModule->citeStyleCO->currentIndex()).toInt());
- updateDefaultBiblio(theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet));
+ updateDefaultBiblio(theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet), which);
+}
+
+
+void GuiDocument::resetDefaultBbxBibfile()
+{
+ resetDefaultBibfile("bbx");
+}
+
+
+void GuiDocument::resetDefaultCbxBibfile()
+{
+ resetDefaultBibfile("cbx");
}
theCiteEnginesList[fromqstr(engine)]->getEngineType();
updateCiteStyles(engs);
+ updateEngineDependends();
resetDefaultBibfile();
-
biblioChanged();
}
+void GuiDocument::updateEngineDependends()
+{
+ bool const biblatex = isBiblatex();
+
+ // These are only useful with BibTeX
+ biblioModule->defaultBiblioCO->setEnabled(!biblatex);
+ biblioModule->bibtexStyleLA->setEnabled(!biblatex);
+ biblioModule->resetDefaultBiblioPB->setEnabled(!biblatex);
+ biblioModule->bibtopicCB->setEnabled(!biblatex);
+
+ // These are only useful with Biblatex
+ biblioModule->biblatexBbxCO->setEnabled(biblatex);
+ biblioModule->biblatexBbxLA->setEnabled(biblatex);
+ biblioModule->biblatexCbxCO->setEnabled(biblatex);
+ biblioModule->biblatexCbxLA->setEnabled(biblatex);
+ biblioModule->resetBbxPB->setEnabled(biblatex);
+ biblioModule->resetCbxPB->setEnabled(biblatex);
+ biblioModule->matchBbxPB->setEnabled(biblatex);
+
+ // These are useful with biblatex, jurabib and natbib
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+ LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)];
+
+ bool const citepack = ce->requires("biblatex.sty") || ce->requires("jurabib.sty")
+ || ce->requires("natbib.sty");
+ biblioModule->citePackageOptionsLE->setEnabled(citepack);
+ biblioModule->citePackageOptionsL->setEnabled(citepack);
+}
+
+
void GuiDocument::citeStyleChanged()
{
QString const engine =
biblioModule->citeEngineCO->itemData(
biblioModule->citeEngineCO->currentIndex()).toString();
- if (theCiteEnginesList[fromqstr(engine)]->isDefaultBiblio(
- fromqstr(biblioModule->defaultBiblioCO->currentText())))
+ QString const currentDef = isBiblatex() ?
+ biblioModule->biblatexBbxCO->currentText()
+ : biblioModule->defaultBiblioCO->currentText();
+ if (theCiteEnginesList[fromqstr(engine)]->isDefaultBiblio(fromqstr(currentDef)))
resetDefaultBibfile();
biblioChanged();
else
bp_.setCiteEngineType(ENGINE_TYPE_DEFAULT);
- bp_.use_bibtopic =
- biblioModule->bibtopicCB->isChecked();
+ bp_.splitbib(biblioModule->bibtopicCB->isChecked());
+
+ bp_.multibib = fromqstr(biblioModule->bibunitsCO->itemData(
+ biblioModule->bibunitsCO->currentIndex()).toString());
- bp_.biblio_style = fromqstr(biblioModule->defaultBiblioCO->currentText());
+ bp_.setDefaultBiblioStyle(fromqstr(biblioModule->defaultBiblioCO->currentText()));
+
+ bp_.biblatex_bibstyle = fromqstr(biblioModule->biblatexBbxCO->currentText());
+ bp_.biblatex_citestyle = fromqstr(biblioModule->biblatexCbxCO->currentText());
+ bp_.biblio_opts = fromqstr(biblioModule->citePackageOptionsLE->text());
string const bibtex_command =
fromqstr(biblioModule->bibtexCO->itemData(
biblioModule->citeStyleCO->setCurrentIndex(
biblioModule->citeStyleCO->findData(bp_.citeEngineType()));
- biblioModule->bibtopicCB->setChecked(
- bp_.use_bibtopic);
+ biblioModule->bibtopicCB->setChecked(bp_.splitbib());
+
+ biblioModule->bibunitsCO->clear();
+ biblioModule->bibunitsCO->addItem(qt_("No"), QString());
+ if (documentClass().hasLaTeXLayout("part"))
+ biblioModule->bibunitsCO->addItem(qt_("per part"), toqstr("part"));
+ if (documentClass().hasLaTeXLayout("chapter"))
+ biblioModule->bibunitsCO->addItem(qt_("per chapter"), toqstr("chapter"));
+ if (documentClass().hasLaTeXLayout("section"))
+ biblioModule->bibunitsCO->addItem(qt_("per section"), toqstr("section"));
+ if (documentClass().hasLaTeXLayout("subsection"))
+ biblioModule->bibunitsCO->addItem(qt_("per subsection"), toqstr("subsection"));
+
+ int const mbpos = biblioModule->bibunitsCO->findData(toqstr(bp_.multibib));
+ if (mbpos != -1)
+ biblioModule->bibunitsCO->setCurrentIndex(mbpos);
+ else
+ biblioModule->bibunitsCO->setCurrentIndex(0);
+
+ updateEngineDependends();
- updateDefaultBiblio(bp_.defaultBiblioStyle());
+ if (isBiblatex()) {
+ updateDefaultBiblio(bp_.biblatex_bibstyle, "bbx");
+ updateDefaultBiblio(bp_.biblatex_citestyle, "cbx");
+ } else
+ updateDefaultBiblio(bp_.defaultBiblioStyle());
+
+ biblioModule->citePackageOptionsLE->setText(toqstr(bp_.biblio_opts));
string command;
string options =
bp_.language->lang()));
langModule->languageCO->setCurrentIndex(pos);
+ updateQuoteStyles();
+
langModule->quoteStyleCO->setCurrentIndex(
- bp_.quotes_style);
+ langModule->quoteStyleCO->findData(bp_.quotes_style));
langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
bool default_enc = true;
}
-void GuiDocument::updateDefaultBiblio(string const & style)
+bool GuiDocument::isBiblatex() const
+{
+ QString const engine =
+ biblioModule->citeEngineCO->itemData(
+ biblioModule->citeEngineCO->currentIndex()).toString();
+
+ return theCiteEnginesList[fromqstr(engine)]->getCiteFramework() == "biblatex";
+}
+
+
+void GuiDocument::updateDefaultBiblio(string const & style,
+ string const & which)
{
QString const bibstyle = toqstr(style);
biblioModule->defaultBiblioCO->clear();
int item_nr = -1;
- QStringList str = texFileList("bstFiles.lst");
- // test whether we have a valid list, otherwise run rescan
- if (str.isEmpty()) {
- rescanTexStyles("bst");
- str = texFileList("bstFiles.lst");
- }
- for (int i = 0; i != str.size(); ++i)
- str[i] = onlyFileName(str[i]);
- // sort on filename only (no path)
- str.sort();
-
- for (int i = 0; i != str.count(); ++i) {
- QString item = changeExtension(str[i], "");
- if (item == bibstyle)
- item_nr = i;
- biblioModule->defaultBiblioCO->addItem(item);
- }
+ if (isBiblatex()) {
+ if (which != "cbx") {
+ // First the bbx styles
+ biblioModule->biblatexBbxCO->clear();
+ QStringList str = texFileList("bbxFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("bbx");
+ str = texFileList("bbxFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->biblatexBbxCO->addItem(item);
+ }
- if (item_nr == -1 && !bibstyle.isEmpty()) {
- biblioModule->defaultBiblioCO->addItem(bibstyle);
- item_nr = biblioModule->defaultBiblioCO->count() - 1;
- }
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->biblatexBbxCO->addItem(bibstyle);
+ item_nr = biblioModule->biblatexBbxCO->count() - 1;
+ }
- if (item_nr != -1)
- biblioModule->defaultBiblioCO->setCurrentIndex(item_nr);
- else
- biblioModule->defaultBiblioCO->clearEditText();
+ if (item_nr != -1)
+ biblioModule->biblatexBbxCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->biblatexBbxCO->clearEditText();
+ }
+
+ if (which != "bbx") {
+ // now the cbx styles
+ biblioModule->biblatexCbxCO->clear();
+ QStringList str = texFileList("cbxFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("cbx");
+ str = texFileList("cbxFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->biblatexCbxCO->addItem(item);
+ }
+
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->biblatexCbxCO->addItem(bibstyle);
+ item_nr = biblioModule->biblatexCbxCO->count() - 1;
+ }
+
+ if (item_nr != -1)
+ biblioModule->biblatexCbxCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->biblatexCbxCO->clearEditText();
+ }
+ } else {// BibTeX
+ biblioModule->biblatexBbxCO->clear();
+ biblioModule->biblatexCbxCO->clear();
+ QStringList str = texFileList("bstFiles.lst");
+ // test whether we have a valid list, otherwise run rescan
+ if (str.isEmpty()) {
+ rescanTexStyles("bst");
+ str = texFileList("bstFiles.lst");
+ }
+ for (int i = 0; i != str.size(); ++i)
+ str[i] = onlyFileName(str[i]);
+ // sort on filename only (no path)
+ str.sort();
+
+ for (int i = 0; i != str.count(); ++i) {
+ QString item = changeExtension(str[i], "");
+ if (item == bibstyle)
+ item_nr = i;
+ biblioModule->defaultBiblioCO->addItem(item);
+ }
+
+ if (item_nr == -1 && !bibstyle.isEmpty()) {
+ biblioModule->defaultBiblioCO->addItem(bibstyle);
+ item_nr = biblioModule->defaultBiblioCO->count() - 1;
+ }
+
+ if (item_nr != -1)
+ biblioModule->defaultBiblioCO->setCurrentIndex(item_nr);
+ else
+ biblioModule->defaultBiblioCO->clearEditText();
+ }
updateResetDefaultBiblio();
}
CiteEngineType const cet =
CiteEngineType(biblioModule->citeStyleCO->itemData(
biblioModule->citeStyleCO->currentIndex()).toInt());
- biblioModule->resetDefaultBiblioPB->setEnabled(
- theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet)
- != fromqstr(biblioModule->defaultBiblioCO->currentText()));
+
+ string const defbib = theCiteEnginesList[fromqstr(engine)]->getDefaultBiblio(cet);
+ if (isBiblatex()) {
+ QString const bbx = biblioModule->biblatexBbxCO->currentText();
+ QString const cbx = biblioModule->biblatexCbxCO->currentText();
+ biblioModule->resetCbxPB->setEnabled(defbib != fromqstr(cbx));
+ biblioModule->resetBbxPB->setEnabled(defbib != fromqstr(bbx));
+ biblioModule->matchBbxPB->setEnabled(bbx != cbx && !cbx.isEmpty()
+ && biblioModule->biblatexBbxCO->findText(cbx) != -1);
+ } else
+ biblioModule->resetDefaultBiblioPB->setEnabled(
+ defbib != fromqstr(biblioModule->defaultBiblioCO->currentText()));
+}
+
+
+void GuiDocument::matchBiblatexStyles()
+{
+ updateDefaultBiblio(fromqstr(biblioModule->biblatexCbxCO->currentText()), "bbx");
+ biblioChanged();
}