]> git.lyx.org Git - features.git/commitdiff
Add NoCounter layout tag. When working on output of equation numbers, I
authorRichard Heck <rgheck@comcast.net>
Wed, 12 Jan 2011 22:53:41 +0000 (22:53 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 12 Jan 2011 22:53:41 +0000 (22:53 +0000)
noticed that article, for example, still has a counter "chapter". This
surprised me.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37193 a592a061-630c-0410-9148-cb99ea01b6c8

lib/scripts/layout2layout.py
src/Counters.cpp
src/Counters.h
src/TextClass.cpp

index 89866d2b7ef8fcb907787ddd4631214a7ac673c1..e27b1da1d6174dfb1dd2a8e80aa088dd1a628cbb 100644 (file)
@@ -107,6 +107,9 @@ import os, re, string, sys
 # Incremented to format 30, 13 August 2010 by rgh
 # Introduced ResetsFont tag for InsetLayout.
 
+# Incremented to format 31, 12 January 2011 by rgh
+# Introducted NoCounter tag.
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -114,7 +117,7 @@ import os, re, string, sys
 # development/tools/updatelayouts.sh script to update all
 # layout files to the new format.
 
-currentFormat = 30
+currentFormat = 31
 
 
 def usage(prog_name):
@@ -290,7 +293,7 @@ def convert(lines):
             continue
         
         # Only new features
-        if format == 29:
+        if format == 29 or format == 30:
           i += 1
           continue
 
index d0bb56faf6720c01f4f79a909a3b4d4370b3a8f0..1e865c73d4b3dd4859a8ef8915c2d36f83cffeff 100644 (file)
@@ -294,6 +294,12 @@ void Counters::reset(docstring const & match)
 }
 
 
+bool Counters::remove(docstring const & cnt)
+{
+       return counterList_.erase(cnt);
+}
+
+
 void Counters::copy(Counters & from, Counters & to, docstring const & match)
 {
        CounterList::iterator it = counterList_.begin();
index 59570fba33986904b31a4075bddec40eeb711b8e..41b80e6076fbbdcbd60f93ba2f9cc9da1de9506b 100644 (file)
@@ -132,6 +132,8 @@ public:
        void reset();
        /// Reset counters matched by match string.
        void reset(docstring const & match);
+       /// Remove counter \p cnt.
+       bool remove(docstring const & cnt);
        /// Copy counters whose name matches match from the &from to
        /// the &to array of counters. Empty string matches all.
        void copy(Counters & from, Counters & to,
index 3506afa15dcce9ff0ed43c5a33ac7762ff2d5dc0..a43ad9edf9019d67fd7c88ef2dc14f6c9314c9f8 100644 (file)
@@ -60,7 +60,7 @@ namespace lyx {
 // development/updatelayouts.sh script, to update the format of 
 // all of our layout files.
 //
-int const LAYOUT_FORMAT = 30;
+int const LAYOUT_FORMAT = 31;
        
 namespace {
 
@@ -196,6 +196,7 @@ enum TextClassTags {
        TC_RIGHTMARGIN,
        TC_FLOAT,
        TC_COUNTER,
+       TC_NOCOUNTER,
        TC_IFCOUNTER,
        TC_NOFLOAT,
        TC_TITLELATEXNAME,
@@ -233,6 +234,7 @@ namespace {
                { "input",             TC_INPUT },
                { "insetlayout",       TC_INSETLAYOUT },
                { "leftmargin",        TC_LEFTMARGIN },
+               { "nocounter",         TC_NOCOUNTER },
                { "nofloat",           TC_NOFLOAT },
                { "nostyle",           TC_NOSTYLE },
                { "outputformat",      TC_OUTPUTFORMAT },
@@ -652,6 +654,14 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
                        readCiteFormat(lexrc);
                        break;
 
+               case TC_NOCOUNTER:
+                       if (lexrc.next()) {
+                               docstring const cnt = lexrc.getDocString();
+                               if (!counters_.remove(cnt))
+                                       LYXERR0("Unable to remove counter: " + to_utf8(cnt));
+                       }
+                       break;
+
                case TC_IFCOUNTER:
                        ifcounter = true;
                case TC_COUNTER: