]> git.lyx.org Git - features.git/commitdiff
Some cleanup of the counters code.
authorRichard Heck <rgheck@comcast.net>
Thu, 2 Dec 2010 20:22:10 +0000 (20:22 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 2 Dec 2010 20:22:10 +0000 (20:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36663 a592a061-630c-0410-9148-cb99ea01b6c8

src/Counters.cpp
src/Counters.h

index d75243e703773e2cfb7b69a01f24e75e9ea3eaf2..c4ec31b017eb5db7c7d19526ee8cf859110b10a1 100644 (file)
@@ -157,6 +157,13 @@ Counter::StringMap & Counter::flatLabelStrings(bool in_appendix) const
 }
 
 
+Counters::Counters() : appendix_(false), subfloat_(false)
+{
+       layout_stack_.push_back(0);
+       counter_stack_.push_back(0);
+}
+
+
 void Counters::newCounter(docstring const & newc,
                          docstring const & masterc, 
                          docstring const & ls,
@@ -269,6 +276,7 @@ void Counters::reset()
                it->second.reset();
        counter_stack_.clear();
        counter_stack_.push_back(from_ascii(""));
+       layout_stack_.clear();
        layout_stack_.push_back(0);
 }
 
@@ -598,14 +606,7 @@ void Counters::setActiveLayout(Layout const & lay)
 
 void Counters::beginEnvironment()
 {
-       docstring cnt = counter_stack_.back();
-       counter_stack_.push_back(cnt);
-       deque<docstring>::const_iterator it = counter_stack_.begin();
-       deque<docstring>::const_iterator en = counter_stack_.end();
-//     docstring d;
-//     for (; it != en; ++it)
-//             d += " --> " + *it;
-//     LYXERR0(counter_stack_.size() << ": " << d);
+       counter_stack_.push_back(counter_stack_.back());
 }
 
 
@@ -613,12 +614,6 @@ void Counters::endEnvironment()
 {
        LASSERT(!counter_stack_.empty(), return);
        counter_stack_.pop_back();
-       deque<docstring>::const_iterator it = counter_stack_.begin();
-       deque<docstring>::const_iterator en = counter_stack_.end();
-//     docstring d;
-//     for (; it != en; ++it)
-//             d += " --> " + *it;
-//     LYXERR0(counter_stack_.size() << ": " << d);
 }
 
 
index 509733f4662f8c3f6fa087ffffcaddbcc3e132e0..386602a0bc51d0fa51e3088ed0d481f44ec3c1b1 100644 (file)
@@ -99,7 +99,7 @@ private:
 class Counters {
 public:
        ///
-       Counters() : appendix_(false), subfloat_(false) {}
+       Counters();
        /// Add new counter newc having masterc as its master, 
        /// ls as its label, and lsa as its appendix label.
        void newCounter(docstring const & newc,
@@ -174,7 +174,7 @@ public:
        /// Call this when entering things like footnotes, where there is now
        /// no "last layout" and we want to restore the "last layout" on exit.
        void clearLastLayout() { layout_stack_.push_back(0); }
-       /// Call then when existing things like footnotes.
+       /// Call this when existing things like footnotes.
        void restoreLastLayout() { layout_stack_.pop_back(); }
        /// 
        void saveLastCounter()