]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
requires is a keyword in C++2a
[lyx.git] / src / insets / InsetBibtex.cpp
index 0b879e1c50f03890220495211717538265356293..bf70c44ae8ce08de6b91a5812cd0bb3b1b379e5d 100644 (file)
@@ -85,7 +85,7 @@ void InsetBibtex::doDispatch(Cursor & cur, FuncRequest & cmd)
        switch (cmd.action()) {
 
        case LFUN_INSET_EDIT:
-               editDatabases();
+               editDatabases(cmd.argument());
                break;
 
        case LFUN_INSET_MODIFY: {
@@ -132,7 +132,7 @@ bool InsetBibtex::getStatus(Cursor & cur, FuncRequest const & cmd,
 }
 
 
-void InsetBibtex::editDatabases() const
+void InsetBibtex::editDatabases(docstring const & db) const
 {
        vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
 
@@ -140,7 +140,7 @@ void InsetBibtex::editDatabases() const
                return;
 
        size_t nr_databases = bibfilelist.size();
-       if (nr_databases > 1) {
+       if (nr_databases > 1 && db.empty()) {
                        docstring const engine = usingBiblatex() ? _("Biblatex") : _("BibTeX");
                        docstring message = bformat(_("The %1$s[[BibTeX/Biblatex]] inset includes %2$s databases.\n"
                                                       "If you proceed, all of them will be opened."),
@@ -155,6 +155,8 @@ void InsetBibtex::editDatabases() const
        vector<docstring>::const_iterator it = bibfilelist.begin();
        vector<docstring>::const_iterator en = bibfilelist.end();
        for (; it != en; ++it) {
+               if (!db.empty() && db != *it)
+                       continue;
                FileName const bibfile = buffer().getBibfilePath(*it);
                theFormats().edit(buffer(), bibfile,
                     theFormats().getFormatFromFile(bibfile));
@@ -264,6 +266,15 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
            && buffer().params().multibib == "child")
                return;
 
+       if (runparams.inDeletedInset) {
+               // We cannot strike-out bibligraphies,
+               // so we just output a note.
+               os << "\\textbf{"
+                  << buffer().B_("[BIBLIOGRAPHY DELETED!]")
+                  << "}";
+               return;
+       }
+
        string style = to_utf8(getParam("options")); // maybe empty! and with bibtotoc
        string bibtotoc;
        if (prefixIs(style, "bibtotoc")) {
@@ -361,7 +372,8 @@ void InsetBibtex::latex(otexstream & os, OutputParams const & runparams) const
                           << "\\end{btSect}\n";
                }
                // bibtotoc option
-               if (!bibtotoc.empty() && !buffer().masterParams().useBibtopic()) {
+               if (!bibtotoc.empty() && !buffer().masterParams().useBibtopic()
+                   && !buffer().masterParams().documentClass().bibInToc()) {
                        // set label for hyperref, see http://www.lyx.org/trac/ticket/6470
                        if (buffer().masterParams().pdfoptions().use_hyperref)
                                        os << "\\phantomsection";
@@ -680,7 +692,7 @@ void InsetBibtex::parseBibTeXFiles(FileNameList & checkedFiles) const
                if (ienc.empty() || ienc == "general")
                        ienc = to_ascii(params()["encoding"]);
 
-               if (!ienc.empty() && ienc != "default" && ienc != "auto" && encodings.fromLyXName(ienc))
+               if (!ienc.empty() && ienc != "auto-legacy-plain" && ienc != "auto-legacy" && encodings.fromLyXName(ienc))
                        encoding = encodings.fromLyXName(ienc)->iconvName();
                ifdocstream ifs(bibfile.toFilesystemEncoding().c_str(),
                        ios_base::in, encoding);
@@ -896,7 +908,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const
 }
 
 
-void InsetBibtex::updateBuffer(ParIterator const &, UpdateType)
+void InsetBibtex::updateBuffer(ParIterator const &, UpdateType, bool const /*deleted*/)
 {
        buffer().registerBibfiles(getBibFiles());
        // record encoding of bib files for biblatex