mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Fix bug 409 (Add support for numbered footnotes)
* src/insets/InsetFoot.cpp (updateLabels): number the footnote if (1) the footnote counter exists and (2) it is not in a title layout * lib/layouts/stdcounters.inc: add a footnote counter. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19524 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eca0637e51
commit
b0d1a6b717
@ -80,3 +80,7 @@ End
|
||||
Counter
|
||||
Name listing
|
||||
End
|
||||
|
||||
Counter
|
||||
Name footnote
|
||||
End
|
||||
|
@ -10,17 +10,22 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#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<docstring>(cnts.value(foot))));
|
||||
|
||||
}
|
||||
InsetCollapsable::updateLabels(buf, it);
|
||||
}
|
||||
|
||||
int InsetFoot::latex(Buffer const & buf, odocstream & os,
|
||||
OutputParams const & runparams_in) const
|
||||
{
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user