]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
Support for multiple bibliographies
[features.git] / src / frontends / qt4 / GuiDocument.cpp
index f7f00795ab6aafe198731a02259e0772767df9d4..daee81b952a3deb9f09e2bedaffbf3240123902f 100644 (file)
@@ -1126,6 +1126,8 @@ GuiDocument::GuiDocument(GuiView & lv)
                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)),
@@ -2378,8 +2380,6 @@ void GuiDocument::updateEngineDependends()
        biblioModule->bibtopicCB->setEnabled(!biblatex);
 
        // These are only useful with Biblatex
-       biblioModule->citePackageOptionsLE->setEnabled(biblatex);
-       biblioModule->citePackageOptionsL->setEnabled(biblatex);
        biblioModule->biblatexBbxCO->setEnabled(biblatex);
        biblioModule->biblatexBbxLA->setEnabled(biblatex);
        biblioModule->biblatexCbxCO->setEnabled(biblatex);
@@ -2387,6 +2387,17 @@ void GuiDocument::updateEngineDependends()
        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);
 }
 
 
@@ -2717,8 +2728,10 @@ void GuiDocument::applyView()
        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_.setDefaultBiblioStyle(fromqstr(biblioModule->defaultBiblioCO->currentText()));
 
@@ -3144,8 +3157,24 @@ void GuiDocument::paramsToDialog()
        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();
 
@@ -3758,14 +3787,13 @@ void GuiDocument::updateDefaultBiblio(string const & style,
 {
        QString const bibstyle = toqstr(style);
        biblioModule->defaultBiblioCO->clear();
-       biblioModule->biblatexBbxCO->clear();
-       biblioModule->biblatexCbxCO->clear();
 
        int item_nr = -1;
 
        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()) {
@@ -3797,6 +3825,7 @@ void GuiDocument::updateDefaultBiblio(string const & style,
 
                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()) {
@@ -3826,6 +3855,8 @@ void GuiDocument::updateDefaultBiblio(string const & style,
                                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()) {