mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
We already allowed a counter declaraton for flex insets. We just
didn't do anything with it. So let's do something with it. Fixes bug #8470.
This commit is contained in:
parent
ecb3b7b25c
commit
a9614f15d2
@ -6,10 +6,15 @@
|
|||||||
|
|
||||||
Format 45
|
Format 45
|
||||||
|
|
||||||
|
Counter endnotes
|
||||||
|
PrettyFormat "Endnote ##"
|
||||||
|
End
|
||||||
|
|
||||||
InsetLayout Flex:Endnote
|
InsetLayout Flex:Endnote
|
||||||
LyXType custom
|
LyXType custom
|
||||||
LatexName endnote
|
LatexName endnote
|
||||||
LatexType command
|
LatexType command
|
||||||
|
Counter endnotes
|
||||||
Decoration classic
|
Decoration classic
|
||||||
Font
|
Font
|
||||||
Size Small
|
Size Small
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
#include "Cursor.h"
|
#include "Cursor.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
|
#include "Language.h"
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
|
#include "ParIterator.h"
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
|
|
||||||
#include "support/gettext.h"
|
#include "support/gettext.h"
|
||||||
@ -124,4 +126,26 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype)
|
||||||
|
{
|
||||||
|
BufferParams const & bp = buffer().masterBuffer()->params();
|
||||||
|
Counters & cnts = bp.documentClass().counters();
|
||||||
|
if (utype == OutputUpdate) {
|
||||||
|
// the counter is local to this inset
|
||||||
|
cnts.saveLastCounter();
|
||||||
|
}
|
||||||
|
InsetLayout const & il = getLayout();
|
||||||
|
docstring const & count = il.counter();
|
||||||
|
docstring custom_label = translateIfPossible(il.labelstring());
|
||||||
|
if (cnts.hasCounter(count))
|
||||||
|
cnts.step(count, utype);
|
||||||
|
custom_label += ' ' +
|
||||||
|
cnts.theCounter(count, it.paragraph().getParLanguage(bp)->code());
|
||||||
|
setLabel(custom_label);
|
||||||
|
InsetCollapsable::updateBuffer(it, utype);
|
||||||
|
if (utype == OutputUpdate)
|
||||||
|
cnts.restoreLastCounter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -45,6 +45,8 @@ public:
|
|||||||
FuncStatus &) const;
|
FuncStatus &) const;
|
||||||
///
|
///
|
||||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||||
|
///
|
||||||
|
void updateBuffer(ParIterator const & it, UpdateType utype);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
|
@ -48,10 +48,10 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype)
|
|||||||
if (!outer.layout().intitle) {
|
if (!outer.layout().intitle) {
|
||||||
InsetLayout const & il = getLayout();
|
InsetLayout const & il = getLayout();
|
||||||
docstring const & count = il.counter();
|
docstring const & count = il.counter();
|
||||||
custom_label_ = translateIfPossible(il.labelstring()) + ' ';
|
custom_label_ = translateIfPossible(il.labelstring());
|
||||||
if (cnts.hasCounter(count))
|
if (cnts.hasCounter(count))
|
||||||
cnts.step(count, utype);
|
cnts.step(count, utype);
|
||||||
custom_label_ +=
|
custom_label_ += ' ' +
|
||||||
cnts.theCounter(count, outer.getParLanguage(bp)->code());
|
cnts.theCounter(count, outer.getParLanguage(bp)->code());
|
||||||
setLabel(custom_label_);
|
setLabel(custom_label_);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user