]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Kill indexing into the list of layouts.
[lyx.git] / src / TextClass.cpp
index aa2f307330739b6dc00db936ac672c0514cdaf4f..dd94d3aa9a33aba4e1e7983f075832c19272cfab 100644 (file)
@@ -531,8 +531,11 @@ bool TextClass::read(FileName const & filename, ReadType rt)
 
        min_toclevel_ = Layout::NOT_IN_TOC;
        max_toclevel_ = Layout::NOT_IN_TOC;
-       for (size_t i = 0; i != layoutCount(); ++i) {
-               int const toclevel = layout(i)->toclevel;
+       DocumentClass::const_iterator lit = begin();
+       DocumentClass::const_iterator len = end();
+       for (; lit != len; ++lit) {
+               Layout const & lt = **lit;
+               int const toclevel = lt.toclevel;
                if (toclevel != Layout::NOT_IN_TOC) {
                        if (min_toclevel_ == Layout::NOT_IN_TOC)
                                min_toclevel_ = toclevel;
@@ -763,8 +766,12 @@ void TextClass::readFloat(Lexer & lexrc)
                            style, name, listName, builtin);
                floatlist_->newFloat(fl);
                // each float has its own counter
-               counters_->newCounter(from_ascii(type), from_ascii(within), 
+               counters_->newCounter(from_ascii(type), from_ascii(within),
                                      docstring(), docstring());
+               // also define sub-float counters
+               docstring const subtype = "sub-" + from_ascii(type);
+               counters_->newCounter(subtype, from_ascii(type),
+                                     "\\alph{" + subtype + "}", docstring());
        }
 
        lexrc.popTable();