]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
Cocoa based Qt-4.6 needs to paint every character separately to match metrics computa...
[lyx.git] / src / insets / InsetBibitem.cpp
index 630f4add135c4c1fb40414fc517f6bbc9d9a435f..d3a10ae63c645bb653a161109434dc75047e42ac 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "BiblioInfo.h"
 #include "Buffer.h"
+#include "Cursor.h"
 #include "buffer_funcs.h"
 #include "BufferParams.h"
 #include "BufferView.h"
@@ -121,6 +122,9 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
                        cur.noScreenUpdate();
                        break;
                }
+
+               cur.recordUndo();
+
                docstring const & old_key = params()["key"];
                docstring const & old_label = params()["label"];
                docstring label = p["label"];
@@ -307,7 +311,7 @@ docstring bibitemWidest(Buffer const & buffer, OutputParams const & runparams)
 }
 
 
-void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it) const
+void InsetBibitem::collectBibKeys(InsetIterator const & it) const
 {
        docstring const key = getParam("key");
        BibTeXInfo keyvalmap(false);
@@ -315,7 +319,7 @@ void InsetBibitem::fillWithBibKeys(BiblioInfo & keys, InsetIterator const & it)
        DocIterator doc_it(it); 
        doc_it.forwardPos();
        keyvalmap[from_ascii("ref")] = doc_it.paragraph().asString();
-       keys[key] = keyvalmap;
+       buffer().addBibTeXInfo(key, keyvalmap);
 }
 
 
@@ -325,8 +329,9 @@ void InsetBibitem::updateBuffer(ParIterator const & it, UpdateType utype)
        BufferParams const & bp = buffer().masterBuffer()->params();
        Counters & counters = bp.documentClass().counters();
        docstring const bibitem = from_ascii("bibitem");
-       if (counters.hasCounter(bibitem) && getParam("label").empty()) {
-               counters.step(bibitem, utype);
+       if (getParam("label").empty()) {
+               if (counters.hasCounter(bibitem))
+                       counters.step(bibitem, utype);
                string const & lang = it.paragraph().getParLanguage(bp)->code();
                autolabel_ = counters.theCounter(bibitem, lang);
        } else {