diff --git a/lib/layouts/stdcounters.inc b/lib/layouts/stdcounters.inc index e3a14768ee..355eabbf97 100644 --- a/lib/layouts/stdcounters.inc +++ b/lib/layouts/stdcounters.inc @@ -80,3 +80,7 @@ End Counter Name listing End + +Counter + Name footnote +End diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 5bd2a9d044..a2b6cbf26c 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -10,17 +10,22 @@ */ #include +#include "debug.h" #include "InsetFoot.h" #include "Buffer.h" +#include "BufferParams.h" +#include "Counters.h" #include "gettext.h" // the following is needed just to get the layout of the enclosing // paragraph. This seems a bit too much to me (JMarc) #include "OutputParams.h" +#include "ParIterator.h" +#include "support/convert.h" #include "support/std_ostream.h" - +#include "support/lstrings.h" namespace lyx { @@ -53,6 +58,23 @@ docstring const InsetFoot::editMessage() const } +void InsetFoot::updateLabels(Buffer const & buf, ParIterator const & it) +{ + TextClass const & tclass = buf.params().getTextClass(); + Counters & cnts = tclass.counters(); + docstring const & foot = from_ascii("footnote"); + Paragraph const & outer = it.paragraph(); + if (!outer.layout()->intitle && cnts.hasCounter(foot)) { + cnts.step(foot); + //FIXME: the counter should format itself. + setLabel(support::bformat(from_ascii("%1$s %2$s"), + getLayout(buf.params()).labelstring, + convert(cnts.value(foot)))); + + } + InsetCollapsable::updateLabels(buf, it); +} + int InsetFoot::latex(Buffer const & buf, odocstream & os, OutputParams const & runparams_in) const { diff --git a/src/insets/InsetFoot.h b/src/insets/InsetFoot.h index f10c11097d..1c7b748101 100644 --- a/src/insets/InsetFoot.h +++ b/src/insets/InsetFoot.h @@ -40,6 +40,9 @@ public: OutputParams const &) const; /// virtual docstring const editMessage() const; + /// Update the counters of this inset and of its contents + void updateLabels(Buffer const &, ParIterator const &); + protected: InsetFoot(InsetFoot const &); private: