]> git.lyx.org Git - features.git/commitdiff
rename TextClass::ctrs_ to counters_
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 16 Aug 2007 15:26:00 +0000 (15:26 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 16 Aug 2007 15:26:00 +0000 (15:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19607 a592a061-630c-0410-9148-cb99ea01b6c8

src/TextClass.cpp
src/TextClass.h

index d83f273e9cab70d25f990fbd1aa6559e527af899..9143bf2ca202b36877293937d4bb7a8f87490dc7 100644 (file)
@@ -104,7 +104,7 @@ bool layout2layout(FileName const & filename, FileName const & tempfile)
 TextClass::TextClass(string const & fn, string const & cln,
                           string const & desc, bool texClassAvail )
        : name_(fn), latexname_(cln), description_(desc),
-         floatlist_(new FloatList), ctrs_(new Counters),
+         floatlist_(new FloatList), counters_(new Counters),
          texClassAvail_(texClassAvail)
 {
        outputType_ = LATEX;
@@ -894,8 +894,8 @@ void TextClass::readFloat(Lexer & lexrc)
                            style, name, listName, builtin);
                floatlist_->newFloat(fl);
                // each float has its own counter
-               ctrs_->newCounter(from_ascii(type), from_ascii(within), 
-                                 docstring(), docstring());
+               counters_->newCounter(from_ascii(type), from_ascii(within), 
+                                     docstring(), docstring());
        }
 
        lexrc.popTable();
@@ -940,7 +940,7 @@ void TextClass::readCounter(Lexer & lexrc)
                case CT_NAME:
                        lexrc.next();
                        name = lexrc.getDocString();
-                       if (ctrs_->hasCounter(name))
+                       if (counters_->hasCounter(name))
                                LYXERR(Debug::TCLASS) 
                                        << "Reading existing counter " 
                                        << to_utf8(name) << endl;
@@ -972,8 +972,8 @@ void TextClass::readCounter(Lexer & lexrc)
 
        // Here if have a full counter if getout == true
        if (getout)
-               ctrs_->newCounter(name, within, 
-                                 labelstring, labelstring_appendix);
+               counters_->newCounter(name, within, 
+                                     labelstring, labelstring_appendix);
 
        lexrc.popTable();
 }
@@ -1090,12 +1090,23 @@ FloatList const & TextClass::floats() const
 
 Counters & TextClass::counters() const
 {
-       return *ctrs_.get();
+       return *counters_.get();
 }
 
 InsetLayout const & TextClass::insetlayout(docstring const & name) const 
 {
-       return insetlayoutlist_[name]; 
+       docstring n = name;
+       while (!n.empty()) {
+               if (insetlayoutlist_.count(n) > 0)
+                       return insetlayoutlist_[n];
+               docstring::size_type i = n.rfind(':');
+               if (i != string::npos) // delimiter was found
+                       n = n.substr(i + 1);
+               else
+                       break;
+       }
+       static const InsetLayout empty;
+       return empty;
 }
 
 
index 8f0c8cf1cb7932ff24121ad55c8051c09dd5acf9..64716c1741e87cc4553196e705310e8149d3610a 100644 (file)
@@ -257,7 +257,7 @@ private:
        boost::shared_ptr<FloatList> floatlist_;
 
        /// Types of counters, eg. sections, eqns, figures, avail. in document class.
-       boost::shared_ptr<Counters> ctrs_;
+       boost::shared_ptr<Counters> counters_;
 
        /// Has this layout file been loaded yet?
        mutable bool loaded_;