Some cleanup of the counters code.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36663 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-12-02 20:22:10 +00:00
parent 0464d83ce0
commit 09466ad2db
2 changed files with 11 additions and 16 deletions

View 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);
}

View 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()