Author: rgheck
Date: Wed Jan 12 23:53:41 2011
New Revision: 37193
URL: http://www.lyx.org/trac/changeset/37193
Log:
Add NoCounter layout tag. When working on output of equation numbers, I
noticed that article, for example, still has a counter "chapter". This
surprised me.
Modified:
lyx-devel/trunk/lib/scripts/layout2layout.py
lyx-devel/trunk/src/Counters.cpp
lyx-devel/trunk/src/Counters.h
lyx-devel/trunk/src/TextClass.cpp
Modified: lyx-devel/trunk/lib/scripts/layout2layout.py
==============================================================================
--- lyx-devel/trunk/lib/scripts/layout2layout.py Wed Jan 12 23:23:27
2011 (r37192)
+++ lyx-devel/trunk/lib/scripts/layout2layout.py Wed Jan 12 23:53:41
2011 (r37193)
@@ -107,6 +107,9 @@
# 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 @@
# 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 @@
continue
# Only new features
- if format == 29:
+ if format == 29 or format == 30:
i += 1
continue
Modified: lyx-devel/trunk/src/Counters.cpp
==============================================================================
--- lyx-devel/trunk/src/Counters.cpp Wed Jan 12 23:23:27 2011 (r37192)
+++ lyx-devel/trunk/src/Counters.cpp Wed Jan 12 23:53:41 2011 (r37193)
@@ -294,6 +294,12 @@
}
+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();
Modified: lyx-devel/trunk/src/Counters.h
==============================================================================
--- lyx-devel/trunk/src/Counters.h Wed Jan 12 23:23:27 2011 (r37192)
+++ lyx-devel/trunk/src/Counters.h Wed Jan 12 23:53:41 2011 (r37193)
@@ -132,6 +132,8 @@
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,
Modified: lyx-devel/trunk/src/TextClass.cpp
==============================================================================
--- lyx-devel/trunk/src/TextClass.cpp Wed Jan 12 23:23:27 2011 (r37192)
+++ lyx-devel/trunk/src/TextClass.cpp Wed Jan 12 23:53:41 2011 (r37193)
@@ -60,7 +60,7 @@
// 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 @@
TC_RIGHTMARGIN,
TC_FLOAT,
TC_COUNTER,
+ TC_NOCOUNTER,
TC_IFCOUNTER,
TC_NOFLOAT,
TC_TITLELATEXNAME,
@@ -233,6 +234,7 @@
{ "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 @@
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: