]> git.lyx.org Git - features.git/commitdiff
When a counter is stepped, reset recursively all slaves
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 11 Apr 2016 10:00:19 +0000 (12:00 +0200)
committerRichard Heck <rgheck@lyx.org>
Sat, 28 May 2016 21:41:20 +0000 (17:41 -0400)
Fixes bug #10063.

src/Counters.cpp
src/Counters.h
status.22x [new file with mode: 0644]

index fe2604044994b1f075f438d636f1353e66be0905..0b17aa1b9b84eac8b6d7f94d16cf5bdbf71af9bc 100644 (file)
@@ -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);
 }
 
 
index ce122c4140ebbf71216cee445dfecc20457b3d58..4ba0d004846d2f0f8361e10d9286d5f0754b03f4 100644 (file)
@@ -128,10 +128,10 @@ public:
        void addto(docstring const & ctr, int val);
        ///
        int value(docstring const & ctr) const;
-       /// Increment by one counter named by arg, and zeroes slave
+       /// Reset recursively all the counters that are slaves of the one named by \c ctr.
+       void resetSlaves(docstring const & ctr);
+       /// Increment by one counter named by \c ctr, and zeroes slave
        /// counter(s) for which it is the master.
-       /// Sub-slaves are not zeroed! That happens at slave's first 
-       /// step 0->1. Seems to be sufficient.
        /// \param utype determines whether we track the counters.
        void step(docstring const & ctr, UpdateType utype);
        /// Reset all counters, and all the internal data structures
diff --git a/status.22x b/status.22x
new file mode 100644 (file)
index 0000000..2331993
--- /dev/null
@@ -0,0 +1,71 @@
+-*- text -*-
+
+This file describes what has been done in the preparation of LyX 2.2.1.
+All comments are welcome.
+
+We try to group things by topic and in decreasing order of importance.
+Please feel free to re-arrange if that seems like a good idea.
+
+What's new
+==========
+
+** Updates:
+***********
+
+* DOCUMENT INPUT/OUTPUT
+
+
+
+* TEX2LYX IMPROVEMENTS
+
+
+
+* USER INTERFACE
+
+* DOCUMENTATION AND LOCALIZATION
+
+
+
+* BUILD/INSTALLATION
+
+
+
+
+** Bug fixes:
+*************
+
+* DOCUMENT INPUT/OUTPUT
+
+
+
+* LYX2LYX
+
+
+
+* USER INTERFACE
+
+- When a counter is stepped, reset recursively all subcounters (bug #10063).
+
+
+* INTERNALS
+
+
+
+* DOCUMENTATION AND LOCALIZATION
+
+
+
+* LYXHTML
+
+
+
+* TEX2LYX
+
+
+
+* ADVANCED FIND AND REPLACE
+
+
+
+* BUILD/INSTALLATION
+