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) std::set<docstring> & callers)
{ {
if (!hasCounter(counter)) if (!hasCounter(counter))
return from_ascii("??"); return from_ascii("#");
docstring label; docstring label;

View File

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

View File

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

View File

@ -51,8 +51,9 @@ void InsetFoot::updateLabels(ParIterator const & it)
Counters & cnts = tclass.counters(); Counters & cnts = tclass.counters();
docstring const foot = from_ascii("footnote"); docstring const foot = from_ascii("footnote");
Paragraph const & outer = it.paragraph(); Paragraph const & outer = it.paragraph();
if (!outer.layout().intitle && cnts.hasCounter(foot)) { if (!outer.layout().intitle) {
cnts.step(foot); if (cnts.hasCounter(foot))
cnts.step(foot);
// FIXME: the counter should format itself. // FIXME: the counter should format itself.
custom_label_= support::bformat(from_utf8("%1$s %2$s"), custom_label_= support::bformat(from_utf8("%1$s %2$s"),
translateIfPossible(getLayout(buffer().params()).labelstring()), translateIfPossible(getLayout(buffer().params()).labelstring()),

View File

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

View File

@ -84,6 +84,9 @@ What's new
- Fix the display of the horizontal alignment of table cells (bug 7007). - 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 * DOCUMENTATION AND LOCALIZATION