]> git.lyx.org Git - lyx.git/commitdiff
Remove references to Counter LabelType from source code. The
authorRichard Heck <rgheck@lyx.org>
Sat, 9 Feb 2013 16:09:56 +0000 (11:09 -0500)
committerRichard Heck <rgheck@lyx.org>
Sat, 9 Feb 2013 18:44:05 +0000 (13:44 -0500)
intention is to use Static in its place, and we now expand the
label for these, as well.

src/Buffer.cpp
src/Layout.cpp
src/LayoutEnums.h
src/Paragraph.cpp
src/Text3.cpp
src/frontends/qt4/GuiDocument.cpp

index 530200caa08e5290366927f0dc16c4a3f81b978f..9299d478027139e75a71637ca96b48ed2ea5bd12 100644 (file)
@@ -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;
        }
 }
 
index 78485d49969a235e676a5e2d6a39372e0221efbe..52504ae22ac72e78629e51ebc5c4c47d5ba78c31 100644 (file)
@@ -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;
index 5c02d8ed0a6b76d19aa2f33cbe6483dcd98e6a64..efdd5f546df2f5c141e62dfd5debe1dfa822261c 100644 (file)
@@ -123,8 +123,6 @@ enum LabelType {
        ///
        LABEL_SENSITIVE,
        ///
-       LABEL_COUNTER,
-       ///
        LABEL_ENUMERATE,
        ///
        LABEL_ITEMIZE
index ea2c8366a06755a8e818d9654c6d8cfa64d7d673..d025a80b3ff1f02559a915845cd5b250c867f265 100644 (file)
@@ -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',
index 2893e080f92800e49360e3af0bf3b8078cacb8b3..fad451c7288007d612f4c4bca479e7e5b328a7b8 100644 (file)
@@ -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':
index 16242c09745e3a9cff3d42a7235277a3afa07809..399d88d7dc3c0918855a2110b2b067da656087dc 100644 (file)
@@ -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);