]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetbib.C
pos=string::npos for regex not found, use handcoded transform in lstring.C, fix the...
[lyx.git] / src / insets / insetbib.C
index 19f9100170538b30244b03223f433ddd76ca6006..09040ef2d107d7c09ffa05954f9174eebe684b83 100644 (file)
@@ -152,7 +152,7 @@ InsetCitation::~InsetCitation()
 void InsetCitation::Edit(int, int)
 {
        if(current_view->buffer()->isReadonly())
-               WarnReadonly();
+               WarnReadonly(current_view->buffer()->fileName());
 
        if (!citation_form) {
                citation_form = create_form_citation_form();
@@ -257,7 +257,7 @@ string InsetBibKey::getScreenLabel() const
 void InsetBibKey::Edit(int, int)
 {
        if(current_view->buffer()->isReadonly())
-               WarnReadonly();
+               WarnReadonly(current_view->buffer()->fileName());
        
        if (!bibitem_form) {
                bibitem_form = create_form_bibitem_form();
@@ -350,7 +350,7 @@ int InsetBibtex::Latex(string & file, signed char /*fragile*/)
 
 
 // This method returns a comma separated list of Bibtex entries
-string InsetBibtex::getKeys()
+string InsetBibtex::getKeys(char delim)
 {
        // This hack is copied from InsetBibtex::Latex.
        // Is it still needed? Probably yes.
@@ -364,7 +364,7 @@ string InsetBibtex::getKeys()
        while(!tmp.empty()) {
                string fil = findtexfile(ChangeExtension(tmp, "bib", false),
                                         "bib");
-               lyxerr << "Bibfile: " << fil << endl;
+               lyxerr[Debug::LATEX] << "Bibfile: " << fil << endl;
                // If we didn't find a matching file name just fail silently
                if (!fil.empty()) {
                        // This is a _very_ simple parser for Bibtex database
@@ -374,6 +374,7 @@ string InsetBibtex::getKeys()
                        ifstream ifs(fil.c_str());
                        string linebuf;
                        while (getline(ifs, linebuf)) {
+                               linebuf = frontStrip(linebuf);
                                if (prefixIs(linebuf, "@")) {
                                        linebuf = subst(linebuf, '{', '(');
                                        linebuf = split(linebuf, tmp, '(');
@@ -382,9 +383,10 @@ string InsetBibtex::getKeys()
                                            && !prefixIs(tmp, "@preamble")) {
                                                linebuf = split(linebuf,
                                                                tmp, ',');
+                                               tmp = frontStrip(strip(tmp));
                                                if (!tmp.empty()) {
-                                                       keys += strip(tmp);
-                                                       keys += ", ";
+                                                       keys += tmp;
+                                                       keys += delim;
                                                }
                                        }
                                }