X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCounters.cpp;h=75c891128efa90777a0ba9a04a7164e5e14232aa;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=fe2604044994b1f075f438d636f1353e66be0905;hpb=d3b5260f45d8b65c972f89819113723de96ed5ed;p=lyx.git diff --git a/src/Counters.cpp b/src/Counters.cpp index fe26040449..75c891128e 100644 --- a/src/Counters.cpp +++ b/src/Counters.cpp @@ -265,6 +265,31 @@ 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::stepMaster(docstring const & ctr, UpdateType utype) +{ + CounterList::iterator it = counterList_.find(ctr); + if (it == counterList_.end()) { + lyxerr << "step: Counter does not exist: " + << to_utf8(ctr) << endl; + return; + } + step(it->second.master(), utype); +} + + void Counters::step(docstring const & ctr, UpdateType utype) { CounterList::iterator it = counterList_.find(ctr); @@ -280,13 +305,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); }