[LyX/master] StepMasterCounter --> StepParentCounter

Richard Kimberly Heck rikiheck at lyx.org
Mon Nov 2 22:08:19 UTC 2020


commit 060c3de2f08b21fd2695a1b445d0b8f3d0ff9186
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Mon Nov 2 17:36:58 2020 -0500

    StepMasterCounter --> StepParentCounter
---
 lib/doc/Customization.lyx    |   51 +++++++++++++++++++++++++++++++++++++-----
 lib/scripts/layout2layout.py |   11 ++++++++-
 src/Buffer.cpp               |    4 +-
 src/Layout.cpp               |   12 +++++-----
 src/Layout.h                 |    4 +-
 src/TextClass.cpp            |    2 +-
 6 files changed, 66 insertions(+), 18 deletions(-)

diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index 357845a..8f2e6dc 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 598
+\lyxformat 599
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -17239,7 +17239,13 @@ status collapsed
 status collapsed
 
 \begin_layout Plain Layout
-StepMasterCounter
+Step
+\change_deleted 731793113 1604355211
+Master
+\change_inserted 731793113 1604355212
+Parent
+\change_unchanged
+Counter
 \end_layout
 
 \end_inset
@@ -17266,8 +17272,13 @@ status collapsed
 
 \end_inset
 
-] Steps the master counter of a given counter at the beginning of a new
- sequence of layouts.
+] Steps the 
+\change_deleted 731793113 1604355214
+master
+\change_inserted 731793113 1604355216
+parent
+\change_unchanged
+ counter of a given counter at the beginning of a new sequence of layouts.
  This is currently only useful when 
 \begin_inset Flex Code
 status collapsed
@@ -21991,6 +22002,8 @@ textbf{Sourrounding text
 \backslash
 myinset{content}\SpecialChar ldots
 }
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -22021,6 +22034,8 @@ myinset{
 \backslash
 emph{content}}\SpecialChar ldots
 }
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -22035,6 +22050,8 @@ status collapsed
 
 \backslash
 emph
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -22058,6 +22075,8 @@ status collapsed
 
 \change_inserted -712698321 1597733292
 0
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -22505,12 +22524,24 @@ hebrew
 \end_deeper
 \begin_layout Standard
 If LabelString is not defined, a default value is constructed as follows:
- if the counter has a master counter 
+ if the counter has a 
+\change_deleted 731793113 1604355218
+master
+\change_inserted 731793113 1604355221
+parent
+\change_unchanged
+ counter 
 \begin_inset Flex Code
 status collapsed
 
 \begin_layout Plain Layout
+
+\change_deleted 731793113 1604355223
 master
+\change_inserted 731793113 1604355226
+parent
+\change_unchanged
+
 \end_layout
 
 \end_inset
@@ -22536,7 +22567,13 @@ status collapsed
 \begin_layout Plain Layout
 
 \backslash
-themaster.
+the
+\change_inserted 731793113 1604355228
+parent
+\change_deleted 731793113 1604355230
+master
+\change_unchanged
+.
 \backslash
 arabic{counter}
 \end_layout
@@ -28440,6 +28477,8 @@ status collapsed
 
 \change_inserted 1075283030 1598469476
 para
+\change_unchanged
+
 \end_layout
 
 \end_inset
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 5c6de88..29159b0 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 86
+currentFormat = 87
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -296,6 +296,8 @@ currentFormat = 86
 # Incremented to format 86, 20 October 2020 by tcuvelier
 # New tag DocBookSection.
 
+# Incremeted to format 87, 2 November 2020 by rkh
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -545,6 +547,13 @@ def convert(lines, end_format):
                 i += 1
             continue
 
+        if format == 86:
+            if lines[i].lstrip().lower().startswith(b"stepmastercounter"):
+                pattern = re.compile(b"stepmastercounter", re.IGNORECASE)
+                lines[i] = pattern.sub(b"StepParentCounter", lines[i])
+            i += 1
+            continue
+
         if 82 <= format <= 85:
             # nothing to do.
             i += 1
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 10a38f6..a6afadf 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -5153,8 +5153,8 @@ void Buffer::Impl::setLabel(ParIterator & it, UpdateType utype) const
 		}
 
 		if (needEnumCounterReset(it)) {
-			// Increase the master counter?
-			if (layout.stepmastercounter)
+			// Increase the parent counter?
+			if (layout.stepparentcounter)
 				counters.stepParent(enumcounter, utype);
 			// Maybe we have to reset the enumeration counter.
 			if (!layout.resumecounter)
diff --git a/src/Layout.cpp b/src/Layout.cpp
index ac8fd58..ff123dc 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -138,7 +138,7 @@ enum LayoutTags {
 	LT_REFPREFIX,
 	LT_RESETARGS,
 	LT_RESUMECOUNTER,
-	LT_STEPMASTERCOUNTER,
+	LT_STEPPARENTCOUNTER,
 	LT_RIGHTDELIM,
 	LT_FORCELOCAL,
 	LT_TOGGLE_INDENT,
@@ -156,7 +156,7 @@ Layout::Layout()
 	margintype = MARGIN_STATIC;
 	latextype = LATEX_PARAGRAPH;
 	resumecounter = false;
-	stepmastercounter = false;
+	stepparentcounter = false;
 	intitle = false;
 	inpreamble = false;
 	needprotect = false;
@@ -327,7 +327,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
 		{ "rightmargin",    LT_RIGHTMARGIN },
 		{ "spacing",        LT_SPACING },
 		{ "spellcheck",     LT_SPELLCHECK },
-		{ "stepmastercounter",  LT_STEPMASTERCOUNTER },
+		{ "stepparentcounter",  LT_STEPPARENTCOUNTER },
 		{ "textfont",       LT_TEXTFONT },
 		{ "toclevel",       LT_TOCLEVEL },
 		{ "toggleindent",   LT_TOGGLE_INDENT },
@@ -447,8 +447,8 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
 			lex >> resumecounter;
 			break;
 
-		case LT_STEPMASTERCOUNTER:
-			lex >> stepmastercounter;
+		case LT_STEPPARENTCOUNTER:
+			lex >> stepparentcounter;
 			break;
 
 		case LT_ARGUMENT:
@@ -1400,7 +1400,7 @@ void Layout::write(ostream & os) const
 	      "\tInPreamble " << inpreamble << "\n"
 	      "\tTocLevel " << toclevel << "\n"
 	      "\tResumeCounter " << resumecounter << "\n"
-	     "\tStepMasterCounter " << stepmastercounter << '\n';
+	      "\tStepParentCounter " << stepparentcounter << '\n';
 	// ResetArgs does not make sense here
 	for (LaTeXArgMap::const_iterator it = latexargs_.begin();
 	     it != latexargs_.end(); ++it)
diff --git a/src/Layout.h b/src/Layout.h
index 3ea5049..102bab6 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -392,8 +392,8 @@ public:
 	docstring counter;
 	/// Resume counter?
 	bool resumecounter;
-	/// Step master counter?
-	bool stepmastercounter;
+	/// Step parent counter?
+	bool stepparentcounter;
 	/// Prefix to use when creating labels
 	docstring refprefix;
 	/// Depth of XML command
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 04b339f..cd87cca 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -59,7 +59,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 86; // tcuvelier: DocBookSection.
+int const LAYOUT_FORMAT = 87; // rkh: master --> parent for counters
 
 
 // Layout format for the current lyx file format. Controls which format is


More information about the lyx-cvs mailing list