X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCounters.cpp;h=0b17aa1b9b84eac8b6d7f94d16cf5bdbf71af9bc;hb=57b69a5efddf9f3c148007322f00dad6c253a2ed;hp=79fe76fea9afa0d3d588c3858296643f19f300c6;hpb=edddb47bae9a29f678e083807fc12e03135f5065;p=lyx.git diff --git a/src/Counters.cpp b/src/Counters.cpp index 79fe76fea9..0b17aa1b9b 100644 --- a/src/Counters.cpp +++ b/src/Counters.cpp @@ -265,6 +265,19 @@ int Counters::value(docstring const & ctr) const } +void Counters::resetSlaves(docstring const & ctr) +{ + CounterList::iterator it = counterList_.begin(); + CounterList::iterator const end = counterList_.end(); + for (; it != end; ++it) { + if (it->second.master() == ctr) { + it->second.reset(); + resetSlaves(it->first); + } + } +} + + void Counters::step(docstring const & ctr, UpdateType utype) { CounterList::iterator it = counterList_.find(ctr); @@ -280,13 +293,8 @@ void Counters::step(docstring const & ctr, UpdateType utype) counter_stack_.pop_back(); counter_stack_.push_back(ctr); } - it = counterList_.begin(); - CounterList::iterator const end = counterList_.end(); - for (; it != end; ++it) { - if (it->second.master() == ctr) { - it->second.reset(); - } - } + + resetSlaves(ctr); } @@ -400,7 +408,7 @@ docstring const romanCounter(int const n) "DC", "DCC", "DCCC", "CM" }; - if (n > 1000 || n < 1) + if (n >= 1000 || n < 1) return from_ascii("??"); int val = n; @@ -525,8 +533,6 @@ docstring Counters::flattenLabelString(docstring const & counter, string const & lang, vector & callers) const { - docstring label; - if (find(callers.begin(), callers.end(), counter) != callers.end()) { // recursion detected lyxerr << "Warning: Recursion in label for counter `"