Author: vfr Date: Fri Dec 3 01:47:42 2010 New Revision: 36671 URL: http://www.lyx.org/trac/changeset/36671
Log: branch: Fix bug #6315: counters in insets that don't produce output have ghost values. see r36603. Modified: lyx-devel/branches/BRANCH_1_6_X/src/Counters.cpp lyx-devel/branches/BRANCH_1_6_X/src/buffer_funcs.cpp lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetBibitem.cpp lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetFoot.cpp lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetText.cpp lyx-devel/branches/BRANCH_1_6_X/status.16x Modified: lyx-devel/branches/BRANCH_1_6_X/src/Counters.cpp ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/src/Counters.cpp Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/src/Counters.cpp Fri Dec 3 01:47:42 2010 (r36671) @@ -425,7 +425,7 @@ std::set<docstring> & callers) { if (!hasCounter(counter)) - return from_ascii("??"); + return from_ascii("#"); docstring label; Modified: lyx-devel/branches/BRANCH_1_6_X/src/buffer_funcs.cpp ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/src/buffer_funcs.cpp Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/src/buffer_funcs.cpp Fri Dec 3 01:47:42 2010 (r36671) @@ -355,10 +355,10 @@ 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; Modified: lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetBibitem.cpp ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetBibitem.cpp Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetBibitem.cpp Fri Dec 3 01:47:42 2010 (r36671) @@ -310,8 +310,9 @@ { 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("??"); Modified: lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetFoot.cpp ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetFoot.cpp Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetFoot.cpp Fri Dec 3 01:47:42 2010 (r36671) @@ -51,8 +51,9 @@ 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()), Modified: lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetText.cpp ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetText.cpp Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/src/insets/InsetText.cpp Fri Dec 3 01:47:42 2010 (r36671) @@ -483,6 +483,7 @@ else { DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass(); Counters const savecnt = tclass.counters(); + tclass.counters() = Counters(); lyx::updateLabels(buffer(), it2); tclass.counters() = savecnt; } Modified: lyx-devel/branches/BRANCH_1_6_X/status.16x ============================================================================== --- lyx-devel/branches/BRANCH_1_6_X/status.16x Thu Dec 2 23:11:52 2010 (r36670) +++ lyx-devel/branches/BRANCH_1_6_X/status.16x Fri Dec 3 01:47:42 2010 (r36671) @@ -84,6 +84,9 @@ - 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