branch: Fix bug #6315: counters in insets that don't produce output have ghost values.

see r36603.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36671 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-12-03 00:47:42 +00:00
parent d17f05abbb
commit f984080b21
6 changed files with 15 additions and 9 deletions

View File

@ -425,7 +425,7 @@ docstring Counters::theCounter(docstring const & counter,
std::set<docstring> & callers)
{
if (!hasCounter(counter))
return from_ascii("??");
return from_ascii("#");
docstring label;

View File

@ -355,10 +355,10 @@ void setLabel(Buffer const & buf, ParIterator & it)
case LABEL_COUNTER:
if (layout.toclevel <= bp.secnumdepth
&& (layout.latextype != LATEX_ENVIRONMENT
|| isFirstInSequence(it.pit(), it.plist()))) {
counters.step(layout.counter);
par.params().labelString(
par.expandLabel(layout, bp));
|| isFirstInSequence(it.pit(), it.plist()))) {
if (counters.hasCounter(layout.counter))
counters.step(layout.counter);
par.params().labelString(par.expandLabel(layout, bp));
} else
par.params().labelString(docstring());
break;

View File

@ -310,8 +310,9 @@ void InsetBibitem::updateLabels(ParIterator const &)
{
Counters & counters = buffer().masterBuffer()->params().documentClass().counters();
docstring const bibitem = from_ascii("bibitem");
if (counters.hasCounter(bibitem) && getParam("label").empty()) {
counters.step(bibitem);
if (getParam("label").empty()) {
if (counters.hasCounter(bibitem))
counters.step(bibitem);
autolabel_ = counters.theCounter(bibitem);
} else {
autolabel_ = from_ascii("??");

View File

@ -51,8 +51,9 @@ void InsetFoot::updateLabels(ParIterator const & it)
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);
if (!outer.layout().intitle) {
if (cnts.hasCounter(foot))
cnts.step(foot);
// FIXME: the counter should format itself.
custom_label_= support::bformat(from_utf8("%1$s %2$s"),
translateIfPossible(getLayout(buffer().params()).labelstring()),

View File

@ -483,6 +483,7 @@ void InsetText::updateLabels(ParIterator const & it)
else {
DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
Counters const savecnt = tclass.counters();
tclass.counters() = Counters();
lyx::updateLabels(buffer(), it2);
tclass.counters() = savecnt;
}

View File

@ -84,6 +84,9 @@ What's new
- Fix the display of the horizontal alignment of table cells (bug 7007).
- Numbered items in insets that do not produce any output (e.g., Notes)
no longer have a number associated with them (bug 6315).
* DOCUMENTATION AND LOCALIZATION