From 57d8b059e0c5b2c14247d3eeb9ada771fe5a502d Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sat, 9 Feb 2013 11:09:56 -0500 Subject: [PATCH] Remove references to Counter LabelType from source code. The intention is to use Static in its place, and we now expand the label for these, as well. --- src/Buffer.cpp | 31 +++++++++++++++++-------------- src/Layout.cpp | 5 ----- src/LayoutEnums.h | 2 -- src/Paragraph.cpp | 3 +-- src/Text3.cpp | 2 +- src/frontends/qt4/GuiDocument.cpp | 2 +- 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 530200caa0..9299d47802 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -4364,17 +4364,6 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const } switch(layout.labeltype) { - case LABEL_COUNTER: - if (layout.toclevel <= bp.secnumdepth - && (layout.latextype != LATEX_ENVIRONMENT - || it.text()->isFirstInSequence(it.pit()))) { - if (counters.hasCounter(layout.counter)) - counters.step(layout.counter, utype); - par.params().labelString(par.expandLabel(layout, bp)); - } else - par.params().labelString(docstring()); - break; - case LABEL_ITEMIZE: { // At some point of time we should do something more // clever here, like: @@ -4454,13 +4443,27 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const par.params().labelString(docstring()); break; - case LABEL_MANUAL: case LABEL_TOP_ENVIRONMENT: case LABEL_CENTERED_TOP_ENVIRONMENT: - case LABEL_STATIC: + case LABEL_STATIC: { + docstring const & lcounter = layout.counter; + if (!lcounter.empty()) { + if (layout.toclevel <= bp.secnumdepth + && (layout.latextype != LATEX_ENVIRONMENT + || it.text()->isFirstInSequence(it.pit()))) { + if (counters.hasCounter(lcounter)) + counters.step(lcounter, utype); + par.params().labelString(par.expandLabel(layout, bp)); + } else + par.params().labelString(docstring()); + } else + par.params().labelString(par.expandLabel(layout, bp)); + break; + } + + case LABEL_MANUAL: case LABEL_BIBLIO: par.params().labelString(par.expandLabel(layout, bp)); - break; } } diff --git a/src/Layout.cpp b/src/Layout.cpp index 78485d4996..52504ae22a 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -688,7 +688,6 @@ void Layout::readLabelType(Lexer & lex) LA_CENTERED_TOP_ENVIRONMENT, LA_STATIC, LA_SENSITIVE, - LA_COUNTER, LA_ENUMERATE, LA_ITEMIZE, LA_BIBLIO @@ -698,7 +697,6 @@ void Layout::readLabelType(Lexer & lex) LexerKeyword labelTypeTags[] = { { "bibliography", LA_BIBLIO }, { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT }, - { "counter", LA_COUNTER }, { "enumerate", LA_ENUMERATE }, { "itemize", LA_ITEMIZE }, { "manual", LA_MANUAL }, @@ -735,9 +733,6 @@ void Layout::readLabelType(Lexer & lex) case LA_SENSITIVE: labeltype = LABEL_SENSITIVE; break; - case LA_COUNTER: - labeltype = LABEL_COUNTER; - break; case LA_ENUMERATE: labeltype = LABEL_ENUMERATE; break; diff --git a/src/LayoutEnums.h b/src/LayoutEnums.h index 5c02d8ed0a..efdd5f546d 100644 --- a/src/LayoutEnums.h +++ b/src/LayoutEnums.h @@ -123,8 +123,6 @@ enum LabelType { /// LABEL_SENSITIVE, /// - LABEL_COUNTER, - /// LABEL_ENUMERATE, /// LABEL_ITEMIZE diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index ea2c8366a0..d025a80b3f 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2084,8 +2084,7 @@ docstring Paragraph::expandParagraphLabel(Layout const & layout, bool const in_appendix = process_appendix && d->params_.appendix(); docstring fmt = translateIfPossible(layout.labelstring(in_appendix), lang); - if (fmt.empty() && layout.labeltype == LABEL_COUNTER - && !layout.counter.empty()) + if (fmt.empty() && !layout.counter.empty()) return tclass.counters().theCounter(layout.counter, lang); // handle 'inherited level parts' in 'fmt', diff --git a/src/Text3.cpp b/src/Text3.cpp index 2893e080f9..fad451c728 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1097,7 +1097,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) /* Paragraph & par = pars_[cur.pit()]; if (inset->lyxCode() == LABEL_CODE - && par.layout().labeltype == LABEL_COUNTER) { + && !par.layout().counter.empty() { // Go to the end of the paragraph // Warning: Because of Change-Tracking, the last // position is 'size()' and not 'size()-1': diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 16242c0974..399d88d7dc 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -2448,7 +2448,7 @@ void GuiDocument::updateNumbering() DocumentClass::const_iterator len = tclass.end(); for (; lit != len; ++lit) { int const toclevel = lit->toclevel; - if (toclevel != Layout::NOT_IN_TOC && lit->labeltype == LABEL_COUNTER) { + if (toclevel != Layout::NOT_IN_TOC && !lit->counter.empty()) { item = new QTreeWidgetItem(numberingModule->tocTW); item->setText(0, toqstr(translateIfPossible(lit->name()))); item->setText(1, (toclevel <= depth) ? yes : no); -- 2.39.2