]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCitation.cpp
Replace a half-baked attempt to remove \lyxdot from the directory part of
[lyx.git] / src / insets / InsetCitation.cpp
index 7780f24a8d09c721b3cede8b6ac4fd1787ad68b9..c1a5145f0e70f5e20623fde57d5f07075addf337 100644 (file)
@@ -19,6 +19,8 @@
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "DispatchResult.h"
+#include "FuncCode.h"
+#include "FuncRequest.h"
 #include "LaTeXFeatures.h"
 #include "output_xhtml.h"
 #include "ParIterator.h"
@@ -99,6 +101,14 @@ bool InsetCitation::isCompatibleCommand(string const & cmd)
 }
 
 
+void InsetCitation::doDispatch(Cursor & cur, FuncRequest & cmd)
+{
+       if (cmd.action() == LFUN_INSET_MODIFY)
+               cache.recalculate = true;
+       InsetCommand::doDispatch(cur, cmd);
+}
+
+
 docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
 {
        Buffer const & buf = bv.buffer();
@@ -459,11 +469,10 @@ docstring InsetCitation::screenLabel() const
 
 void InsetCitation::updateBuffer(ParIterator const &, UpdateType)
 {
-       CiteEngine const engine = buffer().params().citeEngine();
-       if (cache.params == params() && cache.engine == engine)
+       if (!cache.recalculate && buffer().citeLabelsValid())
                return;
 
-       // The label has changed, so we have to re-create it.
+       // The label may have changed, so we have to re-create it.
        docstring const glabel = generateLabel();
 
        unsigned int const maxLabelChars = 45;
@@ -474,8 +483,7 @@ void InsetCitation::updateBuffer(ParIterator const &, UpdateType)
                label += "...";
        }
 
-       cache.engine  = engine;
-       cache.params = params();
+       cache.recalculate = false;
        cache.generated_label = glabel;
        cache.screen_label = label;
 }
@@ -603,9 +611,9 @@ void InsetCitation::validate(LaTeXFeatures & features) const
 }
 
 
-docstring InsetCitation::contextMenuName() const
+string InsetCitation::contextMenuName() const
 {
-       return from_ascii("context-citation");
+       return "context-citation";
 }